gold/
[external/binutils.git] / gold / ChangeLog
1 2012-12-14  Cary Coutant  <ccoutant@google.com>
2
3         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
4         --no-as-needed flag.
5         (exception_separate_shared_12_test): Likewise.
6         (incremental_copy_test): Likewise.
7         * testsuite/Makefile.in: Regenerate.
8
9 2012-12-14  Cary Coutant  <ccoutant@google.com>
10
11         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
12         (Dwp_output_file::Dwp_index::enter_set): Add assert.
13
14 2012-12-12  Alan Modra  <amodra@gmail.com>
15
16         * powerpc.cc (class Track_tls): New.
17         (class Relocate, class Scan): Inherit Track_tls.
18         (Target_powerpc::Scan::local, global): Track tls optimization
19         and avoid creating plt entry for __tls_get_addr if all uses
20         are optimized away.
21         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
22
23 2012-12-12  Alan Modra  <amodra@gmail.com>
24
25         * options.h (General_options): Add --toc-sort/--no-toc-sort.
26         Replace no_toc_optimize with toc_optimize.
27         * output.h (Output_section::input_sections): Provide non-const variant.
28         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
29         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
30         accessors.
31         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
32         (class Sort_toc_sections): New.
33         (Target_powerpc::do_finalize_sections): Sort toc sections.
34         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
35
36 2012-12-10  Roland McGrath  <mcgrathr@google.com>
37
38         * testsuite/binary_unittest.cc (read_all): New function.
39         (Sized_binary_test): Use it instead of ::read.
40         * fileread.cc (do_read): Don't assume pread always reads the whole
41         amount in a single call.
42
43 2012-12-10  Alan Modra  <amodra@gmail.com>
44
45         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
46         Set EM_PPC64 or EM_PPC here.
47         (Target_selector_powerpc::do_recognize): Delete.
48
49 2012-12-10  Alan Modra  <amodra@gmail.com>
50
51         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
52         stub_table_.
53         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
54
55 2012-12-07  Roland McGrath  <mcgrathr@google.com>
56
57         * testsuite/binary_unittest.cc (Sized_binary_test):
58         Use open_descriptor rather than ::open.
59
60 2012-12-07  Alan Modra  <amodra@gmail.com>
61
62         * powerpc.cc (Stub_table::do_write): Delete redundant Address
63         typedef and invalid_address constant.
64         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
65         instantiate constants.
66
67 2012-12-06  Roland McGrath  <mcgrathr@google.com>
68
69         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
70         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
71         * aclocal.m4: Regenerate.
72         * configure: Regenerate.
73         * Makefile.in: Regenerate.
74         * testsuite/Makefile.in: Regenerate.
75
76 2012-12-07  Alan Modra  <amodra@gmail.com>
77
78         * options.h (General_options): Add no_toc_optimize.
79         * powerpc.cc (ok_lo_toc_insn): New function.
80         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
81
82 2012-12-06  Alan Modra  <amodra@gmail.com>
83
84         * options.h (General_options): Add plt_align, plt_static_chain,
85         plt_thread_safe.  Update stub_group_size help text.
86         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
87         for new plt_thread_safe_ var.
88         (use_plt_offset): Correct comments.
89         (Target_powerpc::do_relax): Look for thread creation symbols to
90         determine default plt_thread_safe value.  Clear plt call stubs
91         as well as branch stubs each iteration.
92         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
93         insn constants.
94         (l, hi, ha, write_insn): Move earlier.
95         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
96         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
97         plt stubs too.
98         (Stub_table::update_size): Adjust.
99         (Stub_table::prev_size, set_prev_size): Delete.
100         (Stub_table::stub_align): Let --plt-align affect result.
101         (Stub_table::plt_call_size): Calculate sizes for various stubs.
102         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
103         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
104         (Stub_table::do_write): Support more stub variants.
105
106 2012-12-04  Alan Modra  <amodra@gmail.com>
107
108         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
109         (Target_powerpc::do_define_standard_symbols): New function.
110
111 2012-12-03  Alan Modra  <amodra@gmail.com>
112
113         * output.h: Formatting, whitespace.
114
115 2012-12-03  Alan Modra  <amodra@gmail.com>
116
117         * layout.h (Layout::get_executable_sections): Declare.
118         * layout.cc (Layout::get_executable_sections): New function.
119         * arm.cc (Target_arm::group_sections): Use it.
120         (Arm_output_section::group_sections): Delete now redundant test.
121         * output.cc (Output_reloc::Output_reloc): Add is_relative.
122         param to handle relative relocs.
123         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
124         (Output_data_reloc::add_absolute): Adjust.
125         (Output_data_reloc::add_relative): New function.
126         (Output_data::reset_data_size): New function.
127         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
128         (Output_section::set_addralign): New function.
129         (Output_section::checkpoint_set_addralign): New function.
130         (Output_section::clear_section_offsets_need_adjustment): New function.
131         (Output_section::input_sections): Make public.
132         * powerpc.cc (class Output_data_brlt_powerpc): New.
133         (class Stub_table, class Stub_control): New.
134         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
135         stub_table_, set_stub_table, stub_table): New vectors and accessor
136         functions.
137         (Target_powerpc::do_may_relax, do_relax, push_branch,
138         new_stub_table, stub_tables, brlt_section, group_sections,
139         add_branch_lookup_table, find_branch_lookup_table,
140         write_branch_lookup_table, make_brlt_section): New functions.
141         (Target_powerpc::struct Sort_sections, class Branch_info): New.
142         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
143         branch_info_): New vars.
144         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
145         make call stubs here.
146         (Output_data_glink): Remove all call stub handling from this class.
147         (Target_powerpc::Scan::local, global): Save interesting branch
148         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
149         (Target_powerpc::do_finalize_sections): Only make reg save/restore
150         functions on final link.
151         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
152         Handle long branch destinations too.
153         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
154         do_plt_address_for_local): Adjust lookup of plt call stubs.
155
156 2012-11-30  Alan Modra  <amodra@gmail.com>
157
158         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
159         relocs against protected symbols when building 32-bit shared libs.
160
161 2012-11-30  Alan Modra  <amodra@gmail.com>
162
163         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
164         param.  Call got_section() to make .got.  Update all callers
165         and their callers and so on.
166
167 2012-11-30  Alan Modra  <amodra@gmail.com>
168
169         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
170         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
171         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
172         value if it already exists.
173
174 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
175
176         PR gold/14858
177         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
178
179 2012-11-14  Roland McGrath  <mcgrathr@google.com>
180
181         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
182         than bfc instruction for data sandboxing.
183
184 2012-11-08  Alan Modra  <amodra@gmail.com>
185
186         * po/POTFILES.in: Regenerate.
187
188 2012-11-05  Alan Modra  <amodra@gmail.com>
189
190         * configure.ac: Apply 2012-09-10 change to config.in here.
191         * configure: Regenerate.
192
193 2012-11-05  Alan Modra  <amodra@gmail.com>
194
195         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
196         (struct Opd_ent): Use "Address" rather than "Offset".
197         (Output_data_got_powerpc::got_base_offset): Return Valtype.
198         (Target_powerpc::got_section): Make public.
199         (Target_powerpc::scan_relocs): Move code setting symbols..
200         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
201         Create _SDA_BASE_ only when referenced.
202
203 2012-11-02  Roland McGrath  <mcgrathr@google.com>
204
205         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
206         from last change.
207
208 2012-11-01  Roland McGrath  <mcgrathr@google.com>
209
210         * target.h (Sized_target::relocate_relocs): Use Elf_Off
211         for offset_in_output_section parameter.
212         (Sized_target::relocate_special_relocatable): Likewise.
213         * arm.cc (Target_arm::relocate_relocs): Likewise.
214         (Target_arm::relocate_special_relocatable): Likewise.
215         * i386.cc (Target_i386::relocate_relocs): Likewise.
216         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
217         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
218         * target-reloc.h (relocate_relocs): Likewise.
219         * testsuite/testfile.cc (Target_test): Likewise.
220         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
221         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
222
223         * system.h: Move inclusion of <clocale> to after <libintl.h> in
224         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
225
226         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
227         parameter, which is unused in the [!F_SETFD] case.
228
229         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
230         SYMNDX to off_t before comparing it to this->data_size().
231         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
232         * incremental.cc (Output_section_incremental_inputs::do_write):
233         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
234
235         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
236
237 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
238
239         * gold.cc (Target_arm::do_adjust_elf_header): Add the
240         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
241         in EABI_VER5.
242
243 2012-10-29  Cary Coutant  <ccoutant@google.com>
244
245         * dwp.cc (usage): Add file and exit status parameters;
246         add --help and --version options.
247         (print_version): New function.
248         (main): Add --help and --version options.
249
250 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
251
252         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
253         final_layout_sequence.txt.
254         * testsuite/Makefile.in: Regenerated.
255
256 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
257
258         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
259         COMPILE generated by automake.
260         (LINK1): Likewise.
261         (CXXCOMPILE1): Likewise.
262         (CXXLINK1): Likewise.
263         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
264         (LINK): Likewise.
265         (CXXCOMPILE): Likewise.
266         (CXXLINK): Likewise.
267         * testsuite/Makefile.in: Regenerated.
268
269 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
270
271         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
272         on bad fwrite return.
273
274 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
275
276         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
277         on val.
278
279 2012-10-23  Cary Coutant  <ccoutant@google.com>
280
281         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
282         * testsuite/Makefile.in: Regenerate.
283         * testsuite/dwp_test.h: New source file.
284         * testsuite/dwp_test_1.cc: New source file.
285         * testsuite/dwp_test_1.s: New source file.
286         * testsuite/dwp_test_1.sh: New source file.
287         * testsuite/dwp_test_1b.cc: New source file.
288         * testsuite/dwp_test_1b.s: New source file.
289         * testsuite/dwp_test_2.cc: New source file.
290         * testsuite/dwp_test_2.s: New source file.
291         * testsuite/dwp_test_2.sh: New source file.
292         * testsuite/dwp_test_main.cc: New source file.
293         * testsuite/dwp_test_main.s: New source file.
294
295 2012-10-23  Cary Coutant  <ccoutant@google.com>
296
297         * dwp.h: New header file.
298         * dwp.cc: New source file.
299         * gold.h: Move shared declarations to system.h.
300         * system.h: New header file.
301         * Makefile.am: Add dwp.
302         * Makefile.in: Regenerate.
303
304 2012-10-23  Cary Coutant  <ccoutant@google.com>
305
306         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
307         Dwarf_info_reader::read_from_pointer.
308         (Dwarf_pubnames_table::read_header): Likewise.
309         (Dwarf_pubnames_table::next_name): Likewise.
310         (Dwarf_die::read_attributes): Likewise.
311         (Dwarf_die::skip_attributes): Likewise.
312         (Dwarf_info_reader::read_from_pointer): New function template.
313         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
314         (Dwarf_pubnames_table): Likewise.
315         (Dwarf_info_reader::read_from_pointer): New function template.
316         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
317         Dwarf_pubnames_table ctor.
318
319 2012-10-23  Cary Coutant  <ccoutant@google.com>
320
321         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
322         abbrev_shndx.
323         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
324         abbrev_shndx_.
325         (Dwarf_info_reader::set_abbrev_shndx): New method.
326         (Dwarf_info_reader::abbrev_shndx_): New data member.
327
328 2012-10-23  Cary Coutant  <ccoutant@google.com>
329
330         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
331         from object, not parameters.
332         (Dwarf_info_reader::parse): Likewise.
333         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
334         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
335         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
336         methods.
337
338 2012-10-23  Cary Coutant  <ccoutant@google.com>
339
340         * fileread.cc (Input_file::Input_file): New constructor.
341         * fileread.h (class Input_file): Add new constructor.
342
343 2012-10-18  Alan Modra  <amodra@gmail.com>
344
345         PR gold/14727
346         * object.cc (Relobj::is_section_name_included): Also match
347         .sdata personality section.
348
349 2012-10-18  Alan Modra  <amodra@gmail.com>
350
351         * target-reloc.h (class Default_comdat_behavior): New, package up..
352         (get_comdat_behaviour): ..this.
353         (relocate_section): Add Relocate_comdat_behavior template arg,
354         adjust code to suit.
355         * arm.cc (Target_arm::relocate_section): Adjust to suit.
356         (Target_arm::scan_reloc_section): Likewise.
357         * i386.cc (Target_i386::relocate_section): Likewise.
358         * sparc.cc (Target_sparc::relocate_section): Likewise.
359         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
360         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
361         * powerpc.cc (class Relocate_comdat_behavior): New.
362         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
363         gold::relocate_section with new template arg.
364
365 2012-10-18  Alan Modra  <amodra@gmail.com>
366
367         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
368         dynamic relocs for GOT_TPREL got entries, without symbol if
369         resolving locally.
370         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
371         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
372         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
373
374 2012-10-17  Alan Modra  <amodra@gmail.com>
375
376         PR gold/14726
377         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
378
379 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
380
381         * layout.cc (Layout::include_section): Keep sections marked
382         SHF_EXCLUDE when doing relocatable links.
383
384 2012-10-16  Alan Modra  <amodra@gmail.com>
385
386         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
387         (Target_powerpc::do_finalize_sections): Call it.
388         (Output_data_save_res): New class and supporting functions.
389         (Target_powerpc::symval_for_branch): Only look up .opd entry for
390         normal symbols defined in object files.
391
392 2012-10-12  Alan Modra  <amodra@gmail.com>
393
394         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
395         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
396         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
397         section if scan_opd_relocs not yet called.
398         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
399
400 2012-10-12  Alan Modra  <amodra@gmail.com>
401
402         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
403         add_local_ifunc_entry): Revert last change.
404         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
405
406 2012-10-05  Alan Modra  <amodra@gmail.com>
407
408         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
409         do_plt_address_for_global): New functions.
410         (Output_data_got_powerpc::do_write): Don't segfault when linking
411         statically.
412         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
413         add_local_ifunc_entry): Return true on adding entry..
414         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
415         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
416         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
417         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
418         set up symbols here.
419         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
420         syms here.  Do so even when no .iplt.  Don't segfault when linking
421         statically.
422         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
423         new variants without reloc param.
424         (Glink_sym_ent::Glink_sym_ent): Likewise.
425         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
426         reloc when refs will resolve to plt call stub.
427         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
428         R_PPC_PLTREL24 to resolve locally.
429         (Target_powerpc::Scan::global): Correct ifunc handling.
430         (Target_powerpc::Relocate::relocate): Correct local sym glink
431         lookup.  Don't destroy "value" when we have a plt call stub,
432         and when checking plt call validity.
433         (Target_powerpc::do_dynsym_value): Simplify.
434
435 2012-10-05  Alan Modra  <amodra@gmail.com>
436
437         * i386.cc (Output_data_plt_i386::address_for_global,
438         address_for_local): Add plt offset to returned value.  Adjust uses.
439         * sparc.cc (Output_data_plt_sparc::address_for_global,
440         address_for_local): Likewise.
441         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
442         address_for_local): Likewise.
443         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
444         address_for_local): Likewise.
445         * target.h (Target::plt_address_for_global, plt_address_for_local):
446         Update comment.
447         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
448         (Output_data_got::Got_entry::write): Nor here.
449         * output.h: Comment fix.
450
451 2012-10-02  Jiong Wang  <jiwang@tilera.com>
452
453         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
454         global_offset_table_ value for larget got.
455         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
456
457 2012-09-29  Alan Modra  <amodra@gmail.com>
458
459         * powerpc.cc (Target_powerpc::iplt_): New output section.
460         (Target_powerpc::iplt_section, make_iplt_section,
461         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
462         (Target_powerpc::make_plt_entry): Handle ifunc syms.
463         Target_powerpc::plt_entry_count): Count iplt entries too.
464         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
465         reloc section in constructor.  New params.
466         (Target_powerpc::make_plt_section): Create reloc section here instead.
467         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
468         functions.
469         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
470         (Output_data_glink::add_entry, find_entry): New functions to
471         deal with local syms.
472         (Glink_sym_ent): Add support for local syms.
473         (Output_data_glink::do_write): Handle ifunc plt entries.
474         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
475         (Target_powerpc::Scan::local, global): Handle ifunc syms.
476         (Target_powerpc::Relocate::relocate): Likewise.
477         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
478
479 2012-09-25  Alan Modra  <amodra@gmail.com>
480
481         * object.h (Sized_relobj_file::adjust_local_symbol,
482         do_adjust_local_symbol): New functions.
483         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
484         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
485         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
486         and irregular opd entry spacing.
487         (Powerpc_relobj::do_read_relocs): Add opd size checks.
488         (Global_symbol_visitor_opd): New functor.
489         (Target_powerpc::do_finalize_sections): Omit global symbols defined
490         on deleted opd entries.
491
492 2012-09-15  Jiong Wang  <jiwang@tilera.com>
493
494         * tilegx.cc: New file.
495         * Makefile.am (TARGETSOURCES): Add tilegx.cc
496         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
497         * configure.tgt: Add entries for tilegx*.
498         * configure.ac: Likewise.
499         * Makefile.in: Rebuild.
500         * configure: Likewise.
501         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
502         tilegx.
503
504 2012-09-13  Alan Modra  <amodra@gmail.com>
505
506         * target-reloc.h (scan_relocs): Call scan.local for relocs
507         against symbols in discarded sections.  Pass is_discarded
508         param.
509         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
510         Add is_discarded param.
511         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
512         is_discarded to flag opd entry as discarded.  Don't emit dyn
513         relocs on such entries.
514         (Target_powerpc::Scan::global): Similarly detect and handle
515         such opd entries.
516         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
517         opd_ent_.  Update all uses.
518         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
519         (Target_powerpc::relocate_section): Zero out discarded opd
520         entry relocs.
521
522 2012-09-12  Ian Lance Taylor  <iant@google.com>
523
524         PR gold/14570
525         * output.cc: Rename Output_data_got template parameter from size
526         to got_size for all functions.  Compile all variants of
527         Output_data_got.
528         (Output_data_got::Got_entry::write): Correct use of size for
529         symbol value.  Use local_is_tls rather than casting to
530         Sized_relobj_file.
531         * object.h (class Object): Add local_is_tls and do_local_is_tls.
532         (class Sized_relobj_file): Add do_local_is_tls.
533         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
534
535 2012-09-11  Alan Modra  <amodra@gmail.com>
536
537         PR gold/14566
538         * layout.cc (Layout::set_segment_offsets): When using
539         common-page-size alignment, ensure we are on a new max-page-size
540         page.
541         * output.cc (Output_segment::set_section_addresses): Use
542         abi_pagesize, not common_pagesize for relro boundary.
543         (Output_segment::set_offset): Likewise.
544
545 2012-09-11  Alan Modra  <amodra@gmail.com>
546
547         * output.h (Output_data_got::add_global_tls, add_local_tls,
548         add_local_tls_pair): New functions.
549         (Output_data_got::add_local_pair_with_rel): Remove second
550         reloc param.  Expand comment.
551         (Output_data_got::Got_entry): Rename use_plt_offset_ to
552         use_plt_or_tls_offset_, similarly for constructor param.
553         (Output_data_got::Got_entry::write): Add got_index param.
554         * output.cc (Output_data_got::add_global_tls, add_local_tls,
555         add_local_tls_pair): New functions.
556         (Output_data_got::Got_entry::write): Handle tls symbols
557         with use_plt_or_tls_offset_ set specially.
558         (Output_data_got::add_local_pair_with_rel): Only one reloc.
559         (Output_data_got::do_write): Replace iterator with index, pass
560         index to entry write function.
561         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
562         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
563         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
564         call.
565         * i386.cc (Target_i386::Scan::local): Likewise.
566         * sparc.cc (Target_sparc::Scan::local): Likewise.
567         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
568         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
569         do_tls_offset_for_global): New functions.
570         (Target_powerpc::Scan::local): Correct TLS relocations and got
571         entry values.
572         (Target_powerpc::Scan::global): Don't emit unnecessary
573         dynamic relocations on TLS GOT entries.
574
575 2012-09-10  Matthias Klose  <doko@ubuntu.com>
576
577         * config.in: Disable sanity check for kfreebsd.
578
579 2012-09-10  Sterling Augustine  <saugustine@google.com>
580
581         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
582         (Gdb_index::pubtypes_read): New parameter.
583         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
584         to calls.
585         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
586         pubtypes_object_.
587
588 2012-09-09  Alan Modra  <amodra@gmail.com>
589
590         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
591         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
592         * gc.h (gc_process_relocs): Call target gc_add_reference.
593         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
594         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
595         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
596         unnecessary cast.
597         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
598         to cater for when we don't need code offset.  Update use.
599         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
600         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
601         set_opd_valid): New functions.
602         (Target_powerpc::do_gc_add_reference): New function.
603         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
604         stashed refs.
605         (Target_powerpc::do_gc_mark_symbol): New function.
606
607 2012-09-06  Cary Coutant  <ccoutant@google.com>
608
609         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
610         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
611         (Dwarf_die::skip_attributes): Likewise.
612         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
613         * testsuite/gdb_index_test.cc (inline_func_1): New function.
614         (main): Call it.
615         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
616
617 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
618
619         * testsuite/script_test_3.t: Add .got.plt output section
620         statement.
621         * testsuite/script_test_4.t: Likewise.
622
623 2012-09-05  Alan Modra  <amodra@gmail.com>
624
625         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
626         update all uses and lose "enum" when using type.
627
628 2012-09-05  Alan Modra  <amodra@gmail.com>
629
630         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
631         * configure: Regenerate.
632         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
633         (plugin_final_layout.stdout): Likewise.
634         (memory_test): Set page sizes to 0x1000.
635         * testsuite/Makefile.in: Regenerate.
636         * testsuite/discard_locals_test.sh: Add FIXME comment.
637         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
638         * testsuite/pr14265.t: Add .got output section statement.
639         * testsuite/script_test_2.t: Likewise.
640         * testsuite/script_test_3.t: Likewise.
641         * testsuite/script_test_4.t: Likewise.
642         * testsuite/script_test_5.t: Likewise.
643         * testsuite/script_test_6.t: Likewise.
644         * testsuite/script_test_7.t: Likewise.
645         * testsuite/script_test_9.t: Likewise.
646
647 2012-09-05  Alan Modra  <amodra@gmail.com>
648
649         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
650         (Powerpc_relocate_functions::Status): New typedef.
651         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
652         (Target_powerpc::Scan::local): Handle REL64.
653         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
654         for REL32 and REL64.
655         (Target_powerpc::symval_for_branch): New function, extracted from..
656         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
657         checks.  Report overflow errors.
658
659 2012-09-05  Alan Modra  <amodra@gmail.com>
660
661         * object.h (Sized_relobj_file::emit_relocs): Delete.
662         (Sized_relobj_file::emit_relocs_reltype): Delete.
663         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
664         relocate_relocs for --emit-relocs.
665         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
666         * output.h: Update comment.
667         (Output_segment::first_section): New function.
668         (Output_segment::first_section_load_address): Use first_section.
669         * output.cc (Output_segment::first_section): New function extracted..
670         (Output_segment::first_section_load_address): ..from here.  Delete.
671         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
672         * target.h (Sized_target::relocate_for_relocatable): Likewise.
673         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
674         adjust call to target.h function.
675         * i386.cc (Target_i386): Likewise.
676         * sparc.cc (Target_sparc): Likewise.
677         * x86_64.cc (Target_x86_64): Likewise.
678         * powerpc.cc (Target_powerpc): Likewise.
679         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
680         first tls section has section symbol for optimised local dynamic
681         output relocs.
682         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
683         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
684         optimised tls code.
685         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
686         Rename to relocate_relocs.  Update error message.
687
688 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
689
690         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
691         --just-symbols.
692
693 2012-08-31  Alan Modra  <amodra@gmail.com>
694
695         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
696         (Powerpc_relobj::toc_base_offset): New stub function.
697         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
698         got_mod_index_offset to tlsld_got_offset.  Update all refs.
699         (Target_powerpc::Relocate::enum skip_tls): New.
700         (Target_powerpc::call_tls_get_addr_): New var.
701         (Target_powerpc::is_branch_reloc): Move to file scope.
702         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
703         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
704         New functions.
705         (Target_powerpc::enum Got_type): Delete old values, add new ones.
706         (powerpc_info): Correct common_pagesize for ppc64.
707         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
708         (Powerpc_relocate_functions): Add overflow check enums and functions.
709         Add non-shift version of rela, rela_ua.  Delete all rel public
710         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
711         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
712         addr16_ha3, addr14 functions.
713         (Output_data_got_powerpc::add_constant_pair): New function.
714         (Output_data_got_powerpc::got_base_offset): Likewise.
715         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
716         (instruction constants): Sort, add some more.
717         (Output_data_glink::do_write): Add and use Address typedef.  Use
718         object->toc_base_offset() stub for 64-bit.
719         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
720         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
721         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
722         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
723         Always treat .opd relocs as against locally defined symbol.
724         Correct condition for RELATIVE relocs.
725         (Target_powerpc::do_finalize_sections): Test for NULL sections.
726         (Target_powerpc::Relocate::relocate): Use plt call stub as value
727         for 32-bit syms with a plt entry.  Correct ppc64 toc base
728         calculations.  Handle TLS relocs, and more.  Add overflow
729         checking and adjust for Powerpc_relocate_functions changes.
730         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
731         Reinstate --emit-relocs code with FIXME.
732
733 2012-08-30  Alan Modra  <amodra@gmail.com>
734
735         * layout.cc (Layout::set_segment_offsets): Set p_align to
736         abi_pagesize, not common_pagesize.
737         (Layout::relaxation_loop_body): Similarly use abi_pagesize
738         to determine whether file header can go in segment.
739
740 2012-08-30  Alan Modra  <amodra@gmail.com>
741
742         * output.h (Output_reloc::Output_reloc <output section>): Add
743         is_relative param.  Adjust calls.
744         (Output_reloc::add_output_section_relative): New functions.
745         * output.cc (Output_reloc::Output_reloc <output section>): Handle
746         is_relative.
747         (Output_reloc::symbol_value): Handle SECTION_CODE.
748
749 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
750
751         * gold.cc (queue_middle_tasks): Call layout again when unique
752         segments for sections is desired.
753         * layout.cc (Layout::Layout): Initialize new members.
754         (Layout::get_output_section_flags): New function.
755         (Layout::choose_output_section): Call get_output_section_flags.
756         (Layout::layout): Make output section for mapping to a unique segment.
757         (Layout::insert_section_segment_map): New function.
758         (Layout::attach_allocated_section_to_segment): Make unique segment for
759         output sections marked so.
760         (Layout::segment_precedes): Check for unique segments when sorting.
761         * layout.h (Layout::Unique_segment_info): New struct.
762         (Layout::Section_segment_map): New typedef.
763         (Layout::insert_section_segment_map): New function.
764         (Layout::get_output_section_flags): New function.
765         (Layout::is_unique_segment_for_sections_specified): New function.
766         (Layout::set_unique_segment_for_sections_specified): New function.
767         (Layout::unique_segment_for_sections_specified_): New member.
768         (Layout::section_segment_map_): New member.
769         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
770         Rename is_gc_pass_one to is_pass_one.
771         Rename is_gc_pass_two to is_pass_two.
772         Rename is_gc_or_icf to is_two_pass.
773         Check for which pass based on whether symbols data is present.
774         Make it two pass when unique segments for sections is desired.
775         * output.cc (Output_section::Output_section): Initialize new
776         members.
777         * output.h (Output_section::is_unique_segment): New function.
778         (Output_section::set_is_unique_segment): New function.
779         (Output_section::is_unique_segment_): New member.
780         (Output_section::extra_segment_flags): New function.
781         (Output_section::set_extra_segment_flags): New function.
782         (Output_section::extra_segment_flags_): New member.
783         (Output_section::segment_alignment): New function.
784         (Output_section::set_segment_alignment): New function.
785         (Output_section::segment_alignment_): New member.
786         (Output_segment::Output_segment): Initialize is_unique_segment_.
787         (Output_segment::is_unique_segment): New function.
788         (Output_segment::set_is_unique_segment): New function.
789         (Output_segment::is_unique_segment_): New member.
790         * plugin.cc (allow_unique_segment_for_sections): New function.
791         (unique_segment_for_sections): New function.
792         (Plugin::load): Add new functions to transfer vector.
793         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
794         * Makefile.in: Regenerate.
795         * testsuite/plugin_final_layout.sh: Check if unique segment
796         functionality works.
797         * testsuite/plugin_section_order.c (onload): Check if new interfaces
798         are available.
799         (allow_unique_segment_for_sections): New global.
800         (unique_segment_for_sections): New global.
801         (claim_file_hook): Call allow_unique_segment_for_sections.
802         (all_symbols_read_hook): Call unique_segment_for_sections.
803
804 2012-08-22  Cary Coutant  <ccoutant@google.com>
805
806         * layout.cc (Layout::include_section): Don't assert on GROUP
807         sections with --emit-relocs.
808
809 2012-08-21  Cary Coutant  <ccoutant@google.com>
810
811         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
812         if --export-dynamic-symbol names an undef symbol.
813
814 2012-08-18  Alan Modra  <amodra@gmail.com>
815
816         * powerpc.cc: Formatting and white space.
817         (Powerpc_relobj): Rename got2_section_ to special_.
818         Add opd_ent_shndx_ and opd_ent_off_ vectors.
819         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
820         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
821         (Target_powerpc): Add Address typedef and invalid_address.  Use
822         throughout.
823         (Target_powerpc::is_branch_reloc): New function.
824         (Powerpc_relocate_functions): Add Address typedef, use throughout.
825         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
826         for dst_mask, value and addend.
827         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
828         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
829         (Output_data_glink::do_write): Correct toc base.  Don't try to use
830         uint16_t for 24-bit offset.  Use get_output_section_offset and
831         check return.
832         (Target_powerpc::Scan::local): Handle more relocs.
833         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
834         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
835         Plug in toc restoring insn after plt calls.  Translate branches
836         to function descriptor symbols to corresponding entry point.
837         (Target_powerpc::relocate_for_relocatable): Check return from
838         get_output_section_offset.
839         * symtab.h: Comment typo.
840
841 2012-08-14  Ian Lance Taylor  <iant@google.com>
842
843         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
844         unsupported_relocal_local to call unsupported_reloc_global.
845
846 2012-08-14  Nick Clifton  <nickc@redhat.com>
847
848         PR ld/14265
849         * script-sections.cc (Sections_element::output_section_name): Add
850         keep return parameter.
851         (Output_section_element::match_name): Add keep return parameter.
852         Return the value of the keep_ member.
853         * script-sections.h (class Output_section): Update
854         output_section_name prototype.
855         * layout.cc (Layout::keep_input_section): New public member
856         function.
857         (Layout::choose_output_section): Pass keep parameter to
858         output_section_name.
859         * layout.h (class Layout): Add keep_input_section.
860         * object.cc (Sized_relobj_file::do_layout): Check for kept input
861         sections.
862         * testsuite/Makefile.am: Add a test.
863         * testsuite/Makefile.in: Regenerate.
864         * testsuite/pr14265.c: Source file for the test.
865         * testsuite/pr14265.t: Linker script for the test.
866         * testsuite/pr14265.sh: Shell script for the test.
867
868 2012-08-14  Alan Modra  <amodra@gmail.com>
869
870         * target.h (Target::output_section_name): New function.
871         (Target::do_output_section_name): New function.
872         * layout.cc (Layout::choose_output_section): Call the above.
873         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
874
875 2012-08-14  Alan Modra  <amodra@gmail.com>
876
877         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
878         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
879         for replace_constant call.
880         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
881         (Output_data_glink::do_print_to_mapfile): New function.
882         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
883         (Target_powerpc::Relocate::relocate): Likewise.
884
885 2012-08-14  Alan Modra  <amodra@gmail.com>
886
887         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
888         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
889         (Output_data_glink::add_entry,find_entry): Remove shndx param.
890         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
891         all references to shndx_.  Handle special case for R_PPC_PLTREL24
892         here.
893         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
894         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
895         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
896         here.
897         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
898         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
899
900 2012-08-12  Alan Modra  <amodra@gmail.com>
901
902         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
903         (glink insn constants): Use uint32_t.
904         (Output_data_glink::add_entry): Use insert, not [] operator.
905
906 2012-08-11  Alan Modra  <amodra@gmail.com>
907
908         * object.h (Sized_relobj_file::find_shdr): New function.
909         (Sized_relobj_file::find_special_sections): New function.
910         * object.cc (Sized_relobj_file::find_shdr): New function.
911         (Sized_relobj_file::find_eh_frame): Use find_shdr.
912         (Sized_relobj_file::find_special_sections): New function, split out..
913         (Sized_relobj_file::do_read_symbols): ..from here.
914         * output.h (Output_data_got::replace_constant): New function.
915         (Output_data_got::num_entries): New function.
916         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
917         (Output_data_got::got_offset): Protected rather than private.
918         (Output_data_got::replace_got_entry): New function.
919         * output.cc (Output_data_got::replace_got_entry): New function.
920         * powerpc.cc (class Powerpc_relobj): New.
921         (class Powerpc_relocate_functions): Delete all psymval variants or
922         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
923         Implement _ha functions using corresponding _hi function.
924         (Powerpc_relobj::find_special_sections): New function.
925         (Target_powerpc::do_make_elf_object): New function.
926         (class Output_data_got_powerpc): New.
927         (class Output_data_glink): New.
928         (class Powerpc_scan_relocatable_reloc): New.
929         Many more changes througout file.
930
931 2012-08-09  Nick Clifton  <nickc@redhat.com>
932
933         * po/vi.po: Updated Vietnamese translation.
934
935 2012-08-07  Ian Lance Taylor  <iant@google.com>
936
937         * layout.cc (Layout::add_target_dynamic_tags): If
938         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
939         plt_rel.
940
941 2012-07-30  Nick Clifton  <nickc@redhat.com>
942
943         * po/gold.pot: Updated template.
944         * po/es.po: Updated Spanish translation.
945
946 2012-07-18  Cary Coutant  <ccoutant@google.com>
947
948         PR gold/14344
949         * configure.ac: Add check for -gpubnames support.
950         * configure: Regenerate.
951         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
952         support; force -gno-pubnames.
953         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
954         support.
955         (gdb_index_test_4): New test.
956         * testsuite/Makefile.in: Regenerate.
957         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
958         * testsuite/gdb_index_test_2.sh: Likewise.
959         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
960         * testsuite/gdb_index_test_4.sh: New script.
961         * testsuite/gdb_index_test_comm.sh: New script with common code;
962         don't look for space after colon.
963
964 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
965
966         * gold.cc (queue_middle_tasks): Update function order only after
967         deferred objects due to plugins are processed.
968
969 2012-07-11  Ian Lance Taylor  <iant@google.com>
970
971         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
972         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
973         (Target_arm::scan_reloc_for_stub): Likewise.
974         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
975         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
976         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
977         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
978         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
979
980 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
981             Ian Lance Taylor  <iant@google.com>
982
983         PR gold/14309
984         * configure.ac: Test whether std::tr1::hash<off_t> works.
985         * gold.h: Add a specialization for std::tr1::hash<off_t> if
986         needed.
987         * output.h (class Output_fill): Add virtual destructor.
988         * configure, config.in: Rebuild.
989
990 2012-06-22  Roland McGrath  <mcgrathr@google.com>
991
992         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
993
994 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
995
996         * plugin.cc (Plugin::load): Handle position independent executables.
997
998 2012-06-06  Cary Coutant  <ccoutant@google.com>
999
1000         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1001         add .debug_macro.
1002         (lines_only_debug_sections): Likewise.
1003         (gdb_fast_lookup_sections): New static array.
1004         (is_gdb_debug_section): Rename formal parameter.
1005         (is_lines_only_debug_section): Likewise.
1006         (is_gdb_fast_lookup_section): New function.
1007         (Layout::include_section): Check for ".zdebug_" prefix; pass
1008         section name suffix to is_gdb_debug_section, et al.; check for
1009         fast-lookup sections when building .gdb_index.
1010         * options.h (--strip-debug-gdb): Update GDB version number.
1011
1012 2012-06-06  Cary Coutant  <ccoutant@google.com>
1013
1014         * configure.ac: Add check for fallocate.
1015         * configure: Regenerate.
1016         * config.in: Regenerate.
1017
1018         * options.h (class General_options): Add --mmap-output-file and
1019         --posix-fallocate options.
1020         * output.cc: (posix_fallocate): Remove; replace with...
1021         (gold_fallocate): New function.
1022         (Output_file::map_no_anonymous): Call gold_fallocate.
1023         (Output_file::map): Check --mmap-output-file option.
1024
1025 2012-06-05  Jing Yu  <jingyu@google.com>
1026
1027         * gold.h (textdomain): Add do {} to empty while(0).
1028         (bindtextdomain): Likewise.
1029
1030 2012-06-04  Cary Coutant  <ccoutant@google.com>
1031
1032         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1033         has_dynsym_index.
1034
1035 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1036
1037         * symtab.cc (Symbol_table::define_special_symbol):
1038         Initialize *poldsym to prevent uninitialized variable errors.
1039
1040 2012-05-23  Cary Coutant  <ccoutant@google.com>
1041
1042         * layout.cc (Layout::section_name_mapping): Add rules to handle
1043         exact match on .data.rel.ro.local or .data.rel.ro.
1044         (Layout::output_section_name): Check for exact matches.
1045
1046 2012-05-23  Cary Coutant  <ccoutant@google.com>
1047
1048         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1049         more carefully.
1050
1051 2012-05-22  Cary Coutant  <ccoutant@google.com>
1052
1053         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1054         object before exporting symbol.
1055
1056 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1057
1058         * testsuite/tls_test.cc: Include "config.h" first.
1059         * testsuite/tls_test_c.c: Likewise.
1060
1061 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1062             Nick Clifton  <nickc@redhat.com>
1063
1064         PR 14072
1065         * configure.in: Add check that sysdep.h has been included before
1066         any system header files.
1067         * configure: Regenerate.
1068         * config.in: Regenerate.
1069
1070 2012-05-14  Cary Coutant  <ccoutant@google.com>
1071
1072         * layout.cc (Layout::make_output_section): Mark .tdata section
1073         as RELRO.
1074         * testsuite/relro_test.cc: Add a TLS variable.
1075
1076 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1077
1078         PR gold/14091
1079         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1080         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1081         R_X86_64_64.
1082
1083 2012-05-08  Cary Coutant  <ccoutant@google.com>
1084
1085         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1086         (lines_only_debug_sections): Likewise.
1087
1088 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1089
1090         * nacl.cc: New file.
1091         * nacl.h: New file.
1092         * Makefile.am (CCFILES, HFILES): Add them.
1093         * Makefile.in: Regenerate.
1094         * i386.cc (Output_data_plt_i386_nacl): New class.
1095         (Output_data_plt_i386_nacl_exec): New class.
1096         (Output_data_plt_i386_nacl_dyn): New class.
1097         (Target_i386_nacl): New class.
1098         (Target_selector_i386_nacl): New class.
1099         (target_selector_i386): Use it instead of Target_selector_i386.
1100         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1101         (Target_x86_64_nacl): New class.
1102         (Target_selector_x86_64_nacl): New class.
1103         (target_selector_x86_64, target_selector_x32): Use it instead of
1104         Target_selector_x86_64.
1105         * arm.cc (Output_data_plt_arm_nacl): New class.
1106         (Target_arm_nacl): New class.
1107         (Target_selector_arm_nacl): New class.
1108         (target_selector_arm, target_selector_armbe): Use it instead of
1109         Target_selector_arm.
1110
1111         * target-select.cc (select_target): Take new Input_file* and off_t
1112         arguments, pass them on to recognize method of selector.
1113         * object.cc (make_elf_sized_object): Update caller.
1114         * parameters.cc (parameters_force_valid_target): Likewise.
1115         * incremental.cc (make_sized_incremental_binary): Likewise.
1116         * target-select.h: Update decl.
1117         (Target_selector::recognize): Take new Input_file* argument,
1118         pass it on to do_recognize.
1119         (Target_selector::do_recognize): Take new Input_file* argument.
1120         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1121         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1122         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1123         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1124
1125         * target.h (Target::Target_info): New members isolate_execinstr
1126         and rosegment_gap.
1127         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1128         * arm.cc (Target_arm::arm_info): Update initializer.
1129         * i386.cc (Target_i386::i386_info): Likewise.
1130         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1131         * sparc.cc (Target_sparc::sparc_info): Likewise.
1132         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1133         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1134         * layout.cc (Layout::attach_allocated_section_to_segment):
1135         Take new const Target* argument.  If target->isolate_execinstr(), act
1136         like --rosegment.
1137         (Layout::find_first_load_seg): Take new const Target* argument;
1138         if target->isolate_execinstr(), reject PF_X segments.
1139         (Layout::relaxation_loop_body): Update caller.
1140         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1141         reset file offset to zero when we hit LOAD_SEG, and then do a second
1142         loop over the segments before LOAD_SEG to reassign offsets after
1143         addresses have been determined.  Handle target->rosegment_gap().
1144         (Layout::attach_section_to_segment): Take new const Target* argument;
1145         pass it to attach_allocated_section_to_segment.
1146         (Layout::make_output_section): Update caller.
1147         (Layout::attach_sections_to_segments): Take new const Target* argument;
1148         pass it to attach_section_to_segment.
1149         * gold.cc (queue_middle_tasks): Update caller.
1150         * layout.h (Layout): Update method decls with new arguments.
1151
1152         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1153         Target_info pointer to use.
1154         (Target_arm::do_make_data_plt): New virtual method.
1155         (Target_arm::make_data_plt): New method that calls it.
1156         (Target_arm::make_plt_entry): Use it.
1157         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1158         for the section alignment.
1159         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1160         method.
1161         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1162         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1163         method.
1164         (Output_data_plt_arm::get_plt_entry_size): Call it.
1165         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1166         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1167         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1168         method.
1169         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1170         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1171         method instead of sizeof(plt_entry).
1172         (Output_data_plt_arm::add_entry): Likewise.
1173         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1174         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1175         than static method.
1176         (Target_arm::plt_entry_size): Likewise.
1177         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1178         Move to ...
1179         (Output_data_plt_arm_standard): ... here, new class.
1180         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1181         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1182         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1183
1184         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1185         Take additional argument for the PLT entry size.
1186         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1187         Use get_plt_entry_size method rather than plt_entry_size variable.
1188         (Output_data_plt_x86_64::reserve_slot): Likewise.
1189         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1190         (Output_data_plt_x86_64::add_entry): Likewise.
1191         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1192         (Output_data_plt_x86_64::address_for_global): Likewise.
1193         (Output_data_plt_x86_64::address_for_local): Likewise.
1194         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1195         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1196         Make method non-static.
1197         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1198         method.
1199         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1200         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1201         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1202         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1203         virtual method.
1204         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1205         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1206         virtual method.
1207         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1208         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1209         virtual method.
1210         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1211         (Output_data_plt_x86_64::plt_entry_size)
1212         (Output_data_plt_x86_64::first_plt_entry)
1213         (Output_data_plt_x86_64::plt_entry)
1214         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1215         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1216         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1217         (Output_data_plt_x86_64_standard): ... here, new class.
1218         (Target_x86_64::Target_x86_64): Take optional argument for the
1219         Target_info pointer to use.
1220         (Target_x86_64::do_make_data_plt): New virtual method.
1221         (Target_x86_64::make_data_plt): New method to call it.
1222         (Target_x86_64::init_got_plt_for_update): Use that.
1223         Call this->plt_->add_eh_frame method here.
1224         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1225         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1226         rather than static method.
1227         (Target_x86_64::plt_entry_size): Likewise.
1228         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1229         rather than plt_entry_size variable.  Move guts of PLT filling to...
1230         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1231         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1232         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1233
1234         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1235         additional argument for the section alignment.
1236         Don't do add_eh_frame_for_plt here.
1237         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1238         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1239         variable.
1240         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1241         method.
1242         (Output_data_plt_i386::get_plt_entry_size): Call it.
1243         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1244         (Output_data_plt_i386::add_eh_frame): New method to call it.
1245         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1246         method.
1247         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1248         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1249         method.
1250         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1251         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1252         method instead of plt_entry_size.
1253         (Output_data_plt_i386::plt_entry_size)
1254         (Output_data_plt_i386::plt_eh_frame_fde_size)
1255         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1256         (Output_data_plt_i386_standard): ... here, new class.
1257         (Output_data_plt_i386_exec): New class.
1258         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1259         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1260         (Output_data_plt_i386::exec_plt_entry): Move to ...
1261         (Output_data_plt_i386_exec::plt_entry): ... here.
1262         (Output_data_plt_i386_dyn): New class.
1263         (Output_data_plt_i386::first_plt_entry): Move to ...
1264         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1265         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1266         (Output_data_plt_i386_dyn::plt_entry): ... here.
1267         (Target_i386::Target_i386): Take optional argument for the Target_info
1268         pointer to use.
1269         (Target_i386::do_make_data_plt): New virtual method.
1270         (Target_i386::make_data_plt): New method to call it.
1271         (Target_i386::make_plt_section): Use that.
1272         Call this->plt_->add_eh_frame method here.
1273         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1274         rather than plt_entry_size variable.
1275         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1276         (Output_data_plt_i386::address_for_local): Likewise.
1277         (Output_data_plt_i386::do_write): Likewise.
1278         Move guts of PLT filling to...
1279         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1280         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1281         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1282         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1283
1284 2012-05-01  Cary Coutant  <ccoutant@google.com>
1285
1286         * dwarf_reader.cc (Dwarf_die::read_attributes)
1287         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1288         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1289         * reduced_debug_output.cc
1290         (Output_reduced_debug_info_section::get_die_end): Remove
1291         DW_FORM_GNU_ref_index.  Add default case.
1292
1293 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1294
1295         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1296         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1297         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1298         DW_AT_high_pc as offset from DW_AT_low_pc.
1299
1300         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1301         * testsuite/Makefile.in: Regenerate.
1302         * testsuite/gdb_index_test_3.c: New test source file.
1303         * testsuite/gdb_index_test_3.sh: New test source file.
1304
1305 2012-04-25  Ian Lance Taylor  <iant@google.com>
1306
1307         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1308         pointer.
1309         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1310         as a class, not a struct.
1311         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1312         (Target_arm::apply_cortex_a8_workaround): Likewise.
1313         * gc.h: Declare Reloc_types as a struct, not a class.
1314         * object.h: Declare Symbols_data as a struct.
1315         * reloc.h: Declare Read_relocs_data as a struct.
1316         * target.h: Declare Relocate_info as a struct.
1317
1318 2012-04-24  David S. Miller  <davem@davemloft.net>
1319
1320         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1321         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1322         and R_SPARC_WPLT30.
1323
1324 2012-04-24  Cary Coutant  <ccoutant@google.com>
1325
1326         * incremental-dump.cc (find_input_containing_global): Replace
1327         magic number with symbolic constant.
1328         (dump_incremental_inputs): Update version number.
1329         * incremental.cc (Output_section_incremental_inputs): Update version
1330         number; import symbolic constants from Incremental_inputs_reader.
1331         (Incremental_inputs::create_data_sections): Align relocations
1332         section correctly for 64-bit targets.
1333         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1334         constants; add padding.
1335         (Output_section_incremental_inputs::write_header): Add assert for
1336         header_size.
1337         (Output_section_incremental_inputs::write_input_files): Add assert
1338         for input_entry_size.
1339         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1340         add assert for object_info_size, input_section_entry_size,
1341         global_sym_entry_size.
1342         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1343         for data structure sizes; use them.
1344         (Incremental_input_entry_reader): Import symbolic constants from
1345         Incremental_inputs_reader; use them.
1346
1347 2012-04-23  David S. Miller  <davem@davemloft.net>
1348
1349         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1350         and elf_flags_set_.
1351         (Target_sparc::Target_sparc): Initialize new fields.
1352         (Target_sparc::do_make_elf_object): New function.
1353         (Target_sparc::do_adjust_elf_header): New function.
1354
1355 2012-04-23  Cary Coutant  <ccoutant@google.com>
1356
1357         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1358         CU range table of gdb index.
1359
1360 2012-04-20  David S. Miller  <davem@davemloft.net>
1361
1362         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1363         instead of false.
1364
1365 2012-04-16  David S. Miller  <davem@davemloft.net>
1366
1367         * sparc.cc (Target_sparc::got_address): New function.
1368         (Sparc_relocate_functions::gdop_hix22): New function.
1369         (Sparc_relocate_functions::gdop_lox10): New function.
1370         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1371         relocs.
1372         (Target_sparc::Scan::local): Likewise if the global symbol is not
1373         preemptible and is not IFUNC.
1374         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1375         transformations for local and non-preemptible non-IFUNC global
1376         symbols.
1377
1378         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1379         writing out 64-bit part of ranges.
1380
1381         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1382         -fpic and -fpie respectively.
1383         * Makefile.in: Regenerate.
1384
1385         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1386         (Target_sparc::Target_sparc): Initialize new field.
1387         (Target_sparc::do_plt_section_for_global): New function.
1388         (Target_sparc::do_plt_section_for_local): New function.
1389         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1390         (Target_sparc::make_plt_section): New function, broken out of
1391         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1392         (Target_sparc::make_plt_entry): Call make_plt_section.
1393         (Target_sparc::make_local_ifunc_plt_entry): New function.
1394         (Target_sparc::rela_ifunc_section): New function.
1395         (Target_sparc::plt_section): Remove const.
1396         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1397         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1398         and ifunc_count_ fields.
1399         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1400         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1401         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1402         (Output_data_plt_sparc::rela_ifunc): New function.
1403         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1404         (Output_data_plt_sparc::has_ifunc_section): New function.
1405         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1406         (Output_data_plt_sparc::address_for_global): New function.
1407         (Output_data_plt_sparc::address_for_local): New function.
1408         (Output_data_plt_sparc::plt_index_to_offset): New function.
1409         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1410         and entry_count.
1411         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1412         entry_count.
1413         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1414         R_SPARC_JMP_IREL to switch.
1415         (Target_sparc::Scan::check_non_pic): Likewise.
1416         (Target_sparc::Scan::local): Handle IFUNC symbols.
1417         (Target_sparc::Scan::local): Likewise.
1418         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1419         and plt_address_for_local.
1420         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1421         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1422
1423         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1424         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1425         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1426         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1427         global relocs too.
1428         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1429         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1430         calls.
1431         * sparc.cc (Target_sparc::Scan::global): Likewise.
1432         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1433
1434 2012-04-16  Cary Coutant  <ccoutant@google.com>
1435
1436         * archive.cc (Library_base::should_include_member): Check for
1437         --export-dynamic-symbol.
1438         * options.h (class General_options): Add --export-dynamic-symbol.
1439         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1440         --export-dynamic-symbol.
1441         (Symbol_table::gc_mark_undef_symbols): Likewise.
1442         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1443
1444 2012-04-12  David S. Miller  <davem@davemloft.net>
1445
1446         * sparc.cc (Reloc::wdisp10): New relocation method.
1447         (Reloc::h34): Likewise.
1448         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1449         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1450         R_SPARC_WDISP10.
1451         (Target_sparc::Scan::local): Likewise.
1452         (Target_sparc::Scan::global): Likewise.
1453         (Target_sparc::Relocate::relocate): Likewise.
1454
1455 2012-04-09  Cary Coutant  <ccoutant@google.com>
1456
1457         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1458         low_pc == 0.
1459
1460 2012-04-06  Ian Lance Taylor  <iant@google.com>
1461
1462         * timer.cc: #include <unistd.h>.
1463
1464 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1465
1466         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1467         * config.in: Regenerate.
1468         * configure: Regenerate.
1469
1470 2012-04-05  Nick Clifton  <nickc@redhat.com>
1471
1472         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1473         (AM_LC_MESSAGES): Add.
1474         * aclocal.m4: Regenerate.
1475         * config.in: Regenerate.
1476         * configure: Regenerate.
1477
1478 2012-03-21  Cary Coutant  <ccoutant@google.com>
1479
1480         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1481         * Makefile.in: Regenerate.
1482         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1483         (Sized_elf_reloc_mapper::symbol_section): New function.
1484         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1485         (make_elf_reloc_mapper): New function.
1486         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1487         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1488         (Dwarf_abbrev_table::do_get_abbrev): New function.
1489         (Dwarf_ranges_table::read_ranges_table): New function.
1490         (Dwarf_ranges_table::read_range_list): New function.
1491         (Dwarf_pubnames_table::read_section): New function.
1492         (Dwarf_pubnames_table::read_header): New function.
1493         (Dwarf_pubnames_table::next_name): New function.
1494         (Dwarf_die::Dwarf_die): New function.
1495         (Dwarf_die::read_attributes): New function.
1496         (Dwarf_die::skip_attributes): New function.
1497         (Dwarf_die::set_name): New function.
1498         (Dwarf_die::set_linkage_name): New function.
1499         (Dwarf_die::attribute): New function.
1500         (Dwarf_die::string_attribute): New function.
1501         (Dwarf_die::int_attribute): New function.
1502         (Dwarf_die::uint_attribute): New function.
1503         (Dwarf_die::ref_attribute): New function.
1504         (Dwarf_die::child_offset): New function.
1505         (Dwarf_die::sibling_offset): New function.
1506         (Dwarf_info_reader::check_buffer): New function.
1507         (Dwarf_info_reader::parse): New function.
1508         (Dwarf_info_reader::do_parse): New function.
1509         (Dwarf_info_reader::do_read_string_table): New function.
1510         (Dwarf_info_reader::lookup_reloc): New function.
1511         (Dwarf_info_reader::get_string): New function.
1512         (Dwarf_info_reader::visit_compilation_unit): New function.
1513         (Dwarf_info_reader::visit_type_unit): New function.
1514         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1515         Sized_elf_reloc_mapper.
1516         (Sized_dwarf_line_info::symbol_section): Remove function.
1517         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1518         (Sized_dwarf_line_info::read_line_mappings): Remove object
1519         parameter, adjust callers.
1520         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1521         * dwarf_reader.h: Include <sys/types.h>.
1522         (class Track_relocs): Remove forward declaration.
1523         (class Elf_reloc_mapper): New class.
1524         (class Sized_elf_reloc_mapper): New class.
1525         (class Dwarf_abbrev_table): New class.
1526         (class Dwarf_range_list): New class.
1527         (class Dwarf_ranges_table): New class.
1528         (class Dwarf_pubnames_table): New class.
1529         (class Dwarf_die): New class.
1530         (class Dwarf_info_reader): New class.
1531         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1532         (Sized_dwarf_line_info::symbol_section): Remove member function.
1533         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1534         base class.
1535         * gdb-index.cc: New source file.
1536         * gdb-index.h: New source file.
1537         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1538         and .debug_types sections, call Layout::add_to_gdb_index.
1539         (Sized_relobj_incr::do_section_name): Implement.
1540         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1541         return type; Implement.
1542         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1543         return type.
1544         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1545         parameter list and return type.
1546         (Sized_incr_dynobj::do_section_contents): Likewise.
1547         * layout.cc: Include gdb-index.h.
1548         (Layout::Layout): Initialize gdb_index_data_.
1549         (Layout::init_fixed_output_section): Check for .gdb_index section.
1550         (Layout::add_to_gdb_index): New function. Instantiate.
1551         * layout.h: Add forward declaration for class Gdb_index.
1552         (Layout::add_to_gdb_index): New member function.
1553         (Layout::gdb_index_data_): New data member.
1554         * main.cc: Include gdb-index.h.
1555         (main): Print statistics for gdb index.
1556         * object.cc (Object::section_contents): Move code into
1557         do_section_contents.
1558         (need_decompressed_section): Check for sections needed when building
1559         gdb index.
1560         (build_compressed_section_map): Likewise.
1561         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1562         gdb index.
1563         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1564         sections; call Layout::add_to_gdb_index.
1565         (Sized_relobj_file::do_decompressed_section_contents): Call
1566         do_section_contents directly.
1567         * object.h (Object::do_section_contents): Adjust parameter list and
1568         return type.
1569         (Object::do_decompressed_section_contents): Call do_section_contents
1570         directly.
1571         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1572         return type.
1573         * options.h (class General_options): Add --gdb-index option.
1574         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1575         list and return type.
1576         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1577         * reloc.h (Track_relocs::checkpoint): New function.
1578         (Track_relocs::reset): New function.
1579
1580         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1581         New test cases.
1582         * testsuite/Makefile.in: Regenerate.
1583         * testsuite/gdb_index_test.cc: New test source file.
1584         * testsuite/gdb_index_test_1.sh: New test source file.
1585         * testsuite/gdb_index_test_2.sh: New test source file.
1586
1587 2012-03-19  Doug Kwan  <dougkwan@google.com>
1588
1589         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1590         (Target_arm::do_finalize_sections): Remove code which defines
1591         __exidx_start and __exidx_end.  Make symbol table parameter
1592         anonymous as it is not used.
1593         * gold.cc (queue_middle_tasks): Call target hook to define any
1594         target-specific symbols.
1595         * target.h (Target::define_standard_symbols): New method.
1596         (Target::do_define_standard_symbols): Same.
1597         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1598         * testsuite/Makefile.in: Regenerate.
1599         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1600         and __exidx_end.
1601         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1602         relocations are generated for __exidx_start and __exidx_end.
1603
1604 2012-03-16  Doug Kwan  <dougkwan@google.com>
1605
1606         * testsuite/Makefile.am: Disable test initpri3b.
1607         * testsuite/Makefile.in: Regenerate.
1608
1609 2012-03-15  Doug Kwan  <dougkwan@google.com>
1610
1611         * arm.cc (Target_arm::got_section): Make .got section read-only
1612         if -z now is given.
1613
1614 2012-03-15  Ian Lance Taylor  <iant@google.com>
1615
1616         PR gold/13850
1617         * layout.cc (Layout::make_output_section): Correctly mark
1618         SHT_INIT_ARRAY, et. al., as relro.
1619
1620 2012-03-14  Doug Kwan  <dougkwan@google.com>
1621
1622         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1623         dynamic relocations for protected symbols in shared objects.
1624
1625 2012-03-13  Ian Lance Taylor  <iant@google.com>
1626
1627         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1628         keep the larger alignment.
1629
1630 2012-03-12  Cary Coutant  <ccoutant@google.com>
1631
1632         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1633         handling of DW_LNE_define_file.
1634
1635 2012-03-12  Cary Coutant  <ccoutant@google.com>
1636
1637         * reduced_debug_output.cc
1638         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1639         codes to switch.
1640
1641 2012-02-29  Cary Coutant  <ccoutant@google.com>
1642
1643         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1644
1645 2012-02-29  Cary Coutant  <ccoutant@google.com>
1646
1647         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1648         Call Object::decompressed_section_contents.
1649         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1650         New dtor.
1651         (Sized_dwarf_line_info::buffer_start_): New data member.
1652         * merge.cc (Output_merge_data::do_add_input_section): Call
1653         Object::decompressed_section_contents.
1654         (Output_merge_string::do_add_input_section): Likewise.
1655         * object.cc (need_decompressed_section): New function.
1656         (build_compressed_section_map): Decompress sections needed later.
1657         (Sized_relobj_file::do_decompressed_section_contents): New function.
1658         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1659         * object.h (Object::decompressed_section_contents): New function.
1660         (Object::discard_decompressed_sections): New function.
1661         (Object::do_decompressed_section_contents): New function.
1662         (Object::do_discard_decompressed_sections): New function.
1663         (Compressed_section_info): New type.
1664         (Compressed_section_map): Include decompressed section contents.
1665         (Sized_relobj_file::do_decompressed_section_contents): New function.
1666         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1667
1668 2012-02-16  Cary Coutant  <ccoutant@google.com>
1669
1670         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1671         * testsuite/Makefile.in: Regenerate.
1672
1673 2012-02-14  Cary Coutant  <ccoutant@google.com>
1674
1675         * options.cc (General_options::finalize): Disallow -pie and -static.
1676
1677 2012-02-03  Doug Kwan  <dougkwan@google.com>
1678
1679         * arm.cc (Arm_relocate_functions::abs8,
1680         Arm_relocate_functions::abs16): Use
1681         Bits::has_signed_unsigned_overflow32.
1682         (Arm_relocate_functions::thm_abs8): Correct range of
1683         overflow check.
1684         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1685         in assertions.
1686
1687 2012-02-02  Doug Kwan  <dougkwan@google.com>
1688
1689         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1690         position independent outputs, not just shared objects.
1691
1692 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1693
1694         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1695         * configure: Regenerated.
1696
1697 2012-01-27  Ian Lance Taylor  <iant@google.com>
1698
1699         * reloc.h (Bits): New class with static functions, copied from
1700         namespace utils in arm.cc.
1701         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1702         instead.
1703
1704 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1705
1706         * incremental.cc (write_info_blocks): Correct relocation offset.
1707
1708 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1709
1710         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1711         (Relocate::tls_gd_to_le): Likewise.
1712
1713 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1714
1715         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1716
1717 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1718
1719         * configure.ac: Check if -mcmodel=medium works.
1720         * configure: Regenerated.
1721
1722 2012-01-24  Cary Coutant  <ccoutant@google.com>
1723
1724         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1725         definition and ...
1726         (read_unsigned_LEB_128_x): ... this new function.
1727         (read_signed_LEB_128): Replaced with inline definition and ...
1728         (read_signed_LEB_128_x): ... this new function.
1729         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1730         (read_unsigned_LEB_128): Add inline definition.
1731         (read_signed_LEB_128_x): New function.
1732         (read_signed_LEB_128): Add inline definition.
1733         * testsuite/Makefile.am (leb128_unittest): New unit test.
1734         * testsuite/Makefile.in: Regenerate.
1735         * testsuite/leb128_unittest.cc: New unit test.
1736
1737 2012-01-23  Ian Lance Taylor  <iant@google.com>
1738
1739         PR gold/13617
1740         * i386.cc (Target_i386::do_code_fill): When using a jmp
1741         instruction, pad with nop instructions.
1742         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1743
1744 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1745
1746         * x86_64.cc (gc_process_relocs): Add typename on types used in
1747         template.
1748         (scan_relocs): Likewise.
1749         (relocate_section): Likewise.
1750         (apply_relocation): Likewise.
1751
1752 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1753
1754         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1755         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1756         under x32.
1757
1758 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1759
1760         * x86_64.cc: Initial support for x32.
1761
1762 2012-01-03  Cary Coutant  <ccoutant@google.com>
1763
1764         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1765         Use abstract base class for GOT.
1766         * gold/output.h (class Output_data_got_base): New abstract base class.
1767         (class Output_data_got): Derive from new base class, adjust ctors.
1768         (Output_data_got::reserve_slot): Make virtual; rename to
1769         do_reserve_slot; Adjust callers.
1770         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1771         pointer to abstract base class.
1772         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1773
1774 2011-12-18  Ian Lance Taylor  <iant@google.com>
1775
1776         * object.h (Relobj::local_symbol_value): New function.
1777         (Relobj::local_plt_offset): New function.
1778         (Relobj::local_has_got_offset): New function.
1779         (Relobj::local_got_offset): New function.
1780         (Relobj::set_local_got_offset): New function.
1781         (Relobj::do_local_symbol_value): New pure virtual function.
1782         (Relobj::do_local_plt_offset): Likewise.
1783         (Relobj::do_local_has_got_offset): Likewise.
1784         (Relobj::do_local_got_offset): Likewise.
1785         (Relobj::do_set_local_got_offset): Likewise.
1786         (Sized_relobj::do_local_has_got_offset): Rename from
1787         local_has_got_offset.
1788         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1789         (Sized_relobj::do_set_local_got_offset): Rename from
1790         set_local_got_offset.
1791         (Sized_relobj_file::do_local_plt_offset): Rename from
1792         local_plt_offset.
1793         (Sized_relobj_file::do_local_symbol_value): New function.
1794         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1795         local_plt_offset.
1796         * output.cc (Output_data_got::Got_entry::write): Change object to
1797         Relobj.  Use local_symbol_value.
1798         (Output_data_got::add_global_with_rel): Change rel_dyn to
1799         Output_data_reloc_generic*.  Use add_global_generic.
1800         (Output_data_got::add_global_with_rela): Remove.  Change all
1801         callers to use add_global_with_rel.
1802         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1803         Output_data_reloc_generic*.  Use add_global_generic.
1804         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1805         callers to use add_global_pair_with_rel.
1806         (Output_data_got::add_local): Change object to Relobj*.
1807         (Output_data_got::add_local_plt): Likewise.
1808         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1809         change rel_dyn to Output_data_reloc_generic*.  Use
1810         add_local_generic.
1811         (Output_data_got::add_local_with_rela): Remove.  Change all
1812         callers to use all_local_with_rel.
1813         (Output_data_got::add_local_pair_with_rel): Change object to
1814         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1815         add_output_section_generic.
1816         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1817         callers to use add_local_pair_with_rel.
1818         (Output_data_got::reserve_local): Change object to Relobj*.
1819         * output.h: (class Output_data_reloc_generic): Add pure virtual
1820         declarations for add_global_generic, add_local_generic,
1821         add_output_section_generic.
1822         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1823         functions for Output_data_reloc_generic.  Update declarations for
1824         changes listed in output.cc.
1825         (class Output_data_got): Change template parameter to got_size.
1826         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1827         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1828         function.
1829         (Sized_relobj_incr::do_local_plt_offset): New function.
1830         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1831         add_global_generic.
1832
1833 2011-12-17  Cary Coutant  <ccoutant@google.com>
1834
1835         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1836         * resolve.cc (Symbol_table::resolve): Likewise.
1837         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1838         arrays.
1839         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1840
1841 2011-12-16  Ian Lance Taylor  <iant@google.com>
1842
1843         * output.h (Output_data_reloc_generic::add): Only call
1844         add_dynamic_reloc if this is a dynamic reloc section.
1845
1846 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1847
1848         PR gold/13505
1849         * target-reloc.h (apply_relocation): Replace <64, false> with
1850         <size, big_endian>.
1851
1852 2011-11-25  Nick Clifton  <nickc@redhat.com>
1853
1854         * po/it.po: New Italian translation.
1855
1856 2011-11-17  Sterling Augustine  <saugustine@google.com>
1857
1858         * script.cc (script_include_directive): Implement.
1859         (read_script_file): New local variables name and search_path. Update
1860         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1861         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1862         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1863
1864 2011-11-11  Sterling Augustine  <saugustine@google.com>
1865
1866         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1867         (file_or_sections_cmd): Likewise.
1868
1869 2011-11-11  Doug Kwan  <dougkwan@google.com>
1870
1871         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1872         if --just-symbols is given.
1873
1874 2011-11-10  Doug Kwan  <dougkwan@google.com>
1875
1876         PR gold/13362
1877         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1878         when processing data relocs.
1879         * reloc.h (Relocate_functions::rel_unaligned): New method.
1880         (Relocate_functions::pcrel_unaligned): Ditto.
1881         (Relocate_functions::rel32_unaligned): Ditto.
1882         (Relocate_functions::pcrel32_unaligned): Ditto.
1883
1884 2011-11-09  Doug Kwan  <dougkwan@google.com>
1885
1886         PR gold/13362
1887         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1888         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1889         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1890         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1891         (Relocate_functions::rel_unaligned): New.
1892         (Relocate_functions::rel32_unaligned): New.
1893         * target-reloc.h (relocate_for_relocatable): Add code to handle
1894         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1895         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1896         arm_unaligned_reloc_r): New targets.
1897         * testsuite/Makefile.in: Regenerate.
1898         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1899         linking.
1900
1901 2011-11-02  Ian Lance Taylor  <iant@google.com>
1902
1903         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1904         NATIVE_LINKER.
1905         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1906         * options.cc (General_options::finalize): Use library search path
1907         from configure script if specified.  If not native and no sysroot,
1908         only search TOOLLIBDIR.
1909         * options.h (Search_directory::Search_directory): Change name to
1910         const std::string&.
1911         (General_options::add_to_library_path_with_sysroot): Change arg to
1912         const std::string&.
1913         * configure, Makefile.in, config.in: Rebuild.
1914
1915 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1916
1917         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1918         we are working around the ARM1176 Erratum.
1919         * options.h (General_options::fix_arm1176): Add option.
1920         * testsuite/Makefile.am: Add testcases, and keep current ones
1921         working.
1922         * testsuite/Makefile.in: Regenerate.
1923         * testsuite/arm_fix_1176.s: New file.
1924         * testsuite/arm_fix_1176.sh: Likewise.
1925
1926 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1927
1928         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1929         may_use_blx_.
1930         (Target_arm::may_use_blx): Remove method.
1931         (Target_arm::set_may_use_blx): Likewise.
1932         (Target_arm::may_use_v4t_interworking): New method.
1933         (Target_arm::may_use_v5t_interworking): Likewise.
1934         (Target_arm::may_use_blx_): Remove member variable.
1935         (Arm_relocate_functions::arm_branch_common): Check for v5T
1936         interworking.
1937         (Arm_relocate_functions::thumb_branch_common): Likewise.
1938         (Reloc_stub::stub_type_for_reloc): Likewise.
1939         (Target_arm::do_finalize_sections): Correct interworking checks.
1940         * testsuite/Makefile.am: Add new tests.
1941         * testsuite/Makefile.in: Regenerate.
1942         * testsuite/arm_farcall_arm_arm.s: New test.
1943         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1944         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1945         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1946         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1947         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1948         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1949         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1950
1951 2011-10-31  Cary Coutant  <ccoutant@google.com>
1952
1953         PR gold/13023
1954         * expression.cc (Expression::eval_with_dot): Add
1955         is_section_dot_assignment parameter.
1956         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1957         absolute and assigning to dot within a section.
1958         * script-sections.cc
1959         (Output_section_element_assignment::set_section_addresses): Pass
1960         dot_section to set_if_absolute.
1961         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1962         as is_section_dot_assignment flag to eval_with_dot.
1963         (Output_section_element_dot_assignment::set_section_addresses):
1964         Likewise.
1965         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1966         parameter.  Also set value if relative to dot_section; set the
1967         symbol's output_section.
1968         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1969         parameter.  Adjust all callers.
1970         (Expression::eval_maybe_dot): Likewise.
1971         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1972         Adjust all callers.
1973         * testsuite/script_test_2.t: Test assignment of an absolute value
1974         to dot within an output section element.
1975
1976 2011-10-31  Cary Coutant  <ccoutant@google.com>
1977
1978         * options.h (class General_options): Add --[no-]gnu-unique options.
1979         * symtab.cc (Symbol_table::sized_write_globals): Convert
1980         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1981
1982 2011-10-31  Cary Coutant  <ccoutant@google.com>
1983
1984         PR gold/13359
1985         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1986         unnecessary assertion.
1987         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1988
1989 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1990
1991         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1992         gc_mark_symbol.
1993         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1994         gc_mark_symbol.
1995         Change to just keep the section associated with symbol.
1996         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1997         they are externally visible and --export-dynamic is turned on.
1998         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1999
2000 2011-10-19  Ian Lance Taylor  <iant@google.com>
2001
2002         PR gold/13163
2003         * script-sections.cc
2004         (Output_section_element_dot_assignment::needs_output_section): New
2005         function.
2006
2007 2011-10-19  Ian Lance Taylor  <iant@google.com>
2008
2009         PR gold/13204
2010         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2011         --section-start option was seen.
2012         * options.h (General_options::any_section_start): New function.
2013
2014 2011-10-18  David S. Miller  <davem@davemloft.net>
2015
2016         PR binutils/13301
2017         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2018         member to track relocation locations that have moved during TLS
2019         reloc optimizations.
2020         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2021         (Target_sparc::Relocate::relocate): Adjust view down by 4
2022         bytes if it matches reloc_adjust_addr_.
2023         (Target_sparc::Relocate::relocate_tls): Always move the
2024         __tls_get_addr call delay slot instruction forward 4 bytes when
2025         performing relaxation.
2026
2027 2011-10-18  Cary Coutant  <ccoutant@google.com>
2028
2029         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2030         (Output_file::map_no_anonymous): Check for non-zero
2031         return code from posix_fallocate.
2032
2033 2011-10-17  Cary Coutant  <ccoutant@google.com>
2034
2035         PR gold/13245
2036         * plugin.cc (is_visible_from_outside): Check for symbols
2037         referenced from dynamic objects.
2038         * resolve.cc (Symbol_table::resolve): Don't count references
2039         from dynamic objects as references from real ELF files.
2040         * testsuite/plugin_test_2.sh: Adjust expected result.
2041
2042 2011-10-17  Cary Coutant  <ccoutant@google.com>
2043
2044         * gold.cc: Include timer.h.
2045         (queue_middle_tasks): Stamp time.
2046         (queue_final_tasks): Likewise.
2047         * main.cc (main): Store timer in parameters.  Print timers
2048         for each pass.
2049         * parameters.cc (Parameters::Parameters): Initialize timer_.
2050         (Parameters::set_timer): New function.
2051         (set_parameters_timer): New function.
2052         * parameters.h (Parameters::set_timer): New function.
2053         (Parameters::timer): New function.
2054         (Parameters::timer_): New data member.
2055         (set_parameters_timer): New function.
2056         * timer.cc (Timer::stamp): New function.
2057         (Timer::get_pass_time): New function.
2058         * timer.h (Timer::stamp): New function.
2059         (Timer::get_pass_time): New function.
2060         (Timer::pass_times_): New data member.
2061
2062 2011-10-17  Cary Coutant  <ccoutant@google.com>
2063
2064         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2065         task for members of lib groups.
2066
2067 2011-10-17  Cary Coutant  <ccoutant@google.com>
2068
2069         PR gold/13288
2070         * fileread.cc (File_read::find_view): Add assert.
2071         (File_read::make_view): Move bounds check (replace with assert)...
2072         (File_read::find_or_make_view): ... to here.
2073
2074 2011-10-12  Cary Coutant  <ccoutant@google.com>
2075
2076         * output.cc (Output_file::open_base_file): Handle case where
2077         ::read returns less than requested size.
2078
2079 2011-10-10  Cary Coutant  <ccoutant@google.com>
2080
2081         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2082         Initialize defined_count_.
2083         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2084         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2085         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2086         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2087         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2088         * incremental.h (Sized_relobj_incr::defined_count_): New data
2089         member.
2090         (Sized_incr_dynobj::defined_count_): New data member.
2091         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2092         Return zeroes instead of internal error.
2093
2094 2011-10-10  Cary Coutant  <ccoutant@google.com>
2095
2096         PR gold/13249
2097         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2098         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2099         * output.h (class Output_reloc): Add use_plt_offset flag.
2100         (Output_reloc::type_): Adjust size of bit field.
2101         (Output_reloc::use_plt_offset_): New bit field.
2102         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2103         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2104         flag.  Adjust all callers.
2105         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2106         creating RELATIVE relocations.
2107
2108 2011-10-10  Nick Clifton  <nickc@redhat.com>
2109
2110         * po/es.po: Updated Spanish translation.
2111         * po/fi.po: Updated Finnish translation.
2112
2113 2011-10-03   Diego Novillo  <dnovillo@google.com>
2114
2115         * options.cc (parse_uint): Fix dereference of RETVAL.
2116
2117 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2118
2119         * layout.h (section_order_map_): New member.
2120         (get_section_order_map): New member function.
2121         * output.cc (Output_section::add_input_section): Check for patterns
2122         only when --section-ordering-file is specified.
2123         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2124         output_sections have been formed.
2125         * layout.cc (Layout_Layout): Initialize section_order_map_.
2126         * plugin.cc (update_section_order): Store order in order_map. Do not
2127         update the order.
2128         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2129         * testsuite/Makefile.in: Regenerate.
2130         * testsuite/plugin_section_order.c: New file.
2131         * testsuite/plugin_final_layout.cc: New file.
2132         * testsuite/plugin_final_layout.sh: New file.
2133
2134 2011-09-29  Cary Coutant  <ccoutant@google.com>
2135
2136         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2137         Check for NULL.
2138         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2139         symbols during incremental update.
2140         (Symbol_table::add_from_dynobj): Likewise.
2141
2142 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2143             Ian Lance Taylor  <iant@google.com>
2144
2145         * symtab.cc (Symbol_table::define_special_symbol): Always
2146         canonicalize version string.
2147
2148 2011-09-26  Cary Coutant  <ccoutant@google.com>
2149
2150         * gold.cc (queue_initial_tasks): Move option checks ...
2151         * options.cc (General_options::finalize): ... to here. Disable
2152         some options; make others fatal.
2153
2154 2011-09-26  Cary Coutant  <ccoutant@google.com>
2155
2156         gcc PR lto/47247
2157         * plugin.cc (get_symbols_v2): New function.
2158         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2159         (is_referenced_from_outside): New function.
2160         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2161         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2162         (get_symbols): Pass version parameter.
2163         (get_symbols_v2): New function.
2164         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2165         parameter.
2166         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2167         (onload): Add LDPT_GET_SYMBOLS_V2.
2168         (all_symbols_read_hook): Use get_symbols_v2; check for
2169         LDPR_PREVAILING_DEF_IRONLY_EXP.
2170         * testsuite/plugin_test_3.sh: Update expected results.
2171
2172 2011-09-23  Simon Baldwin  <simonb@google.com>
2173
2174         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2175         configuration options.
2176         * configure: Regenerate.
2177         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2178         * Makefile.in: Regenerate.
2179         * testsuite/Makefile.in: Regenerate.
2180
2181 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2182
2183         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2184
2185 2011-09-19  Cary Coutant  <ccoutant@google.com>
2186
2187         * incremental.cc (can_incremental_update): Fix typo in comment.
2188         * incremental.h (can_incremental_update): Likewise.
2189
2190 2011-09-18  Cary Coutant  <ccoutant@google.com>
2191
2192         * incremental.cc (can_incremental_update): New function.
2193         * incremental.h (can_incremental_update): New function.
2194         * layout.cc (Layout::init_fixed_output_section): Call it.
2195         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2196         * object.cc (Sized_relobj_file::do_layout): Call
2197         can_incremental_update.
2198
2199 2011-09-13  Cary Coutant  <ccoutant@google.com>
2200
2201         * configure.ac: Check for glibc support for gnu_indirect_function
2202         support with static linking, setting automake conditional
2203         IFUNC_STATIC.
2204         * Makefile.in: Regenerate.
2205         * configure: Regenerate.
2206
2207         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2208         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2209         for IFUNC_STATIC.
2210         * testsuite/Makefile.in: Regenerate.
2211
2212 2011-09-13  Cary Coutant  <ccoutant@google.com>
2213
2214         * incremental.cc (Sized_relobj_incr::do_layout): Call
2215         report_comdat_group for kept comdat sections.
2216         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2217         * testsuite/Makefile.in: Regenerate.
2218         * testsuite/incr_comdat_test_1.cc: New source file.
2219         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2220         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2221         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2222
2223 2011-09-13  Ian Lance Taylor  <iant@google.com>
2224
2225         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2226         variable external_symbols_offset.
2227
2228 2011-09-12  Ian Lance Taylor  <iant@google.com>
2229
2230         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2231         triggered if object has no symbols.
2232
2233 2011-09-09  David S. Miller  <davem@davemloft.net>
2234
2235         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2236         (Output_fill_debug_line::do_write): Likewise.
2237
2238 2011-08-29  Cary Coutant  <ccoutant@google.com>
2239
2240         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2241         casts to match formatting specs.
2242         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2243
2244 2011-08-26  Cary Coutant  <ccoutant@google.com>
2245
2246         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2247         remaining hole size when allocating.
2248         (Layout::make_output_section): Set fill methods for debug sections.
2249         * layout.h (Free_list::Free_list_node): Move from private to
2250         public.
2251         (Free_list::set_min_hole_size): New function.
2252         (Free_list::begin, Free_list::end): New functions.
2253         (Free_list::min_hole_): New data member.
2254         * output.cc: Include dwarf.h.
2255         (Output_fill_debug_info::do_minimum_hole_size): New function.
2256         (Output_fill_debug_info::do_write): New function.
2257         (Output_fill_debug_line::do_minimum_hole_size): New function.
2258         (Output_fill_debug_line::do_write): New function.
2259         (Output_section::Output_section): Initialize new data member.
2260         (Output_section::set_final_data_size): Ensure patch space is larger
2261         than minimum hole size.
2262         (Output_section::do_write): Fill holes in debug sections.
2263         * output.h (Output_fill): New class.
2264         (Output_fill_debug_info): New class.
2265         (Output_fill_debug_line): New class.
2266         (Output_section::set_free_space_fill): New function.
2267         (Output_section::free_space_fill_): New data member.
2268         * testsuite/Makefile.am (incremental_test_3): Add
2269         --incremental-patch option.
2270         (incremental_test_4): Likewise.
2271         (incremental_test_5): Likewise.
2272         (incremental_test_6): Likewise.
2273         (incremental_copy_test): Likewise.
2274         (incremental_common_test_1): Likewise.
2275         * testsuite/Makefile.in: Regenerate.
2276
2277 2011-08-26  Nick Clifton  <nickc@redhat.com>
2278
2279         * po/es.po: Updated Spanish translation.
2280
2281 2011-08-01  Cary Coutant  <ccoutant@google.com>
2282
2283         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2284         * gold/testsuite/Makefile.in: Regenerate.
2285         * gold/testsuite/justsyms_exec.c: New source file.
2286         * gold/testsuite/justsyms_lib.c: New source file.
2287
2288 2011-08-01  Cary Coutant  <ccoutant@google.com>
2289
2290         * layout.cc (Layout::set_segment_offsets): Don't realign text
2291         segment if -Ttext was specified.
2292         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2293         file type.
2294         * object.h (Sized_relobj_file::e_type): New function.
2295         (Sized_relobj_file::e_type_): New data member.
2296         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2297         base address for ET_EXEC files.
2298         * target.cc (Target::do_make_elf_object_implementation): Allow
2299         ET_EXEC files with --just-symbols option.
2300
2301 2011-07-28  Cary Coutant  <ccoutant@google.com>
2302
2303         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2304         Add thread_number parameter.
2305         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2306         * workqueue-threads.cc
2307         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2308         current thread if its thread number is greater than desired thread
2309         count.
2310         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2311         Add thread_number parameter.
2312         (Workqueue::should_cancel_thread): Likewise.
2313         (Workqueue::find_runnable_or_wait): Pass thread_number to
2314         should_cancel_thread.
2315         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2316         parameter.
2317
2318 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2319
2320         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2321         only after checking if it cannot be forced local.
2322         * symtab.h (is_externally_visible): Check if the symbol is not forced
2323         local.
2324
2325 2011-07-15  Ian Lance Taylor  <iant@google.com>
2326
2327         * options.h (class General_options): Add --print-output-format.
2328         Move -EL next to -EB, for  better --help output.
2329         * target-select.cc: Include <cstdio>, "options.h", and
2330         "parameters.h".
2331         (Target_selector::do_target_bfd_name): New function.
2332         (print_output_format): New function.
2333         * target-select.h (class Target_selector): Update declarations.
2334         (Target_selector::target_bfd_name): New function.
2335         (print_output_format): Declare.
2336         * main.cc: Include "target-select.h".
2337         (main): Handle --print-output-format.
2338         * gold.cc: Include "target-select.h".
2339         (queue_initial_tasks): Handle --print-output-format when there are
2340         no input files.
2341         * parameters.cc (parameters_force_valid_target): Give a better
2342         error message if -EB/-EL does not match target.
2343         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2344         function.
2345
2346 2011-07-15  Ian Lance Taylor  <iant@google.com>
2347
2348         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2349         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2350         (Output_data_plt_i386::do_write): Write address of .dynamic
2351         section to first entry in .got.plt section.
2352         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2353         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2354         Initialize layout_.
2355         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2356         section to first entry in .got.plt section.
2357         * layout.h (Layout::dynamic_section): New function.
2358
2359 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2360
2361         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2362         to claim_file call.
2363         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2364         input_section_position_, and input_section_glob_.
2365         (read_layout_from_file): Call function section_ordering_specified.
2366         * layout.h (is_section_ordering_specified): New function.
2367         (section_ordering_specified): New function.
2368         (section_ordering_specified_): New boolean member.
2369         * main.cc(main): Call load_plugins after layout object is defined.
2370         * output.cc (Output_section::add_input_section): Use
2371         function section_ordering_specified to check if section ordering is
2372         needed.
2373         * output.cc (Output_section::add_relaxed_input_section): Use
2374         function section_ordering_specified to check if section ordering is
2375         needed.
2376         (Output_section::update_section_layout): New function.
2377         (Output_section::sort_attached_input_sections): Check if input section
2378         must be reordered.
2379         * output.h (Output_section::update_section_layout): New function.
2380         * plugin.cc (get_section_count): New function.
2381         (get_section_type): New function.
2382         (get_section_name): New function.
2383         (get_section_contents): New function.
2384         (update_section_order): New function.
2385         (allow_section_ordering): New function.
2386         (Plugin::load): Add the new interfaces to the transfer vector.
2387         (Plugin_manager::load_plugins): New parameter.
2388         (Plugin_manager::all_symbols_read): New parameter.
2389         (Plugin_manager::claim_file): New parameter. Save the elf object for
2390         unclaimed objects.
2391         (Plugin_manager::get_elf_object): New function.
2392         (Plugin_manager::get_view): Change to directly use the bool to check
2393         if get_view is called from claim_file_hook.
2394         * plugin.h (input_objects): New function
2395         (Plugin__manager::load_plugins): New parameter.
2396         (Plugin_manager::claim_file): New parameter.
2397         (Plugin_manager::get_elf_object): New function.
2398         (Plugin_manager::in_claim_file_handler): New function.
2399         (Plugin_manager::in_claim_file_handler_): New member.
2400         (layout): New function.
2401         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2402         handler with an extra parameter. Make the elf object before calling
2403         claim_file handler.
2404         * testsuite/plugin_test.c (get_section_count): New function pointer.
2405         (get_section_type): New function pointer.
2406         (get_section_name): New function pointer.
2407         (get_section_contents): New function pointer.
2408         (update_section_order): New function pointer.
2409         (allow_section_ordering): New function pointer.
2410         (onload): Check if the new interfaces exist.
2411
2412 2011-07-13  Ian Lance Taylor  <iant@google.com>
2413
2414         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2415         relro section.
2416         * x86_64.cc (Target_x86_64::got_section): Likewise.
2417         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2418         (relro_now_test_SOURCES): New variable.
2419         (relro_now_test_DEPENDENCIES): New variable.
2420         (relro_now_test_LDFLAGS): New variable.
2421         (relro_now_test_LDADD): New variable.
2422         (relro_now_test.so): New target.
2423         * testsuite/Makefile.in: Rebuild.
2424
2425 2011-07-12  Ian Lance Taylor  <iant@google.com>
2426
2427         PR gold/12980
2428         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2429         GLOB_DAT relocation rather than a RELATIVE relocation for a
2430         protected symbol when creating a shared library.
2431         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2432         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2433         * testsuite/protected_main_1.cc (main): Test that protected
2434         function has same address.
2435
2436 2011-07-11  Ian Lance Taylor  <iant@google.com>
2437
2438         PR gold/12979
2439         * options.h (class General_options): Add -Bgroup.
2440         * options.cc (General_options::finalize): If -Bgroup is set,
2441         default to --unresolved-symbols=report-all.
2442         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2443         * target-reloc.h (issue_undefined_symbol_error): Handle
2444         --unresolved-symbols=report-all.
2445
2446 2011-07-08  Ian Lance Taylor  <iant@google.com>
2447
2448         PR gold/11985
2449         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2450         if linker script discards key sections.
2451         (Layout::create_dynamic_symtab): Likewise.
2452         (Layout::assign_local_dynsym_offsets): Likewise.
2453         (Layout::sized_create_version_sections): Likewise.
2454         (Layout::create_interp): Likewise.
2455         (Layout::finish_dynamic_section): Likewise.
2456         (Layout::set_dynamic_symbol_size): Likewise.
2457
2458 2011-07-08  Ian Lance Taylor  <iant@google.com>
2459
2460         PR gold/12386
2461         * options.h (class General_options): Add --unresolved-symbols.
2462         * target-reloc.h (issue_undefined_symbol_error): Check
2463         --unresolved-symbols.  Add comments.
2464
2465 2011-07-08  Ian Lance Taylor  <iant@google.com>
2466
2467         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2468         expression more complex.
2469
2470 2011-07-08  Ian Lance Taylor  <iant@google.com>
2471
2472         PR gold/11317
2473         * target-reloc.h (issue_undefined_symbol_error): New inline
2474         function, broken out of relocate_section.
2475         (relocate_section): Call issue_undefined_symbol_error.
2476         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2477         there is no TLS segment if we are about to issue an undefined
2478         symbol error.
2479         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2480
2481 2011-07-08  Ian Lance Taylor  <iant@google.com>
2482
2483         PR gold/12279
2484         * resolve.cc (Symbol_table::should_override): Add fromtype
2485         parameter.  Change all callers.  Give error when linking together
2486         TLS and non-TLS symbol.
2487         (Symbol_table::should_override_with_special): Add fromtype
2488         parameter.  Change all callers.
2489         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2490         there is no TLS segment if we have reported some errors.
2491         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2492
2493 2011-07-08  Ian Lance Taylor  <iant@google.com>
2494
2495         PR gold/12372
2496         * target.h (Target::plt_address_for_global): New function.
2497         (Target::plt_address_for_local): New function.
2498         (Target::plt_section_for_global): Remove.
2499         (Target::plt_section_for_local): Remove.
2500         (Target::do_plt_address_for_global): New virtual function.
2501         (Target::do_plt_address_for_local): New virtual function.
2502         (Target::do_plt_section_for_global): Remove.
2503         (Target::do_plt_section_for_local): Remove.
2504         (Target::register_global_plt_entry): Add Symbol_table and Layout
2505         parameters.
2506         * output.cc (Output_data_got::Got_entry::write): Use
2507         plt_address_for_global and plt_address_for_local.
2508         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2509         address of output section.
2510         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2511         got_irelative_, and irelative_count_ fields.  Update
2512         declarations.
2513         (Output_data_plt_i386::has_irelative_section): New function.
2514         (Output_data_plt_i386::entry_count): Add irelative_count_.
2515         (Output_data_plt_i386::set_final_data_size): Likewise.
2516         (class Target_i386): Add got_irelative_ and rel_irelative_
2517         fields.  Update declarations.
2518         (Target_i386::Target_i386): Initialize new fields.
2519         (Target_i386::do_plt_address_for_global): New function replacing
2520         do_plt_section_for_global.
2521         (Target_i386::do_plt_address_for_local): New function replacing
2522         do_plt_section_for_local.
2523         (Target_i386::got_section): Create got_irelative_.
2524         (Target_i386::rel_irelative_section): New function.
2525         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2526         fields.  Don't define __rel_iplt_{start,end}.
2527         (Output_data_plt_i386::add_entry): Add symtab and layout
2528         parameters.  Change all callers.  Use different PLT and GOT for
2529         IFUNC symbols.
2530         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2531         layout parameters.  Change all callers.  Use different PLT and
2532         GOT.
2533         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2534         (Output_data_plt_i386::rel_irelative): New function.
2535         (Output_data_plt_i386::address_for_global): New function.
2536         (Output_data_plt_i386::address_for_local): New function.
2537         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2538         IRELATIVE GOT when changing IFUNC GOT entries.
2539         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2540         reloc.
2541         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2542         if we didn't create an IRELATIVE GOT.
2543         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2544         plt_address_for_local.
2545         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2546         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2547         got_irelative_, and irelative_count_ fields.  Update
2548         declarations.
2549         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2550         Initialize new fields.  Remove symtab parameter.  Change all
2551         callers.
2552         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2553         irelative_count_.
2554         (Output_data_plt_x86_64::has_irelative_section): New function.
2555         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2556         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2557         fields.  Update declarations.
2558         (Target_x86_64::Target_x86_64): Initialize new fields.
2559         (Target_x86_64::do_plt_address_for_global): New function replacing
2560         do_plt_section_for_global.
2561         (Target_x86_64::do_plt_address_for_local): New function replacing
2562         do_plt_section_for_local.
2563         (Target_x86_64::got_section): Create got_irelative_.
2564         (Target_x86_64::rela_irelative_section): New function.
2565         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2566         all callers.  Don't create __rel_iplt_{start,end}.
2567         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2568         parameters.  Change all callers.  Use different PLT and GOT for
2569         IFUNC symbols.
2570         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2571         layout parameters.  Change all callers.  Use different PLT and
2572         GOT.
2573         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2574         parameters.  Change all callers.  Use different PLT and GOT for
2575         IFUNC symbols.
2576         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2577         (Output_data_plt_x86_64::rela_irelative): New function.
2578         (Output_data_plt_x86_64::address_for_global): New function.
2579         (Output_data_plt_x86_64::address_for_local): New function.
2580         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2581         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2582         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2583         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2584         parameters.
2585         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2586         reloc.
2587         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2588         symbols if we didn't create an IRELATIVE GOT.
2589         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2590         plt_address_for_local.
2591         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2592         * testsuite/ifuncvar1.c: New test file.
2593         * testsuite/ifuncvar2.c: New test file.
2594         * testsuite/ifuncvar3.c: New test file.
2595         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2596         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2597         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2598         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2599         * testsuite/Makefile.in: Rebuild.
2600
2601 2011-07-07  Cary Coutant  <ccoutant@google.com>
2602
2603         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2604         (two_file_test_1_ndebug.o): Likewise.
2605         (two_file_test_1b_ndebug.o): Likewise.
2606         (two_file_test_2_ndebug.o): Likewise.
2607         (two_file_test_main_ndebug.o): Likewise.
2608         (incremental_test_2): Link with no-debug versions.
2609
2610 2011-07-06  Cary Coutant  <ccoutant@google.com>
2611
2612         * gold/incremental.cc
2613         (Output_section_incremental_inputs::write_info_blocks): Check for
2614         hidden and internal symbols.
2615
2616 2011-07-06  Cary Coutant  <ccoutant@google.com>
2617
2618         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2619         Check disposition for startup file.
2620         (Incremental_inputs::report_command_line): Ignore
2621         --incremental-startup-unchanged option.
2622         * options.cc (General_options::parse_incremental_startup_unchanged):
2623         New function.
2624         (General_options::General_options): Initialize new data member.
2625         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2626         (General_options): Add --incremental-startup-unchanged option.
2627         (General_options::incremental_startup_disposition): New function.
2628         (General_options::incremental_startup_disposition_): New data member.
2629
2630 2011-07-06  Cary Coutant  <ccoutant@google.com>
2631
2632         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2633         input file index to Script_info ctor.
2634         (Sized_incremental_binary::do_file_has_changed): Find the
2635         command-line argument for files named in scripts.
2636         * incremental.h (Script_info::Script_info): New ctor
2637         with input file index.
2638         (Script_info::input_file_index): New function.
2639         (Script_info::input_file_index_): New data member.
2640         (Incremental_binary::get_library): Add const.
2641         (Incremental_binary::get_script_info): Add const.
2642         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2643         * testsuite/Makefile.am (incremental_test_5): New test case.
2644         (incremental_test_6): New test case.
2645         * testsuite/Makefile.in: Regenerate.
2646
2647 2011-07-06  Cary Coutant  <ccoutant@google.com>
2648
2649         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2650         debug output when command lines differ.
2651
2652 2011-07-06  Cary Coutant  <ccoutant@google.com>
2653
2654         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2655         --incremental-patch option.
2656         * layout.cc (Free_list::allocate): Extend allocation beyond original
2657         end if enabled.
2658         (Layout::make_output_section): Mark sections that should get
2659         patch space.
2660         * options.cc (parse_percent): New function.
2661         * options.h (parse_percent): New function.
2662         (DEFINE_percent): New macro.
2663         (General_options): Add --incremental-patch option.
2664         * output.cc (Output_section::Output_section): Initialize new data
2665         members.
2666         (Output_section::add_input_section): Print section name when out
2667         of patch space.
2668         (Output_section::add_output_section_data): Likewise.
2669         (Output_section::set_final_data_size): Add patch space when
2670         doing --incremental-full.
2671         (Output_section::do_reset_address_and_file_offset): Remove patch
2672         space.
2673         (Output_segment::set_section_list_addresses): Print debug output
2674         only if --incremental-update.
2675         * output.h (Output_section::set_is_patch_space_allowed): New function.
2676         (Output_section::is_patch_space_allowed_): New data member.
2677         (Output_section::patch_space_): New data member.
2678         * parameters.cc (Parameters::incremental_full): New function.
2679         * parameters.h (Parameters::incremental_full): New function
2680         * testsuite/Makefile.am (incremental_test_2): Add test for
2681         --incremental-patch option.
2682         * testsuite/Makefile.in: Regenerate.
2683         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2684         (t18): Remove function body.
2685
2686 2011-07-05  Doug Kwan  <dougkwan@google.com>
2687
2688         PR gold/12771
2689         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2690         Arm_Address type for relocation result.
2691         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2692         overflow check.
2693         (Arm_relocate_functions::abs32): Use unaligned access.
2694         (Arm_relocate_functions::rel32): Ditto.
2695         (Arm_relocate_functions::prel31): Ditto.
2696         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2697         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2698         static data relocations.
2699         * testsuite/Makefile.in: Regnerate.
2700         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2701
2702 2011-07-05  Ian Lance Taylor  <iant@google.com>
2703
2704         PR gold/12392
2705         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2706         symbols if necessary.
2707         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2708
2709 2011-07-05  Ian Lance Taylor  <iant@google.com>
2710
2711         PR gold/12952
2712         * resolve.cc (Symbol::override_base_with_special): Simply override
2713         version with special symbol version, ignoring previous version.
2714
2715 2011-07-05  Ian Lance Taylor  <iant@google.com>
2716
2717         * object.cc (Sized_relobj_file::include_section_group): Add
2718         information to comment about signature location.
2719
2720 2011-07-02  Ian Lance Taylor  <iant@google.com>
2721
2722         PR gold/12957
2723         * options.h (class General_options): Add -f and -F.
2724         * options.cc (General_options::finalize): Fatal error if -f/-F
2725         are used without -shared.
2726         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2727
2728 2011-07-02  Ian Lance Taylor  <iant@google.com>
2729
2730         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2731
2732 2011-07-01  Ian Lance Taylor  <iant@google.com>
2733
2734         PR gold/12525
2735         PR gold/12952
2736         * resolve.cc (Symbol::override_base_with_special): Don't override
2737         the version if the overriding symbol has a different name.
2738         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2739         all callers.  If we give an error about an undefined version,
2740         define the base version if necessary.
2741         * dynobj.h (class Versions): Update declaration.
2742         * testsuite/weak_alias_test_5.cc: New file.
2743         * testsuite/weak_alias_test.script: New file.
2744         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2745         and versioned_alias have the right value, and call t2.
2746         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2747         weak_alias_test_5.so.
2748         (weak_alias_test_LDADD): Likewise.
2749         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2750         * testsuite/Makefile.in: Rebuild.
2751
2752 2011-07-01  Ian Lance Taylor  <iant@google.com>
2753
2754         PR gold/12525
2755         * options.h (class General_options): Support -z notext.
2756         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2757         -Wl,-z,notext.
2758         (two_file_shared_nonpic.so): Likewise.
2759         (two_file_shared_mixed.so): Likewise.
2760         (two_file_shared_mixed_1.so): Likewise.
2761         (weak_undef_lib_nonpic.so): Likewise.
2762         (alt/weak_undef_lib_nonpic.so): Likewise.
2763         (tls_test_shared_nonpic.so): Likewise.
2764         * testsuite/Makefile.in: Rebuild.
2765
2766 2011-07-01  Ian Lance Taylor  <iant@google.com>
2767
2768         PR gold/12525
2769         * configure.ac: Test whether static linking works, setting
2770         the automake conditional HAVE_STATIC.
2771         * testsuite/Makefile.am: Disable tests using -static if
2772         HAVE_STATIC is not true.
2773         * configure, testsuite/Makefile.in: Rebuild.
2774
2775 2011-07-01  Ian Lance Taylor  <iant@google.com>
2776
2777         PR gold/12525
2778         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2779         Assert if we see DW_EH_PE_indirect.
2780         * target.h (Target::ehframe_datarel_base): New function.
2781         (Target::do_ehframe_datarel_base): New target function.
2782         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2783         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2784         function.
2785
2786 2011-07-01  Ian Lance Taylor  <iant@google.com>
2787
2788         PR gold/12571
2789         * options.h (class General_options): Add
2790         --ld-generated-unwind-info.
2791         * ehframe.cc (Fde::write): Add address parameter.  Change all
2792         callers.  If associated with PLT, fill in address and size.
2793         (Cie::set_output_offset): Only add merge mapping if there is an
2794         object.
2795         (Cie::write): Add address parameter.  Change all callers.
2796         (Eh_frame::add_ehframe_for_plt): New function.
2797         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2798         input_offset_ fields into union u_, with new plt field.
2799         (Fde::Fde): Adjust for new union field.
2800         (Fde::Fde) [Output_data version]: New constructor.
2801         (Fde::add_mapping): Only add merge mapping if there is an object.
2802         (class Cie): Update declarations.
2803         (class Eh_frame): Declare add_ehframe_for_plt.
2804         * layout.cc (Layout::layout_eh_frame): Break out code into
2805         make_eh_frame_section, and call it.
2806         (Layout::make_eh_frame_section): New function.
2807         (Layout::add_eh_frame_for_plt): New function.
2808         * layout.h (class Layout): Update declarations.
2809         * merge.cc (Merge_map::add_mapping): Add assertion.
2810         * i386.cc: Include "dwarf.h".
2811         (class Output_data_plt_i386): Make first_plt_entry,
2812         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2813         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2814         and plt_eh_frame_fde.
2815         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2816         boundary.  Call add_eh_frame_for_plt if appropriate.
2817         * x86_64.cc: Include "dwarf.h".
2818         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2819         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2820         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2821         and plt_eh_frame_fde.
2822         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2823         appropriate.
2824
2825 2011-06-29  Ian Lance Taylor  <iant@google.com>
2826
2827         PR gold/12629
2828         * object.cc (Sized_relobj_file::layout_section): Change shdr
2829         parameter to be const.
2830         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2831         out of do_layout.
2832         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2833         appropriate.  Call layout_eh_frame_section.
2834         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2835         sections.
2836         * object.h (class Sized_relobj_file): Update declarations.
2837
2838 2011-06-29  Ian Lance Taylor  <iant@google.com>
2839
2840         PR gold/12652
2841         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2842         modifier.
2843         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2844
2845 2011-06-29  Ian Lance Taylor  <iant@google.com>
2846
2847         PR gold/12675
2848         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2849         SHT_X86_64_UNWIND.
2850         * layout.cc (Layout::layout_eh_frame): Likewise.
2851
2852 2011-06-29  Ian Lance Taylor  <iant@google.com>
2853
2854         PR gold/12695
2855         * layout.cc (Layout::symtab_section_shndx): New function.
2856         * layout.h (class Layout): Declare symtab_section_shndx.
2857         * output.cc (Output_section::write_header): Call it.
2858
2859 2011-06-29  Ian Lance Taylor  <iant@google.com>
2860
2861         PR gold/12818
2862         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2863         symbols which are not used in a relocation.
2864
2865 2011-06-28  Ian Lance Taylor  <iant@google.com>
2866
2867         PR gold/12898
2868         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2869         script create indistinguishable segments.
2870         (Layout::set_segment_offsets): Use stable_sort when sorting
2871         segments.  Pass this to Compare_segments constructor.
2872         * layout.h (class Layout): Make segment_precedes non-static.
2873         (class Compare_segments): Change from struct to class.  Add
2874         layout_ field.  Add constructor.
2875         * script-sections.cc
2876         (Script_sections::attach_sections_using_phdrs_clause): Rename
2877         local orphan to is_orphan.  Don't report failure to put empty
2878         section in segment.  On attachment failure, report name of
2879         section, and attach to first PT_LOAD segment.
2880
2881 2011-06-28  Ian Lance Taylor  <iant@google.com>
2882
2883         PR gold/12934
2884         * target-select.cc (Target_selector::Target_selector): Add
2885         emulation parameter.  Change all callers.
2886         (select_target_by_bfd_name): Rename from select_target_by_name.
2887         Change all callers.
2888         (select_target_by_emulation): New function.
2889         (supported_emulation_names): New function.
2890         * target-select.h (class Target_selector): Add emulation_ field.
2891         Update declarations.
2892         (Target_selector::recognize_by_bfd_name): Rename from
2893         recognize_by_name.  Change all callers.
2894         (Target_selector::supported_bfd_names): Rename from
2895         supported_names.  Change all callers.
2896         (Target_selector::recognize_by_emulation): New function.
2897         (Target_selector::supported_emulations): New function.
2898         (Target_selector::emulation): New function.
2899         (Target_selector::do_recognize_by_bfd_name): Rename from
2900         do_recognize_by_name.  Change all callers.
2901         (Target_selector::do_supported_bfd_names): Rename from
2902         do_supported_names.  Change all callers.
2903         (Target_selector::do_recognize_by_emulation): New function.
2904         (Target_selector::do_supported_emulations): New function.
2905         (select_target_by_bfd_name): Change name in declaration.
2906         (select_target_by_emulation): Declare.
2907         (supported_emulation_names): Declare.
2908         * parameters.cc (parameters_force_valid_target): Try to find
2909         target based on emulation from -m option.
2910         * options.h (class General_options): Change doc string for -m.
2911         * options.cc (help): Print emulations.
2912         (General_options::parse_V): Likewise.
2913         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2914         Add emulation parameter.  Change all callers.
2915
2916 2011-06-28  Ian Lance Taylor  <iant@google.com>
2917
2918         * target.h (class Target): Add osabi_ field.
2919         (Target::osabi): New function.
2920         (Target::set_osabi): New function.
2921         (Target::Target): Initialize osabi_.
2922         (Target::do_adjust_elf_header): Make pure virtual.
2923         (Sized_target::do_adjust_elf_header): Declare.
2924         * target.cc (Sized_target::do_adjust_elf_header): New function.
2925         (class Sized_target): Instantiate all versions.
2926         * freebsd.h (class Target_freebsd): Remove.
2927         (Target_selector_freebsd::do_recognize): Call set_osabi on
2928         Target.
2929         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2930         (Target_selector_freebsd::set_osabi): Remove.
2931         * i386.cc (class Target_i386): Inherit from Sized_target rather
2932         than Target_freebsd.
2933         * x86_64.cc (class Target_x86_64): Likewise.
2934
2935 2011-06-28  Ian Lance Taylor  <iant@google.com>
2936
2937         * target.h (Target::can_check_for_function_pointers): Rewrite.
2938         Make non-virtual.
2939         (Target::can_icf_inline_merge_sections): Likewise.
2940         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2941         (Target::Target_info): Add can_icf_inline_merge_sections field.
2942         (Target::do_can_check_for_function_pointers): New virtual
2943         function.
2944         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2945         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2946         from can_check_for_function_pointers, move in file.
2947         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2948         section_may_have_icf_unsafe_poineters, move in file.
2949         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2950         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2951         Rename from can_check_for_function_pointers, move in file.
2952         (Target_i386::can_icf_inline_merge_sections): Remove.
2953         (Target_i386::i386_info): Initialize
2954         can_icf_inline_merge_sections.
2955         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2956         Initialize can_icf_inline_merge_sections.
2957         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2958         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2959         Rename from can_check_for_function_pointers, move in file.
2960         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2961         (Target_x86_64::x86_64_info): Initialize
2962         can_icf_inline_merge_sections.
2963         * testsuite/testfile.cc (Target_test::test_target_info):
2964         Likewise.
2965         * icf.cc (get_section_contents): Correct formatting.
2966
2967 2011-06-27  Ian Lance Taylor  <iant@google.com>
2968
2969         * symtab.cc (Symbol::versioned_name): New function.
2970         (Symbol_table::add_to_final_symtab): Use versioned_name when
2971         appropriate.
2972         (Symbol_table::sized_write_symbol): Likewise.
2973         * symtab.h (class Symbol): Declare versioned_name.
2974         * stringpool.h (class Stringpool_template): Add variant of add
2975         which takes a std::basic_string.
2976         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2977         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2978         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2979         (ver_test_12.o): New target.
2980         * testsuite/Makefile.in: Rebuild.
2981
2982 2011-06-27  Doug Kwan  <dougkwan@google.com>
2983
2984         * arm.cc (Arm_relocate_functions::thm_jump8,
2985         Arm_relocate_functions::thm_jump11): Use a wider signed
2986         type to compute offset.
2987         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2988         arm_thm_jump8.
2989         * testsuite/Makefile.in: Regenerate.
2990         * testsuite/arm_branch_in_range.sh: Check test results of
2991         arm_thm_jump11 and arm_thm_jump8.
2992         * testsuite/arm_thm_jump11.s: New test source file.
2993         * testsuite/arm_thm_jump11.t: New linker script.
2994         * testsuite/arm_thm_jump8.s: New test source file.
2995         * testsuite/arm_thm_jump8.t: New linker script.
2996
2997 2011-06-24  Ian Lance Taylor  <iant@google.com>
2998
2999         * layout.cc: Include "object.h".
3000         (ctors_sections_in_init_array): New static variable.
3001         (Layout::is_ctors_in_init_array): New function.
3002         (Layout::layout): Add entry to ctors_sections_in_init_array if
3003         appropriate.
3004         * layout.h (class Layout): Declare is_ctors_in_init_array.
3005         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3006         is_ctors_reverse_view is set.
3007         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3008         all callers.  Set is_ctors_reverse_view field of View_size.
3009         (Sized_relobj_file::reverse_words): New function.
3010         * object.h (Sized_relobj_file::View_size): Add
3011         is_ctors_reverse_view field.
3012         (class Sized_relobj_file): Update declarations.
3013         * testsuite/initpri3.c: New test.
3014         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3015         initpri3b.
3016         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3017         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3018         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3019         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3020         * testsuite/Makefile.in: Rebuild.
3021
3022 2011-06-24  Cary Coutant  <ccoutant@google.com>
3023
3024         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3025         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3026         (debug_msg_cdebug.err): New targets.
3027         * testsuite/Makefile.in: Regenerate.
3028         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3029         Fix checks for link with shared library.
3030
3031 2011-06-24  Doug Kwan  <dougkwan@google.com>
3032
3033         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3034         skip empty text sections.
3035         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3036
3037 2011-06-22  Ian Lance Taylor  <iant@google.com>
3038
3039         PR gold/12910
3040         * options.h (class General_options): Add --ctors-in-init-array.
3041         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3042         friends as SHT_PROGBITS for merging sections.
3043         (Layout::layout): Remove special handling of .init_array and
3044         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3045         and .dtors if ctors_in_init_array.
3046         (Layout::make_output_section): Force correct section types for
3047         .init_array and friends.  Don't sort if doing relocatable link,
3048         Don't sort .ctors and .dtors if ctors_in_init_array.
3049         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3050         (Layout::output_section_name): Add relobj parameter.  Change all
3051         callers.  Handle .ctors. and .dtors. in code rather than table.
3052         Handle .ctors and .dtors if ctors_in_init_array.
3053         (Layout::match_file_name): New function, moved from output.cc.
3054         * layout.h (class Layout): Update declarations.
3055         * output.cc: Include "layout.h".
3056         (Input_section_sort_entry::get_priority): New function.
3057         (Input_section_sort_entry::match_file_name): Just call
3058         Layout::match_file_name.
3059         (Output_section::Input_section_sort_init_fini_compare::operator()):
3060         Handle .ctors and .dtors.  Sort by explicit priority rather than
3061         by name.
3062         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3063         * testsuite/initpri2.c: New test.
3064         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3065         (check_PROGRAMS): Add initpri2.
3066         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3067         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3068         * configure, testsuite/Makefile.in: Rebuild.
3069
3070 2011-06-19  Ian Lance Taylor  <iant@google.com>
3071
3072         PR gold/12880
3073         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3074         .interp section to a PT_INTERP segment even if we have seen a
3075         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3076         clause in a linker script.
3077         (Layout::finalize): Don't create a .interp section if we've
3078         already create a PT_INTERP segment.
3079         (Layout::create_interp): Always call choose_output_section (revert
3080         patch of 2011-06-17).  Don't create PT_INTERP segment.
3081         * script-sections.cc
3082         (Script_sections::create_note_and_tls_segments): Add a .interp
3083         section to a PT_INTERP segment even if we have seen a
3084         --dynamic-linker option.
3085
3086 2011-06-18  Ian Lance Taylor  <iant@google.com>
3087
3088         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3089         merely because a non-PT_LOAD segment has a dynamic reloc.
3090
3091 2011-06-18  Ian Lance Taylor  <iant@google.com>
3092
3093         * layout.cc (Layout::finish_dynamic_section): Don't create
3094         DT_FLAGS entry if not needed.
3095
3096 2011-06-18  Ian Lance Taylor  <iant@google.com>
3097
3098         PR gold/12745
3099         * layout.cc (Layout::layout_eh_frame): Correct handling of
3100         writable .eh_frame section.
3101
3102 2011-06-17  Ian Lance Taylor  <iant@google.com>
3103
3104         PR gold/12893
3105         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3106         symbol is redefined with the exact same object and value.
3107
3108 2011-06-17  Ian Lance Taylor  <iant@google.com>
3109
3110         PR gold/12880
3111         * layout.h (class Layout): Add interp_segment_ field.
3112         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3113         (Layout::attach_allocated_section_to_segment): If making shared
3114         library, put .interp section in PT_INTERP segment.
3115         (Layout::finalize): Also call create_interp if -dynamic-linker
3116         option was used.
3117         (Layout::create_interp): Assert that there is no PT_INTERP
3118         segment.  If not using a SECTIONS clause, use make_output_section.
3119         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3120         * script-sections.cc
3121         (Script_sections::create_note_and_tls_segments): If making shared
3122         library, put .interp section in PT_INTERP segment.
3123
3124 2011-06-17  Ian Lance Taylor  <iant@google.com>
3125
3126         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3127         when making a shared library.
3128
3129 2011-06-17  Ian Lance Taylor  <iant@google.com>
3130
3131         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3132         parameter.  Change all callers.  Don't issue warning about PC32
3133         against locally defined symbol.
3134
3135 2011-06-16  Ian Lance Taylor  <iant@google.com>
3136
3137         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3138         occurs in same object.
3139
3140 2011-06-14  Alan Modra  <amodra@gmail.com>
3141
3142         * po/POTFILES.in: Regenerate.
3143
3144 2011-06-09  Ian Lance Taylor  <iant@google.com>
3145
3146         * script-sections.cc
3147         (Orphan_output_section::set_section_addresses): For a relocatable
3148         link set address to 0.
3149
3150 2011-06-09  Cary Coutant  <ccoutant@google.com>
3151
3152         PR gold/12804
3153         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3154         used with --compress-debug-sections.
3155         * gold/object.cc (Sized_relobj_file::do_layout): Report
3156         uncompressed size of compressed input sections.
3157
3158 2011-06-08  Cary Coutant  <ccoutant@google.com>
3159
3160         PR gold/12804
3161         * testsuite/two_file_test_2_v1.cc: Change initialization of
3162         v2 to keep it in .data.
3163
3164 2011-06-07  Cary Coutant  <ccoutant@google.com>
3165
3166         * common.cc (Symbol_table::do_allocate_commons_list): Call
3167         gold_fallback.
3168         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3169         (Errors::fallback): New function.
3170         (gold_fallback): New function.
3171         * errors.h (Errors::fallback): New function.
3172         * gold.cc (gold_exit): Change status parameter to enum; adjust
3173         all callers.
3174         (queue_initial_tasks): Call gold_fallback.
3175         * gold.h: Include cstdlib.
3176         (Exit_status): New enum type.
3177         (gold_exit): Change status parameter to enum.
3178         (gold_fallback): New function.
3179         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3180         (Layout::create_symtab_sections): Likewise.
3181         (Layout::create_shdrs): Likewise.
3182         * main.cc (main): Adjust call to gold_exit.
3183         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3184         (Output_data_got::add_got_entry_pair): Likewise.
3185         (Output_section::add_input_section): Likewise.
3186         (Output_section::add_output_section_data): Likewise.
3187         (Output_segment::set_section_list_addresses): Likewise.
3188         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3189
3190 2011-06-07  Cary Coutant  <ccoutant@google.com>
3191
3192         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3193         for incremental links.
3194         * output.cc (Output_segment::set_section_list_addresses): Remove
3195         FIXME and test for TLS or BSS.
3196
3197 2011-06-07  Cary Coutant  <ccoutant@google.com>
3198
3199         * testsuite/Makefile.am: Add incremental_copy_test,
3200         incremental_common_test_1.
3201         * testsuite/Makefile.in: Regenerate.
3202         * testsuite/common_test_1_v1.c: New source file.
3203         * testsuite/common_test_1_v2.c: New source file.
3204         * testsuite/copy_test_v1.cc: New source file.
3205
3206 2011-06-07  Cary Coutant  <ccoutant@google.com>
3207
3208         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3209         update, allocate common from bss section's free list.
3210         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3211         linker-defined symbols.
3212         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3213         Skip GOT and PLT entries that are no longer referenced.
3214         (Output_section_incremental_inputs::write_info_blocks): Mark
3215         linker-defined symbols.
3216         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3217         * output.cc (Output_section::allocate): New function.
3218         * output.h (Output_section::allocate): New function.
3219         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3220         linker-defined symbols.
3221         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3222         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3223         (Symbol::init_base_output_data): Likewise.
3224         (Symbol::init_base_output_segment): Likewise.
3225         (Symbol::init_base_constant): Likewise.
3226         (Sized_symbol::init_output_data): Likewise.
3227         (Sized_symbol::init_output_segment): Likewise.
3228         (Sized_symbol::init_constant): Likewise.
3229         (Symbol_table::do_define_in_output_data): Likewise.
3230         (Symbol_table::do_define_in_output_segment): Likewise.
3231         (Symbol_table::do_define_as_constant): Likewise.
3232         * symtab.h (Symbol::is_predefined): New function.
3233         (Symbol::init_base_output_data): Add is_predefined parameter.
3234         (Symbol::init_base_output_segment): Likewise.
3235         (Symbol::init_base_constant): Likewise.
3236         (Symbol::is_predefined_): New data member.
3237         (Sized_symbol::init_output_data): Add is_predefined parameter.
3238         (Sized_symbol::init_output_segment): Likewise.
3239         (Sized_symbol::init_constant): Likewise.
3240         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3241
3242 2011-06-07  Cary Coutant  <ccoutant@google.com>
3243
3244         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3245         instead of emit_copy_reloc.
3246         (Copy_relocs::emit_copy_reloc): Refactor.
3247         (Copy_relocs::make_copy_reloc): New function.
3248         (Copy_relocs::add_copy_reloc): Remove.
3249         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3250         section.
3251         (Copy_relocs::make_copy_reloc): New function.
3252         (Copy_relocs::add_copy_reloc): Remove.
3253         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3254         unchanged input files.
3255         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3256         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3257         Reserve BSS space for COPY relocations.
3258         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3259         (Output_section_incremental_inputs::write_info_blocks): Record
3260         whether a symbol is copied from a shared object.
3261         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3262         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3263         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3264         (Incremental_input_entry_reader::get_output_symbol_index): Add
3265         is_copy parameter.
3266         (Incremental_binary::emit_copy_relocs): New function.
3267         (Incremental_binary::do_emit_copy_relocs): New function.
3268         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3269         new data member.
3270         (Sized_incremental_binary::add_copy_reloc): New function.
3271         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3272         (Sized_incremental_binary::Copy_reloc): New struct.
3273         (Sized_incremental_binary::Copy_relocs): New typedef.
3274         (Sized_incremental_binary::copy_relocs_): New data member.
3275         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3276         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3277         * target.h (Sized_target::emit_copy_reloc): New function.
3278         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3279
3280 2011-06-02  Cary Coutant  <ccoutant@google.com>
3281
3282         PR gold/12163
3283         * gold/archive.cc (Archive::Archive): Initialize new data member.
3284         (Archive::include_all_members): Return if archive has already been
3285         included.
3286         * gold/archive.h (Archive::include_all_members_): New data member.
3287
3288 2011-06-02  Nick Clifton  <nickc@redhat.com>
3289
3290         * dynobj.h: Fix spelling mistake in comment.
3291         * output.cc: Likewise.
3292
3293 2011-05-31  Doug Kwan  <dougkwan@google.com>
3294             Asier Llano
3295
3296         PR gold/12826
3297         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3298         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3299         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3300         redundant arm_exidx_test.so.
3301         * testsuite/Makefile.in: Regenerate.
3302         (check_SCRIPTS): Add pr12826.sh
3303         (check_DATA): Add pr12826.stdout
3304         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3305         * testsuite/pr12826.sh: New file.
3306         * testsuite/pr12826_1.s: Ditto.
3307         * testsuite/pr12826_1.s: Ditto.
3308
3309 2011-05-30  Ian Lance Taylor  <iant@google.com>
3310
3311         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3312         sections.
3313
3314 2011-05-29  Ian Lance Taylor  <iant@google.com>
3315
3316         PR gold/12804
3317         * testsuite/Makefile.am: Use different file name for two_file_test
3318         temporary file for each incremental test.
3319         * testsuite/Makefile.in: Rebuild.
3320
3321 2011-05-29  Ian Lance Taylor  <iant@google.com>
3322
3323         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3324         binary input file is empty.
3325
3326 2011-05-27  Ian Lance Taylor  <iant@google.com>
3327
3328         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3329         (ver_test_9.so): Likewise.
3330         * testsuite/Makefile.in: Rebuild.
3331
3332 2011-05-26 Cary Coutant  <ccoutant@google.com>
3333
3334         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3335         * incremental.cc (Incremental_inputs::report_input_section): Fix
3336         comment, indentation.
3337         (Incremental_inputs::report_comdat_group): New function.
3338         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3339         of data for incremental input file entry.
3340         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3341         group count, COMDAT group signatures.
3342         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3343         an unchanged input file.
3344         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3345         Initialize new data member.
3346         (Incremental_object_entry::add_comdat_group): New function.
3347         (Incremental_object_entry::get_comdat_group_count): New function.
3348         (Incremental_object_entry::get_comdat_signature_key): New function.
3349         (Incremental_object_entry::groups_): New data member.
3350         (Incremental_inputs::report_comdat_group): New function.
3351         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3352         data for incremental input file entry.
3353         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3354         (Incremental_input_entry_reader::get_input_section): Adjust size of
3355         data for incremental input file entry.
3356         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3357         (Incremental_input_entry_reader::get_comdat_group_signature): New
3358         function.
3359         * object.cc (Sized_relobj::include_section_group): Report kept
3360         COMDAT groups for incremental links.
3361
3362 2011-05-24  David Meyer  <pdox@google.com>
3363
3364         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3365         with name parameter.  Add found_name parameter.
3366         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3367         * dirsearch.h (class Dirsearch): Update declaration.
3368
3369 2011-05-24  Ian Lance Taylor  <iant@google.com>
3370
3371         * archive.cc (Library_base::should_include_member): Pull in object
3372         from archive if it defines the entry symbol.
3373         * parameters.cc (Parameters::entry): New function.
3374         * parameters.h (class Parameters): Declare entry.
3375         * output.h (class Output_file_header): Remove entry_ field.
3376         * output.cc (Output_file_header::Output_file_header): Remove entry
3377         parameter.  Change all callers.
3378         (Output_file_header::entry): Use parameters->entry.
3379         * gold.cc (queue_middle_tasks): Likewise.
3380         * plugin.cc (Plugin_hook::run): Likewise.
3381
3382 2011-05-24 Cary Coutant  <ccoutant@google.com>
3383
3384         * gold.cc (queue_initial_tasks): Pass incremental base filename
3385         to Output_file::open_base_file; don't print error message.
3386         * incremental-dump.cc (main): Adjust call to
3387         Output_file::open_for_modification.
3388         * incremental-dump.cc (main): Likewise.
3389         * incremental.cc (Incremental_inputs::report_command_line):
3390         Ignore --incremental-base option when comparing command lines.
3391         Ignore parameter when given as separate argument.
3392         * options.h (class General_options): Add --incremental-base.
3393         * output.cc (Output_file::Output_file):
3394         (Output_file::open_base_file): Add base_name and writable parameters;
3395         read base file into new file; print error message here.
3396         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3397         callers.
3398         * output.h (Output_file::open_for_modification): Rename to...
3399         (Output_file::open_base_file): ...this; add base_name and
3400         writable parameters; adjust all callers.
3401         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3402         callers.
3403         * testsuite/Makefile.am (incremental_test_4): Test
3404         --incremental-base.
3405         * testsuite/Makefile.in: Regenerate.
3406
3407 2011-05-24 Cary Coutant  <ccoutant@google.com>
3408
3409         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3410         incremental_test_4.
3411         * testsuite/Makefile.in: Regenerate.
3412         * testsuite/two_file_test_1_v1.cc: New test source file.
3413         * testsuite/two_file_test_1b_v1.cc: New test source file.
3414         * testsuite/two_file_test_2_v1.cc: New test source file.
3415
3416 2011-05-24 Cary Coutant  <ccoutant@google.com>
3417
3418         * dynobj.h (Dynobj::do_dynobj): New function.
3419         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3420         flag and soname for shared objects.
3421         * incremental.cc (Incremental_inputs::report_object): Make
3422         either Incremental_object_entry or Incremental_dynobj_entry; add
3423         soname to string table.
3424         (Incremental_inputs::report_input_section): Add assertion.
3425         (Output_section_incremental_inputs::set_final_data_size): Adjust
3426         type of input file entry for shared libraries; adjust size of
3427         shared library info entry.
3428         (Output_section_incremental_inputs::write_input_files): Write
3429         as_needed flag for shared libraries.
3430         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3431         of input file entry for shared libraries; write soname.
3432         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3433         soname from incremental info.
3434         * incremental.h (enum Incremental_input_flags): Add
3435         INCREMENTAL_INPUT_AS_NEEDED.
3436         (Incremental_input_entry::Incremental_input_entry): Initialize new
3437         data member.
3438         (Incremental_input_entry::set_as_needed): New function.
3439         (Incremental_input_entry::as_needed): New function.
3440         (Incremental_input_entry::do_dynobj_entry): New function.
3441         (Incremental_input_entry::as_needed_): New data member.
3442         (Incremental_object_entry::Incremental_object_entry): Don't check
3443         for shared library.
3444         (Incremental_object_entry::do_type): Likewise.
3445         (class Incremental_dynobj_entry): New class.
3446         (Incremental_input_entry_reader::as_needed): New function.
3447         (Incremental_input_entry_reader::get_soname): New function.
3448         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3449         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3450         size of shared library info entry.
3451         * layout.cc (Layout::finish_dynamic_section): Don't test for
3452         incremental link when adding DT_NEEDED entries.
3453         * object.h (Object::Object): Initialize new data member.
3454         (Object::dynobj): New function.
3455         (Object::set_as_needed): New function.
3456         (Object::as_needed): New function.
3457         (Object::do_dynobj): New function.
3458         (Object::as_needed_): New data member.
3459
3460 2011-05-24 Cary Coutant  <ccoutant@google.com>
3461
3462         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3463         info; adjust display of GOT entries.
3464         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3465         vector of input objects; remove file_status_.
3466         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3467         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3468         got_plt reader; call target hooks to reserve GOT entries.
3469         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3470         of input file info header and GOT info entry.
3471         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3472         relocation info.
3473         (Got_plt_view_info::got_descriptor): Remove.
3474         (Got_plt_view_info::sym_index): New data member.
3475         (Got_plt_view_info::input_index): New data member.
3476         (Local_got_offset_visitor::visit): Write input file index.
3477         (Global_got_offset_visitor::visit): Write 0 for input file index.
3478         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3479         with sym_index and input_index.
3480         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3481         incremental info GOT entry; replace got_descriptor with input_index.
3482         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3483         map from input file index to object.
3484         (Sized_relobj_incr::do_layout): Replace direct data member reference
3485         with accessor function.
3486         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3487         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3488         Adjust size of input file info header.
3489         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3490         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3491         (Incremental_input_entry_reader::get_input_section): Adjust size of
3492         input file info header.
3493         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3494         of incremental info GOT entry.
3495         (Incremental_got_plt_reader::get_got_desc): Remove.
3496         (Incremental_got_plt_reader::get_got_symndx): New function.
3497         (Incremental_got_plt_reader::get_got_input_index): New function.
3498         (Sized_incremental_binary::Sized_incremental_binary): Remove
3499         file_status_; add input_objects_.
3500         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3501         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3502         (Sized_incremental_binary::file_is_unchanged): Remove.
3503         (Sized_incremental_binary::set_input_object): New function.
3504         (Sized_incremental_binary::input_object): New function.
3505         (Sized_incremental_binary::file_status_): Remove.
3506         (Sized_incremental_binary::input_objects_): New data member.
3507         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3508         references.
3509         (Sized_relobj_incr::invalid_address): Move to base class.
3510         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3511         class.
3512         (Sized_relobj_incr::do_output_section_offset): Likewise.
3513         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3514         (Sized_relobj_incr::section_offsets_): Likewise.
3515         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3516         function.
3517         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3518         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3519         with accessor function.
3520         (Sized_relobj_file::do_layout): Likewise.
3521         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3522         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3523         (Sized_relobj_file::compute_final_local_value): Replace refs to
3524         section_offsets_ with accessor function.
3525         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3526         * object.h (Relobj::Relobj): Initialize new data members.
3527         (Relobj::add_dyn_reloc): New function.
3528         (Relobj::first_dyn_reloc): New function.
3529         (Relobj::dyn_reloc_count): New function.
3530         (Relobj::first_dyn_reloc_): New data member.
3531         (Relobj::dyn_reloc_count_): New data member.
3532         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3533         references.
3534         (Sized_relobj::Address): New typedef.
3535         (Sized_relobj::invalid_address): Move here from child class.
3536         (Sized_relobj::Sized_relobj): Initialize new data members.
3537         (Sized_relobj::sized_relobj): New function.
3538         (Sized_relobj::is_output_section_offset_invalid): Move here from
3539         child class.
3540         (Sized_relobj::get_output_section_offset): Likewise.
3541         (Sized_relobj::local_has_got_offset): Likewise.
3542         (Sized_relobj::local_got_offset): Likewise.
3543         (Sized_relobj::set_local_got_offset): Likewise.
3544         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3545         (Sized_relobj::clear_got_offsets): New function.
3546         (Sized_relobj::section_offsets): Move here from child class.
3547         (Sized_relobj::do_output_section_offset): Likewise.
3548         (Sized_relobj::do_set_section_offset): Likewise.
3549         (Sized_relobj::Local_got_offsets): Likewise.
3550         (Sized_relobj::local_got_offsets_): Likewise.
3551         (Sized_relobj::section_offsets_): Likewise.
3552         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3553         references.
3554         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3555         class.
3556         (Sized_relobj_file::sized_relobj): New function
3557         (Sized_relobj_file::local_has_got_offset): Move to base class.
3558         (Sized_relobj_file::local_got_offset): Likewise.
3559         (Sized_relobj_file::set_local_got_offset): Likewise.
3560         (Sized_relobj_file::get_output_section_offset): Likewise.
3561         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3562         (Sized_relobj_file::do_output_section_offset): Likewise.
3563         (Sized_relobj_file::do_set_section_offset): Likewise.
3564         (Sized_relobj_file::Local_got_offsets): Likewise.
3565         (Sized_relobj_file::local_got_offsets_): Likewise.
3566         (Sized_relobj_file::section_offsets_): Likewise.
3567         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3568         (all constructors).
3569         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3570         (Output_reloc::get_symbol_index): Likewise.
3571         (Output_reloc::local_section_offset): Likewise.
3572         (Output_reloc::get_address): Likewise.
3573         (Output_reloc::symbol_value): Likewise.
3574         (Output_data_got::reserve_slot): Move to class definition.
3575         (Output_data_got::reserve_local): New function.
3576         (Output_data_got::reserve_slot_for_global): Remove.
3577         (Output_data_got::reserve_global): New function.
3578         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3579         (all constructors, two instantiations).
3580         (Output_reloc::get_relobj): New function (two instantiations).
3581         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3582         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3583         (Output_data_reloc::add_global): Adjust type of relobj.
3584         (Output_data_reloc::add_global_relative): Likewise.
3585         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3586         (Output_data_reloc::add_local): Likewise.
3587         (Output_data_reloc::add_local_relative): Likewise.
3588         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3589         (Output_data_reloc::add_local_section): Likewise.
3590         (Output_data_reloc::add_output_section): Likewise.
3591         (Output_data_reloc::add_absolute): Likewise.
3592         (Output_data_reloc::add_target_specific): Likewise.
3593         (Output_data_got::reserve_slot): Move definition here.
3594         (Output_data_got::reserve_local): New function.
3595         (Output_data_got::reserve_global): New function.
3596         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3597         section_offsets_ with accessor function.
3598         (Sized_relobj_file::write_sections): Likewise.
3599         (Sized_relobj_file::do_relocate_sections): Likewise.
3600         * target.h (Sized_target::reserve_local_got_entry): New function.
3601         (Sized_target::reserve_global_got_entry): New function.
3602         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3603         (Target_x86_64::reserve_global_got_entry): New function.
3604         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3605
3606 2011-05-23 Cary Coutant  <ccoutant@google.com>
3607
3608         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3609         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3610         bit when checking got_type.
3611         * incremental.cc (Sized_incremental_binary::setup_readers):
3612         Store symbol table and string table locations; initialize bit vector
3613         of file status flags.
3614         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3615         unchanged files.
3616         (Sized_incremental_binary::do_process_got_plt): New function.
3617         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3618         (Output_section_incremental_inputs::set_final_data_size): Record
3619         file index for each input file.
3620         (Output_section_incremental_inputs::write_got_plt): Store file index
3621         instead of input entry offset for each GOT entry.
3622         * incremental.h
3623         (Incremental_input_entry::Incremental_input_entry): Initialize new
3624         data member.
3625         (Incremental_input_entry::set_offset): Store file index.
3626         (Incremental_input_entry::get_file_index): New function.
3627         (Incremental_input_entry::file_index_): New data member.
3628         (Incremental_binary::process_got_plt): New function.
3629         (Incremental_binary::do_process_got_plt): New function.
3630         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3631         data members.
3632         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3633         (Sized_incremental_binary::set_file_is_unchanged): New function.
3634         (Sized_incremental_binary::file_is_unchanged): New function.
3635         (Sized_incremental_binary::do_process_got_plt): New function.
3636         (Sized_incremental_binary::file_status_): New data member.
3637         (Sized_incremental_binary::main_symtab_loc_): New data member.
3638         (Sized_incremental_binary::main_strtab_loc_): New data member.
3639         * output.cc (Output_data_got::Got_entry::write): Add case
3640         RESERVED_CODE.
3641         (Output_data_got::add_global): Call add_got_entry.
3642         (Output_data_got::add_global_plt): Likewise.
3643         (Output_data_got::add_global_with_rel): Likewise.
3644         (Output_data_got::add_global_with_rela): Likewise.
3645         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3646         (Output_data_got::add_global_pair_with_rela): Likewise.
3647         (Output_data_got::add_local): Call add_got_entry.
3648         (Output_data_got::add_local_plt): Likewise.
3649         (Output_data_got::add_local_with_rel): Likewise.
3650         (Output_data_got::add_local_with_rela): Likewise.
3651         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3652         (Output_data_got::add_local_pair_with_rela): Likewise.
3653         (Output_data_got::reserve_slot): New function.
3654         (Output_data_got::reserve_slot_for_global): New function.
3655         (Output_data_got::add_got_entry): New function.
3656         (Output_data_got::add_got_entry_pair): New function.
3657         (Output_section::add_output_section_data): Edit FIXME.
3658         * output.h
3659         (Output_section_data_build::Output_section_data_build): New
3660         constructor with size parameter.
3661         (Output_data_space::Output_data_space): Likewise.
3662         (Output_data_got::Output_data_got): Initialize new data member; new
3663         constructor with size parameter.
3664         (Output_data_got::add_constant): Call add_got_entry.
3665         (Output_data_got::reserve_slot): New function.
3666         (Output_data_got::reserve_slot_for_global): New function.
3667         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3668         (Output_data_got::add_got_entry): New function.
3669         (Output_data_got::add_got_entry_pair): New function.
3670         (Output_data_got::free_list_): New data member.
3671         * target.h (Sized_target::init_got_plt_for_update): New function.
3672         (Sized_target::register_global_plt_entry): New function.
3673         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3674         Initialize new data member; call init; add constructor with PLT count.
3675         (Output_data_plt_x86_64::init): New function.
3676         (Output_data_plt_x86_64::add_relocation): New function.
3677         (Output_data_plt_x86_64::reserve_slot): New function.
3678         (Output_data_plt_x86_64::free_list_): New data member.
3679         (Target_x86_64::init_got_plt_for_update): New function.
3680         (Target_x86_64::register_global_plt_entry): New function.
3681         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3682         incremental updates.
3683         (Output_data_plt_x86_64::add_relocation): New function.
3684         * testsuite/object_unittest.cc (Object_test): Set default options.
3685
3686 2011-05-16  Ian Lance Taylor  <iant@google.com>
3687
3688         * options.h (class General_options): Make -i a synonym for -r.
3689
3690 2011-05-16  Ian Lance Taylor  <iant@google.com>
3691
3692         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3693
3694 2011-05-10 Cary Coutant  <ccoutant@google.com>
3695
3696         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3697         strip_all (-s).
3698
3699 2011-05-06  Ian Lance Taylor  <iant@google.com>
3700
3701         * layout.cc (Layout::layout): If the output section flags change,
3702         update the ordering.
3703
3704 2011-04-25 Cary Coutant  <ccoutant@google.com>
3705
3706         * incremental-dump.cc (dump_incremental_inputs): Print local
3707         symbol info for each input file.
3708         * incremental.cc
3709         (Output_section_incremental_inputs::set_final_data_size): Add local
3710         symbol info to input file entries in incremental info.
3711         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3712         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3713         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3714         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3715         implementation.
3716         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3717         (Sized_incr_relobj::do_relocate): Write the local symbols.
3718         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3719         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3720         Adjust size of input file header.
3721         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3722         (Incremental_inputs_reader::get_local_symbol_count): New function.
3723         (Incremental_inputs_reader::get_input_section): Adjust size of input
3724         file header.
3725         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3726         (Sized_incr_relobj::This): New typedef.
3727         (Sized_incr_relobj::sym_size): New const data member.
3728         (Sized_incr_relobj::Local_symbol): New struct.
3729         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3730         (Sized_incr_relobj::do_local_symbol_offset): New function.
3731         (Sized_incr_relobj::local_symbol_count_): New data member.
3732         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3733         (Sized_incr_relobj::local_symbol_index_): New data member.
3734         (Sized_incr_relobj::local_symbol_offset_): New data member.
3735         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3736         (Sized_incr_relobj::local_symbols_): New data member.
3737         * object.h (Relobj::output_local_symbol_count): New function.
3738         (Relobj::local_symbol_offset): New function.
3739         (Relobj::do_output_local_symbol_count): New function.
3740         (Relobj::do_local_symbol_offset): New function.
3741         (Sized_relobj::do_output_local_symbol_count): New function.
3742         (Sized_relobj::do_local_symbol_offset): New function.
3743
3744 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3745
3746         * descriptors.cc (set_close_on_exec): New function.
3747         (Descriptors::open): Use set_close_on_exec.
3748         * output.cc (S_ISLNK): Define if not defined.
3749
3750 2011-04-22 Cary Coutant  <ccoutant@google.com>
3751
3752         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3753         global symbol map.
3754         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3755         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3756         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3757         relocations.
3758         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3759         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3760         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3761         * incremental.h
3762         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3763         function.
3764         (Incremental_binary::apply_incremental_relocs): New function.
3765         (Incremental_binary::do_apply_incremental_relocs): New function.
3766         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3767         data member.
3768         (Sized_incremental_binary::add_global_symbol): New function.
3769         (Sized_incremental_binary::global_symbol): New function.
3770         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3771         (Sized_incremental_binary::symbol_map_): New data member.
3772         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3773         * target.h (Sized_target::apply_relocation): New function.
3774         * target-reloc.h (apply_relocation): New function.
3775         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3776
3777 2011-04-22  Doug Kwan  <dougkwan@google.com>
3778
3779         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3780         flag of a SHT_ARM_EXIDX section.
3781         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3782         * testsuite/Makefile.in: Regenerate.
3783         * testsuite/arm_exidx_test.s: New file.
3784         * testsuite/arm_exidx_test.sh: Same.
3785
3786 2011-04-20 Cary Coutant  <ccoutant@google.com>
3787
3788         PR gold/12689
3789         * archive.h (Incremental_archive_entry::Archive_member):
3790         Initialize arg_serial_ (second constructor).
3791
3792 2011-04-17  Ian Lance Taylor  <iant@google.com>
3793
3794         * object.cc (Relocate_info::location): Simplify location string.
3795         * errors.cc (Errors::error_at_location): Don't print program
3796         name.
3797         (Errors::warning_at_location): Likewise.
3798         (Errors::undefined_symbol): Likewise.
3799         * testsuite/debug_msg.sh: Update accordingly.
3800
3801 2011-04-14 Cary Coutant  <ccoutant@google.com>
3802
3803         * gold/layout.cc (Layout::symtab_section_offset): New function.
3804         * gold/layout.h (Layout::symtab_section_offset): New function.
3805         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3806
3807 2011-04-12  Ian Lance Taylor  <iant@google.com>
3808
3809         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3810         with MREMAP_MAYMOVE.
3811         * output.h (class Output_file): Add map_is_allocated_ field.
3812         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3813         not available, provide stubs.  If mremap is not available, #define
3814         it to gold_mremap.
3815         (MREMAP_MAYMOVE): Define if not defined.
3816         (Output_file::Output_file): Initialize map_is_allocated_.
3817         (Output_file::resize): Check map_is_allocated_.
3818         (Output_file::map_anonymous): If mmap fails, use malloc.
3819         (Output_file::unmap): Don't do anything for an anonymous map.
3820         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3821         is not available, provide stubs.
3822         (File_read::View::~View): Use free rather than delete[].
3823         (File_read::make_view): Use malloc rather than new[].  If mmap
3824         fails, use malloc.
3825         (File_read::find_or_make_view): Use malloc rather than new[].
3826         * gold.h: Remove HAVE_REMAP code.
3827         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3828         exists.  Rename mremap to gold_mremap.  If mmap is not available
3829         don't do anything.
3830         * configure, config.in: Rebuild.
3831
3832 2011-04-11  Ian Lance Taylor  <iant@google.com>
3833
3834         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3835         initialize local variable v.
3836
3837 2011-04-11  Cary Coutant  <ccoutant@google.com>
3838
3839         * archive.cc (Archive::include_member): Adjust call to
3840         report_object.
3841         (Add_archive_symbols::run): Track argument serial numbers.
3842         (Lib_group::include_member): Likewise.
3843         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3844         * archive.h (Incremental_archive_entry::Archive_member):
3845         Initialize arg_serial_.
3846         (Archive_member::arg_serial_): New data member.
3847         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3848         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3849         incremental link.
3850         (Sized_dynobj::do_for_all_local_got_entries): New function.
3851         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3852         function.
3853         * fileread.cc (get_mtime): New function.
3854         * fileread.h (get_mtime): New function.
3855         * gold.cc (queue_initial_tasks): Check for incremental update.
3856         (process_incremental_input): New function.
3857         (queue_middle_tasks): Don't force valid target for incremental
3858         update.
3859         * incremental-dump.cc (find_input_containing_global): Adjust
3860         size of symbol info entry.
3861         (dump_incremental_inputs): Dump argument serial number and
3862         in_system_directory flag; bias shndx by 1; print symbol names
3863         when dumping per-file symbol lists; use new symbol info readers.
3864         * incremental.cc
3865         (Output_section_incremental_inputs:update_data_size): New function.
3866         (Sized_incremental_binary::setup_readers): Setup input readers
3867         for each input file; build maps for files added from libraries
3868         and scripts.
3869         (Sized_incremental_binary::check_input_args): New function.
3870         (Sized_incremental_binary::do_check_inputs): Build map of argument
3871         serial numbers to input arguments.
3872         (Sized_incremental_binary::do_file_has_changed): Rename
3873         do_file_is_unchanged to this; compare file modification times.
3874         (Sized_incremental_binary::do_init_layout): New function.
3875         (Sized_incremental_binary::do_reserve_layout): New function.
3876         (Sized_incremental_binary::do_get_input_reader): Remove.
3877         (Sized_incremental_binary::get_symtab_view): New function.
3878         (Incremental_checker::can_incrementally_link_output_file): Remove.
3879         (Incremental_inputs::report_command_line): Exclude --debug options.
3880         (Incremental_inputs::report_archive_begin): Add parameter; track
3881         argument serial numbers; don't put input file entry for archive
3882         before archive members.
3883         (Incremental_inputs::report_archive_end): Put input file entry
3884         for archive after archive members.
3885         (Incremental_inputs::report_object): Add parameter; track argument
3886         serial numbers and in_system_directory flag.
3887         (Incremental_inputs::report_script): Add parameter; track argument
3888         serial numbers.
3889         (Output_section_incremental_inputs::set_final_data_size): Adjust
3890         size of symbol info entry; check for forwarding symbols.
3891         (Output_section_incremental_inputs::write_input_files): Write
3892         in_system_directory flag and argument serial number.
3893         (Output_section_incremental_inputs::write_info_blocks): Map section
3894         indices between incremental info and original input file; store
3895         input section index for each symbol.
3896         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3897         change operator() to visit().
3898         (class Global_got_offset_visitor): Likewise.
3899         (class Global_symbol_visitor_got_plt):
3900         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3901         classes.
3902         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3903         (Sized_incr_relobj::do_read_symbols): New function.
3904         (Sized_incr_relobj::do_layout): New function.
3905         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3906         (Sized_incr_relobj::do_add_symbols): New function.
3907         (Sized_incr_relobj::do_should_include_member): New function.
3908         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3909         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3910         (Sized_incr_relobj::do_section_size): New function.
3911         (Sized_incr_relobj::do_section_name): New function.
3912         (Sized_incr_relobj::do_section_contents): New function.
3913         (Sized_incr_relobj::do_section_flags): New function.
3914         (Sized_incr_relobj::do_section_entsize): New function.
3915         (Sized_incr_relobj::do_section_address): New function.
3916         (Sized_incr_relobj::do_section_type): New function.
3917         (Sized_incr_relobj::do_section_link): New function.
3918         (Sized_incr_relobj::do_section_info): New function.
3919         (Sized_incr_relobj::do_section_addralign): New function.
3920         (Sized_incr_relobj::do_initialize_xindex): New function.
3921         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3922         (Sized_incr_relobj::do_read_relocs): New function.
3923         (Sized_incr_relobj::do_gc_process_relocs): New function.
3924         (Sized_incr_relobj::do_scan_relocs): New function.
3925         (Sized_incr_relobj::do_count_local_symbols): New function.
3926         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3927         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3928         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3929         (Sized_incr_relobj::do_relocate): New function.
3930         (Sized_incr_relobj::do_set_section_offset): New function.
3931         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3932         (Sized_incr_dynobj::do_read_symbols): New function.
3933         (Sized_incr_dynobj::do_layout): New function.
3934         (Sized_incr_dynobj::do_add_symbols): New function.
3935         (Sized_incr_dynobj::do_should_include_member): New function.
3936         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3937         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3938         (Sized_incr_dynobj::do_section_size): New function.
3939         (Sized_incr_dynobj::do_section_name): New function.
3940         (Sized_incr_dynobj::do_section_contents): New function.
3941         (Sized_incr_dynobj::do_section_flags): New function.
3942         (Sized_incr_dynobj::do_section_entsize): New function.
3943         (Sized_incr_dynobj::do_section_address): New function.
3944         (Sized_incr_dynobj::do_section_type): New function.
3945         (Sized_incr_dynobj::do_section_link): New function.
3946         (Sized_incr_dynobj::do_section_info): New function.
3947         (Sized_incr_dynobj::do_section_addralign): New function.
3948         (Sized_incr_dynobj::do_initialize_xindex): New function.
3949         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3950         (make_sized_incremental_object): New function.
3951         (Incremental_library::copy_unused_symbols): New function.
3952         (Incremental_library::do_for_all_unused_symbols): New function.
3953         * incremental.h (enum Incremental_input_flags): New type.
3954         (class Incremental_checker): Remove.
3955         (Incremental_input_entry::Incremental_input_entry): Add argument
3956         serial number.
3957         (Incremental_input_entry::arg_serial): New function.
3958         (Incremental_input_entry::set_is_in_system_directory): New function.
3959         (Incremental_input_entry::is_in_system_directory): New function.
3960         (Incremental_input_entry::arg_serial_): New data member.
3961         (Incremental_input_entry::is_in_system_directory_): New data member.
3962         (class Script_info): Move here from script.h.
3963         (Script_info::Script_info): Add filename parameter.
3964         (Script_info::filename): New function.
3965         (Script_info::filename_): New data member.
3966         (Incremental_script_entry::Incremental_script_entry): Add argument
3967         serial number.
3968         (Incremental_object_entry::Incremental_object_entry): Likewise.
3969         (Incremental_object_entry::add_input_section): Build list of input
3970         sections with map to original shndx.
3971         (Incremental_object_entry::get_input_section_index): New function.
3972         (Incremental_object_entry::shndx_): New data member.
3973         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3974         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3975         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3976         serial number.
3977         (Incremental_inputs::report_archive_begin): Likewise.
3978         (Incremental_inputs::report_object): Likewise.
3979         (Incremental_inputs::report_script): Likewise.
3980         (class Incremental_global_symbol_reader): New class.
3981         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3982         and store flags and input file type.
3983         (Incremental_input_entry_reader::arg_serial): New function.
3984         (Incremental_input_entry_reader::type): Extract type from flags.
3985         (Incremental_input_entry_reader::is_in_system_directory): New function.
3986         (Incremental_input_entry_reader::get_input_section_count): Call
3987         accessor function for type.
3988         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3989         function for type; adjust size of global symbol entry.
3990         (Incremental_input_entry_reader::get_global_symbol_count): Call
3991         accessor function for type.
3992         (Incremental_input_entry_reader::get_object_count): Likewise.
3993         (Incremental_input_entry_reader::get_object_offset): Likewise.
3994         (Incremental_input_entry_reader::get_member_count): Likewise.
3995         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3996         (Incremental_input_entry_reader::get_member_offset): Likewise.
3997         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3998         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3999         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4000         (Incremental_input_entry_reader::get_global_symbol_reader): New
4001         function.
4002         (Incremental_input_entry_reader::get_output_symbol_index): New
4003         function.
4004         (Incremental_input_entry_reader::type_): Remove.
4005         (Incremental_input_entry_reader::flags_): New data member.
4006         (Incremental_inputs_reader::input_file_offset): New function.
4007         (Incremental_inputs_reader::input_file_index): New function.
4008         (Incremental_inputs_reader::input_file): Call input_file_offset.
4009         (Incremental_inputs_reader::input_file_at_offset): New function.
4010         (Incremental_relocs_reader::get_r_type): Reformat.
4011         (Incremental_relocs_reader::get_r_shndx): Reformat.
4012         (Incremental_relocs_reader::get_r_offset): Reformat.
4013         (Incremental_relocs_reader::data): New function.
4014         (Incremental_binary::Incremental_binary): Initialize new data members.
4015         (Incremental_binary::check_inputs): Add cmdline parameter.
4016         (Incremental_binary::file_is_unchanged): Remove.
4017         (Input_reader::arg_serial): New function.
4018         (Input_reader::get_unused_symbol_count): New function.
4019         (Input_reader::get_unused_symbol): New function.
4020         (Input_reader::do_arg_serial): New function.
4021         (Input_reader::do_get_unused_symbol_count): New function.
4022         (Input_reader::do_get_unused_symbol): New function.
4023         (Incremental_binary::input_file_count): New function.
4024         (Incremental_binary::get_input_reader): Change signature to use
4025         index instead of filename.
4026         (Incremental_binary::file_has_changed): New function.
4027         (Incremental_binary::get_input_argument): New function.
4028         (Incremental_binary::get_library): New function.
4029         (Incremental_binary::get_script_info): New function.
4030         (Incremental_binary::init_layout): New function.
4031         (Incremental_binary::reserve_layout): New function.
4032         (Incremental_binary::output_file): New function.
4033         (Incremental_binary::do_check_inputs): New function.
4034         (Incremental_binary::do_file_is_unchanged): Remove.
4035         (Incremental_binary::do_file_has_changed): New function.
4036         (Incremental_binary::do_init_layout): New function.
4037         (Incremental_binary::do_reserve_layout): New function.
4038         (Incremental_binary::do_input_file_count): New function.
4039         (Incremental_binary::do_get_input_reader): Change signature.
4040         (Incremental_binary::input_args_map_): New data member.
4041         (Incremental_binary::library_map_): New data member.
4042         (Incremental_binary::script_map_): New data member.
4043         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4044         new data members.
4045         (Sized_incremental_binary::output_section): New function.
4046         (Sized_incremental_binary::inputs_reader): Add const.
4047         (Sized_incremental_binary::symtab_reader): Add const.
4048         (Sized_incremental_binary::relocs_reader): Add const.
4049         (Sized_incremental_binary::got_plt_reader): Add const.
4050         (Sized_incremental_binary::get_symtab_view): New function.
4051         (Sized_incremental_binary::Inputs_reader): New typedef.
4052         (Sized_incremental_binary::Input_entry_reader): New typedef.
4053         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4054         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4055         (Sized_incremental_binary::do_file_has_changed): New function.
4056         (Sized_incremental_binary::do_init_layout): New function.
4057         (Sized_incremental_binary::do_reserve_layout): New function.
4058         (Sized_input_reader::Inputs_reader): Remove.
4059         (Sized_input_reader::Input_entry_reader): Remove.
4060         (Sized_input_reader::do_arg_serial): New function.
4061         (Sized_input_reader::do_get_unused_symbol_count): New function.
4062         (Sized_input_reader::do_get_unused_symbol): New function.
4063         (Sized_incremental_binary::do_input_file_count): New function.
4064         (Sized_incremental_binary::do_get_input_reader): Change signature;
4065         use index instead of filename.
4066         (Sized_incremental_binary::section_map_): New data member.
4067         (Sized_incremental_binary::input_entry_readers_): New data member.
4068         (class Sized_incr_relobj): New class.
4069         (class Sized_incr_dynobj): New class.
4070         (make_sized_incremental_object): New function.
4071         (class Incremental_library): New class.
4072         * layout.cc (Free_list::num_lists): New static data member.
4073         (Free_list::num_nodes): New static data member.
4074         (Free_list::num_removes): New static data member.
4075         (Free_list::num_remove_visits): New static data member.
4076         (Free_list::num_allocates): New static data member.
4077         (Free_list::num_allocate_visits): New static data member.
4078         (Free_list::init): New function.
4079         (Free_list::remove): New function.
4080         (Free_list::allocate): New function.
4081         (Free_list::dump): New function.
4082         (Free_list::print_stats): New function.
4083         (Layout_task_runner::run): Resize output file for incremental updates.
4084         (Layout::Layout): Initialize new data members.
4085         (Layout::set_incremental_base): New function.
4086         (Layout::init_fixed_output_section): New function.
4087         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4088         incremental updates.
4089         (Layout::create_gold_note): Do not create gold note section for
4090         incremental updates.
4091         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4092         for incremental updates.
4093         (Layout::set_section_offsets): For incremental updates, allocate space
4094         from free list.
4095         (Layout::create_symtab_sections): Layout with offsets relative to
4096         start of section; for incremental updates, allocate space from free
4097         list.
4098         (Layout::create_shdrs): For incremental updates, allocate space from
4099         free list.
4100         (Layout::finish_dynamic_section): For incremental updates, do not
4101         check --as-needed (fixed in subsequent patch).
4102         * layout.h (class Free_list): New class.
4103         (Layout::set_incremental_base): New function.
4104         (Layout::incremental_base): New function.
4105         (Layout::init_fixed_output_section): New function.
4106         (Layout::allocate): New function.
4107         (Layout::incremental_base_): New data member.
4108         (Layout::free_list_): New data member.
4109         * main.cc (main): Print Free_list statistics.
4110         * object.cc (Relobj::finalize_incremental_relocs): Add
4111         clear_counts parameter; clear counts only when clear_counts is set.
4112         (Sized_relobj::Sized_relobj): Initialize new base class.
4113         (Sized_relobj::do_layout): Don't report special sections.
4114         (Sized_relobj::do_for_all_local_got_entries): New function.
4115         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4116         symtab_off to all symbol table offsets.
4117         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4118         * object.h (class Got_offset_list): Move to top of file.
4119         (Object::Object): Allow case where input_file == NULL.
4120         (Object::~Object): Likewise.
4121         (Object::input_file): Assert that input_file != NULL.
4122         (Object::lock): Allow case where input_file == NULL.
4123         (Object::unlock): Likewise.
4124         (Object::is_locked): Likewise.
4125         (Object::token): Likewise.
4126         (Object::release): Likewise.
4127         (Object::is_incremental): New function.
4128         (Object::get_mtime): New function.
4129         (Object::for_all_local_got_entries): New function.
4130         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4131         (Object::set_is_in_system_directory): New function.
4132         (Object::is_in_system_directory): New function.
4133         (Object::do_is_incremental): New function.
4134         (Object::do_get_mtime): New function.
4135         (Object::do_for_all_local_got_entries): New function.
4136         (Object::is_in_system_directory_): New data member.
4137         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4138         (class Sized_relobj_base): New class.
4139         (class Sized_relobj): Derive from Sized_relobj_base.
4140         (class Sized_relobj::Symbols): Redeclare from base class.
4141         (class Sized_relobj::local_got_offset_list): Remove.
4142         (class Sized_relobj::Output_sections): Redeclare from base class.
4143         (class Sized_relobj::do_for_all_local_got_entries): New function.
4144         (class Sized_relobj::write_local_symbols): Add offset parameter.
4145         (class Sized_relobj::local_symbol_offset_): Update comment.
4146         (class Sized_relobj::local_dynsym_offset_): Update comment.
4147         * options.cc (Input_arguments::add_file): Remove const.
4148         * options.h (Input_file_argument::Input_file_argument):
4149         Initialize arg_serial_ (all constructors).
4150         (Input_file_argument::set_arg_serial): New function.
4151         (Input_file_argument::arg_serial): New function.
4152         (Input_file_argument::arg_serial_): New data member.
4153         (Input_arguments::Input_arguments): Initialize file_count_.
4154         (Input_arguments::add_file): Remove const.
4155         (Input_arguments::number_of_input_files): New function.
4156         (Input_arguments::file_count_): New data member.
4157         (Command_line::number_of_input_files): Call
4158         Input_arguments::number_of_input_files.
4159         * output.cc (Output_segment_headers::Output_segment_headers):
4160         Set current size.
4161         (Output_section::Input_section::current_data_size): New function.
4162         (Output_section::Output_section): Initialize new data members.
4163         (Output_section::add_input_section): Don't do merge sections for
4164         an incremental link; allocate space from free list for an
4165         incremental update.
4166         (Output_section::add_output_section_data): Allocate space from
4167         free list for an incremental update.
4168         (Output_section::update_data_size): New function.
4169         (Output_section::set_fixed_layout): New function.
4170         (Output_section::reserve): New function.
4171         (Output_segment::set_section_addresses): Remove const.
4172         (Output_segment::set_section_list_addresses): Remove const; allocate
4173         space from free list for an incremental update.
4174         (Output_segment::set_offset): Adjust size of RELRO segment for an
4175         incremental update.
4176         * output.h (Output_data::current_data_size): Move here from
4177         child classes.
4178         (Output_data::pre_finalize_data_size): New function.
4179         (Output_data::update_data_size): New function.
4180         (Output_section_headers::update_data_size): new function.
4181         (Output_section_data_build::current_data_size): Move to Output_data.
4182         (Output_data_strtab::update_data_size): New function.
4183         (Output_section::current_data_size): Move to Output_data.
4184         (Output_section::set_fixed_layout): New function.
4185         (Output_section::has_fixed_layout): New function.
4186         (Output_section::reserve): New function.
4187         (Output_section::update_data_size): New function.
4188         (Output_section::has_fixed_layout_): New data member.
4189         (Output_section::free_list_): New data member.
4190         (Output_segment::set_section_addresses): Remove const.
4191         (Output_segment::set_section_list_addresses): Remove const.
4192         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4193         New function.
4194         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4195         New function.
4196         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4197         parameter when calling Add_symbols constructor; store argument
4198         serial number for members of a lib group.
4199         (Add_symbols::locks): Allow case where token == NULL.
4200         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4201         (Read_member::~Read_member): New function.
4202         (Read_member::is_runnable): New function.
4203         (Read_member::locks): New function.
4204         (Read_member::run): New function.
4205         (Check_script::~Check_script): New function.
4206         (Check_script::is_runnable): New function.
4207         (Check_script::locks): New function.
4208         (Check_script::run): New function.
4209         (Check_library::~Check_library): New function.
4210         (Check_library::is_runnable): New function.
4211         (Check_library::locks): New function.
4212         (Check_library::run): New function.
4213         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4214         (Add_symbols::library_): New data member.
4215         (class Read_member): New class.
4216         (class Check_script): New class.
4217         (class Check_library): New class.
4218         * reloc.cc (Read_relocs::is_runnable): Allow case where
4219         token == NULL.
4220         (Read_relocs::locks): Likewise.
4221         (Scan_relocs::locks): Likewise.
4222         (Relocate_task::locks): Likewise.
4223         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4224         to clear counters.
4225         (Sized_relobj::incremental_relocs_scan): Fix comment.
4226         (Sized_relobj::do_relocate): Pass output file offset to
4227         write_local_symbols.
4228         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4229         from class declaration.
4230         * script.cc (read_input_script): Allocate Script_info; pass
4231         argument serial number to report_script.
4232         * script.h (class Script_info): Move to incremental.h.
4233         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4234         * symtab.h (Symbol_table::add_from_incrobj): New function.
4235         (Symbol_table::set_file_offset): New function.
4236
4237 2011-04-05  Cary Coutant  <ccoutant@google.com>
4238
4239         * incremental-dump.cc (dump_incremental_inputs): Change signature
4240         to take a Sized_incremental_binary; change caller.  Use readers
4241         in Sized_incremental_binary.
4242         * incremental.cc
4243         (Sized_incremental_binary::find_incremental_inputs_sections):
4244         Rename do_find_incremental_inputs_sections to this.
4245         (Sized_incremental_binary::setup_readers): New function.
4246         (Sized_incremental_binary::do_check_inputs): Check
4247         has_incremental_info_ flag; move setup code to setup_readers;
4248         use input readers.
4249         (Sized_incremental_binary::do_file_is_unchanged): New function.
4250         (Sized_incremental_binary::do_get_input_reader): New function.
4251         * incremental.h (class Incremental_binary): Move to end of file.
4252         (Incremental_binary::file_is_unchanged): New function.
4253         (Incremental_binary::do_file_is_unchanged): New function.
4254         (Incremental_binary::Input_reader): New class.
4255         (Incremental_binary::get_input_reader): New function.
4256         (class Sized_incremental_binary): Move to end of file.
4257         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4258         input section reader classes.
4259         (Sized_incremental_binary::has_incremental_info): New function.
4260         (Sized_incremental_binary::inputs_reader): New function.
4261         (Sized_incremental_binary::symtab_reader): New function.
4262         (Sized_incremental_binary::relocs_reader): New function.
4263         (Sized_incremental_binary::got_plt_reader): New function.
4264         (Sized_incremental_binary::do_file_is_unchanged): New function.
4265         (Sized_incremental_binary::Sized_input_reader): New class.
4266         (Sized_incremental_binary::get_input_reader): New function.
4267         (Sized_incremental_binary::find_incremental_inputs_sections):
4268         Rename do_find_incremental_inputs_sections to this.
4269         (Sized_incremental_binary::setup_readers): New function.
4270         (Sized_incremental_binary::has_incremental_info_): New data member.
4271         (Sized_incremental_binary::inputs_reader_): New data member.
4272         (Sized_incremental_binary::symtab_reader_): New data member.
4273         (Sized_incremental_binary::relocs_reader_): New data member.
4274         (Sized_incremental_binary::got_plt_reader_): New data member.
4275         (Sized_incremental_binary::current_input_file_): New data member.
4276
4277 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4278
4279         PR gold/12640
4280         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4281         violation.
4282
4283 2011-03-30  Cary Coutant  <ccoutant@google.com>
4284
4285         * archive.cc (Archive::include_member): Adjust call to report_object.
4286         (Add_archive_symbols::run): Add script_info to call to
4287         report_archive_begin.
4288         (Lib_group::include_member): Adjust call to report_object.
4289         (Add_lib_group_symbols::run): Adjust call to report_object.
4290         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4291         blocks.  Add object count for script input files.
4292         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4293         script_info parameter; change all callers.
4294         (Incremental_inputs::report_object): Add script_info parameter;
4295         change all callers.
4296         (Incremental_inputs::report_script): Store backpointer to
4297         incremental info entry.
4298         (Output_section_incremental_inputs::set_final_data_size): Record
4299         additional information for scripts.
4300         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4301         * incremental.h (Incremental_script_entry::add_object): New function.
4302         (Incremental_script_entry::get_object_count): New function.
4303         (Incremental_script_entry::get_object): New function.
4304         (Incremental_script_entry::objects_): New data member; adjust
4305         constructor.
4306         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4307         (Incremental_inputs::report_object): Add script_info parameter.
4308         (Incremental_inputs_reader::get_object_count): New function.
4309         (Incremental_inputs_reader::get_object_offset): New function.
4310         * options.cc (Input_arguments::add_file): Return reference to
4311         new input argument.
4312         * options.h (Input_argument::set_script_info): New function.
4313         (Input_argument::script_info): New function.
4314         (Input_argument::script_info_): New data member; adjust all
4315         constructors.
4316         (Input_file_group::add_file): Return reference to new input argument.
4317         (Input_file_lib::add_file): Likewise.
4318         (Input_arguments::add_file): Likewise.
4319         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4320         * script.cc (Parser_closure::Parser_closure): Add script_info
4321         parameter; adjust all callers.
4322         (Parser_closure::script_info): New function.
4323         (Parser_closure::script_info_): New data member.
4324         (read_input_script): Report scripts earlier to incremental info.
4325         (script_add_file): Set script_info in Input_argument.
4326         (script_add_library): Likewise.
4327         * script.h (Script_options::Script_info): Rewrite class.
4328
4329 2011-03-29  Cary Coutant  <ccoutant@google.com>
4330
4331         * archive.cc (Library_base::should_include_member): Move
4332         method here from class Archive.
4333         (Archive::Archive): Initialize base class.
4334         (Archive::should_include_member): Move to base class.
4335         (Archive::do_for_all_unused_symbols): New function.
4336         (Add_archive_symbols::run): Remove redundant access to
4337         incremental_inputs.
4338         (Lib_group::Lib_group): Initialize base class.
4339         (Lib_group::do_filename): New function.
4340         (Lib_group::include_member): Pass pointer to Lib_group to
4341         report_object.
4342         (Lib_group::do_for_all_unused_symbols): New function.
4343         (Add_lib_group_symbols::run): Report archive information for
4344         incremental links.
4345         * archive.h (class Library_base): New base class.
4346         (class Archive): Derive from Library_base.
4347         (Archive::filename): Move to base class.
4348         (Archive::set_incremental_info): Likewise.
4349         (Archive::incremental_info): Likewise.
4350         (Archive::Should_include): Likewise.
4351         (Archive::should_include_member): Likewise.
4352         (Archive::Armap_entry): Remove.
4353         (Archive::Unused_symbol_iterator): Remove.
4354         (Archive::unused_symbols_begin): Remove.
4355         (Archive::unused_symbols_end): Remove.
4356         (Archive::do_filename): New function.
4357         (Archive::do_get_mtime): New function.
4358         (Archive::do_for_all_unused_symbols): New function.
4359         (Archive::task_): Move to base class.
4360         (Archive::incremental_info_): Likewise.
4361         (class Lib_group): Derive from Library_base.
4362         (Lib_group::do_filename): New function.
4363         (Lib_group::do_get_mtime): New function.
4364         (Lib_group::do_for_all_unused_symbols): New function.
4365         (Lib_group::task_): Move to base class.
4366         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4367         function.
4368         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4369         function.
4370         * incremental.cc (Incremental_inputs::report_archive_begin):
4371         Use Library_base; call library's get_mtime; add incremental inputs
4372         entry before members.
4373         (class Unused_symbol_visitor): New class.
4374         (Incremental_inputs::report_archive_end): Use Library_base; use
4375         visitor class to record unused symbols; don't add incremental inputs
4376         entry after members.
4377         (Incremental_inputs::report_object): Use Library_base.
4378         * incremental.h
4379         (Incremental_archive_entry::Incremental_archive_entry): Remove
4380         unused Archive parameter.
4381         (Incremental_inputs::report_archive_begin): Use Library_base.
4382         (Incremental_inputs::report_archive_end): Likewise.
4383         (Incremental_inputs::report_object): Likewise.
4384         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4385         function.
4386         * object.h (Object::for_all_global_symbols): New function.
4387         (Object::do_for_all_global_symbols): New function.
4388         (Sized_relobj::do_for_all_global_symbols): New function.
4389         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4390         function.
4391         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4392         function.
4393
4394 2011-03-27  Ian Lance Taylor  <iant@google.com>
4395
4396         * archive.cc (Archive::interpret_header): Return -1 if something
4397         goes wrong.  Change callers accordingly.
4398
4399 2011-03-25  Cary Coutant  <ccoutant@google.com>
4400
4401         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4402         * testsuite/Makefile.in: Regenerate.
4403
4404 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4405
4406         * plugin.cc (get_view): New.
4407         (Plugin::load): Pass get_view to the plugin.
4408         (Plugin_manager::get_view): New.
4409
4410 2011-03-21  Ian Lance Taylor  <iant@google.com>
4411
4412         * testsuite/final_layout.sh: Rewrite to not use dc.
4413         * testsuite/relro_test.sh: Fail if dc is not present.
4414
4415 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4416
4417         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4418         Change == to -eq.
4419         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4420         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4421         Change == to -eq.
4422         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4423         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4424
4425 2011-03-14  Ian Lance Taylor  <iant@google.com>
4426
4427         * script-sections.cc (Sort_output_sections::script_compare):
4428         Rename from is_before, change return type.
4429         (Sort_output_sections::operator()): Adjust accordingly.
4430
4431 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4432
4433         PR gold/12572
4434         * testsuite/odr_violation2.cc: Add comment to make all error line
4435         numbers double digits.
4436         * testsuite/debug_msg.sh: Adjust expected errors.
4437
4438 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4439
4440         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4441         but mark earlier ones as non-canonical
4442         (offset_to_iterator): Update search target and example
4443         (do_addr2line): Return extra lines in a vector*
4444         (format_file_lineno): Extract from do_addr2line
4445         (one_addr2line): Add vector* out-param
4446         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4447         when a lineno entry appeared last for its instruction
4448         (Dwarf_line_info): Add vector* out-param
4449         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4450         * symtab.cc (Odr_violation_compare): Include the lineno in the
4451         comparison again.
4452         (linenos_from_loc): New. Combine the canonical line for an
4453         address with its other lines.
4454         (True_if_intersect): New. Helper functor to make
4455         std::set_intersection a query.
4456         (detect_odr_violations): Compare sets of lines instead of just
4457         one line for each function. This became less deterministic, but
4458         has fewer false positives.
4459         * symtab.h: Declarations.
4460         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4461         mix an optimized and non-optimized object in the same binary
4462         (odr_violation2.so): Same.
4463         * testsuite/Makefile.in: Regenerate from Makefile.am.
4464         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4465         * testsuite/debug_msg.sh: Update line numbers and add
4466         assertions.
4467         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4468         non-optimized context.
4469         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4470         isn't inlined, and use OdrDerived in an optimized context.
4471         * testsuite/odr_header1.h: Defines OdrDerived, where
4472         optimization will change the
4473         first-instruction-in-the-destructor's file and line number.
4474         * testsuite/odr_header2.h: Defines OdrBase.
4475
4476 2011-03-09  Ian Lance Taylor  <iant@google.com>
4477
4478         * fileread.cc (File_read::clear_views): Don't delete the whole
4479         file view.
4480
4481 2011-03-08  Ian Lance Taylor  <iant@google.com>
4482
4483         PR gold/12525
4484         * fileread.cc: #include <climits>.
4485         (GOLD_IOV_MAX): Define.
4486         (File_read::read_multiple): Limit number of entries by iov_max.
4487         * fileread.h (class File_read): Always set max_readv_entries to
4488         128.
4489
4490 2011-03-07  Ian Lance Taylor  <iant@google.com>
4491
4492         PR gold/12525
4493         * options.h (class General_options): Add -dy and -dn.
4494
4495 2011-03-02  Cary Coutant  <ccoutant@google.com>
4496
4497         * testsuite/script_test_9.t: Add TLS segment.
4498
4499 2011-03-02  Simon Baldwin  <simonb@google.com>
4500
4501         * configure.ac: Add check for gnu_indirect_function support in
4502         the toolchain building binutils.
4503         * configure: Rebuild.
4504
4505 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4506
4507         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4508         plugin only symbols.
4509         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4510         in plugin files as not needed in the symbol table.
4511
4512 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4513
4514         * output.cc (Output_section::add_input_section): Delay fill
4515         generation for section ordering.
4516
4517 2011-02-09  Ian Lance Taylor  <iant@google.com>
4518
4519         PR gold/12316
4520         * object.h (class Sized_relobj): Remove clear_local_symbols.
4521         * reloc.cc (Sized_relobj::do_relocate): Don't call
4522         clear_local_symbols.
4523
4524 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4525
4526         * plugin.cc (is_visible_from_outside): Return true for symbols
4527         in the -u option.
4528
4529 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4530
4531         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4532         filename.
4533
4534 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4535
4536         * icf.h (is_section_foldable_candidate): Change type of parameter
4537         to std::string.
4538         * icf.cc (Icf::find_identical_sections): Change type of local variable
4539         section_name to be std::string.
4540         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4541
4542 2011-01-25  Ian Lance Taylor  <iant@google.com>
4543
4544         * script.cc (script_add_extern): Rewrite to use
4545         add_symbol_reference.
4546
4547 2011-01-25  Doug Kwan  <dougkwan@google.com>
4548
4549         * icf.cc (get_section_contents): Always lock section's object.
4550
4551 2011-01-24  Ian Lance Taylor  <iant@google.com>
4552
4553         * options.h (class General_options): Accept
4554         --no-detect-odr-violations.
4555
4556 2011-01-24  Ian Lance Taylor  <iant@google.com>
4557
4558         * version.cc (version_string): Bump to 1.11.
4559
4560 2011-01-24  Ian Lance Taylor  <iant@google.com>
4561
4562         * plugin.cc (class Plugin_rescan): Define new class.
4563         (Plugin_manager::claim_file): Set any_claimed_.
4564         (Plugin_manager::save_archive): New function.
4565         (Plugin_manager::save_input_group): New function.
4566         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4567         necessary.
4568         (Plugin_manager::new_undefined_symbol): New function.
4569         (Plugin_manager::rescan): New function.
4570         (Plugin_manager::rescannable_defines): New function.
4571         (Plugin_manager::add_input_file): Set any_added_.
4572         * plugin.h (class Plugin_manager): define new fields rescannable_,
4573         undefined_symbols_, any_claimed_, and any_added_.  Declare
4574         Plugin_rescan as friend.  Declare new functions.
4575         (Plugin_manager::Rescannable): Define type.
4576         (Plugin_manager::Rescannable_list): Define type.
4577         (Plugin_manager::Undefined_symbol_list): Define type.
4578         (Plugin_manager::Plugin_manager): Initialize new fields.
4579         * archive.cc (Archive::defines_symbol): New function.
4580         (Add_archive_symbols::run): Pass archive to plugins if any.
4581         * archive.h (class Archive): Declare defines_symbol.
4582         * readsyms.cc (Input_group::~Input_group): New function.
4583         (Finish_group::run): Pass input_group to plugins if any.
4584         * readsyms.h (class Input_group): Declare destructor.
4585         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4586         any.
4587
4588 2011-01-10  Ian Lance Taylor  <iant@google.com>
4589
4590         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4591         section as relro.
4592         (Layout::set_segment_offsets): Reset increase_relro before calling
4593         set_section_addresses a second time.
4594
4595 2011-01-04  Cary Coutant  <ccoutant@google.com>
4596
4597         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4598         sections before NOBITS sections.
4599
4600 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4601
4602         * version.cc (print_version): Update copyright to 2011.
4603
4604 2010-12-23  Cary Coutant  <ccoutant@google.com>
4605
4606         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4607         of OS to this->add.  Add OD parameter to second form of the function.
4608
4609 2010-12-20  Ian Lance Taylor  <iant@google.com>
4610
4611         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4612         second of two consecutive entries with same offset.
4613
4614 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4615
4616         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4617         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4618         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4619         to avoid unneeded links against $(LDADD).
4620         * testsuite/Makefile.in: Regenerate.
4621
4622 2010-12-15  Ian Lance Taylor  <iant@google.com>
4623
4624         PR gold/12324
4625         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4626         for R_X86_64_32 and R_X86_64_PC32.
4627         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4628         ver_matching_def_pic.o.
4629         (ver_matching_def_pic.o): New target.
4630
4631 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4632
4633         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4634         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4635         Move definition before File_read::View member definitions.
4636         (File_read::View::~View): Initialize and hold lock before
4637         updating current_mapped_bytes.
4638
4639 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4640
4641         * dwarf_reader.cc: Remove outdated comment.
4642         * gold-threads.cc: Fix typo in error message.
4643         * archive.cc: Fix typos in comments.
4644         * archive.h: Likewise.
4645         * arm-reloc-property.cc: Likewise.
4646         * arm-reloc-property.h: Likewise.
4647         * arm-reloc.def: Likewise.
4648         * arm.cc: Likewise.
4649         * attributes.h: Likewise.
4650         * cref.cc: Likewise.
4651         * ehframe.cc: Likewise.
4652         * fileread.h: Likewise.
4653         * gold.h: Likewise.
4654         * i386.cc: Likewise.
4655         * icf.cc: Likewise.
4656         * incremental.h: Likewise.
4657         * int_encoding.cc: Likewise.
4658         * layout.h: Likewise.
4659         * main.cc: Likewise.
4660         * merge.h: Likewise.
4661         * object.cc: Likewise.
4662         * object.h: Likewise.
4663         * options.cc: Likewise.
4664         * readsyms.cc: Likewise.
4665         * reduced_debug_output.cc: Likewise.
4666         * reloc.cc: Likewise.
4667         * script-sections.cc: Likewise.
4668         * sparc.cc: Likewise.
4669         * symtab.h: Likewise.
4670         * target-reloc.h: Likewise.
4671         * target.cc: Likewise.
4672         * target.h: Likewise.
4673         * timer.cc: Likewise.
4674         * timer.h: Likewise.
4675         * x86_64.cc: Likewise.
4676
4677 2010-12-09  Cary Coutant  <ccoutant@google.com>
4678
4679         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4680         stack.
4681         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4682         parameter; change all callers.
4683         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4684         * options.h (warn_execstack): New option.
4685
4686 2010-12-07  Doug Kwan  <dougkwan@google.com>
4687
4688         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4689         like function call relocations.
4690
4691 2010-12-07  Ian Lance Taylor  <iant@google.com>
4692
4693         * archive.cc (Archive::get_elf_object_for_member): Permit
4694         punconfigured to be NULL.
4695         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4696         (Archive::include_member): Pass NULL to get_elf_object_for_member
4697         if we searched for the archive and this is the first included
4698         object.
4699
4700 2010-12-01  Ian Lance Taylor  <iant@google.com>
4701
4702         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4703         track_relocs_type_ field.
4704         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4705         Set track_relocs_type_.
4706         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4707         contents when using RELA relocs.
4708         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4709         reloc_map_.
4710         * reloc.cc (Track_relocs::next_addend): New function.
4711         * reloc.h (class Track_relocs): Declare next_addend.
4712
4713 2010-12-01  Ian Lance Taylor  <iant@google.com>
4714
4715         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4716         virtual destructor.
4717
4718 2010-12-01  Ian Lance Taylor  <iant@google.com>
4719
4720         * README: Update compilers known to work and fail.
4721
4722 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4723
4724         * configure.in: For --enable-gold, handle value `default' instead of
4725         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4726         not the default.
4727         * configure: Regenerate.
4728
4729 2010-11-18  Doug Kwan  <dougkwan@google.com>
4730
4731         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4732         and right_alignment to be zero.  Store result alignment only if it is
4733         greater than existing alignment.
4734
4735 2010-11-16  Cary Coutant  <ccoutant@google.com>
4736
4737         PR gold/12220
4738         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4739         Check for ".zdebug_line".
4740
4741 2010-11-16  Doug Kwan  <dougkwan@google.com>
4742             Cary Coutant  <ccoutant@google.com>
4743
4744         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4745         by reference; adjust all callers.
4746         * output.cc (Output_segment::set_section_addresses): Adjust references
4747         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4748         list is empty.
4749         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4750         end at page boundary.
4751
4752 2010-11-16  Cary Coutant  <ccoutant@google.com>
4753
4754         PR gold/12220
4755         * layout.cc (Layout::choose_output_section): Transform names of
4756         compressed sections even when using a script with a SECTIONS clause.
4757         (Layout::output_section_name): Remove code to transform
4758         compressed debug section names.
4759         * output.cc (Output_section::add_input_section): Use uncompressed
4760         section size when tracking input sections.
4761
4762 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4763
4764         * symtab.h (Symbol::NON_PIC_REF): Remove.
4765         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4766         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4767         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4768         (Symbol::use_plt_offset): Take a flags argument and pass it
4769         directly to needs_dynamic_reloc.  Restrict check for undefined
4770         weak symbols to function calls.
4771         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4772         (Target_arm::Scan::global): Use it.
4773         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4774         (Target_arm::Relocate::relocate): Likewise.
4775         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4776         parameter with an r_type parameter.  Use get_reference_flags
4777         to get the flags.
4778         (Target_arm::Relocate::relocate): Update accordingly.
4779         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4780         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4781         (Target_i386::Scan::global): Likewise.
4782         (Target_i386::Relocate::relocate): Likewise.
4783         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4784         parameter with an r_type parameter.  Use get_reference_flags
4785         to get the flags.
4786         (Target_i386::Relocate::relocate): Update accordingly.
4787         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4788         (Target_powerpc::Scan::global): Use it.
4789         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4790         (Target_powerpc::Relocate::relocate): Likewise.
4791         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4792         (Target_sparc::Scan::global): Use it.
4793         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4794         (Target_sparc::Relocate::relocate): Likewise.
4795         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4796         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4797         (Target_x86_64::Scan::global): Likewise.
4798         (Target_x86_64::Relocate::relocate): Likewise.
4799
4800 2010-11-08  Doug Kwan  <dougkwan@google.com>
4801             Cary Coutant  <ccoutant@google.com>
4802
4803         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4804         (Arm_exidx_merge_section::section_contents_): New data member.
4805         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4806         (Arm_input_section::~Arm_input_section): De-allocate memory.
4807         (Arm_input_section::original_contents_): New data member.
4808         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4809         in parameters instead of calling Object::section_contents without
4810         locking.
4811         (Arm_output_section::group_section): New parameter TASK.  Pass it
4812         to callees that need locking objects.
4813         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4814         to lock EXIDX input sections.  Fix a formatting issue.  Call
4815         Arm_exidx_merged_section::build_contents to create merged section
4816         contents.
4817         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4818         to lock object of stub table owner.
4819         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4820         TEXT_SIZE to initialize data member TEXT_SIZE_.
4821         (Arm_exidx_input_section::addralign): Fix typo in comment.
4822         (Arm_exidx_input_section::text_size): New method.
4823         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4824         that require locking objects.  Lock objects before scanning for stubs
4825         and updating local symbols.
4826         (Arm_input_section<big_endian>::init): Copy contents of original
4827         input section.
4828         (Arm_input_section<big_endian>::do_write): Use saved contents of
4829         original input section instead of calling Object::section_contents
4830         without locking.
4831         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4832         size without calling Object::section_size().
4833         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4834         for size.  Allocate a buffer for merged EXIDX entries.
4835         (Arm_exidx_merged_section::build_contents): New method.
4836         (Arm_exidx_merged_section::do_write): Move merge section contents
4837         building code to Arm_exidx_merged_section::build_contetns.  Write
4838         out contetns in buffer instead of building it on the fly.
4839         (Arm_relobj::make_exidx_input_section): Also pass text section size
4840         to Arm_exidx_input_section constructor.
4841         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4842         (Arm_dynobj::do_read_symbols): Fix memory leak.
4843         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4844         * target.h: (class Task): Add forward declaration.
4845         (Target::relax): Add new parameter TASK and pass it to
4846         Target::do_relax().
4847         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4848
4849 2010-11-05  Cary Coutant  <ccoutant@google.com>
4850
4851         PR gold/10708
4852         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4853         object when reading from the file.
4854         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4855         second layout pass.
4856         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4857         when reading section contents.
4858         (get_section_contents): Likewise.
4859         (icf::find_identical_sections): Likewise.
4860         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4861         object when reading from the file.
4862         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4863         the object when doing deferred section layout.
4864
4865 2010-11-03  Nick Clifton  <nickc@redhat.com>
4866
4867         PR gold/12001
4868         * script.h (class Symbol_assignment: name): New member.  Returns
4869         the name of the symbol.
4870         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4871         Returns true if the given symbol name is on the list of
4872         assignments wating to be processed.
4873         * archive.cc (should_incldue_member): If the symbol is undefined,
4874         check to see if it is on the list of symbols pending assignment.
4875
4876 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4877
4878         * script-sections.cc (Script_sections::find_memory_region): Check
4879         for a NULL output section pointer.
4880
4881 2010-10-29  Doug Kwan  <dougkwan@google.com>
4882
4883         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4884         Output_section::add_relaxed_input_section.
4885         * output.cc (Output_section::add_relaxed_input_section): Add new
4886         arguments LAYOUT and NAME.  Set section order index.
4887         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4888         Copy section order index.
4889         * output.h (Output_section::add_relaxed_input_section): Add new
4890         arguments LAYOUT and NAME.
4891
4892 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4893
4894         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4895         NATIVE_OR_CROSS_LINKER.
4896         * testsuite/Makefile.in: Regenerate.
4897
4898 2010-10-20  Doug Kwan  <dougkwan@google.com>
4899
4900         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4901         without SHF_LINK_ORDER flags.
4902         * layout.cc (Layout::choose_output_section): Do not filter
4903         SHF_LINK_ORDER flag in a relocatable link.
4904
4905 2010-10-17  Cary Coutant  <ccoutant@google.com>
4906
4907         * output.h (Output_segment::set_section_addresses): Change function
4908         signature.  Update all callers.
4909         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4910         sections.
4911         (Output_segment::set_section_addresses): Align after last TLS
4912         section.  Add padding before last relro section instead of after.
4913
4914 2010-10-17  Doug Kwan  <dougkwan@google.com>
4915
4916         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4917         GOT output section to be writable.
4918
4919 2010-10-14  Cary Coutant  <ccoutant@google.com>
4920
4921         * debug.h (DEBUG_INCREMENTAL): New flag.
4922         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4923         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4924         mode.
4925         * incremental.cc (report_command_line): Ignore all forms of
4926         --incremental.
4927         * layout.cc (Layout::Layout): Check parameters for incremental link
4928         mode.
4929         * options.cc (General_options::parse_incremental): New function.
4930         (General_options::parse_no_incremental): New function.
4931         (General_options::parse_incremental_full): New function.
4932         (General_options::parse_incremental_update): New function.
4933         (General_options::incremental_mode_): New data member.
4934         (General_options::finalize): Check incremental_mode_.
4935         * options.h (General_options): Update help text for --incremental.
4936         Add --no-incremental, --incremental-full, --incremental-update.
4937         (General_options::Incremental_mode): New enum type.
4938         (General_options::incremental_mode): New function.
4939         (General_options::incremental_mode_): New data member.
4940         * parameters.cc (Parameters::incremental_mode_): New data member.
4941         (Parameters::set_options): Set incremental_mode_.
4942         (Parameters::set_incremental_full): New function.
4943         (Parameters::incremental): New function.
4944         (Parameters::incremental_update): New function.
4945         (set_parameters_incremental_full): New function.
4946         * parameters.h (Parameters::set_incremental_full): New function.
4947         (Parameters::incremental): New function.
4948         (Parameters::incremental_update): New function.
4949         (Parameters::incremental_mode_): New data member.
4950         (set_parameters_incremental_full): New function.
4951         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4952         incremental link mode.
4953         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4954         (Sized_relobj::do_relocate_sections): Likewise.
4955         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4956         option.
4957         * testsuite/Makefile.in: Regenerate.
4958         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4959
4960 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4961
4962         * script-sections.h (class Script_sections): Make
4963         Sections_elements typedef public.
4964         * script-sections.cc (class Sort_output_sections): Add elements_
4965         field.  Add constructor which sets it; change all callers.
4966         (Sort_output_sections::is_before): New function.
4967         (Sort_output_sections::operator()): Call is_before.
4968         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4969         conditional.
4970         * testsuite/script_test_10.sh: New test. Test script section
4971         order.
4972         * testsuite/script_test_10.t: Likewise.
4973         * testsuite/script_test_10.s: Likewise.
4974         * testsuite/Makefile.am: Wrap the cross linker tests and the
4975         common tests into NATIVE_OR_CROSS_LINKER.
4976         (check_SCRIPTS): Add script_test_10.sh.
4977         (check_DATA): Add script_test_10.stdout.
4978         (script_test_10.o, script_test_10): New targets.
4979         (script_test_10.stdout): New target.
4980         * configure, testsuite/Makefile.in: Regenerate.
4981
4982 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4983
4984         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4985         error for the deprecated relocations.
4986         (Target_arm::Scan::global): Likewise.
4987         (Target_arm::Relocate::relocate): Likewise.
4988
4989 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4990
4991         * fileread.cc (Input_file::find_file): Initialize *found_name
4992         and *namep when using the fallback search for case 4.
4993
4994 2010-10-11  Cary Coutant  <ccoutant@google.com>
4995
4996         * options.h (class General_options): Redefine -z lazy as an alias for
4997         the negation of -z now.
4998
4999 2010-10-11  Ian Lance Taylor  <iant@google.com>
5000
5001         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5002         binding.
5003
5004 2010-10-06  Nick Clifton  <nickc@redhat.com>
5005
5006         * script-sections.cc(class Memory_region): Remove
5007         current_lma_offset_ field.  Rename current_vma_offset_ to
5008         current_offset_.  Add last_section_ field.
5009         (Memory_region::get_current_vma_address): Rename to
5010         get_current_address.
5011         (Memory_region::get_current_lma_address): Delete.
5012         (Memory_region::increment_vma_offset): Rename to
5013         increment_offset.
5014         (Memory_region::increment_lma_offset): Delete.
5015         (Memory_region::attributes_compatible): New method.  Returns
5016         true if the provided section is compatible with the region.
5017         (Memory_region::get_last_section): New method.  Returns the last
5018         section to use the region.
5019         (Memory_region::set_last_section): New method.  Stores the last
5020         section to use the region.
5021         (Script_sections::block_in_region): New method.  Returns true if
5022         a block of memory is contained within a region.
5023         (Script_sections::find_memory_region): New method.  Locates a
5024         memory region to be used to set a VMA or LMA address.
5025         (Output_section_definition::set_section_addresses): Add code to
5026         check for addresses set by memory regions.
5027         (Output_segment::set_section_addresses): Remove memory region
5028         walking code.
5029         (Script_sections::create_segment): Add a warning if a header
5030         segment is created outside of any region.
5031         * script-sections.h (class Script_sections): Add prototypes for
5032         find_memory_region and block_in_region methods.
5033         * testsuite/memory_test.s: Use .long instead of .word.
5034         * testsuite/memory_test.t: Add some more output sections.
5035         * testsuite/memory_test.sh: Update expected output.
5036
5037 2010-10-02  Doug Kwan  <dougkwan@google.com>
5038
5039         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5040         defintion to symtab.h
5041         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5042         declaration to defintion.
5043
5044 2010-10-01  Nick Clifton  <nickc@redhat.com>
5045
5046         * expression.cc (eval): Replace dummy argument with NULL.
5047         (eval_maybe_dot): Check for a NULL result section pointer.
5048         (Symbol_expression::value): Likewise.
5049         (Dot_expression::value): Likewise.
5050         (BINARY_EXPRESSION): Likewise.
5051         (Max_expression::value): Likewise.
5052         (Min_expression::value): Likewise.
5053         (Absolute_expression::value): Likewise.
5054         (Addr_expression::value_from_output_section): Likewise.
5055         (Loaddddr_expression::value_from_output_section): Likewise.
5056         (Segment_start_expression::value): Likewise.
5057         * script-sections.cc
5058         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5059         argument with NULL.
5060         (Sections_elememt_dot_assignment::set_section_addresses):
5061         Likewise.
5062         (Output_data_expression::do_write_to_buffer): Likewise.
5063         (Output_section_definition::finalize_symbols): Likewise.
5064         (Output_section_definition::set_section_addresses): Likewise.
5065
5066 2010-09-30  Doug Kwan  <dougkwan@google.com>
5067
5068         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5069
5070 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5071
5072         * target.h (Target::can_icf_inline_merge_sections): New virtual
5073         function.
5074         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5075         virtual function.
5076         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5077         virtual function.
5078         * icf.cc (get_section_contents): Inline merge sections only when
5079         target allows it.
5080
5081 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5082
5083         * configure: Regenerate.
5084
5085 2010-09-17  Ian Lance Taylor  <iant@google.com>
5086
5087         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5088         * testsuite/Makefile.am (memory_test.o): New target.
5089         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5090         memory_test.t.
5091         * testsuite/Makefile.in: Rebuild.
5092
5093 2010-09-17  Doug Kwan  <dougkwan@google.com>
5094
5095         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5096         defintion if relocation uses GOT entries of the symbol.
5097         * testsuite/icf_safe_test.sh: Fix test.
5098         * testsuite/icf_safe_so_test.sh: Fix test.
5099
5100 2010-09-16  Cary Coutant  <ccoutant@google.com>
5101
5102         * script_sections.cc (class Memory_region): Remove "NULL" from
5103         vector initializations.
5104
5105 2010-09-15  Cary Coutant  <ccoutant@google.com>
5106
5107         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5108         Resolve forwarding symbols.
5109
5110 2010-09-15  Doug Kwan  <dougkwan@google.com>
5111
5112         * gold/testsuite/script_test_3.t: Add ARM special sections.
5113         * gold/testsuite/script_test_4.t: Same.
5114         * gold/testsuite/script_test_5.t: Same.
5115         * gold/testsuite/script_test_6.t: Same.
5116         * gold/testsuite/script_test_7.t: Same.
5117         * gold/testsuite/script_test_7.t: Same.
5118         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5119
5120 2010-09-14  Cary Coutant  <ccoutant@google.com>
5121
5122         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5123         (Target_x86_64::Relocate::relocate_tls): Replace check for
5124         saw_tls_block_reloc_ with test for executable section.
5125
5126 2010-09-12  Cary Coutant  <ccoutant@google.com>
5127
5128         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5129         position-independent executables to shared libraries need dynamic
5130         relocations.
5131         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5132         position-independent executables.
5133         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5134         * testsuite/Makefile.in: Regenerate.
5135
5136 2010-09-10  Nick Clifton  <nickc@redhat.com>
5137
5138         PR gold/11997
5139         * testsuite/memory_test.t: Discard any sections that are not
5140         needed.
5141
5142 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5143
5144         PR gold/11996
5145         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5146         "This::" to work around a bug in gcc 4.2.
5147
5148         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5149
5150 2010-09-09  Rafael Espindola  <espindola@google.com>
5151
5152         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5153         sections with different PF_X flags in the same segment.
5154         (Layout::find_first_load_seg): Search all segments to find the first
5155         one.
5156         * options.h (rosegment): New.
5157
5158 2010-09-08  Rafael Espindola  <espindola@google.com>
5159
5160         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5161
5162 2010-09-08  Doug Kwan  <dougkwan@google.com>
5163
5164         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5165         (Arm_relobj::do_relocate_sections): Add new parameter for output
5166         file to match the parent.
5167         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5168         of local symbols instead of input values.  Update code to track
5169         changes in gold::relocate_section.
5170         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5171         (Sized_relobj::compute_final_local_value_internal): New methods.
5172         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5173         body into private version of Sized_relobj::compute_final_local_value.
5174         Call the inline method.
5175         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5176         merged symbol value if there is one.
5177         (Symbol_value::has_output_value): New method defintiion.
5178         (Sized_relobj::Compute_final_local_value_status): New enum type.
5179         (Sized_relobj::compute_final_local_value): New methods.
5180         (Sized_relobj::compute_final_local_value_internal): New methods.
5181         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5182         and arm_cortex_a8.sh.
5183         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5184         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5185         New tests.
5186         * Makefile.in: Regenerate.
5187         * testsuite/arm_bl_out_of_range.s: Update test.
5188         * testsuite/thumb_bl_out_of_range.s: Ditto.
5189         * testsuite/thumb_blx_out_of_range.s: Ditto.
5190         * testsuite/arm_branch_out_of_range.sh: New file.
5191         * testsuite/arm_cortex_a8.sh: Ditto.
5192         * testsuite/arm_cortex_a8_b.s: Ditto.
5193         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5194         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5195         * testsuite/arm_cortex_a8_bl.s: Ditto.
5196         * testsuite/arm_cortex_a8_blx.s: Ditto.
5197         * testsuite/arm_cortex_a8_local.s: Ditto.
5198         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5199         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5200
5201 2010-09-08  Rafael Espindola  <espindola@google.com>
5202
5203         * Makefile.am (memory_test.stdout): Run readelf with -W.
5204         * Makefile.in: Regenerate.
5205         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5206         64 bit output.
5207
5208 2010-09-08  Rafael Espindola  <espindola@google.com>
5209
5210         * script-sections.cc (Script_sections::add_memory_region): Convert
5211         field precision to int.
5212         * script.cc (script_set_section_region, script_set_section_region):
5213         Convert field precision to int.
5214
5215 2010-09-08  Rafael Espindola  <espindola@google.com>
5216
5217         * arm.cc (do_finalize_sections): Create the __exidx_start and
5218         __exdix_end symbols even when the section is missing.
5219
5220 2010-09-08  Nick Clifton  <nickc@redhat.com>
5221
5222         * README: Remove claim that MEMORY is not supported.
5223         * expression.cc (script_exp_function_origin)
5224         (script_exp_function_length): Move from here to ...
5225         * script.cc: ... here.
5226         (script_set_section_region, script_add_memory)
5227         (script_parse_memory_attr, script_include_directive): New
5228         functions.
5229         * script-sections.cc
5230         (class Memory_region): New class.
5231         (class Output_section_definition): Add set_memory_region,
5232         set_section_vma, set_section_lma and get_section_name methods.
5233         (class Script_Sections): Add add_memory_region,
5234         find_memory_region, find_memory_region_origin,
5235         find_memory_region_length and set_memory_region methods.
5236         Have set_section_addresses method walk the list of set memory
5237         regions.
5238         Extend the print methos to display memory regions.
5239         * script-sections.h: Add prototypes for new methods.
5240         Add enum for MEMORY region attributes.
5241         * yyscript.y: Add support for parsing MEMORY regions.
5242         * script-c.h: Add prototypes for new functions.
5243         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5244         * testsuite/Makefile.in: Regenerate.
5245         * testsuite/memory_test.sh: New script.
5246         * testsuite/memory_test.s: New assembler source file.
5247         * testsuite/memory_test.t: New linker script.
5248
5249 2010-08-27  Doug Kwan  <dougkwan@google.com>
5250
5251         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5252         reference override an existing dynamic weak reference.
5253         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5254         * testsuite/Makefile.in: Regenerate.
5255         * testsuite/dyn_weak_ref.sh: New file.
5256         * testsuite/dyn_weak_ref_1.c: Ditto.
5257         * testsuite/dyn_weak_ref_2.c: Ditto.
5258
5259 2010-08-27  Ian Lance Taylor  <iant@google.com>
5260
5261         * incremental.h (class Incremental_input_entry): Add virtual
5262         destructor.
5263
5264 2010-08-27  Ian Lance Taylor  <iant@google.com>
5265
5266         * testsuite/start_lib_test_3.c: Mark t3 as used.
5267
5268 2010-08-27  Nick Clifton  <nickc@redhat.com>
5269
5270         * options.cc (version_script): Fix small typo in previous
5271         whitespace tidyup.
5272
5273 2010-08-25  Nick Clifton  <nickc@redhat.com>
5274
5275         * archive.cc: Formatting fixes: Remove whitespace between
5276         typename and following asterisk.  Remove whitespace between
5277         function name and opening parenthesis.
5278         * archive.h: Likewise.
5279         * arm.cc: Likewise.
5280         * attributes.cc: Likewise.
5281         * attributes.h: Likewise.
5282         * common.cc: Likewise.
5283         * copy-relocs.cc: Likewise.
5284         * dirsearch.h: Likewise.
5285         * dynobj.cc: Likewise.
5286         * ehframe.cc: Likewise.
5287         * ehframe.h: Likewise.
5288         * expression.cc: Likewise.
5289         * fileread.cc: Likewise.
5290         * fileread.h: Likewise.
5291         * gc.h: Likewise.
5292         * gold-threads.cc: Likewise.
5293         * gold.cc: Likewise.
5294         * i386.cc: Likewise.
5295         * icf.h: Likewise.
5296         * incremental-dump.cc: Likewise.
5297         * incremental.cc: Likewise.
5298         * layout.cc: Likewise.
5299         * layout.h: Likewise.
5300         * main.cc: Likewise.
5301         * merge.cc: Likewise.
5302         * merge.h: Likewise.
5303         * object.cc: Likewise.
5304         * object.h: Likewise.
5305         * options.cc: Likewise.
5306         * options.h: Likewise.
5307         * output.cc: Likewise.
5308         * output.h: Likewise.
5309         * plugin.cc: Likewise.
5310         * plugin.h: Likewise.
5311         * powerpc.cc: Likewise.
5312         * reloc.cc: Likewise.
5313         * script-c.h: Likewise.
5314         * script-sections.cc: Likewise.
5315         * script.cc: Likewise.
5316         * stringpool.cc: Likewise.
5317         * symtab.cc: Likewise.
5318         * symtab.h: Likewise.
5319         * target.cc: Likewise.
5320         * timer.cc: Likewise.
5321         * timer.h: Likewise.
5322         * version.cc: Likewise.
5323         * x86_64.cc: Likewise.
5324
5325 2010-08-24  Nick Clifton  <nickc@redhat.com>
5326
5327         PR 11899
5328         * layout.cc (segment_precedes): Sort segments by their physical
5329         addresses, if they have been set.
5330
5331 2010-08-23  Cary Coutant  <ccoutant@google.com>
5332
5333         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5334         symbols data.
5335         (Lib_group::include_member): Unlock object after deleting its
5336         symbols data.
5337         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5338         the bug fixed here.
5339
5340 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5341             Cary Coutant  <ccoutant@google.com>
5342
5343         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5344         constructor, and set_blocker.
5345         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5346         readsyms_blocker_.
5347         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5348         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5349         * testsuite/Makefile.am (start_lib_test): New test case.
5350         * testsuite/Makefile.in: Regenerate.
5351         * testsuite/start_lib_test_main.c: New file.
5352         * testsuite/start_lib_test_1.c: New file.
5353         * testsuite/start_lib_test_2.c: New file.
5354         * testsuite/start_lib_test_3.c: New file.
5355
5356 2010-08-19  Ian Lance Taylor  <iant@google.com>
5357
5358         * Makefile.in: Rebuild with automake 1.11.1.
5359         * aclocal.m4: Likewise.
5360         * testsuite/Makefile.in: Likewise.
5361
5362 2010-08-19  Ian Lance Taylor  <iant@google.com>
5363
5364         PR 10893
5365         * i386.cc (class Output_data_plt_i386): Update declarations.
5366         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5367         local_ifuncs_ fields.
5368         (Target_i386::do_plt_section_for_global): New function.
5369         (Target_i386::do_plt_section_for_local): New function.
5370         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5371         parameter; change all callers.  Initialize global_ifuncs_ and
5372         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5373         __rel_iplt_end.
5374         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5375         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5376         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5377         symbols.
5378         (Target_i386::make_plt_section): New function, broken out of
5379         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5380         (Target_i386::make_plt_entry): Call make_plt_section.
5381         (Target_i386::make_local_ifunc_plt_entry): New function.
5382         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5383         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5384         R_386_IRELATIVE to switch.
5385         (Target_i386::Scan::global): Likewise.
5386         (Target_i386::Relocate::relocate): Likewise.
5387         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5388         switch.
5389         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5390         (Target_x86_64::do_plt_section_for_global): New function.
5391         (Target_x86_64::do_plt_section_for_local): New function.
5392         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5393         parameter; change all callers.  If doing a static link define
5394         __rela_iplt_start and __rela_iplt_end.
5395         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5396         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5397         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5398         to point to .plt.
5399         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5400         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5401         switch.
5402         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5403         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5404         R_X86_64_IRELATIVE to switch.
5405         (Target_x86_64::Scan::global): Likewise.
5406         (Target_x86_64::Relocate::relocate): Likewise.
5407         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5408         switch.
5409         * target.h (class Target): Add plt_section_for_global and
5410         plt_section_for_local functions.  Add do_plt_section_for_global
5411         and do_plt_section_for_local virtual functions.
5412         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5413         clarifying comments.
5414         (Symbol::use_plt_offset): Handle IFUNC symbol.
5415         * object.cc (Sized_relobj::Sized_relobj): Initialize
5416         local_plt_offsets_.
5417         (Sized_relobj::local_has_plt_offset): New function.
5418         (Sized_relobj::local_plt_offset): New function.
5419         (Sized_relobj::set_local_plt_offset): New function.
5420         (Sized_relobj::do_count): Handle IFUNC symbol.
5421         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5422         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5423         is_ifunc_symbol functions.
5424         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5425         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5426         local_plt_offsets_ field.
5427         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5428         * output.h (class Output_section_data): Add non-const
5429         output_section function.
5430         (class Output_data_got): Update declarations.
5431         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5432         Add use_plt_offset parameter to global and local constructors.
5433         Change all callers.  Change local_sym_index_ field to 31 bits.
5434         Change GSYM_CODE and CONSTANT_CODE accordingly.
5435         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5436         doing a static link don't set sh_link field.
5437         (Output_data_got::Got_entry::write): Use PLT offset if
5438         appropriate.
5439         (Output_data_got::add_global_plt): New function.
5440         (Output_data_got::add_local_plt): New function.
5441         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5442         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5443         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5444         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5445         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5446         IFUNC conditional.
5447         * testsuite/ifunc-sel.h: New file.
5448         * testsuite/ifuncmain1.c: New file.
5449         * testsuite/ifuncmain1vis.c: New file.
5450         * testsuite/ifuncmod1.c: New file.
5451         * testsuite/ifuncdep2.c: New file.
5452         * testsuite/ifuncmain2.c: New file.
5453         * testsuite/ifuncmain3.c: New file.
5454         * testsuite/ifuncmod3.c: New file.
5455         * testsuite/ifuncmain4.c: New file.
5456         * testsuite/ifuncmain5.c: New file.
5457         * testsuite/ifuncmod5.c: New file.
5458         * testsuite/ifuncmain6pie.c: New file.
5459         * testsuite/ifuncmod6.c: New file.
5460         * testsuite/ifuncmain7.c: New file.
5461         * configure, testsuite/Makefile.in: Rebuild.
5462
5463 2010-08-18  Ian Lance Taylor  <iant@google.com>
5464
5465         * incremental.cc
5466         (Output_section_incremental_inputs::write_input_files): Add cast
5467         to avoid signed/unsigned comparison warning.
5468         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5469
5470 2010-08-12  Cary Coutant  <ccoutant@google.com>
5471
5472         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5473
5474 2010-08-13  Ian Lance Taylor  <iant@google.com>
5475
5476         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5477
5478 2010-08-12  Cary Coutant  <ccoutant@google.com>
5479             Doug Kwan  <dougkwan@google.com>
5480
5481         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5482         defintion overrides non-weak undef, remember that the original undef
5483         is not weak.
5484         * symtab.cc (Symbol_table::sized_write_global): For undef without
5485         an original weak binding, set binding to global in output.
5486         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5487         * testsuite/Makefile.in: Regenerate.
5488         * testsuite/strong_ref_weak_def.sh: New file.
5489         * testsuite/strong_ref_weak_def_1.c: Ditto.
5490         * testsuite/strong_ref_weak_def_2.c: Ditto.
5491
5492 2010-08-12  Cary Coutant  <ccoutant@google.com>
5493
5494         * testsuite/incremental_test.sh: Rewrite.
5495         * testsuite/incremental_test_1.c: Rewrite.
5496         * testsuite/incremental_test_2.c: Rewrite.
5497
5498 2010-08-12  Cary Coutant  <ccoutant@google.com>
5499
5500         * arm.cc (Target_arm::got_size): Add const.
5501         (Target_arm::got_entry_count): New function.
5502         (Target_arm::plt_entry_count): New function.
5503         (Target_arm::first_plt_entry_offset): New function.
5504         (Target_arm::plt_entry_size): New function.
5505         (Output_data_plt_arm::entry_count): New function.
5506         (Output_data_plt_arm::first_plt_entry_offset): New function.
5507         (Output_data_plt_arm::get_plt_entry_size): New function.
5508         * i386.cc (Target_i386::got_size): Add const.
5509         (Target_i386::got_entry_count): New function.
5510         (Target_i386::plt_entry_count): New function.
5511         (Target_i386::first_plt_entry_offset): New function.
5512         (Target_i386::plt_entry_size): New function.
5513         (Output_data_plt_i386::entry_count): New function.
5514         (Output_data_plt_i386::first_plt_entry_offset): New function.
5515         (Output_data_plt_i386::get_plt_entry_size): New function.
5516         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5517         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5518         * incremental.cc: Include target.h.
5519         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5520         parameter.  Adjust all callers.  Find incremental_got_plt section.
5521         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5522         section.
5523         (Output_section_incremental_inputs::set_final_data_size): Calculate
5524         size of incremental_got_plt section.
5525         (Output_section_incremental_inputs::do_write): Write the
5526         incremental_got_plt section.
5527         (Got_plt_view_info): New struct.
5528         (Local_got_offset_visitor): New class.
5529         (Global_got_offset_visitor): New class.
5530         (Global_symbol_visitor_got_plt): New class.
5531         (Output_section_incremental_inputs::write_got_plt): New function.
5532         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5533         Add parameter.  Adjust all callers.
5534         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5535         (Incremental_inputs::got_plt_section): New function.
5536         (Incremental_inputs::got_plt_section_): New data member.
5537         (Incremental_got_plt_reader): New class.
5538         * layout.cc (Layout::create_incremental_info_sections): Add the
5539         incremental_got_plt section.
5540         * object.h (Got_offset_list::get_list): New function.
5541         (Got offset_list::for_all_got_offsets): New function.
5542         (Sized_relobj::local_got_offset_list): New function.
5543         * powerpc.cc (Target_powerpc::got_size): Add const.
5544         (Target_powerpc::got_entry_count): New function.
5545         (Target_powerpc::plt_entry_count): New function.
5546         (Target_powerpc::first_plt_entry_offset): New function.
5547         (Target_powerpc::plt_entry_size): New function.
5548         (Output_data_plt_powerpc::entry_count): New function.
5549         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5550         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5551         * sparc.cc (Target_sparc::got_size): Add const.
5552         (Target_sparc::got_entry_count): New function.
5553         (Target_sparc::plt_entry_count): New function.
5554         (Target_sparc::first_plt_entry_offset): New function.
5555         (Target_sparc::plt_entry_size): New function.
5556         (Output_data_plt_sparc::entry_count): New function.
5557         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5558         (Output_data_plt_sparc::get_plt_entry_size): New function.
5559         * symtab.h (Symbol::got_offset_list): New function.
5560         (Symbol_table::for_all_symbols): New function.
5561         * target.h (Sized_target::got_entry_count): New function.
5562         (Sized_target::plt_entry_count): New function.
5563         (Sized_target::plt_entry_size): New function.
5564         * x86_64.cc (Target_x86_64::got_size): Add const.
5565         (Target_x86_64::got_entry_count): New function.
5566         (Target_x86_64::plt_entry_count): New function.
5567         (Target_x86_64::first_plt_entry_offset): New function.
5568         (Target_x86_64::plt_entry_size): New function.
5569         (Output_data_plt_x86_64::entry_count): New function.
5570         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5571         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5572
5573 2010-08-12  Cary Coutant  <ccoutant@google.com>
5574
5575         * archive.cc: Include incremental.h.
5576         (Archive::Archive): Initialize incremental_info_.
5577         (Archive::include_member): Record archive members in incremental info.
5578         (Add_archive_symbols::run): Record begin and end of an archive in
5579         incremental info.
5580         (Lib_group::include_member): Record objects in incremental info.
5581         * archive.h (Incremental_archive_entry): Forward declaration.
5582         (Archive::set_incremental_info): New member function.
5583         (Archive::incremental_info): New member function.
5584         (Archive::Unused_symbol_iterator): New class.
5585         (Archive::unused_symbols_begin): New member function.
5586         (Archive::unused_symbols_end): New member function.
5587         (Archive::incremental_info_): New data member.
5588         * incremental-dump.cc (find_input_containing_global): New function.
5589         (dump_incremental_inputs): Dump new incremental info sections.
5590         * incremental.cc: Include symtab.h.
5591         (Output_section_incremental_inputs): New class.
5592         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5593         new incremental info sections.
5594         (Sized_incremental_binary::do_check_inputs): Likewise.
5595         (Incremental_inputs::report_archive): Remove.
5596         (Incremental_inputs::report_archive_begin): New function.
5597         (Incremental_inputs::report_archive_end): New function.
5598         (Incremental_inputs::report_object): New function.
5599         (Incremental_inputs::finalize_inputs): Remove.
5600         (Incremental_inputs::report_input_section): New function.
5601         (Incremental_inputs::report_script): Rewrite.
5602         (Incremental_inputs::finalize): Do nothing but finalize string table.
5603         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5604         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5605         (Incremental_inputs::create_data_sections): New function.
5606         (Incremental_inputs::relocs_entsize): New function.
5607         (Output_section_incremental_inputs::set_final_data_size): New function.
5608         (Output_section_incremental_inputs::do_write): New function.
5609         (Output_section_incremental_inputs::write_header): New function.
5610         (Output_section_incremental_inputs::write_input_files): New function.
5611         (Output_section_incremental_inputs::write_info_blocks): New function.
5612         (Output_section_incremental_inputs::write_symtab): New function.
5613         * incremental.h (Incremental_script_entry): Forward declaration.
5614         (Incremental_object_entry): Forward declaration.
5615         (Incremental_archive_entry): Forward declaration.
5616         (Incremental_inputs): Forward declaration.
5617         (Incremental_inputs_header_data): Remove.
5618         (Incremental_inputs_header): Remove.
5619         (Incremental_inputs_header_write): Remove.
5620         (Incremental_inputs_entry_data): Remove.
5621         (Incremental_inputs_entry): Remove.
5622         (Incremental_inputs_entry_write): Remove.
5623         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5624         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5625         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5626         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5627         Likewise.
5628         (Incremental_input_entry): New class.
5629         (Incremental_script_entry): New class.
5630         (Incremental_object_entry): New class.
5631         (Incremental_archive_entry): New class.
5632         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5633         (Incremental_inputs::report_inputs): Remove.
5634         (Incremental_inputs::report_archive): Remove.
5635         (Incremental_inputs::report_archive_begin): New function.
5636         (Incremental_inputs::report_archive_end): New function.
5637         (Incremental_inputs::report_object): Change prototype.
5638         (Incremental_inputs::report_input_section): New function.
5639         (Incremental_inputs::report_script): Change prototype.
5640         (Incremental_inputs::get_reloc_count): New function.
5641         (Incremental_inputs::set_reloc_count): New function.
5642         (Incremental_inputs::create_data_sections): New function.
5643         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5644         (Incremental_inputs::inputs_section): New function.
5645         (Incremental_inputs::symtab_section): New function.
5646         (Incremental_inputs::relocs_section): New function.
5647         (Incremental_inputs::get_stringpool): Add const.
5648         (Incremental_inputs::command_line): Add const.
5649         (Incremental_inputs::inputs): Remove.
5650         (Incremental_inputs::command_line_key): New function.
5651         (Incremental_inputs::input_file_count): New function.
5652         (Incremental_inputs::input_files): New function.
5653         (Incremental_inputs::relocs_entsize): New function.
5654         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5655         (Incremental_inputs::finalize_inputs): Remove.
5656         (Incremental_inputs::Input_info): Remove.
5657         (Incremental_inputs::lock_): Remove.
5658         (Incremental_inputs::inputs_): Change type.
5659         (Incremental_inputs::inputs_map_): Remove.
5660         (Incremental_inputs::current_object_entry_): New data member.
5661         (Incremental_inputs::inputs_section_): New data member.
5662         (Incremental_inputs::symtab_section_): New data member.
5663         (Incremental_inputs::relocs_section_): New data member.
5664         (Incremental_inputs::reloc_count_): New data member.
5665         (Incremental_inputs_reader): New class.
5666         (Incremental_symtab_reader): New class.
5667         (Incremental_relocs_reader): New class.
5668         * layout.cc (Layout::finalize): Move finalization of incremental info
5669         and creation of incremental info sections to follow finalization of
5670         symbol table.  Set offsets for postprocessing sections.
5671         (Layout::create_incremental_info_sections): Call
5672         Incremental_inputs::create_data_sections.  Add incremental symtab
5673         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5674         sections to layout after input sections.
5675         * layout.h (struct Timespec): Forward declaration.
5676         (Layout::incremental_inputs): Add const.
5677         (Layout::create_incremental_info_sections): Add parameter.
5678         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5679         * object.cc: Include incremental.h.
5680         (Relobj::finalize_incremental_relocs): New function.
5681         (Sized_relobj::do_layout): Record input sections in incremental info.
5682         * object.h (Object::output_section): New function.
5683         (Object::output_section_offset): Moved from Relobj.
5684         (Object::get_incremental_reloc_base): New function.
5685         (Object::get_incremental_reloc_count): New function.
5686         (Object::do_output_section): New function.
5687         (Object::do_output_section_offset): Moved from Relobj.
5688         (Object::do_get_incremental_reloc_base): New function.
5689         (Object::do_get_incremental_reloc_count): New function.
5690         (Object::Object): Initialize new data members.
5691         (Relobj::output_section): Renamed do_output_section and moved to
5692         protected.
5693         (Relobj::output_section_offset): Moved to Object.
5694         (Relobj::do_get_incremental_reloc_base): New function.
5695         (Relobj::do_get_incremental_reloc_count): New function.
5696         (Relobj::allocate_incremental_reloc_counts): New function.
5697         (Relobj::count_incremental_reloc): New function.
5698         (Relobj::finalize_incremental_relocs): New function.
5699         (Relobj::next_incremental_reloc_index): New function.
5700         (Relobj::reloc_counts_): New data member.
5701         (Relobj::reloc_bases_): New data member.
5702         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5703         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5704         (Sized_relobj::incremental_relocs_scan): New function.
5705         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5706         (Sized_relobj::incremental_relocs_write): New function.
5707         (Sized_relobj::incremental_relocs_write_reltype): New function.
5708         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5709         incremental link.
5710         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5711         archives and object files elsewhere.
5712         (Add_symbols::run): Report object files here.
5713         (Finish_group::run): Report end of archive at end of group.
5714         * reloc.cc: Include layout.h, incremental.h.
5715         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5716         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5717         (Sized_relobj::incremental_relocs_scan): New function.
5718         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5719         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5720         (Sized_relobj::incremental_relocs_write): New function.
5721         (Sized_relobj::incremental_relocs_write_reltype): New function.
5722         * script.cc (read_input_script): Rewrite test for incremental link.
5723         Change call to Incremental_inputs::report_script.
5724         * symtab.h (Symbol_table::first_global_index): New function.
5725         (Symbol_table::output_count): New function.
5726
5727 2010-08-12  Doug Kwan  <dougkwan@google.com>
5728
5729         * arm.cc (Target_arm::merge_object_attributes): Check command line
5730         options --no-wchar-size-warning and --no-enum-size-warning.
5731         * options.h (General_options): Add ld-compatible options
5732         --no-enum-size-warning and --no-wchar-size-warning.
5733
5734 2010-08-04  Ian Lance Taylor  <iant@google.com>
5735
5736         * x86_64.cc (Target_x86_64::Scan::local): Use
5737         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5738         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5739         (Target_x86_64::Scan::global): Likewise.
5740         (Target_x86_64::Relocate::relocate): Likewise.
5741         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5742         Likewise.
5743
5744 2010-08-03  Cary Coutant  <ccoutant@google.com>
5745
5746         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5747         to reserve space in merged_strings vector. Keep total input size
5748         for stats.
5749         (Output_merge_string::do_print_merge_stats): Print total input size.
5750         * merge.h (Output_merge_string): Add input_size_ field.
5751         * stringpool.cc (Stringpool_template::string_length): Move
5752         implementations out of Stringpool_template class and place in
5753         stringpool.h.
5754         * stringpool.h (string_length): Move out of Stringpool_template.
5755
5756 2010-08-03  Ian Lance Taylor  <iant@google.com>
5757
5758         PR 11712
5759         * layout.cc (relaxation_loop_body): If address of load segment is
5760         set, adjust address to include headers if possible.
5761
5762 2010-08-03  Ian Lance Taylor  <iant@google.com>
5763
5764         * version.cc (version_string): Bump to 1.10.
5765
5766 2010-08-03  Ian Lance Taylor  <iant@google.com>
5767
5768         PR 11805
5769         * layout.h (enum Output_section_order): Define.
5770         (class Layout): Update declarations.
5771         * layout.cc (Layout::get_output_section): Add order parameter.
5772         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5773         is_first_non_relro parameters.  Change all callers.
5774         (Layout::choose_output_section): Likewise.
5775         (Layout::add_output_section_data): Likewise.
5776         (Layout::make_output_section): Likewise.  Set order.
5777         (Layout::default_section_order): New function.
5778         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5779         * output.cc (Output_section::Output_section): Initialize order_.
5780         Don't initialize deleted fields.
5781         (Output_segment::Output_segment): Don't initialize deleted
5782         fields.
5783         (Output_segment::add_output_section_to_load): New function
5784         replacing add_output_section.  Change all callers to call this or
5785         add_output_section_to_nonload.
5786         (Output_segment::add_output_section_to_nonload): New function.
5787         (Output_segment::remove_output_section): Rewrite.
5788         (Output_segment::add_initial_output_data): Likewise.
5789         (Output_segment::has_any_data_sections): Likewise.
5790         (Output_segment::is_first_section_relro): Likewise.
5791         (Output_segment::maximum_alignment): Likewise.
5792         (Output_segment::has_dynamic_reloc): New function replacing
5793         dynamic_reloc_count.  Change all callers.
5794         (Output_segment::has_dynamic_reloc_list): New function replacing
5795         dynamic_reloc_count_list.  Change all callers.
5796         (Output_segment::set_section_addresses): Rewrite.
5797         (Output_segment::set_offset): Rewrite.
5798         (Output_segment::find_first_and_last_list): Remove.
5799         (Output_segment::set_tls_offsets): Rewrite.
5800         (Output_segment::first_section_load_address): Likewise.
5801         (Output_segment::output_section_count): Likewise.
5802         (Output_segment::section_with_lowest_load_address): Likewise.
5803         (Output_segment::write_section_headers): Likewise.
5804         (Output_segment::print_sections_to_map): Likewise.
5805         * output.h (class Output_data): Remove dynamic_reloc_count_
5806         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5807         (Output_data::add_dynamic_reloc): Rewrite.
5808         (Output_data::has_dynamic_reloc): New function.
5809         (Output_data::dynamic_reloc_count): Remove.
5810         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5811         is_last_relro_, is_first_non_relro_, is_interp_,
5812         is_dynamic_linker_section_ fields.  Add order and set_order
5813         functions.  Remove is_relro_local, set_is_relro_local,
5814         is_last_relro, set_is_last_relro, is_first_non_relro,
5815         set_is_first_non_relro functions, is_interp, set_is_interp,
5816         is_dynamic_linker_section, and set_is_dynamic_linker_section
5817         functions.
5818         (class Output_segment): Change Output_data_list from std::list to
5819         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5820         output_bss_ fields.  Update declarations.
5821
5822 2010-08-02  Ian Lance Taylor  <iant@google.com>
5823
5824         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5825         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5826         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5827
5828 2010-08-02  Ian Lance Taylor  <iant@google.com>
5829
5830         PR 11855
5831         * script.cc (Script_options::Script_options): Initialize
5832         symbol_definitions_ and symbol_references_.
5833         (Script_options::add_symbol_assignment): Update
5834         symbol_definitions_ and symbol_references_.
5835         (Script_options::add_symbol_reference): New function.
5836         (script_symbol): New function.
5837         * script.h (class Script_options): Add symbol_definitions_ and
5838         symbol_references_ fields.
5839         (Script_options::referenced_const_iterator): New type.
5840         (Script_options::referenced_begin): New function.
5841         (Script_options::referenced_end): New function.
5842         (Script_options::is_referenced): New function.
5843         (Script_options::any_unreferenced): New function.
5844         * script-c.h (script_symbol): Declare.
5845         * yyscript.y (exp): Call script_symbol.
5846         * symtab.cc: Include "script.h".
5847         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5848         Change all callers.  Check symbols referenced by scripts.
5849         (Symbol_table::add_undefined_symbols_from_command_line): Add
5850         layout parameter.  Change all callers.
5851         (Symbol_table::do_add_undefined_symbols_from_command_line):
5852         Likewise.  Break out loop body.  Check symbols referenced by
5853         scripts.
5854         (Symbol_table::add_undefined_symbol_from_command_line): New
5855         function broken out of
5856         do_add_undefined_symbols_from_command_line.
5857         * symtab.h (class Symbol_table): Update declarations.
5858         * archive.cc: Include "layout.h".
5859         (Archive::should_include_member): Add layout parameter.  Change
5860         all callers.  Check for symbol mentioned in expression.
5861         * archive.h (class Archive): Update declaration.
5862         * object.cc (Sized_relobj::do_should_include_member): Add layout
5863         parameter.
5864         * object.h (Object::should_include_member): Add layout parameter.
5865         Change all callers.
5866         (Object::do_should_include_member): Add layout parameter.
5867         (class Sized_relobj): Update declaration.
5868         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5869         parameter.
5870         * dynobj.h (class Sized_dynobj): Update declaration.
5871         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5872         layout parameter.
5873         * plugin.h (class Sized_pluginobj): Update declaration.
5874
5875 2010-08-02  Ian Lance Taylor  <iant@google.com>
5876
5877         PR 11866
5878         * output.cc (Output_segment::set_offset): Search for the first and
5879         last sections rather than assuming that the list is in order.
5880         (Output_segment::find_first_and_last_list): New function.
5881         * output.h (class Output_segment): Update declarations.
5882         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5883         (relro_strip_test_SOURCES): New variable.
5884         (relro_strip_test_DEPENDENCIES): New variable.
5885         (relro_strip_test_LDFLAGS): New variable.
5886         (relro_strip_test_LDADD): New variable.
5887         (relro_strip_test.so): New target.
5888
5889 2010-08-02  Ian Lance Taylor  <iant@google.com>
5890
5891         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5892         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5893         (Target_i386::got_tlsdesc_section): New function.
5894         (Target_i386::got_section): Create space for GOT entries for
5895         TLSDESC relocations.
5896         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5897         R_386_TLS_GOTDESC.
5898         (Target_i386::Scan::global): Likewise.
5899         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5900         using TLSDESC GOT.
5901         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5902         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5903         (Target_x86_64::got_tlsdesc_section): New function.
5904         (Target_x86_64::got_section): Create space for GOT entries for
5905         TLSDESC relocations.
5906         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5907         R_386_TLS_GOTDESC.
5908         (Target_x86_64::Scan::global): Likewise.
5909         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5910         using TLSDESC GOT.
5911
5912 2010-08-02  Ian Lance Taylor  <iant@google.com>
5913
5914         * testsuite/final_layout.sh: Use dc to convert from hex to
5915         decimal.
5916
5917 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5918
5919         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5920         paramter to the call to gold::gc_process_relocs.
5921         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5922         paramter to the call to gold::gc_process_relocs.
5923         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5924         parameter to the call to gold::gc_process_relocs.
5925         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5926         template parameter to the call to gold::gc_process_relocs.
5927         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5928         paramter to the call to gold::gc_process_relocs.
5929         * gc.h (get_embedded_addend_size): New function.
5930         (gc_process_relocs): Save the size of the reloc for use by ICF.
5931         * icf.cc (get_section_contents): Get the addend from the text section
5932         for SHT_REL relocation sections.
5933         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5934         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5935         * int_encoding.h (read_from_pointer): New overloaded function.
5936         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5937         * testsuite/icf_sht_rel_addend_test.sh: New file.
5938         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5939         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5940
5941 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5942
5943         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5944         * Makefile.in: Regenerate.
5945         * testsuite/Makefile.in: Regenerate.
5946
5947 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5948
5949         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5950         * gold/testsuite/debug_msg.cc: Likewise.
5951         * gold/testsuite/odr_violation1.cc
5952         * gold/testsuite/odr_violation2.cc
5953
5954 2010-07-21  Cary Coutant  <ccoutant@google.com>
5955
5956         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5957         string, and length fields.
5958         (Output_merge_string::Merged_strings_list): New type.
5959         (Output_merge_string::Merged_strings_lists): New typedef.
5960         (Output_merge_string): Replace merged_strings_ with
5961         merged_strings_lists_.
5962         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5963         Merged_strings_list per input object and section.  Don't store pointer
5964         to the string.  Don't store length with each merged string entry.
5965         (Output_merge_string::finalize_merged_data): Loop over list of merged
5966         strings lists.  Recompute length of each merged string.
5967
5968 2010-07-15  Cary Coutant  <ccoutant@google.com>
5969
5970         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5971         here.
5972
5973 2010-07-14  Ian Lance Taylor  <iant@google.com>
5974
5975         * descriptors.cc (Descriptors::open): Report correct name in error
5976         message.
5977
5978 2010-07-13  Doug Kwan  <dougkwan@google.com>
5979
5980         * arm.cc (Arm_input_section::Arm_input_section): For a
5981         SHT_ARM_EXIDX section, always keeps the input sections.
5982         (Arm_input_section::set_exidx_section_link): New method.
5983         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5984         has_errors_ to false.
5985         (Arm_exidx_input_section::has_errors,
5986         Arm_exidx_input_section::set_has_errors): New methods.
5987         (Arm_exidx_input_section::has_errors_): New data member.
5988         (Arm_relobj::get_exidx_shndx_list): New method.
5989         (Arm_output_section::append_text_sections_to_list): Do not skip
5990         section without SHF_EXECINSTR.
5991         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5992         errors.
5993         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5994         section header.  Make error messages more verbose.  Check for
5995         a non-executable section linked to an EXIDX section.
5996         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5997         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5998         check that there is no deferred EXIDX section if we exit early.
5999         Instead of not making an EXIDX section in case of an error, make one
6000         and set the has_errors flag of it.
6001         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6002         in a relocatable link.
6003         (Target_arm::do_relax): Look for the EXIDX output section instead of
6004         assuming that it is called .ARM.exidx.
6005         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6006         section list.  Do not check for SHF_EXECINSTR section flags but
6007         skip any input section with errors.
6008         * output.cc (Output_section::Output_section): Initialize
6009         always_keeps_input_sections_ to false.
6010         (Output_section::add_input_section): Check for
6011         always_keeps_input_sections_.
6012         *  output.h (Output_section::always_keeps_input_sections,
6013         Output_section::set_always_keeps_input_sections): New methods.
6014         (Output_section::always_keeps_input_sections): New data member.
6015
6016 2010-07-13  Rafael Espindola  <espindola@google.com>
6017
6018         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6019         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6020
6021 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6022             Ian Lance Taylor  <iant@google.com>
6023
6024         * output.h (Output_section_lookup_maps::add_merge_section):
6025         Correct check of whether value was inserted.
6026         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6027         (Output_section_lookup_maps::add_relaxed_input_section):
6028         Likewise.
6029         * arm.cc (Target_arm::got_section): Remove used local os.
6030         * i386.cc (Target_i386::got_section): Likewise.
6031         * x86_64.cc (Target_x86_64::got_section): Likewise.
6032         * sparc.cc (Target_sparc::got_section): Likewise.
6033         (Target_sparc::relocate): Remove unused local have_got_offset.
6034         * powerpc.cc (Target_powerpc::relocate): Likewise.
6035
6036 2010-07-13  Ian Lance Taylor  <iant@google.com>
6037
6038         * compressed_output.cc (zlib_decompress): Fix signature in
6039         !HAVE_ZLIB_H case.
6040
6041         * archive.cc (Archive::include_member): Unlock an external member
6042         of a thin archive.  Don't bother to delete an object we know is
6043         NULL.
6044
6045 2010-07-12  Cary Coutant  <ccoutant@google.com>
6046
6047         * compressed_output.cc (zlib_decompress): New function.
6048         (get_uncompressed_size): New function.
6049         (decompress_input_section): New function.
6050         * compressed_output.h (get_uncompressed_size): New function.
6051         (decompress_input_section): New function.
6052         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6053         Handle compressed debug sections.
6054         * layout.cc (is_compressed_debug_section): New function.
6055         (Layout::output_section_name): Map compressed section names to
6056         canonical names.
6057         * layout.h (is_compressed_debug_section): New function.
6058         (is_debug_info_section): Recognize compressed debug sections.
6059         * merge.cc: Include compressed_output.h.
6060         (Output_merge_data::do_add_input_section): Handle compressed
6061         debug sections.
6062         (Output_merge_string::do_add_input_section): Handle compressed
6063         debug sections.
6064         * object.cc: Include compressed_output.h.
6065         (Sized_relobj::Sized_relobj): Initialize new data members.
6066         (build_compressed_section_map): New function.
6067         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6068         * object.h (Object::section_is_compressed): New method.
6069         (Object::do_section_is_compressed): New method.
6070         (Sized_relobj::Compressed_section_map): New type.
6071         (Sized_relobj::do_section_is_compressed): New method.
6072         (Sized_relobj::compressed_sections_): New data member.
6073         * output.cc (Output_section::add_input_section): Handle compressed
6074         debug sections.
6075         * reloc.cc: Include compressed_output.h.
6076         (Sized_relobj::write_sections): Handle compressed debug sections.
6077
6078 2010-07-08  Cary Coutant  <ccoutant@google.com>
6079
6080         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6081         weak when resolving to a dynamic def.
6082         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6083         for weak undef/dynamic def cases. Adjust callers.
6084         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6085         undef_binding_weak_.
6086         (Symbol_table::sized_write_globals): Adjust symbol binding.
6087         (Symbol_table::sized_write_symbol): Add binding parameter.
6088         * symtab.h (Symbol::set_undef_binding): New method.
6089         (Symbol::is_undef_binding_weak): New method.
6090         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6091         (Symbol_table::should_override): Add new parameter.
6092         (Symbol_table::sized_write_symbol): Add new parameter.
6093
6094         * testsuite/weak_undef_file1.cc: Add new test case.
6095         * testsuite/weak_undef_file2.cc: Fix header comment.
6096         * testsuite/weak_undef_test.cc: Add new test case.
6097
6098 2010-06-29  Doug Kwan  <dougkwan@google.com>
6099
6100         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6101         Initialize USE_SYMBOL_.
6102         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6103         definition.
6104         (Arm_reloc_property::uses_symbol_): New data member declaration.
6105         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6106         uses symbol value and symbol is undefined but not weakly undefined.
6107
6108 2010-06-28  Rafael Espindola  <espindola@google.com>
6109
6110         * plugin.cc (Plugin::load): Use dlerror.
6111
6112 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6113
6114         * symtab.cc (detect_odr_violations): When reporting an ODR
6115         violation, report an object where the symbol is defined.
6116
6117 2010-06-25  Doug Kwan  <dougkwan@google.com>
6118
6119         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6120         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6121         definition.
6122         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6123         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6124         target hook to detect function points.
6125         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6126         * icf.h (Icf::check_section_for_function_pointers): Change type of
6127         parameter SECTION_NAME to const reference to std::string.  Use
6128         target hook to determine if section may have unsafe pointers.
6129         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6130         method definition.
6131
6132 2010-06-21  Rafael Espindola  <espindola@google.com>
6133
6134         * fileread.cc (Input_file::find_fie): New
6135         (Input_file::open): Use Input_file::find_fie.
6136         * fileread.h (Input_file::find_fie): New
6137         * plugin.cc (set_extra_library_path): New.
6138         (Plugin::load): Add set_extra_library_path to the transfer vector.
6139         (Plugin_manager::set_extra_library_path): New.
6140         (Plugin_manager::add_input_file): Use the extra search path if set.
6141         (set_extra_library_path(): New.
6142         * plugin.h (Plugin_manager): Add set_extra_library_path and
6143         extra_search_path_.
6144
6145 2010-06-19  Cary Coutant  <ccoutant@google.com>
6146
6147         * layout.cc (gdb_sections): Add .debug_types.
6148         (lines_only_debug_sections): Likewise.
6149
6150 2010-06-18  Rafael Espindola  <espindola@google.com>
6151
6152         * plugin.cc (add_input_file,add_input_library)
6153         (Plugin_manager::add_input_file): Make filename arguments const.
6154         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6155         const.
6156
6157 2010-06-16  Doug Kwan  <dougkwan@google.com>
6158
6159         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6160         .ARM.attributes section if we have not merged any input
6161         attributes sections.
6162
6163 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6164
6165         * arm.cc: Allow combining objects with no EABI version
6166         information.
6167
6168 2010-06-15  Rafael Espindola  <espindola@google.com>
6169
6170         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6171
6172 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6173
6174         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6175         (struct iovec): Correct !HAVE_READV definition.
6176
6177 2010-06-10  Cary Coutant  <ccoutant@google.com>
6178
6179         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6180         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6181         reloc sections.
6182         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6183
6184         PR 11683
6185         * symtab.h (Symbol::is_placeholder): New member function.
6186         * target-reloc.h (relocate_section): Check for placeholder symbols.
6187
6188         * testsuite/Makefile.am (plugin_test_8): New test.
6189         (plugin_test_9): New test.
6190         * testsuite/Makefile.in: Regenerate.
6191
6192 2010-06-09  Nick Clifton  <nickc@redhat.com>
6193
6194         * yyscript.y (input_list_element): Allow strings prefixed with
6195         the '-' character.  Treat these as libraries.
6196         * script.cc (script_add_library): New function.  Adds a library
6197         specified by "-l<name>" found in an input script.
6198         * script-c.h: Add prototype for script_add_library.
6199
6200 2010-06-07  Doug Kwan  <dougkwan@google.com>
6201
6202         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6203         Restrict stub-group size to be within long conditional branch
6204         range when working around cortex-A8 erratum.
6205
6206 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6207
6208         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6209         #ifdef typo.
6210
6211 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6212
6213         PR gold/11658
6214         * output.cc
6215         (Output_section::Input_section_sort_entry::compare_section_ordering):
6216         Change to return non-zero correctly.
6217         (Output_section::Input_section_sort_section_order_index_compare
6218         ::operator()): Change to fix ambiguity in comparisons.
6219
6220 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6221
6222         * gold.h (is_wildcard_string): New function.
6223         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6224         (Layout::layout_eh_frame): Ditto.
6225         (Layout::find_section_order_index): New method.
6226         (Layout::read_layout_from_file): New method.
6227         * layout.h (Layout::find_section_order_index): New method.
6228         (Layout::read_layout_from_file): New method.
6229         (Layout::input_section_position_): New private member.
6230         (Layout::input_section_glob_): New private member.
6231         * main.cc (main): Call read_layout_from_file here.
6232         * options.h (--section-ordering-file): New option.
6233         * output.cc (Output_section::input_section_order_specified_): New
6234         member.
6235         (Output_section::Output_section): Initialize new member.
6236         (Output_section::add_input_section): Add new parameter.
6237         Keep input sections when --section-ordering-file is used.
6238         (Output_section::set_final_data_size): Sort input sections when
6239         section ordering file is specified.
6240         (Output_section::Input_section_sort_entry): Add new parameter.
6241         Check sorting type.
6242         (Output_section::Input_section_sort_entry::compare_section_ordering):
6243         New method.
6244         (Output_section::Input_section_sort_compare::operator()): Change to
6245         consider section_order_index.
6246         (Output_section::Input_section_sort_init_fini_compare::operator()):
6247         Change to consider section_order_index.
6248         (Output_section::Input_section_sort_section_order_index_compare
6249         ::operator()): New method.
6250         (Output_section::sort_attached_input_sections): Change to sort
6251         according to section order when specified.
6252         (Output_section::add_input_section<32, true>): Add new parameter.
6253         (Output_section::add_input_section<64, true>): Add new parameter.
6254         (Output_section::add_input_section<32, false>): Add new parameter.
6255         (Output_section::add_input_section<64, false>): Add new parameter.
6256         * output.h (Output_section::add_input_section): Add new parameter.
6257         (Output_section::input_section_order_specified): New
6258         method.
6259         (Output_section::set_input_section_order_specified): New method.
6260         (Input_section::Input_section): Initialize section_order_index_.
6261         (Input_section::section_order_index): New method.
6262         (Input_section::set_section_order_index): New method.
6263         (Input_section::section_order_index_): New member.
6264         (Input_section::Input_section_sort_section_order_index_compare): New
6265         struct.
6266         (Output_section::input_section_order_specified_): New member.
6267         * script-sections.cc (is_wildcard_string): Delete and move modified
6268         method to gold.h.
6269         (Output_section_element_input::Output_section_element_input): Modify
6270         call to is_wildcard_string.
6271         (Output_section_element_input::Input_section_pattern
6272         ::Input_section_pattern): Ditto.
6273         (Output_section_element_input::Output_section_element_input): Ditto.
6274         * testsuite/Makefile.am (final_layout): New test case.
6275         * testsuite/Makefile.in: Regenerate.
6276         * testsuite/final_layout.cc: New file.
6277         * testsuite/final_layout.sh: New file.
6278
6279 2010-06-01  Rafael Espindola  <espindola@google.com>
6280
6281         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6282
6283 2010-06-01  Rafael Espindola  <espindola@google.com>
6284
6285         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6286         visibility of symbols.
6287
6288 2010-05-27  Doug Kwan  <dougkwan@google.com>
6289
6290         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6291         from start of output section instead of address for a local symbol
6292         in a merged or relaxed section when doing a relocatable link.
6293
6294 2010-05-26  Rafael Espindola  <espindola@google.com>
6295
6296         PR 11604
6297         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6298         adding sections the garbage collector removed.
6299         * gold/testsuite/Makefile.am: Add test.
6300         * gold/testsuite/Makefile.in: Regenerate.
6301         * gold/testsuite/plugin_test_7.sh: New.
6302         * gold/testsuite/plugin_test_7_1.c: New.
6303         * gold/testsuite/plugin_test_7_2.c: New.
6304
6305 2010-05-26  Rafael Espindola  <espindola@google.com>
6306
6307         * script-sections.cc (Output_section_definition::set_section_addresses):
6308         Check for --section-start.
6309
6310 2010-05-26  Doug Kwan  <dougkwan@google.com>
6311
6312         * arm.cc (Arm_scan_relocatable_relocs): New class.
6313         (Target_arm::relocate_special_relocatable): New method.
6314         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6315         (Arm_relocate_functions::thumb_branch_common): Same.
6316         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6317         instead of Default_scan_relocatable_relocs.
6318         * target-reloc.h (relocate_for_relocatable): Let target handle
6319         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6320         * target.h (Sized_target::relocate_special_relocatable): New method.
6321
6322 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6323
6324         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6325
6326 2010-05-23  Doug Kwan  <dougkwan@google.com>
6327
6328         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6329         instead of a cast.
6330         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6331         with a direct branch, not a conditional branch, to a stub.
6332         * merge.cc (Output_merge_base::record_input_section): New method
6333         defintion.
6334         (Output_merge_data::do_add_input_section): Record input section if
6335         keeps-input-sections flag is set.
6336         (Output_merge_string::do_add_input_section): Ditto.
6337         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6338         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6339         INPUT_SECTIONS_.
6340         (Output_merge_base::keeps_input_sections,
6341         Output_merge_base::set_keeps_input_sections,
6342         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6343         method definitions.
6344         (Output_merge_base::Input_sections): New type declaration.
6345         (Output_merge_base::input_sections_begin,
6346         Output_merge_base::input_sections_end,
6347         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6348         (Output_merge_base::bool keeps_input_sections_,
6349         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6350         Output_merge_base::input_sections_): New data members.
6351         (Output_merge_data::do_set_keeps_input_sections): New method
6352         defintion.
6353         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6354         * output.cc (Output_section::Input_section::relobj): Move method
6355         defintion from class declaration to here and handle merge sections.
6356         (Output_section::Input_section::shndx): Ditto.
6357         (Output_section::Output_section): Remove initializations of removed
6358         data members and initialize new data member LOOKUP_MAPS_.
6359         (Output_section::add_input_section): Set keeps-input-sections flag
6360         for a newly created merge output section as appropriate.  Adjust code
6361         to use Output_section_lookup_maps class.
6362         (Output_section::add_relaxed_input_section): Adjst code for lookup
6363         maps code refactoring.
6364         (Output_section::add_merge_input_section): Add a new parameter
6365         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6366         class.  If adding input section to a newly created merge output
6367         section fails, remove the new merge section.
6368         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6369         Adjust code for use of the Output_section_lookup_maps class.
6370         (Output_section::find_merge_section): Ditto.
6371         (Output_section::build_lookup_maps): New method defintion.
6372         (Output_section::find_relaxed_input_section): Adjust code to use
6373         Output_section_lookup_maps class.
6374         (Output_section::get_input_sections): Export merge sections.  Adjust
6375         code to use Output_section_lookup_maps class.
6376         (Output_section:::add_script_input_section): Adjust code to use
6377         Output_section_lookup_maps class.  Update lookup maps for merge
6378         sections also.
6379         (Output_section::discard_states): Use Output_section_lookup_maps.
6380         (Output_section::restore_states): Same.
6381         * output.h (Merge_section_properties): Move class defintion out of
6382         Output_section.
6383         (Output_section_lookup_maps): New class.
6384         (Output_section::Input_section::is_merge_section): New method
6385         defintion.
6386         (Output_section::Input_section::relobj): Move defintion out of class
6387         defintion.  Declare method only.
6388         (Output_section::Input_section::shndx): Ditto.
6389         (Output_section::Input_section::output_merge_base): New method defintion.
6390         (Output_section::Input_section::u2_.pomb): New union field.
6391         (Output_section::Merge_section_by_properties_map,
6392         Output_section::Output_section_data_by_input_section_map,
6393         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6394         Remove types.
6395         (Output_section::add_merge_input_section): Add new parameter
6396         KEEPS_INPUT_SECTIONS.
6397         (Output_section::build_lookup_maps): New method declaration.
6398         (Output_section::merge_section_map_,
6399         Output_section::merge_section_by_properties_map_,
6400         Output_section::relaxed_input_section_map_,
6401         Output_section::is_relaxed_input_section_map_valid_): Remove data
6402         members.
6403         (Output_section::lookup_maps_): New data member.
6404
6405 2010-05-21  Doug Kwan  <dougkwan@google.com>
6406
6407         PR gold/11619
6408         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6409         avoid a compilation error.
6410
6411 2010-05-19  Rafael Espindola  <espindola@google.com>
6412
6413         * script-sections.cc (Output_section_definition::allocate_to_segment):
6414         Update the phdrs_list even when the output section is NULL.
6415         * testsuite/Makefile.am: Add test.
6416         * testsuite/Makefile.in: Regenerate.
6417         * testsuite/script_test_9.cc: New.
6418         * testsuite/script_test_9.sh: New.
6419         * testsuite/script_test_9.t: New.
6420
6421 2010-05-19  Doug Kwan  <dougkwan@google.com>
6422
6423         * arm.cc (Arm_input_section::original_size): New method.
6424         (Arm_input_section::do_addralign): Add a cast.
6425         (Arm_input_section::do_output_offset): Remove static cast.
6426         (Arm_input_section::original_addralign,
6427          Arm_input_section::original_size_): Change type to uint32_t.
6428         (Arm_input_section::init): Add safe casts for section alignment
6429         and size.
6430         (Arm_input_section::set_final_data_size): Do not set address and
6431         offset of stub table.
6432         (Arm_output_section::fix_exidx_coverage): Change use of of
6433         Output_section::Simple_input_section to that of
6434         Output_section::Input_section.
6435         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6436         except for the first pass.
6437         * output.cc (Output_section::get_input_sections): Change type of
6438         input_sections to std::list<Input_section>.
6439         (Output_section::add_script_input_section): Rename from
6440         Output_section::add_simple_input_section.  Change type of SIS
6441         parameter from Simple_input_section to Input_section.
6442         * output.h (Output_section::Simple_input_section): Remove class.
6443         (Output_section::Input_section): Change class visibility to public.
6444         (Output_section::Input_section::addralign): Use stored alignments
6445         for special input sections if set.
6446         (Output_section::Input_section::set_addralign): New method.
6447         (Output_section::get_input_sections): Change parameter type from
6448         list of Simple_input_section to list of Input_section.
6449         (Output_section::add_script_input_section): Rename from
6450         Output_section::add_simple_input_section. Change first parameter's
6451         type from Simple_input_section to Input_section and remove the
6452         second and third parameters.
6453         * script-sections.cc (Input_section::Input_section_list): Change
6454         type to list of Output_section::Input_section/
6455         (Input_section_info::Input_section_info): Change parameter type of
6456         INPUT_SECTION to Output_section::Input_section.
6457         (Input_section_info::input_section): Change return type.
6458         (Input_section_info::input_section_): Change type to
6459         Output_section::Input_section.
6460         (Output_section_element_input::set_section_addresses): Adjust code
6461         to use Output_section::Input_section instead of
6462         Output_section::Simple_input_section.  Adjust code for renaming
6463         of Output_section::add_simple_input_section.
6464         (Orphan_output_section::set_section_addresses): Ditto.
6465
6466 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6467
6468         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6469         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6470
6471 2010-05-18  Rafael Espindola  <espindola@google.com>
6472
6473         * options.cc (General_options::finalize): Handle -nostdlib.
6474         * options.h (nostdlib): New option.
6475         * script.cc (script_add_search_dir): Handle -nostdlib.
6476
6477 2010-05-12  Doug Kwan  <dougkwan@google.com>
6478
6479         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6480         attributes section only if there no attributes section after merging.
6481         (Target_arm::merge_object_attributes): Move value of
6482         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6483         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6484         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6485         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6486         and arm_attr_merge_7.stdout.
6487         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6488         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6489         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6490         arm_attr_merge_7b.o): New rules.
6491         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6492         arm_attr_merge_7
6493         * testsuite/Makefile.in: Regenerate.
6494         * testsuite/arm_attr_merge.sh: New file.
6495         * testsuite/arm_attr_merge_[67][ab].s: Same.
6496
6497 2010-05-05  Nick Clifton  <nickc@redhat.com>
6498
6499         * po/es.po: Updated Spanish translation.
6500
6501 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6502
6503         * Makefile.am (install-exec-local): Properly install gold as
6504         default cross linker.
6505         * Makefile.in: Regenerated.
6506
6507 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6508             Nick Clifton  <nickc@redhat.com>
6509
6510         * configure.ac (install_as_default): Define and set to false
6511         unless --enable-gold or --enable-gold=both/gold has been
6512         specified.
6513         * configure: Regenerate.
6514
6515         * Makefile.am (install-exec-local): Install the executable as
6516         'ld.gold'.  If install_as_default is true then also install it as
6517         'ld'.
6518         * Makefile.in: Regenerated.
6519
6520 2010-04-24  Ian Lance Taylor  <iant@google.com>
6521
6522         * layout.cc (Layout::layout_reloc): In relocatable link don't
6523         combine reloc sections for grouped sections.
6524
6525 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6526
6527         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6528         sections that are not ordinary to icf.
6529         * icf.cc (get_section_contents): Handle relocation pointing to section
6530         with no object or shndx information.
6531         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6532         * testsuite/Makefile.in: Regenerate.
6533         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6534         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6535
6536 2010-04-22  Ian Lance Taylor  <iant@google.com>
6537
6538         * expression.cc (Expression::Expression_eval_info): Add
6539         result_alignment_pointer field.
6540         (Expression::eval_with_dot): Add result_alignment_pointer
6541         parameter.  Change all callers.
6542         (Expression::eval_maybe_dot): Likewise.
6543         (class Binary_expression): Add alignment_pointer parameter to
6544         left_value and right_value.  Change all callers.
6545         (BINARY_EXPRESSION): Set result alignment.
6546         (class Trinary_expression): Add alignment_pointer parameter to
6547         arg2_value and arg3_value.  Change all callers.
6548         (Trinary_cond::value): Set result alignment.
6549         (Max_expression::value, Min_expression::value): Likewise.
6550         (Align_expression::value): Likewise.
6551         * script-sections.cc (class Sections_element): Add dot_alignment
6552         parameter to set_section_addresses virtual function.  Update
6553         instantiations.
6554         (class Output_section_element): Likewise.
6555         (Script_sections::create_segments): Add dot_alignment parameter.
6556         Change all callers.
6557         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6558         (Script_sections::set_phdrs_clause_addresses): Likewise.
6559         * script-sections.h: Update declarations.
6560         * script.h: Update declarations.
6561         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6562         min_p_align.
6563         * testsuite/script_test_3.t: Set large alignment.
6564         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6565         segment has expected alignment.
6566
6567 2010-04-22  Nick Clifton  <nickc@redhat.com>
6568
6569         * po/gold.pot: Updated by the Translation project.
6570         * po/vi.po: Updated Vietnamese translation.
6571
6572 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6573
6574         * testsuite/Makefile.am (check_PROGRAMS): Add
6575         icf_virtual_function_folding_test.
6576         * testsuite/Makefile.in: Regenerated.
6577
6578 2010-04-15  Andrew Haley  <aph@redhat.com>
6579
6580         * options.h (merge_exidx_entries): New option.
6581         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6582         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6583         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6584         (Target_arm::merge_exidx_entries): New function.
6585         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6586         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6587         to Arm_exidx_fixup constructor.
6588         Add new arg, merge_exidx_entries.
6589         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6590         Arm_output_section::fix_exidx_coverage.
6591
6592 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6593
6594         * icf.cc (get_section_contents): Check for preemptible functions.
6595         Ignore addend when appropriate.
6596         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6597         section folded.
6598         (add_from_relobj): Check for section folded.
6599         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6600         * symtab.h (should_add_dynsym_entry): Add new parameter.
6601         * target-reloc.h (scan_relocs): Check for section folded.
6602         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6603         Check reloc types for function pointers in shared objects.
6604         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6605         case.
6606         (icf_preemptible_functions_test): New test case.
6607         (icf_string_merge_test): New test case.
6608         * testsuite.Makefile.in: Regenerate.
6609         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6610         bar_glob.  Refactor code.
6611         * testsuite/icf_preemptible_functions_test.cc: New file.
6612         * testsuite/icf_preemptible_functions_test.sh: New file.
6613         * testsuite/icf_string_merge_test.cc: New file.
6614         * testsuite/icf_string_merge_test.sh: New file.
6615         * testsuite/icf_virtual_function_folding_test.cc: New file.
6616         * testsuite/icf_virtual_function_folding_test.sh: New file.
6617
6618 2010-04-14  Doug Kwan  <dougkwan@google.com>
6619
6620         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6621         for local symbol recounting if we remove a section due to ICF.
6622         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6623         there are no regular objects in input.
6624
6625 2010-04-13  Doug Kwan  <dougkwan@google.com>
6626
6627         * arm.cc (Arm_input_section::set_final_data_size): Compute
6628         accurate final data size instead of using current data size.
6629
6630 2010-04-09  Doug Kwan  <dougkwan@google.com>
6631
6632         * layout.cc (Layout::choose_output_section): Handle script section
6633         types.
6634         (Layout::make_output_section_for_script): Add section type parameter.
6635         Handle script section types.
6636         * layout.h (Layout::make_output_section_for_script): Add section
6637         type parameter.
6638         * output.cc (Output_section::Output_section): Initialize data member
6639         is_noload_.
6640         (Output_section::do_reset_address_and_file_offset): Do not set address
6641         to 0 if section is a NOLOAD section.
6642         * output.h (Output_section::is_noload): New method.
6643         (Output_section::set_is_noload): Ditto.
6644         (Output_section::is_noload_): New data member.
6645         * script-c.h (Script_section_type): New enum type.
6646         (struct Parser_output_section_header): Add new file section_type.
6647         * script-sections.cc (Sections_element::output_section_name): Add
6648         parameter for returning script section type.
6649         (Output_section_definition::output_section_name): Ditto.
6650         (Output_section_definition::section_type)P; New method.
6651         (Output_section_definiton::script_section_type_name): Ditto.
6652         (Output_section_definition::script_section_type_): New data member.
6653         (Output_section_definition::Output_section_definition): Initialize
6654         data member Output_section_definition::script_section_type_.
6655         (Output_section_definition::create_sections): Pass script section type
6656         to Layout::make_output_section_for_script.
6657         (Output_section_definition::output_section_name): Return script
6658         section type to caller.
6659         (Output_section_definition::set_section_address): Do not advance
6660         dot value and load address if section type is NOLOAD.  Set address
6661         of NOLOAD sections regardless of section flags.
6662         (Output_section_definition::print): Print section type if it is
6663         not SCRIPT_SECTION_TYPE_NONE.
6664         (Output_section_definition::section_type): New method.
6665         (Output_section_definition::script_section_type_name): Ditto.
6666         (Script_sections::output_section_name): Add new parameter
6667         PSECTION_TYPE for returning script section type.  Pass it to
6668         section elements.  Handle discard sections.
6669         (Sort_output_sections::operator()): Handle NOLOAD sections.
6670         * script-sections.h (Script_sections::Section_type): New enum type.
6671         (Script_sections::output_section_name): Add a new parameter for
6672         returning script section type.
6673         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6674         INFO and NOLOAD.
6675         * yyscript.y (union): Add new field SECTION_TYPE.
6676         (COPY, DSECT, INFO, NOLOAD): New tokens.
6677         (opt_address_and_section_type): Change type to output_section_header.
6678         (section_type): New non-terminal
6679         (section_header): Handle section type.
6680         (opt_address_and_section_type): Return section type value.
6681
6682 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6683
6684         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6685         * testsuite/plugin_common_test_2.c (foo): Likewise.
6686
6687 2010-04-08  Doug Kwan  <dougkwan@google.com>
6688
6689         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6690         Output_merge_data.
6691         * output.cc (Output_section::add_merge_input_section): Simplify
6692         code and return status of Output_merge_base::add_input_section.
6693         Update merge section map only if Output_merge_base::add_input_section
6694         returns true.
6695
6696 2010-04-07  Doug Kwan  <dougkwan@google.com>
6697
6698         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6699         if section is marked as containing instructions but has no mapping
6700         symbols.
6701         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6702         correct section index.
6703         (Arm_relobj::find_linked_text_section): Ditto.
6704
6705 2010-04-07  Cary Coutant  <ccoutant@google.com>
6706
6707         * archive.cc (include_member): Destroy Read_symbols_data object before
6708         releasing file.
6709         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6710         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6711         (Read_symbols_data::~Read_symbols_data) New destructor.
6712         (Section_relocs::Section_relocs) New constructor.
6713         (Section_relocs::~Section_relocs) New destructor.
6714         (Read_relocs_data::Read_relocs_data) New constructor.
6715         (Read_relocs_data::~Read_relocs_data) New destructor.
6716         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6717         pointers to NULL after deleting.
6718
6719 2010-04-07  Doug Kwan  <dougkwan@google.com>
6720
6721         * arm.cc: Replace "endianity" with "endianness" in comments.
6722         (Arm_exidx_cantunwind): Ditto.
6723         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6724         (Arm_relobj::merge_flags_and_attributes): New method.
6725         (Arm_relobj::merge_flags_and_attributes_): New data member.
6726         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6727         (Arm_relobj::scan_sections_for_stubs): Ditto.
6728         (Arm_relobj::do_read_symbols): Check to see if we really want to
6729         merge processor-specific flags and attributes.  Exit early if
6730         an object is empty except for section names and the undefined symbol.
6731         (Target_arm::do_finalize_sections): Move check for ELF format to
6732         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6733         attributes from a regular object only when we have determined that
6734         it is aapropriate.  Do not create an .ARM.attributes section in
6735         output if there is no regular input object.
6736         (Target_arm::merge_processor_specific_flags): Check
6737         --warn-mismatch before printing any error.
6738         (Target_arm::merge_object_attributes): Ditto.
6739         * gold.cc (queue_middle_tasks): Handle the case in which there is
6740         no regular object in input.
6741         * options.cc (General_options::parse_EB): New method.
6742         (General_options::parse_EL): Same.
6743         (General_options::General_options): Initialize endianness_.
6744         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6745         New options.
6746         (General_options::Endianness): New enum.
6747         (General_options::endianness): New method.
6748         (General_options::endianness_): New data member.
6749         * parameters.cc (Parameters::set_options): Check target endianness.
6750         (Parameters::set_target_once): Ditto.
6751         (Parameters::check_target_endianness): New method.
6752         (parameters_force_valid_target): If either -EL or -EB is specified,
6753         use it to define endianness of default target.
6754         * parameters.h (Parameters::check_target_endianness): New method
6755         declaration.
6756         * target.h (class Target): Change "endianity" to "endianness"
6757         in comments.
6758
6759 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6760
6761         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6762         * configure: Regenerate.
6763         * Makefile.in: Regenerate.
6764         * testsuite/Makefile.in: Regenerate.
6765
6766 2010-04-06  Cary Coutant  <ccoutant@google.com>
6767
6768         gcc PR lto/42757
6769         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6770         prevailing definitions of common symbols.
6771         * testsuite/plugin_test_6.sh: New test case.
6772         * testsuite/plugin_common_test_1.c: New test case.
6773         * testsuite/plugin_common_test_2.c: New test case.
6774         * testsuite/Makefile.am (plugin_test_6): New test case.
6775         * testsuite/Makefile.in: Regenerate.
6776
6777 2010-04-06  Nick Clifton  <nickc@redhat.com>
6778
6779         * po/vi.po: New Vietnamese translation.
6780
6781 2010-03-30  Doug Kwan  <dougkwan@google.com>
6782
6783         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6784
6785 2010-03-25  Doug Kwan  <dougkwan@google.com>
6786
6787         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6788         to avoid a conversion warning on a 32-bit host.
6789
6790 2010-03-24  Ian Lance Taylor  <iant@google.com>
6791
6792         * testsuite/script_test_3.t: Add a TLS segment.
6793         * testsuite/Makefile.am (check_PROGRAMS): Add
6794         tls_phdrs_script_test.
6795         (tls_phdrs_script_test_SOURCES): Define.
6796         (tls_phdrs_script_test_DEPENDENCIES): Define.
6797         (tls_phdrs_script_test_LDFLAGS): Define.
6798         (tls_phdrs_script_test_LDADD): Define.
6799         * testsuite/Makefile.in: Rebuild.
6800
6801 2010-03-23  Cary Coutant  <ccoutant@google.com>
6802
6803         * fileread.cc (find_or_make_view): Fix comment.
6804
6805 2010-03-23  Ian Lance Taylor  <iant@google.com>
6806
6807         * script-sections.cc (class Orphan_section_placement): Define
6808         PLACE_TLS and PLACE_TLS_BSS.
6809         (Orphan_section_placement::Orphan_section_placement): Initialize
6810         new places.
6811         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6812         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6813         (tls_script_test_SOURCES): Define.
6814         (tls_script_test_DEPENDENCIES): Define.
6815         (tls_script_test_LDFLAGS): Define.
6816         (tls_script_test_LDADD): Define.
6817         * testsuite/Makefile.in: Rebuild.
6818
6819 2010-03-22  Doug Kwan  <dougkwan@google.com>
6820
6821         * arm.cc (Arm_relocate_functions::abs8,
6822         Arm_relocate_functions::abs16): Use correct check for overflow
6823         specified in the ARM ELF specs.
6824         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6825         target of a BLX instruction specially.
6826         (Reloc_stub::stub_type_for_reloc): Ditto.
6827         (Relocate::relocate): Use symbolic names instead of numeric relocation
6828         codes to report error.
6829         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6830         workaround.
6831         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6832         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6833         thumb2_blx_out_of_range.stdout
6834         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6835         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6836         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6837         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6838         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6839         thumb2_blx_in_range, thumb2_blx_in_range.o,
6840         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6841         thumb2_blx_out_of_range.o): New rules.
6842         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6843         thumb2_blx_in_range and thumb2_blx_out_of_range.
6844         * testsuite/Makefile.in: Regenerate.
6845         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6846         * testsuite/thumb_blx_in_range.s: New file.
6847         * testsuite/thumb_blx_out_of_range.s: New file.
6848
6849 2010-03-22  Rafael Espindola  <espindola@google.com>
6850
6851         * archive.cc (Should_include): Move to archive.h.
6852         (should_include_member): Make it a member of Archive.
6853         (Lib_group): New.
6854         (Add_lib_group_symbols): New.
6855         * archive.h: Include options.h.
6856         (Archive_member): Moved from Archive.
6857         (Should_include): Moved from archive.cc.
6858         (Lib_group): New.
6859         (Add_lib_group_symbols): New.
6860         * dynobj.cc (do_should_include_member): New.
6861         * dynobj.h (do_should_include_member): New.
6862         * gold.cc (queue_initial_tasks): Update call to queue.
6863         * main.cc (main): Print lib group stats.
6864         * object.cc (do_should_include_member): New.
6865         * object.h: Include archive.h.
6866         (Object::should_include_member): New.
6867         (Object::do_should_include_member): New.
6868         (Sized_relobj::do_should_include_member): New.
6869         * options.cc (General_options::parse_start_lib): New.
6870         (General_options::parse_end_lib): New.
6871         (Input_arguments::add_file): Handle lib groups.
6872         (Input_arguments::start_group): Check we are not in a lib.
6873         (Input_arguments::start_lib): New.
6874         (Input_arguments::end_lib): New.
6875         * options.h (General_options): Add start_lib and end_lib.
6876         (Input_argument::lib_): New.
6877         (Input_argument::lib): New.
6878         (Input_argument::is_lib): New.
6879         (Input_file_lib): New.
6880         (Input_arguments::in_lib_): New.
6881         (Input_arguments::in_lib): New.
6882         (Input_arguments::start_lib): New.
6883         (Input_arguments::end_lib_): New.
6884         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6885         in unused members as preempted.
6886         (Sized_pluginobj::do_should_include_member): New.
6887         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6888         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6889         return the blocker.
6890         (Read_symbols::do_whole_lib_group): New.
6891         (Read_symbols::do_lib_group): New.
6892         (Read_symbols::do_read_symbols): Handle lib groups.
6893         (Read_symbols::get_name): Handle lib groups.
6894         * readsyms.h (Read_symbols): Add an archive member pointer.
6895         (Read_symbols::do_whole_lib_group): New.
6896         (Read_symbols::do_lib_group): New.
6897         (Read_symbols::member_): New.
6898         * script.cc (read_input_script): Update call to queue_soon.
6899
6900 2010-03-19  Doug Kwan  <dougkwan@google.com>
6901
6902         * arm.cc (Stub_table::Stub_table): Initialize new data members
6903         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6904         (Stub_table::add_reloc_stub): Assign stub offset and update
6905         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6906         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6907         New data members.
6908         (Stub_table::update_data_size_and_addralign): Use
6909         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6910         instead of going over all reloc stubs.
6911         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6912         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6913         Stringpool_template::offset_ to size of Stringpool_char.
6914         (Stringpool_template::new_key_offset): Remove code to initialize
6915         Stringpool_template::offset_.
6916         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6917         Stringpool_template::offset_ to zero.
6918
6919 2010-03-15  Doug Kwan  <dougkwan@google.com>
6920
6921         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6922         offset_.
6923         (Stringpool_template::new_key_offset): New method.
6924         (Stringpool_template::add_string): Assign offsets when adding new
6925         strings.
6926         (Stringpool_template::set_string_offsets): Do not set string offsets
6927         when not optimizing.
6928         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6929         member size_.
6930         (Chunked_vector::clear): Clear size_.
6931         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6932         (Chunked_vector::size): Return size_.
6933         (Chunked_vector::push_back): Use size_ to find insert position.
6934         (Chunked_vector::size_): New data member.
6935         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6936         (Stringpool_template::new_key_offset): New method declaration.
6937         (Stringpool_template::offset_): New data member.
6938
6939 2010-03-15   Rafael Espindola  <espindola@google.com>
6940
6941         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6942         Add_symbols' constructor.
6943         * readsyms.h (Add_symbols): Remove the input_group member.
6944
6945 2010-03-10  Ian Lance Taylor  <iant@google.com>
6946
6947         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6948         target to ask whether a reference to a symbol requires a stack
6949         split.
6950         * target.h (Target::is_call_to_non_split): New function.
6951         (Target::do_is_call_to_non_split): Declare virtual function.
6952         * target.cc: Include "symtab.h".
6953         (Target::do_is_call_to_non_split): New function.
6954         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6955
6956 2010-03-10  Cary Coutant  <ccoutant@google.com>
6957
6958         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6959         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6960         (File_read::open[2]): Add whole_file_view_ to list of views.
6961         (File_read::make_view): Remove test of whole_file_view_.
6962         (File_read::find_or_make_view): Create whole_file_view_ if
6963         necessary.
6964         (File_read::clear_views): Replace bool parameter with enum;
6965         adjust all callers.  Don't delete views with permanent data;
6966         do delete cached views and views from archives if
6967         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6968         if clearing the corresponding view.
6969         * fileread.h (File_read::Clear_views_mode): New enum.
6970         (File_read::View::is_permanent_view): New method.
6971         (File_read::clear_views): Replace bool parameter
6972         with enum; adjust all callers.
6973         * options.h (General_options): Change keep_files_mapped option;
6974         add map_whole_files.
6975         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6976         releasing the file.
6977         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6978         the file.
6979
6980 2010-03-10  David S. Miller  <davem@davemloft.net>
6981
6982         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6983
6984 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6985
6986         * icf.cc (get_section_contents): Add '@' marker after processing the
6987         merge reloc.
6988
6989 2010-03-08  Doug Kwan  <dougkwan@google.com>
6990
6991         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6992         due to a conversion warning.
6993         (Arm_relobj::update_output_local_symbol_count): Check for local
6994         symbol with unset output index.
6995
6996 2010-03-05  Ian Lance Taylor  <iant@google.com>
6997
6998         * options.h (class General_options): Add --spare-dynamic-tags.
6999         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7000         --spare-dynamic-tags.
7001
7002 2010-03-05  Ian Lance Taylor  <iant@google.com>
7003
7004         * incremental.cc: Include "libiberty.h".
7005
7006 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7007
7008         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7009         function, is_info_ member.
7010         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7011         (Versions::Versions): Update caller.
7012         (Versions::define_base_version): Likewise.
7013         (Versions::add_def): Likewise.
7014
7015 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7016
7017         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7018         (Scan::possible_function_pointer_reloc): New function.
7019         (Scan::local_reloc_may_be_function_pointer): Change to call
7020         possible_function_pointer_reloc.
7021         (Scan::global_reloc_may_be_function_pointer): Ditto.
7022         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7023         relocations in ".data.rel.ro._ZTV" section.
7024         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7025         * testsuite/icf_safe_so_test.cc: Ditto.
7026         * testsuite/icf_safe_test.cc: Ditto.
7027         * testsuite/icf_safe_test.sh: Ditto.
7028
7029 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7030             Ian Lance Taylor  <iant@google.com>
7031
7032         * target-reloc.h (relocate_section): Check the symbol table index
7033         for -1U before setting the local symbol index.
7034         (scan_relocatable_relocs): If copying the relocation, record that
7035         the local symbol is required.
7036         * object.h (Symbol_value::is_output_symtab_index_set): New
7037         function.
7038         (Symbol_value::may_be_discarded_from_output_symtab): New
7039         function.
7040         (Symbol_value::has_output_symtab_entry): New function.
7041         (Symbol_value::needs_output_symtab_entry): Remove.
7042         (Symbol_value::output_symtab_index): Make sure the symbol index is
7043         set.
7044         (Symbol_value::set_output_symtab_index): Make sure the symbol
7045         index is not set.  Make sure the new index is valid.
7046         (Symbol_value::set_must_have_output_symtab_entry): New function.
7047         (Symbol_value::has_output_dynsym_entry): New function.
7048         (Symbol_value::set_output_dynsym_index): Make sure the new index
7049         is valid.
7050         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7051         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7052         local symbol if permitted.
7053         (Sized_relobj::do_finalize_local_symbols): Call
7054         is_output_symtab_index_set rather than needs_output_symtab_entry.
7055         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7056         rather than needs_output_symtab_entry.  Call
7057         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7058         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7059         is_output_symtab_index_set rather than needs_output_symtab_entry.
7060         * testsuite/discard_locals_relocatable_test.c: New file.
7061         * testsuite/discard_locals_test.sh: Test -r.
7062         * testsuite/Makefile.am (check_DATA): Add
7063         discard_locals_relocatable_test1.syms,
7064         discard_local_relocatable_test2.syms.
7065         (MOSTLYCLEANFILES): Likewise.  Also add
7066         discard_locals_relocatable_test1.lout and
7067         discard_locals_relocatable_test2.out.
7068         (discard_locals_relocatable_test1.syms): New target.
7069         (discard_locals_relocatable_test.o): New target.
7070         (discard_locals_relocatable_test1.out): New target.
7071         (discard_locals_relocatable_test2.syms): New target.
7072         (discard_locals_relocatable_test2.out): New target.
7073         (various): Add missing ../ld-new dependencies.
7074         * testsuite/Makefile.in: Rebuild.
7075
7076 2010-03-03  Nick Clifton  <nickc@redhat.com>
7077
7078         * po/fi.po: New Finnish translation.
7079
7080 2010-03-01  Doug Kwan  <dougkwan@google.com>
7081
7082         * layout.cc (Layout::Layout): Force section types of .init_array*,
7083         .preinit_array* and .fini_array* sections.
7084         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7085         Fix check of return value of std::string::find.().
7086         (Output_section::Input_section_sort_compare::operator()): Remove
7087         comment about .init_array.
7088         (Output_section::Input_section_sort_init_fini_compare::operator()):
7089         New method.
7090         (Output_section::sort_attached_input_sections): Handle .init_array
7091         and .fini_array specially.
7092         * output.h (Output_section::Inut_section_sort_compare): Update
7093         comment.
7094         (Output_section::Input_section_sort_init_fini_compare): New struct.
7095
7096 2010-02-26  Doug Kwan  <dougkwan@google.com>
7097
7098         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7099         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7100         * testsuite/debug_msg.sh: Avoid matching source line number for
7101         use of global variable undef_int.
7102
7103 2010-02-26  Doug Kwan  <dougkwan@google.com>
7104
7105         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7106         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7107         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7108         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7109         * options.cc (General_options::General_options): Initialize member
7110         fix_v4bx_.
7111         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7112         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7113         and rm_no_fix_v4bx.stdout
7114         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7115         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7116         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7117         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7118         and arm_no_fix_v4bx.
7119         * Makefile.in: Regenerate.
7120         * testsuite/arm_fix_v4bx.s: New file.
7121         * testsuite/arm_fix_v4bx.sh: Ditto.
7122
7123 2010-02-24  Doug Kwan  <dougkwan@google.com>
7124
7125         * arm.cc (Target_arm::got_section): Make the .got section the first
7126         non RELRO section in the data segment.
7127         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7128         suffixes of section names.
7129
7130 2010-02-24  Doug Kwan  <dougkwan@google.com>
7131
7132         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7133         flags and attributes merging if an input file is a binary file.
7134         * fileread.cc (Input_file::open): Record format of original file.
7135         * fileread.h (Input_file::Format): New enum type.
7136         (Input_file::Input_file): Initialize data member format_.
7137         (Input_file::format): New method definition.
7138         (Input_file::format_):: New data member.
7139
7140 2010-02-24  Doug Kwan  <dougkwan@google.com>
7141
7142         * arm.cc (Arm_output_data_got): New class.
7143         (ARM_TCB_SIZE): New constant
7144         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7145         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7146         If user uses a script with a SECTIONS clause, issue only a warning
7147         for a misplaced EXIDX input section.  Otherwise, issue an error.
7148         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7149         garbage collection.
7150         (Target_arm::got_mode_index_entry): Handle static linking.
7151         (Target_arm::Scan::local): Ditto.
7152         (Target_arm::Scan::global): Ditto.
7153         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7154         all incorrectly implemented relocations.
7155         (Target_arm::fix_exidx_coverage): Pass layout to
7156         Arm_output_section::fix_exidx_coverage.
7157         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7158         from ".ARM.exidx." and ".ARM.extab.".
7159
7160 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7161
7162         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7163         section if it does not already exist.
7164         * attributes.cc (Attributes_section_data::Attributes_section_data):
7165         Don't crash if size is zero.
7166
7167 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7168             Ian Lance Taylor  <iant@google.com>
7169
7170         * gold.cc (queue_middle_tasks): If no input files were opened,
7171         exit.
7172         * workqueue.h (Task_function::Task_function): Assert that there is
7173         a blocker.
7174
7175 2010-02-22  Doug Kwan  <dougkwan@google.com>
7176
7177         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7178         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7179         types to avoid warnings due to different uint64_t implementations
7180         on different hosts.
7181
7182 2010-02-21  Doug Kwan  <dougkwan@google.com>
7183
7184         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7185         handling of the maximum backward branch offset.
7186         (Arm_relocate_functions::thumb_branch_common): Ditto.
7187         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7188         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7189         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7190         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7191         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7192         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7193         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7194         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7195         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7196         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7197         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7198         thumb2_bl_out_of_range.o): New rules.
7199         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7200         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7201         thumb2_bl_out_of_range
7202         * testsuite/Makefile.in: Regenerate.
7203         * testsuite/arm_bl_in_range.s: New file.
7204         * testsuite/arm_bl_out_of_range.s: Ditto.
7205         * testsuite/arm_branch_in_range.sh: Ditto.
7206         * testsuite/arm_branch_range.t: Ditto.
7207         * testsuite/thumb2_branch_range.t: Ditto.
7208         * testsuite/thumb_bl_in_range.s: Ditto.
7209         * testsuite/thumb_bl_out_of_range.s: Ditto.
7210         * testsuite/thumb_branch_range.t: Ditto.
7211
7212 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7213
7214         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7215         Add reloc offset information.
7216         * icf.cc (get_section_contents): Change iterators to point to the new
7217         vectors. Add reloc offset information to the contents.
7218         * icf.h (Icf::Sections_reachable_info): New typedef.
7219         (Icf::Sections_reachable_list): New typedef.
7220         (Icf::Offset_info): New typedef.
7221         (Icf::Reloc_info): New struct typedef.
7222         (Icf::Reloc_info_list): New typedef.
7223         (Icf::symbol_reloc_list): Delete method.
7224         (Icf::addend_reloc_list): Delete method.
7225         (Icf::section_reloc_list): Delete method.
7226         (Icf::reloc_info_list): New method.
7227         (Icf::reloc_info_list_): New member.
7228
7229 2010-02-19  Doug Kwan  <dougkwan@google.com>
7230
7231         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7232         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7233         * arm.cc (Arm_relocation_functions): New forward declaration.
7234         (Target_arm::Target_arm): Initialize new data members
7235         got_mod_index_offset_ and tls_base_symbol_defined_.
7236         (Target_arm::Relocate::relocate_tls): New method.
7237         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7238          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7239         New methods.
7240         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7241         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7242         (Target_arm::got_mod_index_offset_,
7243         Target_arm::tls_base_symbol_defined_): New data members.
7244         (Target_arm::Scan::local, Target::Scan::global,
7245         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7246         relocations.
7247
7248 2010-02-18  Doug Kwan  <dougkwan@google.com>
7249
7250         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7251         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7252         text section as a parameter becuase some broken tools may not set
7253         the link in section header.
7254         (Target_arm::has_got_section): New method.
7255         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7256         without any mapping symbol as data only.  Remove warning.
7257         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7258         link in its section header, try to discover the link by inspecting the
7259         REL31 relocation at the beginning of the section.
7260         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7261         in error message.
7262         (Target_arm::Scan::global): Treat any reference to the symbol
7263         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7264
7265 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7266
7267         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7268         (Scan::global_reloc_may_be_function_pointer): New function.
7269         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7270         (Scan::global_reloc_may_be_function_pointer): New function.
7271         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7272         (Scan::global_reloc_may_be_function_pointer): New function.
7273         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7274         (Scan::global_reloc_may_be_function_pointer): New function.
7275         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7276         (Scan::global_reloc_may_be_function_pointer): New function.
7277         (Scan::possible_function_pointer_reloc): New function.
7278         (Target_x86_64::can_check_for_function_pointers): New function.
7279         * gc.h (gc_process_relocs): Scan relocation types to determine if
7280         function pointers were taken for targets that support it.
7281         * icf.cc (Icf::find_identical_sections): Include functions for
7282         folding in safe ICF whose pointer is not taken.
7283         * icf.h (Secn_fptr_taken_set): New typedef.
7284         (fptr_section_id_): New member.
7285         (section_has_function_pointers): New function.
7286         (set_section_has_function_pointers): New function.
7287         (check_section_for_function_pointers): New function.
7288         * options.h: Fix comment for safe ICF option.
7289         * target.h (can_check_for_function_pointers): New function.
7290         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7291         Modify icf_safe_test for X86-64.
7292         * testsuite/Makefile.in: Regenerate.
7293         * testsuite/icf_safe_so_test.cc: New file.
7294         * testsuite/icf_safe_so_test.sh: New file.
7295         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7296         (main): Change to take pointer to function kept_func_3.
7297         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7298         folding is done correctly for X86-64.
7299
7300 2010-02-12  David S. Miller  <davem@davemloft.net>
7301
7302         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7303         is_symbolless parameter.
7304         (Output_reloc<SHT_REL>::is_symbolless): New.
7305         (Output_reloc<SHT_REL>::is_symbolless_): New.
7306         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7307         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7308         (Output_reloc<SHT_RELA>::is_symbolless): New.
7309         (Output_data_reloc::add_global): Handle is_symbolless.
7310         (Output_data_reloc::add_global_relative): Likewise.
7311         (Output_data_reloc::add_local): Likewise.
7312         (Output_data_reloc::add_local_relative): Likewise.
7313         (Output_data_reloc::add_symbolless_global_addend): New.
7314         (Output_data_reloc::add_symbolless_local_addend): New.
7315         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7316         is_symbolless.
7317         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7318         instead of ->is_relative_
7319         (Output_reloc::write): Likewise.
7320         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7321         (Output_reloc::write_rel): Simplify.
7322
7323         * sparc.cc (Target_sparc::Scan::local): Use
7324         ->add_symbolless_local_addend as needed.
7325         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7326         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7327         based upon relocation offset.
7328
7329 2010-02-11  Doug Kwan  <dougkwan@google.com>
7330
7331         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7332         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7333         beginning of function.
7334         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7335         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7336         parameter is_32bit in calls to should_apply_static_reloc.
7337         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7338         (check_DATA): Add arm_abs_global.stdout.
7339         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7340         arm_abs_global.stdout): New rules.
7341         (MOSTLLYCLEANFILES): Add arm_abs_global
7342         * Makefile.in: Regenerate.
7343         * testsuite/arm_abs_global.s: New file.
7344         * testsuite/arm_abs_global.sh: Ditto.
7345         * testsuite/arm_abs_lib.s: Ditto.
7346
7347 2010-02-11  Ian Lance Taylor  <iant@google.com>
7348
7349         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7350         Read_relocs task.
7351         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7352         Allocate_commons_task first.
7353         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7354         task, rather than symtab_lock_.
7355         (Gc_process_relocs::~Gc_process_relocs): New function.
7356         (Gc_process_relocs::is_runnable): Check this_blocker_.
7357         (Gc_process_relocs::locks): Use next_blocker_ rather than
7358         blocker_.
7359         (Scan_relocs::~Scan_relocs): New function.
7360         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7361         symtab_lock_.
7362         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7363         next_blocker_.
7364         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7365         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7366         constructor accordingly.
7367         (class Gc_process_relocs): Likewise.
7368         (class Scan_relocs): Likewise.
7369         * common.h (class Allocate_commons_task): Remove symtab_lock_
7370         field, and corresponding constructor parameter.
7371         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7372         symtab_lock_.
7373         (Allocate_commons_task::locks): Likewise.
7374
7375 2010-02-11  Ian Lance Taylor  <iant@google.com>
7376
7377         * gold-threads.h (class Once): Define.
7378         (class Initialize_lock): Rewrite as child of Once.
7379         * gold-threads.cc (class Once_initialize): Define.
7380         (once_pointer_control): New static variable.
7381         (once_pointer, once_arg): New static variables.
7382         (c_run_once): New static function.
7383         (Once::Once, Once::run_once, Once::internal_run): New functions.
7384         (class Initialize_lock_once): Remove.
7385         (initialize_lock_control): Remove.
7386         (initialize_lock_pointer): Remove.
7387         (initialize_lock_once): Remove.
7388         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7389         (Initialize_lock::initialize): Rewrite.
7390         (Initialize_lock::do_run_once): New function.
7391         * archive.cc (Archive::interpret_header): Only clear name if it is
7392         not already empty.
7393         * fileread.cc: Include "gold-threads.h"
7394         (file_counts_lock): New static variable.
7395         (file_counts_initialize_lock): Likewise.
7396         (File_read::release): Only increment counts when using --stats.
7397         Use a lock around the increment.
7398         * parameters.cc (class Set_parameters_target_once): Define.
7399         (set_parameters_target_once): New static variable.
7400         (Parameters::Parameters): Move here from parameters.h.
7401         (Parameters::set_target): Rewrite.
7402         (Parameters::set_target_once): New function.
7403         (Parameters::clear_target): Move here and rewrite.
7404         * parameters.h (class Parameters): Update declarations.  Add
7405         set_parameters_target_once_ field.
7406         (Parameters::Parameters): Move to parameters.cc.
7407         (Parameters::clear_target): Likewise.
7408         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7409         task.
7410         (Start_group::~Start_group): New function.
7411         (Start_group::is_runnable): New function.
7412         (Start_group::locks, Start_group::run): New functions.
7413         (Finish_group::run): Change saw_undefined to size_t.
7414         * readsyms.h (class Start_group): Define.
7415         (class Finish_group): Change saw_undefined_ field to size_t.
7416         (Finish_group::Finish_group): Remove saw_undefined and
7417         this_blocker parameters.  Change all callers.
7418         (Finish_group::set_saw_undefined): New function.
7419         (Finish_group::set_blocker): New function.
7420         * symtab.h (class Symbol_table): Change saw_undefined to return
7421         size_t.  Change saw_undefined_ field to size_t.
7422         * target-select.cc (Set_target_once::do_run_once): New function.
7423         (Target_selector::Target_selector): Initialize set_target_once_
7424         field.  Don't initialize lock_ and initialize_lock_ fields.
7425         (Target_selector::instantiate_target): Rewrite.
7426         (Target_selector::set_target): New function.
7427         * target-select.h (class Set_target_once): Define.
7428         (class Target_selector): Update declarations.  Make
7429         Set_target_once a friend.  Remove lock_ and initialize_lock_
7430         fields.  Add set_target_once_ field.
7431
7432 2010-02-10  Ian Lance Taylor  <iant@google.com>
7433
7434         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7435         queueing any tasks.
7436         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7437         (queue_middle_tasks): Add all blockers before queueing any tasks.
7438         (queue_final_tasks): Likewise.
7439         * token.h (Task_token::add_blockers): New function.
7440         * object.h (Input_objects::number_of_relobjs): New function.
7441
7442 2010-02-10  Ian Lance Taylor  <iant@google.com>
7443
7444         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7445         shared, not if not position independent.
7446         * x86_64.cc (Relocate::relocate_tls): Likewise.
7447         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7448         (tls_pie_pic_test): New target.
7449         * testsuite/Makefile.in: Rebuild.
7450
7451         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7452         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7453         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7454         * testsuite/Makefile.in: Rebuild.
7455
7456 2010-02-09  David S. Miller  <davem@davemloft.net>
7457
7458         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7459         R_SPARC_RELATIVE using ->add_local_relative().
7460         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7461
7462         * output.h (Output_data_dynamic::add_section_size): New method
7463         that takes two Output_data objects.
7464         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7465         entry param.  Handle it in initializers.
7466         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7467         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7468         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7469         arg.
7470         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7471         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7472         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7473         for dynrel_includes_plt.
7474         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7475         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7476         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7477         before .rela.plt
7478         (Target_sparc::do_finalize_sections): Update to pass true for
7479         dynrel_includes_plt.
7480         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7481         output before .rela.plt
7482         (Target_powerpc::do_finalize_sections): Update to pass true for
7483         dynrel_includes_plt when 32-bit.
7484
7485 2010-02-08  Doug Kwan  <dougkwan@google.com>
7486
7487         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7488         method.
7489         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7490         Arm_relobj::scan_section_for_cortex_a8_stubs,
7491         Arm_relobj::do_relocation_section): Instead of calling
7492         Output_section::output_address, use faster
7493         Arm_relobj::simple_input_section_output_address.
7494
7495 2010-02-08  David S. Miller  <davem@davemloft.net>
7496
7497         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7498         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7499         relocation helper function.
7500
7501         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7502         just like R_SPARC_GOT{10,13,22}.
7503         (Target_sparc::Scan::local): Likewise.
7504         (Target_sparc::Relocate:relocate): Likewise.
7505
7506 2010-02-06  Ian Lance Taylor  <iant@google.com>
7507
7508         * configure.ac: Rewrite targetobjs duplicate removal code to use
7509         only shell constructs.
7510         * configure: Rebuild.
7511
7512 2010-02-05  Doug Kwan  <dougkwan@google.com>
7513
7514         PR 11247
7515         * arm.cc (Arm_relobj::section_is_scannable): New method.
7516         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7517         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7518
7519 2010-02-04  Doug Kwan  <dougkwan@google.com>
7520
7521         PR 11247
7522         * arm-reloc-property.cc (cstdio): Include.
7523         * configure.ac (targetobjs): Remove duplicates.
7524         * configure: Regenerate.
7525         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7526         big and little endian version for a given address size.
7527
7528 2010-02-03  Doug Kwan  <dougkwan@google.com>
7529
7530         * arm-reloc-property.cc
7531         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7532         definition.
7533         * arm-reloc-property.h
7534         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7535         New method definition.
7536         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7537         declaration.
7538         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7539         overflow to N.
7540         (GOT_PREL): Change implemented to Y.
7541         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7542         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7543         (Arm_relocate_functions::movw_abs_nc): Remove method.
7544         (Arm_relocate_functions::movt_abs): Ditto.
7545         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7546         (Arm_relocate_functions::thm_movt_abs): Ditto.
7547         (Arm_relocate_functions::movw_rel_nc): Ditto.
7548         (Arm_relocate_functions::movw_rel): Ditto.
7549         (Arm_relocate_functions::movt_rel): Ditto.
7550         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7551         (Arm_relocate_functions:thm_movw_rel): Ditto.
7552         (Arm_relocate_functions:thm_movt_rel): Ditto.
7553         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7554         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7555         New method definitions.
7556         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7557         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7558         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7559         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7560         (Target_arm::Relocate::relocate): Check for non-static or
7561         unimplemented relocation code and exit early.  Change calls to
7562         Target_arm::reloc_uses_thumb_bit and
7563         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7564         instead.  Refactor code to handle similar relocations to increase
7565         code sharing.  Remove check for unsupported relocation code in switch
7566         statement.
7567         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7568         relocation property table to find out size.  Change error message to
7569         print out the name of a relocation code instead of the numeric value.
7570         (Target_arm::scan_reloc_for_stub): Use relocation property table
7571         instead of calling Target_arm::reloc_uses_thumb_bit().
7572
7573 2010-02-02  Doug Kwan  <dougkwan@google.com>
7574
7575         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7576         types of relaxed input section.
7577
7578 2010-02-02  Doug Kwan  <dougkwan@google.com>
7579
7580         * Makefile.am (HFILES): Add arm-reloc-property.h.
7581         (DEFFILES): New.
7582         (TARGETSOURCES): Add arm-reloc-property.cc
7583         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7584         (libgold_a_SOURCES): $(DEFFILES)
7585         * Makefile.in: Regenerate.
7586         * arm-reloc-property.cc: New file.
7587         * arm-reloc-property.h: New file.
7588         * arm-reloc.def: New file.
7589         * arm.cc: Update comments.
7590         (arm-reloc-property.h): New included header.
7591         (arm_reloc_property_table): New global variable.
7592         (Target_arm::do_select_as_default_target): New method definition.
7593         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7594         arm-reloc-property to targ_extra_obj.
7595         * parameters.cc (set_parameters_target): Call
7596         Target::select_as_default_target().
7597         * target.h (Target::select_as_default_target): New method definition.
7598         (Target::do_select_as_default_target): Same.
7599
7600 2010-02-01  Doug Kwan  <dougkwan@google.com>
7601
7602         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7603         first_output_text_section_.
7604         (Arm_exidx_fixup::first_output_text_section): New method definition.
7605         (Arm_exidx_fixup::first_output_text_section_): New data member.
7606         (Arm_exidx_fixup::process_exidx_section): Record the first text
7607         output section seen.
7608         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7609         and entsize in output section header.
7610
7611 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7612
7613         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7614         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7615         (Arm_relocate_functions::thm_alu11): New Method.
7616         (Arm_relocate_functions::thm_pc8): New Method.
7617         (Arm_relocate_functions::thm_pc12): New Method.
7618         (Target_arm::Scan::local): Handle the relocations.
7619         (Target_arm::Scan::global): Likewise.
7620         (Target_arm::Relocate::relocate): Likewise.
7621         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7622
7623 2010-01-29  Doug Kwan  <dougkwan@google.com>
7624
7625         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7626         of relocation types as ld.
7627
7628 2010-01-29  Doug Kwan  <dougkwan@google.com>
7629
7630         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7631         to public.
7632         (Arm_relocate_functions::thumb_branch_common): Ditto.
7633         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7634         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7635         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7636         Arm_relocate_functions::jump24): Remove.
7637         (Target_arm::Relocate::relocate): Adjust code to call
7638         Arm_relocation_functions::arm_branch_common and
7639         Arm_relocation_functions::thumb_branch_common instead of their removed
7640         wrappers.  Merge switch-cases together to reduce source code size.
7641
7642 2010-01-29  Doug Kwan  <dougkwan@google.com>
7643
7644         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7645         output_local_symbol_count_needs_update_.
7646         (Arm_relobj::output_local_symbol_count_needs_update,
7647          Arm_relobj::set_output_local_symbol_count_needs_update,
7648          Arm_relobj::update_output_local_symbol_count): New methods.
7649         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7650         member.
7651         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7652         of pointed function as in a R_ARM_PREL31 relocation.
7653         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7654         for output local symbol count updating.
7655         (Target_arm::do_relax): Update output local symbol counts in objects
7656         if necessary.
7657         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7658
7659 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7660
7661         * arm.cc: Added support for the ARM relocations:
7662         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7663         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7664         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7665         movw_prel_nc).
7666         (Arm_relocate_functions::movw_rel): New method.
7667         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7668         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7669         thm_movw_prel_nc).
7670         (Arm_relocate_functions::thm_movw_rel): New method.
7671         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7672         thm_movt_prel).
7673         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7674         relocations.
7675         (Target_arm::Scan::global): Likewise.
7676         (Target_arm::Relocate::relocate): Likewise.
7677         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7678         Likewise.
7679
7680 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7681
7682         * arm.cc: Added support for ARM group relocations.
7683         (Target_arm::reloc_needs_sym_origin): New method.
7684         (Arm_relocate_functions::calc_grp_kn): New method.
7685         (Arm_relocate_functions::calc_grp_residual): New method.
7686         (Arm_relocate_functions::calc_grp_gn): New method.
7687         (Arm_relocate_functions::arm_grp_alu): New Method.
7688         (Arm_relocate_functions::arm_grp_ldr): New Method.
7689         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7690         (Arm_relocate_functions::arm_grp_ldc): New Method.
7691         (Target_arm::Scan::local): Handle the ARM group relocations.
7692         (Target_arm::Scan::global): Likewise.
7693         (Target_arm::Relocate::relocate): Likewise.
7694         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7695         Likewise.
7696
7697 2010-01-26  Doug Kwan  <dougkwan@google.com>
7698
7699         * arm.cc (set): Include.
7700         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7701         pointer type.
7702         (Arm_output_section::Text_section_list): New type.
7703         (Arm_output_section::append_text_sections_to_list): New method.
7704         (Arm_output_section::fix_exidx_coverage): Ditto.
7705         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7706         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7707         Relobj::set_section_offset() instead of
7708         Sized_relobj::invalidate_section_offset().
7709         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7710         parameter for section headers. Ignore relocation sections for
7711         unallocated sections and EXIDX sections.
7712         (Target_arm::fix_exidx_coverage): New method.
7713         (Target_arm::output_section_address_less_than): New type.
7714         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7715         linked text section instead of the EXIDX section.
7716         (Arm_output_section::create_stub_group): Add an assertion to check
7717         that this is not an EXIDX output section.
7718         (Arm_output_section::append_text_sections_to_list): New method.
7719         (Arm_output_section::fix_exidx_coverage): Ditto.
7720         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7721         Arm_relobj::section_needs_reloc_stub_scanning.
7722         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7723         first pass.
7724         (Target_arm::fix_exidx_coverage): New method.
7725         * object.h (Relobj::set_output_section): New method.
7726         (Sized_relobj::invalidate_section_offset): Remove method.
7727         (Sized_relobj::do_invalidate_section_offset): Remove method.
7728         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7729
7730 2010-01-25  Doug Kwan  <dougkwan@google.com>
7731
7732         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7733         Fix warning due to signed and unsigned comparison on a 32-bit host.
7734
7735 2010-01-22  Doug Kwan  <dougkwan@google.com>
7736
7737         * arm.cc (Target_arm::do_relax): Record an output section for section
7738         offset adjustment it contains any stub table that has changed.
7739         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7740         offsets in an output section if necessary.
7741         * output.cc (Output_section::Output_section): Initialize
7742         section_offsets_need_adjustments_.
7743         (Output_section::add_input_section_for_script): Renamed to
7744         Output_section::add_simple_input_section.
7745         (Output_section::save_states): Add a comment.
7746         (Output_section::discard_states): New method defintion.
7747         (Output_section::adjust_section_offsets): Same.
7748         * output.h (Output_section::add_input_section_for_script): Renamed to
7749         Output_section::add_simple_input_section.
7750         (Output_section::discard_states): New method declaration.
7751         (Output_section::adjust_section_offsets): Same.
7752         (Output_section::section_offsets_need_adjustment,
7753         Output_section::set_section_offsets_need_adjustment): New method
7754         definitions.
7755         (Output_section::section_offsets_need_adjustment_): New data member.
7756         * script-sections.cc
7757         (Output_section_element_input::set_section_address): Adjust code for
7758         renaming of Output_section::add_input_section_for_script.
7759         (Orphan_output_section::set_section_address): Same.
7760
7761 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7762
7763         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7764         Fix_v4bx enum values .
7765         * gold/options.h (General_options): New option definitions.
7766         (General_options::fix_v4bx): New method.
7767         (General_options::Fix_v4bx): New enum.
7768         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7769         (General_options::parse_fix_v4bx_interworking): New method.
7770
7771 2010-01-22  Doug Kwan  <dougkwan@google.com>
7772
7773         * arm.cc (Arm_exidx_fixup): New class.
7774
7775 2010-01-21  Doug Kwan  <dougkwan@google.com>
7776
7777         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7778         classes.
7779         (Arm_exidx_section_offset_map): New type.
7780
7781 2010-01-21  Doug Kwan  <dougkwan@google.com>
7782
7783         * arm.cc (Arm_exidx_input_section): New class.
7784         (Arm_relobj::exidx_input_section_by_link,
7785         Arm_relobj::exidx_input_section_by_shndx,
7786         Arm_relobj::make_exidx_input_section): New methods.
7787         (read_arm_attributes_section): Remove.
7788         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7789         information about them.
7790         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7791         to here.
7792
7793 2010-01-20  Doug Kwan  <dougkwan@google.com>
7794
7795         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7796         Input_section_specifier to Section_id.
7797         (Target_arm::new_arm_input_section: Adjust code for change of key
7798         type.
7799         (Target_arm::find_arm_input_section): Ditto.
7800         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7801         (Section_id): Remove.
7802         (Garbage_collection::Section_id_hash): Remove.
7803         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7804         (Section_id): Remove.
7805         (Icf::Section_id_hash): Remove.
7806         * object.h (Section_id, Const_section_id, Section_id_hash,
7807         Const_section_id_hash): New type definitions.
7808         * output.cc (Output_section::add_relaxed_input_section): Change to
7809         use Const_section_id instead of Input_section_specifier as key type.
7810         (Output_section::add_merge_input_section): Ditto.
7811         (Output_section::build_relaxation_map): Change to use Section_id
7812         instead of Input_section_specifier as key type.
7813         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7814         Ditto.
7815         (Output_section::convert_input_sections_to_relaxed_sections): Change
7816         to use Const_section_id instead of Input_section_specifier as key type.
7817         (Output_section::find_merge_section): Ditto.
7818         (Output_section::find_relaxed_input_section): Ditto.
7819         * output.h (Input_section_specifier): Remove class.
7820         (Output_section::Output_section_data_by_input_section_map): Change
7821         key type to Const_section_id.
7822         (Output_section::Output_relaxed_input_section_by_input_section_map):
7823         Ditto.
7824         (Output_section::Relaxation_map): Change key type to Section_id.
7825
7826 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7827
7828         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7829         (class Arm_v4bx_stub): New class.
7830         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7831         (Stub_factory::make_arm_v4bx_stub): New method.
7832         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7833         (Stub_table::empty): Handle v4bx stubs.
7834         (Stub_table::add_arm_v4bx_stub): New method.
7835         (Stub_table::find_arm_v4bx_stub): New method.
7836         (Arm_relocate_functions::v4bx): New method.
7837         (Target_arm::fix_v4bx): New method.
7838         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7839         (Stub_table::relocate_stubs): Likewise.
7840         (Stub_table::do_write): Likewise.
7841         (Stub_table::update_data_size_and_addralign): Likewise.
7842         (Stub_table::finalize_stubs):  Likewise.
7843         (Target_arm::Scan::local): Likewise.
7844         (Target_arm::Scan::global): Likewise.
7845         (Target_arm::do_finalize_sections): Likewise.
7846         (Target_arm::Relocate::relocate): Likewise.
7847         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7848         Likewise.
7849         (Target_arm::scan_reloc_for_stub): Likewise.
7850         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7851
7852 2010-01-19  Ian Lance Taylor  <iant@google.com>
7853
7854         * output.cc (Output_section_headers::do_sized_write): Write large
7855         segment count to sh_info field.
7856         (Output_file_header::do_sized_write): For large segment count,
7857         write PN_XNUM to e_phnum field.
7858
7859 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7860
7861         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7862         (Arm_relocate_functions::thm_jump8): New function.
7863         (Arm_relocate_functions::thm_jump11): New function.
7864         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7865         R_ARM_THM_JUMP11.
7866         (Target_arm::Scan::global): Likewise.
7867         (Target_arm::Relocate::relocate): Likewise.
7868         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7869         Likewise.
7870
7871 2010-01-14  Doug Kwan  <dougkwan@google.com>
7872
7873         * arm.cc (map, utility): Include headers.
7874         (Target_arm::apply_cortex_a8_workaround): New method.
7875         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7876         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7877         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7878         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7879         the --[no-]fix-cortex-a8 command line options.
7880         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7881         (Target_arm::relocate_stub): Use addend in instruction template.
7882         * options.h (DEFINE_bool): Set the user-set flag.
7883         (General_options): Add --[no-]-fix-cortex options.
7884         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7885         : Update fast look-up map after conversion.
7886
7887 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7888
7889         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7890         in the first pass of do_layout.
7891
7892 2010-01-13  Doug Kwan  <dougkwan@google.com>
7893
7894         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7895         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7896         apparent compiler problem of not folding static constant integral
7897         data members of elfcpp::Elf_sizes<32>.
7898
7899 2010-01-13  Doug Kwan  <dougkwan@google.com>
7900
7901         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7902         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7903         Arm_relobj::scan_section_for_cortex_a8_erratum,
7904         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7905         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7906         sections to scan for relocation stubs into a new method
7907         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7908         relocation and Cortex-A8 stub scanning.
7909         (Target_arm::do_relax): Force stubs to be after stubbed sections
7910         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7911         the beginning of a new relaxation pass.  Update a comment.
7912         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7913
7914 2010-01-12  Ian Lance Taylor  <iant@google.com>
7915
7916         * target-reloc.h (visibility_error): New inline function.
7917         (relocate_section): Call visibility_error.
7918         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7919         (MOSTLYCLEANFILES): Likewise.
7920         (protected_4_pic.o, protected_3.err): New targets.
7921         * testsuite/protected_4.cc: New file.
7922
7923 2010-01-12  Doug Kwan  <dougkwan@google.com>
7924
7925         * arm.cc (Cortex_a8_reloc): New class.
7926         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7927         and cortex_a8_relocs_info_.
7928         (Target_arm::fix_cortex_a8): New method definition.
7929         (Target_arm::Cortex_a8_relocs_info): New type.
7930         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7931         New data member declarations.
7932         (Target_arm::scan_reloc_for_stub): Record information about
7933         relocations for THUMB branches that might be exempted from the
7934         Cortex-A8 workaround.
7935         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7936         at the beginning of a relaxation pass.
7937
7938 2010-01-12  Doug Kwan  <dougkwan@google.com>
7939
7940         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7941         (Arm_relobj::Mapping_symbol_position,
7942          Arm_reloj::Mapping_symbol_position_less,
7943          Arm_relobj::Mapping_symbols_info): New types.
7944         (Target_arm::is_mapping_symbol_name): New method definition.
7945         (Arm_relobj::do_count_local_symbols): Save information about mapping
7946         symbols.
7947
7948 2010-01-11  Doug Kwan  <dougkwan@google.com>
7949
7950         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7951         Arm_relocate_functions::thumb32_branch_upper,
7952         Arm_relocate_functions::thumb32_branch_lower,
7953         Arm_relocate_functions::thumb32_cond_branch_offset,
7954         Arm_relocate_functions::thumb32_cond_branch_upper,
7955         Arm_relocate_functions::thumb32_cond_branch_lower,
7956         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7957         branch offset encoding.
7958         (Arm_relocate_functions::thumb_branch_common): Use new branch
7959         offset encoding methods to avoid code duplication.
7960         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7961         (Stub_addend_reader::operator()): Use new branch encoding method
7962         to avoid code duplication.
7963
7964 2010-01-11  Doug Kwan  <dougkwan@google.com>
7965
7966         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7967         (Target_arm::do_finalize_sections): Define special EXIDX section
7968         symbols only if referenced.
7969         * gc.h (Garbage_collection::add_reference): New method.
7970         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7971         code duplication.
7972
7973 2010-01-11  Ian Lance Taylor  <iant@google.com>
7974
7975         * script.cc (Version_script_info::build_expression_list_lookup):
7976         Change complaing about duplicate wildcard match from error to
7977         warning.
7978
7979         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7980         of 2009-12-30.
7981         (Version_script_info::Version_script_info): Initialize globs_,
7982         default_version_, default_is_global_, and exact_.  Don't
7983         initialize globals_ or locals_.
7984         (Version_script_info::build_lookup_tables): Build local symbols
7985         first.
7986         (Version_script_info::unquote): New function.
7987         (Version_script_info::add_exact_match): New function.
7988         (Version_script_info::build_expression_list_lookup): Remove lookup
7989         parameter.  Add is_global parameter.  Change all callers.  Handle
7990         wildcard pattern specially.  Unquote pattern.  Call
7991         add_exact_match.
7992         (Version_script_info::get_name_to_match): New function.
7993         (Version_script_info::get_symbol_version): New function.
7994         (Version_script_info::get_symbol_version_helper): Remove.
7995         (Version_script_info::check_unmatched_names): Call unquote.
7996         * script.h (class Version_script_info): Change get_symbol_version
7997         to be non-inline and add is_global parameter; change all callers.
7998         Rewrite symbol_is_local.  Update declarations.  Define struct
7999         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8000         Remove globals_ and locals_ members.  Add exact_, globs_,
8001         default_version_, is_global_.
8002         (Version_script_info::Glob): Remove pattern, add expression and
8003         is_global.  Update constructor.  Change all callers.
8004         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8005         default version.
8006         (Versions::symbol_section_contents): If a symbol is undefined, or
8007         defined in a dynamic object, set the version index to
8008         VER_NDX_LOCAL.
8009         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8010         symbol_is_local.
8011         (Symbol_table::add_from_pluginobj): Likewise.
8012         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8013
8014 2010-01-11  Doug Kwan  <dougkwan@google.com>
8015
8016         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8017         (incremental_dump_LDADD): Add linking option for libintl.
8018         * Makefile.in: Regenerate.
8019
8020 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8021
8022         PR gold/11144
8023         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8024         instead of -Ds.
8025         * testsuite/Makefile.in: Regenerated.
8026
8027 2010-01-10  Doug Kwan  <dougkwan@google.com>
8028
8029         * options.h (DEFINE_var): Use parentheses around argument varname__
8030         in macro body to avoid any unintended subsequent substitutions.
8031
8032 2010-01-10  Ian Lance Taylor  <iant@google.com>
8033
8034         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8035         candidates before doing symbol resolution.
8036
8037         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8038         ODR candidates if only one is weak.
8039
8040 2010-01-08  Ian Lance Taylor  <iant@google.com>
8041
8042         * script.cc (Version_script_info::build_expression_list_lookup):
8043         Don't warn about ambiguous version, just record the ambiguity.
8044         (Version_script_info::get_symbol_version_helper): Give error if
8045         version is ambiguous.
8046
8047 2010-01-08  Doug Kwan  <dougkwan@google.com>
8048
8049         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8050         prev_data_size_ and prev_addralign_.  Remove initializer for
8051         deleted data member has_been_changed_.
8052         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8053         to determine if the table is empty.
8054         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8055         Remove.
8056         (Stub_table::add_reloc_stub): Define method in class definition
8057         instead of just declaring it there.
8058         (Stub_table::add_cortex_a8_stub): New method definition.
8059         (Stub_table::update_data_size_and_addralign): Ditto.
8060         (Stub_table::finalize_stubs): Ditto.
8061         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8062         (Stub_table::do_addralign_): Return address alignment in the
8063         (Stub_table::do_reset_address_and_file_offset): Define method in
8064         class definition instead of declaring it there.  Set current data
8065         size to be the data size of the previous pass.
8066         (Stub_table::set_final_data_size): Use current data size as the
8067         final data size.
8068         (Stub_table::relocate_stub): Change parameter type of stub from
8069         Reloc_stub pointer to Stub pointer.
8070         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8071         (Stub_table::Cortex_a8_stub_list): New typedef.
8072         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8073          Stub_table::prev_addralign_): New data member.
8074         (Arm_relobj::Arm_relobj): Initialize data member
8075         section_has_cortex_a8_workaround_.
8076         (Arm_relobj::section_has_cortex_a8_workaround,
8077          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8078          definitions.
8079         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8080         declarations.
8081         (Target_arm::relocate_stub): Change parameter type of stub from
8082         Reloc_stub pointer to Stub pointer.
8083         (Insn_template::size, Insn_template::alignment): Handle
8084         THUMB16_SPECIAL_TYPE.
8085         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8086          Stub_table::update_data_size_and_addralign,
8087          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8088         definitions.
8089         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8090         (Stub_table::do_write): Ditto.
8091         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8092
8093 2010-01-08  Ian Lance Taylor  <iant@google.com>
8094
8095         PR 11108
8096         * symtab.h (class Symbol): Remove fields is_target_special_ and
8097         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8098         (Symbol::is_defined_in_discarded_section): New function.
8099         (Symbol::set_is_defined_in_discarded_section): New function.
8100         (Symbol::has_plt_offset): Rewrite.
8101         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8102         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8103         Don't initialize is_target_special_ or has_plt_offset_.
8104         Initialize is_defined_in_discarded_section_.
8105         (Symbol_table::add_from_relobj): If appropriate, set
8106         is_defined_in_discarded_section.
8107         * resolve.cc (Symbol::override_base_with_special): Don't test
8108         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8109         * target-reloc.h (relocate_section): Do special handling for
8110         symbols defined in discarded sections for global symbols as well
8111         as local symbols.
8112
8113 2010-01-08  Ian Lance Taylor  <iant@google.com>
8114
8115         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8116         the SHT_SYMTAB case.
8117
8118 2010-01-08  Ian Lance Taylor  <iant@google.com>
8119
8120         * object.cc (Sized_relobj::do_layout): Don't get confused if
8121         layout_eh_frame returns NULL.
8122
8123 2010-01-08  Ian Lance Taylor  <iant@google.com>
8124
8125         PR 11084
8126         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8127         dynamic symbol table, use the normal symbol table.
8128         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8129         symbol table.
8130
8131 2010-01-08  Ian Lance Taylor  <iant@google.com>
8132
8133         PR 11072
8134         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8135         sections.
8136
8137 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8138
8139         * version.cc (print_version): Change to "Copyright 2010".
8140
8141 2010-01-08  Ian Lance Taylor  <iant@google.com>
8142
8143         PR 10287
8144         PR 11063
8145         * i386.cc (class Target_i386): Change return type of plt_section
8146         to be non-const.
8147         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8148         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8149         tls_desc_rel_ field.
8150         (Output_data_plt_i386::rel_tls_desc): New function.
8151         (Target_i386::rel_tls_desc_section): New function.
8152         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8153         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8154         R_386_TLS_DESC reloc in rel_tls_desc_section.
8155         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8156         Define struct Tlsdesc_info.
8157         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8158         (Target_x86_64::do_reloc_symbol_index): New function.
8159         (Target_x86_64::add_tlsdesc_info): New function.
8160         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8161         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8162         tlsdesc_rel_ field.
8163         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8164         all callers.
8165         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8166         (Target_x86_64::rela_tlsdesc_section): New function.
8167         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8168         handling.
8169         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8170         (Target_x86_64::do_reloc_addend): New function.
8171         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8172         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8173         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8174         (Output_reloc::type): New function.
8175         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8176         (Output_reloc::is_target_specific): New function.
8177         (Output_reloc::target_arg): New function.
8178         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8179         absolute relocs and target specific relocs.
8180         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8181         add_target_specific.
8182         (class Output_data_reloc) [SHT_RELA]: Likewise.
8183         * output.cc (Output_reloc::Output_reloc): Add four new versions
8184         for absolute relocs and target specific relocs.
8185         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8186         (Output_reloc::get_symbol_index): Likewise.
8187         (Output_reloc::local_section_offset): Check that local_sym_index_
8188         is not TARGET_CODE or 0.
8189         (Output_reloc::symbol_value): Likewise.
8190         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8191         reloc.
8192         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8193         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8194         functions.
8195         * layout.cc (add_target_dynamic_tags): Use output section for
8196         DT_PLTRELSZ and DT_JMPREL.
8197
8198 2010-01-07  Ian Lance Taylor  <iant@google.com>
8199
8200         PR 11061
8201         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8202         function.
8203         (class Output_data_reloc_generic): Define.
8204         (class Output_data_reloc_base): Change base class to
8205         Output_data_reloc_generic.  Change add() method to call
8206         bump_relative_reloc_count for a relative reloc.  Remove
8207         sort_relocs_ field.
8208         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8209         to sort_relocs().
8210         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8211         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8212         appropriate.
8213         * layout.h (class Layout): Update declaration.
8214
8215 2010-01-07  Ian Lance Taylor  <iant@google.com>
8216
8217         * output.h (class Output_data): Add const version of
8218         output_section and do_output_section.
8219         (class Output_section_data): Add const version of
8220         do_output_section.
8221         (class Output_section): Likewise.
8222         * layout.cc (Layout::add_target_dynamic_tags): New function.
8223         * layout.h (class Layout): Update declarations.
8224         * arm.cc (Target_arm::do_finalize_sections): Use
8225         add_target_dynamic_tags.
8226         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8227         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8228         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8229         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8230
8231 2010-01-07  Ian Lance Taylor  <iant@google.com>
8232
8233         PR 11042
8234         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8235         object as needed.
8236
8237 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8238             Ian Lance Taylor  <iant@google.com>
8239
8240         PR 11019
8241         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8242         Xindex::read_symtab_xindex.
8243
8244 2010-01-07  Doug Kwan  <dougkwan@google.com>
8245
8246         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8247         (Insn_template::thumb16_bcond_insn): New method declaration.
8248         (Insn_template): Fix spelling.
8249         (Stub::thumb16_special): New method declaration.
8250         (Stub::do_write): Define virtual method which was previously pure
8251         virtual.
8252         (Stub::do_thumb16_special): New method declaration.
8253         (Stub::do_fixed_endian_write): New template member.
8254         (Reloc_stub::do_write): Remove.
8255         (Reloc_stub::do_fixed_endian_write): Remove.
8256         (Cortex_a8_stub): New class definition.
8257         (Stub_factory::make_cortex_a8_stub): New method definition.
8258         (Stub_factory::Stub_factory): Add missing static storage class
8259         qualifier for elf32_arm_stub_a8_veneer_blx.
8260
8261 2010-01-07  Ian Lance Taylor  <iant@google.com>
8262
8263         PR 10980
8264         * options.h (class General_options): Add --warn-unresolved-symbols
8265         and --error-unresolved-symbols.
8266         * errors.cc (Errors::undefined_symbol): Implement
8267         --warn-unresolved-symbols.
8268
8269         * options.h (class General_options): Add -z text and -z textoff.
8270         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8271
8272 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8273
8274         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8275         (Garbage_collection::cident_sections): New function.
8276         (Garbage_collection::add_cident_section): New function.
8277         (Garbage_collection::cident_sections_): New member.
8278         (gc_process_relocs): Add references to sections whose names are C
8279         identifiers.
8280         * gold.h (cident_section_start_prefix): New constant.
8281         (cident_section_stop_prefix): New constant.
8282         (is_cident): New function.
8283         * layout.cc (Layout::define_section_symbols): Replace string constants
8284         with the newly defined constants.
8285         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8286         C identifiers.
8287         * testsuite/Makefile.am: Add gc_orphan_section_test.
8288         * testsuite/Makefile.in: Regenerate.
8289         * testsuite/gc_orphan_section_test.cc: New file.
8290         * testsuite/gc_orphan_section_test.sh: New file.
8291
8292 2010-01-06  Ian Lance Taylor  <iant@google.com>
8293
8294         PR 10980
8295         * options.h (class General_options): Add --warn-shared-textrel.
8296         * layout.cc (Layout::finish_dynamic_section): Implement
8297         --warn-shared-textrel.
8298
8299         PR 10980
8300         * options.h (class General_options): Add --warn-multiple-gp.
8301
8302 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8303
8304         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8305         $(THREADSLIB) and $(LIBDL).
8306         * Makefile.in: Rebuild.
8307
8308 2010-01-06  Ian Lance Taylor  <iant@google.com>
8309
8310         PR 10980
8311         * options.cc (General_options::parse_section_start): New function.
8312         (General_options::section_start): New function.
8313         (General_options::General_options): Initialize all members.
8314         * options.h: Include <map>
8315         (class General_options): Add --section-start.  Add section_starts_
8316         member.
8317         * layout.cc (Layout::attach_allocated_section_to_segment): If
8318         --section-start was used, set the address of the segment.  Remove
8319         local sort_sections.
8320         (Layout::relaxation_loop_body): If the address of the load segment
8321         has been set by --section-start, don't use it.
8322         * output.h (Output_segment::update_flags_for_output_section): New
8323         function.
8324         * output.cc (Output_segment::add_output_section): Call
8325         update_flags_for_output_section.
8326
8327 2010-01-05  Ian Lance Taylor  <iant@google.com>
8328
8329         PR 10980
8330         * options.h (class General_options): Add --undefined-version.
8331         * script.cc (struct Version_expression): Add was_matched_by_symbol
8332         field.
8333         (Version_script_info::matched_symbol): New function.
8334         (Version_script_info::get_symbol_version_helper): Call
8335         matched_symbol.
8336         (Version_script_info::check_unmatched_names): New function.
8337         * script.h (class Version_script_info): Update declarations.
8338         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8339
8340         * options.h (class General_options): Use DEFINE_bool_alias for
8341         allow_multiple_definition.
8342         * resolve.cc (Symbol_table::should_override): Don't test
8343         allow_multiple_definition.
8344
8345         PR 10980
8346         * options.h (class General_options): Add --cref.
8347         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8348         until after printing cref table.
8349         * cref.cc: Include "symtab.h".
8350         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8351         (Cref_table_compare::operator()): New function.
8352         (Cref_inputs::gather_cref): New function.
8353         (filecol): New static const.
8354         (Cref_inputs::print_cref): New function.
8355         (Cref::print_cref): New function.
8356         * cref.h: Include <cstdio>.
8357         (class Cref): Update declarations.
8358         * mapfile.h (Mapfile::file): New function.
8359         * object.h (class Object): Define Symbols.  Declare virtual
8360         do_get_global_symbols.
8361         (Object::get_global_symbols): New function.
8362         * object.cc (Input_objects::add_object): Pass object to cref_ if
8363         --cref.
8364         (Input_objects::archive_start): Likewise.
8365         (Input_objects::archive_stop): Likewise.
8366         (Input_objects::print_cref): New function.
8367         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8368         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8369         --cref.
8370         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8371         function.
8372         * plugin.h (class Sized_pluginobj): Update declarations.
8373
8374 2010-01-05  Ian Lance Taylor  <iant@google.com>
8375
8376         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8377         to is_default_version.  Rename insdef to insdefault.
8378         (Symbol_table::add_from_relobj): Rename def to is_default_version
8379         and local to is_forced_local.
8380         (Symbol_table::add_from_pluginobj): Likewise.
8381         (Symbol_table::add_from_dynobj): Likewise.
8382         (Symbol_table::define_special_symbol): Rename insdef to
8383         insdefault.
8384
8385 2010-01-04  Ian Lance Taylor  <iant@google.com>
8386
8387         PR 10980
8388         * options.h (class General_options): Add
8389         --allow-multiple-definition and -z muldefs.
8390         * resolve.cc (Symbol_table::should_override): Don't warn about a
8391         multiple symbol definition if --allow-multiple-definition or -z
8392         muldefs.
8393
8394         PR 10980
8395         * options.h (class General_options): Add --add-needed and
8396         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8397         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8398         error if --copy-dt-needed-entries aka --add-needed is used and
8399         would cause a change in behaviour.
8400
8401         PR 10980
8402         * options.h (class General_options): Add -G as a short version of
8403         --shared.  Add no-op options -assert, -g, and -i.
8404
8405 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8406
8407         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8408         check for .text or .gnu.linkonce.t sections.
8409         * icf.cc (Icf::find_identical_sections): Ditto.
8410         Change the detection for mangled function name within the section
8411         name.
8412         * icf.h (is_section_foldable_candidate): New function.
8413
8414 2009-12-30  Ian Lance Taylor  <iant@google.com>
8415
8416         PR 10980
8417         * options.h (class General_options): Permit two dashes with
8418         --retain-symbols-file.
8419
8420 2009-12-30  Ian Lance Taylor  <iant@google.com>
8421
8422         PR 10979
8423         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8424         don't put the file header and segment headers in the text
8425         segment.
8426
8427         PR 10979
8428         * common.cc (Sort_commons::operator()): Stabilize sort when both
8429         entries are NULL.
8430         (Symbol_table::do_allocate_commons_list): When allocating common
8431         symbols, skip a symbol which is no longer common.
8432         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8433         an object before checking its type.
8434         * testsuite/common_test_2.c: New file.
8435         * testsuite/common_test_3.c: New file.
8436         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8437         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8438         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8439         (common_test_2_pic.o, common_test_2.so): New targets.
8440         (common_test_3_pic.o, common_test_3.so): New targets.
8441         * testsuite/Makefile.in: Rebuild.
8442
8443         PR 10979
8444         * script.cc (read_input_script): If we see a new SECTIONS clause,
8445         and we have added an input section, give an error.
8446         * layout.h (class Layout): Add have_added_input_section function.
8447         Add have_added_input_section_ field.
8448         * layout.cc (Layout::Layout): Initialize
8449         have_added_input_section_.
8450         (Layout::layout): Set have_added_input_section_.
8451         (Layout::layout_eh_frame): Likewise.
8452
8453 2009-12-30  Ian Lance Taylor  <iant@google.com>
8454
8455         PR 10931
8456         * options.h (class General_options): Add --sort-common option.
8457         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8458         * common.cc (Sort_common): Add sort_order parameter to
8459         constructor.  Add sort_order_ field.
8460         (Sort_commons::operator): Check sort_order_.
8461         (Symbol_table::allocate_commons): Determine the sort order.
8462         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8463         Change all callers.
8464         (Symbol_table::do_allocate_commons_list): Likewise.
8465
8466 2009-12-30  Ian Lance Taylor  <iant@google.com>
8467
8468         PR 10916
8469         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8470         symbols from this object, don't change the visibility of an
8471         undefined symbol.
8472         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8473
8474 2009-12-30  Ian Lance Taylor  <iant@google.com>
8475
8476         PR 10861
8477         * script.h (class Version_script_info): Define Language enum.
8478         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8479         new fields globals_, locals_, and is_finalized_.
8480         * script.cc: Various formatting fixes.
8481         (class Parser_closure): Change language_stack_ from a vector of
8482         std::string to one of Version_script_info::Language.  Adjust all
8483         uses accordingly.
8484         (class Lazy_demangler): Remove.
8485         (struct Version_expression): Change language from std::string to
8486         Version_script_info::Language.
8487         (Version_script_info::Version_script_info): New function.
8488         (Version_script_info::~Version_script_info): Don't call clear.
8489         (Version_script_info::finalize): New function.
8490         (Version_script_info::build_lookup_tables): New function.
8491         (Version_script_info::build_expression_list_lookup): New
8492         function.
8493         (Version_script_info::get_symbol_version_helper): Rewrite to use
8494         lookup tables.
8495         (Version_script_info::print_expression_list): Adjust to use
8496         Version_script_info::Language.
8497         (script_push_lex_into_version_mode): Check that the version script
8498         has not been finalized.
8499         (version_script_push_lang): Change language string to
8500         Version_script_info::Language.
8501         * options.cc (Command_line::version_script): New function.
8502         * options.h (class General_options): Add finalize_dynamic_list
8503         function.  Change version_script from declaration to definition.
8504         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8505         * testsuite/version_script.map: Remove duplicate def of foo.
8506         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8507         version_script.map.
8508         * testsuite/Makefile.in: Rebuild.
8509
8510 2009-12-30  Ian Lance Taylor  <iant@google.com>
8511
8512         PR 10843
8513         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8514         if the input symbol index is 0, make the output symbol index 0.
8515
8516 2009-12-30  Ian Lance Taylor  <iant@google.com>
8517
8518         PR 10670
8519         * options.h (class General_options): Add -x/--discard-all.
8520         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8521         --discard-all.  If the local symbol needs a dynamic entry, check
8522         that before handling --discard-locals.
8523
8524 2009-12-30  Ian Lance Taylor  <iant@google.com>
8525
8526         PR 10450
8527         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8528         flags to PF_R.
8529         (Output_segment::add_output_section): Don't change the flags if
8530         the type is PT_TLS.
8531
8532         PR 10450
8533         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8534         GNU hash table if they need a dynamic value.  Otherwise, don't add
8535         them if they are defined in a dynamic object or are forced local.
8536
8537 2009-12-29  Ian Lance Taylor  <iant@google.com>
8538
8539         PR 10450
8540         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8541         .gnu.hash table for a 32-bit target.
8542
8543         PR 10450
8544         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8545         regular and a dynamic object only needs a dynamic symbol table
8546         entry if it is externally visible.
8547
8548         PR 10450
8549         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8550         constructor.  Add global_offset_table_ field.
8551         (Target_i386::got_section): Set global_offset_table_.
8552         (Target_i386::do_finalize_sections): Set global_offset_table_
8553         size.
8554         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8555         in constructor.  Add global_offset_table_ field.
8556         (Target_x86_64::got_section): Set global_offset_table_.
8557         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8558         size.
8559
8560         * layout.cc (Layout::Layout): Initialize increase_relro_.
8561         (Layout::get_output_section): Add is_relro, is_last_relro, and
8562         is_first_non_relro parameters.  Change all callers.
8563         (Layout::choose_output_section): Likewise.
8564         (Layout::add_output_section_data): Likewise.
8565         (Layout::make_output_section): Likewise.
8566         (Layout::set_segment_offsets): Clear increase_relro when using a
8567         linker script.
8568         * layout.h (class Layout): Add increase_relro method.  Add
8569         increase_relro_ field.  Update declarations.
8570         * output.cc (Output_section::Output_section): Initialize
8571         is_last_relro_ and is_first_non_relro_.
8572         (Output_segment::add_output_section): Group relro sections is
8573         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8574         (Output_segment::maximum_alignment): Remove relro handling.
8575         (Output_segment::set_section_addresses): Add increase_relro
8576         parameter.  Change all callers.  Add initial alignment to align
8577         relro sections on separate page.  Remove old relro handling.
8578         (Output_segment::set_section_list_addresses): Remove in_relro
8579         parameter.  Change all callers.
8580         (Output_segment::set_offset): Add increase parameter.  Change all
8581         callers.  Remove old relro handling.
8582         * output.h (class Output_section): Add new methods: is_last_relro,
8583         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8584         Add is_last_relro_ and is_first_non_relro_ fields.
8585         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8586         Create separate .got.plt section.  Call increase_relro.
8587         * x86_64.cc (Target_x86_64::got_section): Likewise.
8588         * testsuite/relro_script_test.t: Add .got.plt.
8589
8590         PR 10450
8591         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8592         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8593         (Layout::finalize): Call set_dynamic_symbol_size.
8594         (Layout::set_dynamic_symbol_size): New function.
8595         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8596         set_dynamic_symbol_size.
8597
8598         PR 10450
8599         * output.h (class Output_section): Add is_entsize_zero_ field.
8600         * output.cc (Output_section::Output_section): Initialize
8601         is_entsize_zero_.
8602         (Output_section::set_entsize): If two different entsizes are
8603         requested, force it to zero.
8604         (Output_section::add_input_section): Set flags for .debug_str
8605         before updating section flags.  Set entsize.
8606         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8607         and SHF_STRING if all input sections have those flags.
8608
8609 2009-12-29   Rafael Espindola  <espindola@google.com>
8610
8611         * main.cc (main): Fix the sys time reporting.
8612         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8613         reporting.
8614
8615 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8616
8617         * options.cc (General_options::parse_version): Allow -v to exit
8618         without an error if there is nothing to link.
8619
8620 2009-12-29  Ian Lance Taylor  <iant@google.com>
8621
8622         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8623         using a version of gcc before 4.1.
8624         * configure: Rebuild.
8625
8626 2009-12-28  Chris Demetriou  <cgd@google.com>
8627
8628         * attributes.cc (Output_attributes_section_data::do_write): Use
8629         std::vector::front rather than std::vector::data.
8630
8631 2009-12-28  Ian Lance Taylor  <iant@google.com>
8632
8633         * symtab.h (class Symbol_table): Add enum Defined.
8634         * resolve.cc (Symbol_table::should_override): Add defined
8635         parameter.  Change all callers.  Test whether object is NULL
8636         before calling a method on it.
8637         (Symbol_table::report_resolve_problem): Add defined parameter.
8638         Change all callers.
8639         (Symbol_table::should_override_with_special): Likewise.
8640         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8641         parameter.  Change all callers.
8642         (Symbol_table::do_define_in_output_data): Likewise.
8643         (Symbol_table::define_in_output_segment): Likewise.
8644         (Symbol_table::do_define_in_output_segment): Likewise.
8645         (Symbol_table::define_as_constant): Likewise.
8646         (Symbol_table::do_define_as_constant): Likewise.
8647         * script.h (class Symbol_assignment): Add is_defsym parameter to
8648         constructor; change all callers.
8649         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8650         parameter.  Change all callers.  Add is_defsym_ field.
8651         (class Parser_closure): Add parsing_defsym parameter to
8652         constructor; change all callers.  Add parsing_defsym accessor
8653         function.  Add parsing_defsym_ field.
8654
8655 2009-12-28  Ian Lance Taylor  <iant@google.com>
8656
8657         * gold.cc (queue_middle_tasks): Fix formatting.
8658         * object.cc (Relobj::is_section_name_included): Likewise.
8659
8660 2009-12-23  Ian Lance Taylor  <iant@google.com>
8661
8662         * i386.cc (Target_i386::do_calls_non_split): Recognize
8663         -fsplit-stack prologue for a function with a static chain.
8664         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8665         -fsplit-stack prologue when using %r11.
8666
8667 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8668
8669         * options.cc (General_options::parse_version): Make -v continue and do
8670         the link like GNU ld does.
8671
8672 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8673
8674         * Makefile.am (CCFILES): Add timer.cc.
8675         (HFILES): Add timer.h.
8676         * configure.ac: Check for sysconf and times.
8677         * main.cc: include timer.h.
8678         (main): Use Timer instead of get_run_time.
8679         * timer.cc: New.
8680         * timer.h: New.
8681         * workqueue.cc: include timer.h.
8682         (Workqueue::find_and_run_task):
8683         Report user, sys and wall time.
8684         * Makefile.in: Regenerate.
8685         * config.in: Regenerate.
8686         * configure: Regenerate.
8687
8688 2009-12-16  Doug Kwan  <dougkwan@google.com>
8689
8690         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8691         sections.
8692         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8693         relaxed input sections.
8694         * output.cc (Output_section::find_relaxed_input_section): Change
8695         return type to Output_relaxed_input_section pointer.  Adjust code
8696         for new type of relaxed_input_section_map_.
8697         * output.h (Output_section::find_relaxed_input_section): Change
8698         return type to Output_relaxed_input_section pointer.
8699         (Output_section::Output_relaxed_input_section_by_input_section_map):
8700         New type.
8701         (Output_section::relaxed_input_section_map_): Change type to
8702         Output_section::Output_relaxed_input_section_by_input_section_map.
8703         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8704         input section.
8705
8706 2009-12-15  Ian Lance Taylor  <iant@google.com>
8707
8708         * layout.cc (Layout::create_shstrtab): Only write out after input
8709         sections if we are compressing debug sections.
8710
8711 2009-12-15  Ian Lance Taylor  <iant@google.com>
8712
8713         * archive.cc (Archive::add_symbols): Only look up a symbol without
8714         a version if there is, in fact, a version.
8715
8716 2009-12-14  Ian Lance Taylor  <iant@google.com>
8717
8718         Revert -Wshadow changes, all changes from:
8719         2009-12-11  Doug Kwan  <dougkwan@google.com>
8720         2009-12-11  Nick Clifton  <nickc@redhat.com>
8721         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8722
8723 2009-12-11  Doug Kwan  <dougkwan@google.com>
8724
8725         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8726         due to -Wshadow.
8727         * attributes.cc (Object_attribute::size): Ditto.
8728         (Attributes_section_data::size): Ditto.
8729         (Attributes_section_data::Attributes_section_data): Ditto.
8730         (Output_attributes_section_data::do_write): Ditto.
8731         * attributes.h (Object_attribute::set_type): Ditto.
8732         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8733
8734 2009-12-11  Nick Clifton  <nickc@redhat.com>
8735
8736         * archive.cc: Fix shadowed variable warnings.
8737         * arm.cc: Likewise.
8738         * compressed_output.cc: Likewise.
8739         * compressed_output.h: Likewise.
8740         * configure: Likewise.
8741         * dwarf_reader.cc: Likewise.
8742         * dynobj.cc: Likewise.
8743         * dynobj.h: Likewise.
8744         * ehframe.cc: Likewise.
8745         * ehframe.h: Likewise.
8746         * errors.cc: Likewise.
8747         * expression.cc: Likewise.
8748         * fileread.cc: Likewise.
8749         * fileread.h: Likewise.
8750         * freebsd.h: Likewise.
8751         * i386.cc: Likewise.
8752         * icf.cc: Likewise.
8753         * incremental.h: Likewise.
8754         * layout.cc: Likewise.
8755         * layout.h: Likewise.
8756         * mapfile.cc: Likewise.
8757         * merge.cc: Likewise.
8758         * merge.h: Likewise.
8759         * object.cc: Likewise.
8760         * object.h: Likewise.
8761         * options.h: Likewise.
8762         * output.cc: Likewise.
8763         * output.h: Likewise.
8764         * parameters.cc: Likewise.
8765         * plugin.cc: Likewise.
8766         * powerpc.cc: Likewise.
8767         * reduced_debug_output.cc: Likewise.
8768         * reduced_debug_output.h: Likewise.
8769         * reloc.cc: Likewise.
8770         * reloc.h: Likewise.
8771         * resolve.cc: Likewise.
8772         * script-sections.cc: Likewise.
8773         * script.cc: Likewise.
8774         * script.h: Likewise.
8775         * sparc.cc: Likewise.
8776         * symtab.cc: Likewise.
8777         * symtab.h: Likewise.
8778         * target-select.cc: Likewise.
8779         * target-select.h: Likewise.
8780         * token.h: Likewise.
8781         * workqueue.cc: Likewise.
8782         * workqueue.h: Likewise.
8783         * x86_64.cc: Likewise.
8784
8785 2009-12-10  Doug Kwan  <dougkwan@google.com>
8786
8787         * arm.cc (attributes.h): New include.
8788         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8789         (Arm_relobj::~Arm_relobj): Delete object pointed by
8790         attributes_section_data_.
8791         (Arm_relobj::attributes_section_data): New method definition.
8792         (Arm_relobj::attributes_section_data_): New data member declaration.
8793         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8794         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8795         attributes_section_data_.
8796         (Arm_dynobj::attributes_section_data): New method definition.
8797         (Arm_dynobj::attributes_section_data_): New data member declaration.
8798         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8799         initialization value of may_use_blx_ to false.
8800         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8801         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8802         object attributes to compute results instead of hard-coding.
8803         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8804         Target_arm::get_secondary_compatible_arch,
8805         Target_arm::set_secondary_compatible_arch
8806         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8807         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8808         New method declarations.
8809         (Target_arm::get_aeabi_object_attribute): New method definition.
8810         (Target_arm::attributes_section_data_): New data member declaration.
8811         (read_arm_attributes_section): New template definition.
8812         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8813         (Arm_dynobj::do_read_symbols): Ditto.
8814         (Target_arm::do_finalize_sections): Merge attributes sections from
8815         input.  Check for BLX use after attributes section merging.
8816         Fix __exidx_start and __exidx_end visibility.  Create an
8817         .ARM.attributes section if necessary.
8818         (Target_arm::get_secondary_compatible_arch,
8819         Target_arm::set_secondary_compatible_arch,
8820         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8821         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8822         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8823         New method definitions.
8824
8825 2009-12-09  Ian Lance Taylor  <iant@google.com>
8826
8827         * plugin.cc (Plugin::load): Don't cast from void* to a function
8828         pointer.
8829
8830 2009-12-09  Ian Lance Taylor  <iant@google.com>
8831
8832         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8833         information fields.
8834
8835 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8836
8837         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8838         Replace two_file_shared_1.so with two_file_shared_2.so.
8839         * testsuite/Makefile.in: Regenerated.
8840
8841 2009-12-08  Doug Kwan  <dougkwan@google.com>
8842
8843         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8844         (HFILES): Add attributes.h and int_encoding.h.
8845         * Makefile.in: Regenerate.
8846         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8847         function definitions to int_encoding.cc
8848         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8849         prototypes to int_encoding.h
8850         * reduced_debug_output.cc (int_encoding.h): New include.
8851         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8852         function definitions to int_encoding.cc
8853         (insert_into_vector, read_from_pointer): Move template definitions to
8854         int_encoding.h
8855         * attributes.cc: New file.
8856         * attributes.h: New file.
8857         * int_encoding.cc: New file.
8858         * int_encoding.h: New file.
8859
8860 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8861
8862         PR gold/11055
8863         * incremental-dump.cc (dump_incremental_inputs): New.
8864         (main): Use dump_incremental_inputs.
8865
8866 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8867
8868         PR gold/10893
8869         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8870         checking elfcpp::STT_FUNC.
8871         (Target_i386::Relocate::relocate): Likewise.
8872         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8873
8874         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8875         symbols from shared libraries into normal FUNC symbols.
8876
8877         * symtab.h (Symbol): Add is_func and use it.
8878
8879 2009-12-05  Doug Kwan  <dougkwan@google.com>
8880
8881         * arm.cc (Target_arm::arm_info): Initialize new fields
8882         attributes_section and attributes_vendor.
8883         * i386.cc (Target_i386::i386_info): Same.
8884         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8885         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8886         fields attributes_section and attributes_vendor.
8887         * sparc.cc (Target_sparc::sparc_info): Same.
8888         * target.h (Target::attributes_section, Target::attributes_vendor,
8889         Target::is_attributes_section, Target::attribute_arg_type,
8890         Target::attributes_order): New method definitions.
8891         (Target::Target_info::attributes_section,
8892         Target::Target_info::attributes_vendor): New fields.
8893         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8894         virtual method definitions.
8895         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8896         attributes_section and attributes_vendor.
8897         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8898
8899 2009-12-05  Doug Kwan  <dougkwan@google.com>
8900
8901         * arm.cc: Update comments about interworking and stub generation.
8902         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8903         considered as non-PIC.
8904         (Arm_relocate_functions::base_abs): Fix formatting.
8905         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8906         of function to use GOT entry address instead of offset.
8907         (Target_arm::Scan::global): Issue an error if a symbol would need a
8908         PLT does not get one because it is untyped.  Remove code to create
8909         dynamic symbols for relative branches.
8910         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8911         takes unsigned integer instead of boolean.
8912
8913 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8914
8915         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8916         (two_file_test_LDADD): Likewise.
8917         (common_test_1_LDADD): Likewise.
8918         (exception_test_LDADD) Likewise.
8919         (weak_test_LDADD): Likewise.
8920         (many_sections_test_LDADD): Likewise.
8921         (initpri1_LDADD): Likewise.
8922         (script_test_1_LDADD): Likewise.
8923         (script_test_2_LDADD): Likewise.
8924         (justsyms_LDADD): Likewise.
8925         (binary_test_LDADD): Likewise.
8926         (large_LDADD): Likewise.
8927         * testsuite/Makefile.in: Regenerated.
8928
8929 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8930
8931         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8932         (Symbol_table::override_with_special): Likewise.
8933         (Symbol_table::add_from_object): Likewise.
8934
8935 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8936
8937         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8938         Don't set the data_offset twice.
8939
8940 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8941
8942         * testsuite/Makefile.in: Regenerate.
8943
8944 2009-12-03  Doug Kwan  <dougkwan@google.com>
8945
8946         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8947         (Target_arm::do_finalize_sections): Add parameter for symbol table
8948         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8949         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8950         parameter for symbol table pointer.
8951         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8952         an additional parameter for a pointer to symbol table.
8953         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8954         parameter for a symbol table pointer.
8955         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8956         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8957         Ditto.
8958         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8959         parameter for a symbol table pointer.
8960
8961 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8962
8963         * incremental.cc (Incremental_inputs_header)
8964         (Incremental_inputs_header_write, Incremental_inputs_entry)
8965         (Incremental_inputs_entry_write): Move ...
8966         * incremental.h (Incremental_inputs_header)
8967         (Incremental_inputs_header_write, Incremental_inputs_entry)
8968         (Incremental_inputs_entry_write): here.
8969
8970 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8971
8972         * incremental.cc (make_sized_incremental_binary): Set the target.
8973         Error if it is incompatible.
8974         * output.h (Output_file): Add filename method.
8975
8976 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8977
8978         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8979         from the get_* methods.
8980
8981 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8982
8983         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8984         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8985         Write 0 for the data_offset of scripts.
8986
8987 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8988
8989         * testsuite/Makefile.am: Add the incremental_test.sh test.
8990         * testsuite/incremental_test.sh: New.
8991         * testsuite/incremental_test_1.c: New.
8992         * testsuite/incremental_test_2.c: New.
8993
8994 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8995
8996         * incremental-dump.cc (main): Fix typos.
8997
8998 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8999
9000         PR gold/11025
9001         * incremental-dump.cc (main): Use llu to print 64 bit values.
9002
9003 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9004             H.J. Lu  <hongjiu.lu@intel.com>
9005
9006         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9007         $(LIBDL).
9008         (incremental_dump_LDADD): Likewise.
9009         * Makefile.in: Regenerated.
9010
9011 2009-11-25  Doug Kwan  <dougkwan@google.com>
9012
9013         Revert:
9014
9015         2009-11-25  Doug Kwan  <dougkwan@google.com>
9016
9017                 * arm.cc (Target_arm::Target_arm): Move method definition
9018                 outside of class definition.  Add code to handle
9019                 --target1-rel, --target1-abs and --target2= options.
9020                 (Target_arm::get_reloc_reloc_type): Change method to be
9021                 non-static and const.
9022                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9023                 New data member declaration.
9024                 (Target_arm::Scan::local, Target_arm::Scan::global,
9025                 Target_arm::Relocate::relocate,
9026                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9027                 Adjust call to Target_arm::get_real_reloc_type.
9028                 (Target_arm::get_real_reloc_type): Use command line options
9029                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9030                 * options.h (--target1-rel, --target1-abs, --target2): New
9031                 ARM-only options.
9032
9033 2009-11-25  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9036         class definition.  Add code to handle --target1-rel, --target1-abs
9037         and --target2= options.
9038         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9039         and const.
9040         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9041         member declaration.
9042         (Target_arm::Scan::local, Target_arm::Scan::global,
9043         Target_arm::Relocate::relocate,
9044         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9045         call to Target_arm::get_real_reloc_type.
9046         (Target_arm::get_real_reloc_type): Use command line options to
9047         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9048         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9049         options.
9050
9051 2009-11-25  Doug Kwan  <dougkwan@google.com>
9052
9053         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9054         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9055         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9056         formatting.
9057         (Arm_relocate_functions::thm_call): Replace body with a call to
9058         Arm_relocate_functions::thumb_branch_common.
9059         (Arm_relocate_functions::thm_jump24,
9060         Arm_relocate_functions::thm_xpc22): New method definitions.
9061         (Arm_relocate_functions::thumb_branch_common): New method definition.
9062         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9063         operator.
9064         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9065         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9066
9067 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9068
9069         * Makefile.am: Build incremental-dump
9070         * Makefile.in: Regenerate.
9071         * incremental-dump.cc: New.
9072         * incremental.cc (Incremental_inputs_header_data,
9073         Incremental_inputs_entry_data): Move to incremental.h
9074         * incremental.h: (Incremental_inputs_header_data,
9075         Incremental_inputs_entry_data): Move from incremental.cc
9076
9077 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9078
9079         * incremental.cc (Incremental_inputs_header,
9080         Incremental_inputs_header_write, Incremental_inputs_entry,
9081         Incremental_inputs_entry_write): Add a typedef with the data type.
9082
9083 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9084
9085         * incremental.cc (Incremental_inputs_header,
9086         Incremental_inputs_header_write, Incremental_inputs_entry,
9087         Incremental_inputs_entry_write): Update comment about which
9088         type has the filed descriptions.
9089
9090 2009-11-15  Doug Kwan  <dougkwan@google.com>
9091
9092         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9093         (Arm_relocate_functions::arm_branch_common): Change method defintion
9094         in class definition to a method declaration and update list of formal
9095         parameters.
9096         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9097         Arm_relocation_functions::jump24): Adjust call to
9098         Arm_relocate_functions::arm_branch_common.  Update list of formal
9099         parameters.
9100         (Arm_relocate_functions::xpc25): New method definition.
9101         (Arm_relocate_functions::arm_branch_common): Move method defintion
9102         out from class definition.  Use stubs for mode-switching and extending
9103         branch ranges.
9104         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9105         specially.  Change code to enable use of stubs in ARM branches.
9106
9107 2009-11-10  Doug Kwan  <dougkwan@google.com>
9108
9109         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9110         in method declaration.
9111         (Target_arm::relocate_stub): New method declaration.
9112         (Target_arm::default_target): Change to return a pointer instead of
9113         a const reference.
9114         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9115         Target_arm::default_target.
9116         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9117         method definition.
9118         (Target_arm::relocate_section): Adjust view.
9119         (Target_arm::relocate_stub): New method definition.
9120
9121 2009-11-10  Doug Kwan  <dougkwan@google.com>
9122
9123         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9124         a format warning.
9125         * incremental.cc (open_incremental_binary): Initialized local
9126         variables to avoid warnings.
9127         * object.cc (make_elf_object): Ditto.
9128         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9129         a format warning.
9130
9131 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9132
9133         PR gold/10930
9134         * testsuite/plugin_test.c: Include "config.h".
9135
9136 2009-11-09  Doug Kwan  <dougkwan@google.com>
9137
9138         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9139         (arm_symbol_value): Remove.
9140         (Arm_relocate_functions::arm_branch_common,
9141         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9142         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9143         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9144         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9145         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9146         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9147         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9148         Arm_relocate_functions::thm_mobw_abs_nc,
9149         Arm_relocate_functions::thm_mov_abs,
9150         Arm_relocate_functions::movw_prel_nc,
9151         Arm_relocate_functions::thm_movt_abs,
9152         Arm_relocate_functions::movt_prel,
9153         Arm_relocate_functions::thm_movw_prel_nc,
9154         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9155         (Target_arm::Relocate::relocate): Only decompose address into two
9156         parts if relocation type uses the thumb-bit and pass the actual
9157         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9158         calls to methods in Arm_relocate_functions for this change.
9159
9160 2009-11-08  Ian Lance Taylor  <iant@google.com>
9161
9162         PR 10925
9163         * reloc.cc: Instantiate
9164         Sized_relobj::initialize_input_to_output_maps and
9165         Sized_relobj:free_input_to_output_maps.
9166
9167 2009-11-06  Ian Lance Taylor  <iant@google.com>
9168
9169         PR 10876
9170         * defstd.cc (in_segment): Set only_if_ref true for "end".
9171
9172 2009-11-06  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (class Reloc_stub): Correct a comment.
9175         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9176         (Target_arm::scan_section_for_stubs): New method declaration.
9177         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9178         Change methods from private to protected.
9179         (Target_arm::do_may_relax): New method definition.
9180         (Target_arm::do_relax, Target_arm::group_sections,
9181         Target_arm::scan_reloc_for_stub,
9182         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9183         (Target_arm::arm_input_section_map_): New data member declaration.
9184         (Target_arm::scan_reloc_for_stub,
9185         Target_arm::scan_reloc_section_for_stubs,
9186         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9187         Target_arm::do_relax): New method definitions.
9188
9189 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9190
9191         * configure.ac: Check for (struct stat)::st_mtim
9192         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9193         * config.in: Regenerate.
9194         * configure: Regenerate.
9195
9196 2009-11-05  Ian Lance Taylor  <iant@google.com>
9197
9198         PR 10910
9199         * output.cc (Output_segment::add_output_section): Add missing
9200         return statement.
9201
9202 2009-11-04  Ian Lance Taylor  <iant@google.com>
9203
9204         PR 10880
9205         * object.h (class Object): Add is_needed and set_is_needed
9206         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9207         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9208         defined in a dynamic object and referenced by a regular object,
9209         set is_needed for the dynamic object.
9210         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9211         if the file is marked with as_needed and it is not needed.
9212
9213 2009-11-04  Ian Lance Taylor  <iant@google.com>
9214
9215         PR 10887
9216         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9217         tags if data is discarded by linker script.
9218         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9219         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9220         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9221         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9222
9223 2009-11-04  Ian Lance Taylor  <iant@google.com>
9224
9225         * layout.cc (Layout::get_output_section): Add is_interp and
9226         is_dynamic_linker_section parameters.  Change all callers.
9227         (Layout::choose_output_section): Likewise.
9228         (Layout::make_output_section): Likewise.
9229         (Layout::add_output_section_data): Add is_dynamic_linker_section
9230         parameter.  Change all callers.
9231         * layout.h (class Layout): Update declarations.
9232         * output.h (class Output_section): Add is_interp, set_is_interp,
9233         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9234         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9235         generate_code_fills_at_write_ to a bitfield.
9236         * output.cc (Output_section::Output_sections): Initialize new
9237         fields.
9238         (Output_segment::add_output_section): Add do_sort parameter.
9239         Change all callers.
9240
9241 2009-11-03  Ian Lance Taylor  <iant@google.com>
9242
9243         PR 10860
9244         * options.h (class General_options): Add --warn-common.
9245         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9246         merging two common symbols.
9247         (Symbol_table::should_override): Handle --warn-common when merging
9248         a common symbol with a defined symbol.  Use report_resolve_problem
9249         for multiple definitions.
9250         (Symbol_table::report_resolve_problem): New function.
9251         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9252
9253 2009-11-03  Doug Kwan  <dougkwan@google.com>
9254
9255         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9256         stub_factory_.
9257         (Target_arm::stub_factory): New method definition.
9258         (Target_arm::new_arm_input_section,
9259         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9260         Target_arm::reloc_uses_thumb_bit): New method declarations.
9261         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9262         New type definitions.
9263         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9264         member declarations.
9265         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9266         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9267         New method definitions.
9268
9269 2009-11-03  Ian Lance Taylor  <iant@google.com>
9270
9271         * options.h (class General_options): Add --warn_constructors.
9272
9273 2009-11-03  Ian Lance Taylor  <iant@google.com>
9274
9275         PR 10893
9276         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9277         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9278
9279 2009-11-03  Ian Lance Taylor  <iant@google.com>
9280
9281         PR 10895
9282         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9283         --msgid-bugs-address.
9284         (install-pdf): New target.
9285         (install-data_yes): Look up one directory to find mkinstalldirs.
9286
9287 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9288
9289         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9290         tree.
9291
9292 2009-10-30  Doug Kwan  <dougkwan@google.com>
9293
9294         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9295
9296 2009-10-30  Doug Kwan  <dougkwan@google.com>
9297
9298         * arm.cc (Stub_addend_reader): New struct template definition
9299         and partial specializations.
9300         (Stub_addend_reader::operator()): New method definition for a
9301         partially specialized template.
9302
9303 2009-10-30  Doug Kwan  <dougkwan@google.com>
9304
9305         * arm.cc (Arm_relobj::processor_specific_flags): New method
9306         definition.
9307         (Arm_relobj::do_read_symbols): New method declaration.
9308         (Arm_relobj::processor_specific_flags_): New data member declaration.
9309         (Arm_dynobj): New class definition.
9310         (Target_arm::do_finalize_sections): Add input_objects parameter.
9311         (Target_arm::do_adjust_elf_header): New method declaration.
9312         (Target_arm::are_eabi_versions_compatible,
9313         (Target_arm::merge_processor_specific_flags): New method declaration.
9314         (Target_arm::do_make_elf_object): New overloaded method definitions
9315         and declaration.
9316         (Arm_relobj::do_read_symbols): New method definition.
9317         (Arm_dynobj::do_read_symbols): Ditto.
9318         (Target_arm::do_finalize_sections): Add input_objects parameters.
9319         Merge processor-specific flags from all input objects.
9320         (Target_arm::are_eabi_versions_compatible,
9321         Target_arm::merge_processor_specific_flags,
9322         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9323         New method definitions.
9324         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9325         Input_objects pointer type parameter.
9326         * layout.cc (Layout::finalize): Pass input objects to target's.
9327         finalize_sections function.
9328         * output.cc (Output_file_header::do_sized_write): Set ELF file
9329         header's processor-specific flags.
9330         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9331         Input_objects pointer type parameter.
9332         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9333         * target.h (Input_objects): New forward class declaration.
9334         (Target::processor_specific_flags,
9335         Target::are_processor_specific_flags_sect): New method definitions.
9336         (Target::finalize_sections): Add input_objects parameter.
9337         (Target::Target): Initialize processor_specific_flags_ and
9338         are_processor_specific_flags_set_.
9339         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9340         parameter.
9341         (Target::set_processor_specific_flags): New method definition.
9342         (Target::processor_specific_flags_,
9343         Target::are_processor_specific_flags_set_): New data member
9344         declarations.
9345         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9346         Input_objects pointer type parameter.
9347
9348 2009-10-30  Doug Kwan  <dougkwan@google.com>
9349
9350         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9351
9352 2009-10-28  Ian Lance Taylor  <iant@google.com>
9353
9354         * object.h (class Relobj): Drop options parameter from
9355         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9356         do_scan_relocs, do_relocate.  Change all callers.
9357         (class Sized_relobj): Drop options parameters from
9358         do_gc_process_relocs, do_scan_relocs, do_relocate,
9359         do_relocate_sections, relocate_sections, emit_relocs_scan,
9360         emit_relocs_scan_reltype.  Change all callers.
9361         (struct Relocate_info): Remove options field and all references to
9362         it.
9363         * reloc.h (class Read_relocs): Remove options constructor
9364         parameter and options_ field.  Change all callers.
9365         (class Gc_process_relocs, class Scan_relocs): Likewise.
9366         (class Relocate_task): Likewise.
9367         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9368         all callers.
9369         (scan_relocatable_relocs): Likewise.
9370         * target.h (class Sized_target): Remove options parameter from
9371         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9372         all callers.
9373         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9374         callers.
9375         * arm.cc: Update functions to remove options parameters.
9376         * i386.cc: Likewise.
9377         * powerpc.cc: Likewise.
9378         * sparc.cc: Likewise.
9379         * x86_64.cc: Likewise.
9380         * testsuite/testfile.cc: Likewise.
9381
9382 2009-10-28  Doug Kwan  <dougkwan@google.com>
9383
9384         * arm.cc (Arm_relobj): New class definition.
9385         (Arm_relobj::scan_sections_for_stubs,
9386         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9387         New method definitions.
9388
9389 2009-10-28  Cary Coutant  <ccoutant@google.com>
9390
9391         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9392         (Plugin::cleanup_done_): New member.
9393         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9394         (Plugin_manager::cleanup_done_): Remove.
9395         (Plugin_manager::add_input_file): Edit error message.
9396         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9397         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9398
9399 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9400
9401         * fileread.cc: (File_read::View::~View): Use the new
9402         data_ownership_ filed.
9403         (File_read::~File_read): Dispose the new whole_file_view_.
9404         (File_read::open): Mmap the whole file if needed.
9405         (File_read::open): Use whole_file_view_ instead of contents_.
9406         (File_read::find_view): Use whole_file_view_ if applicable.
9407         (File_read::do_read): Use whole_file_view_ instead of contents_.
9408         (File_read::make_view): Use whole_file_view_ instead of contents_,
9409         update File_read::View::View call.
9410         (File_read::find_or_make_view): Update File_read::View::View
9411         call.
9412         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9413         remove contents_
9414         (File_read::View::Data_ownership): New enum.
9415         (File_read::View::View): Replace bool mapped_ with Data_ownership
9416         argument.
9417         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9418         (File_read::View::data_ownership_): New field.
9419         (File_read::contents_): Remove (replaced by whole_file_view_).
9420         (File_read::whole_file_view_): New field.
9421         * options.h (class General_options): Add --keep-files-mapped.
9422
9423 2009-10-27  Cary Coutant  <ccoutant@google.com>
9424
9425         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9426         * testsuite/Makefile.am (plugin_test_5): New test case.
9427         * testsuite/Makefile.in: Regenerate.
9428
9429 2009-10-25  Doug Kwan  <dougkwan@google.com>
9430
9431         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9432         from private to protected to allow access by child class.
9433         (Sized_relobj::do_relocate_sections): New method declaration.
9434         (Sized_relobj::relocate_sections): Virtualize.
9435         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9436         Sized_relobj::relocate_sections.  Instantiate template explicitly
9437         for different target sizes and endianity.
9438
9439 2009-10-24  Doug Kwan  <dougkwan@google.com>
9440
9441         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9442         (Arm_input_section::as_arm_input_section): New method.
9443         (Arm_output_section): New class definition.
9444         (Arm_output_section::create_stub_group,
9445         Arm_output_section::group_sections): New method definitions.
9446
9447 2009-10-22  Doug Kwan  <dougkwan@google.com>
9448
9449         * arm.cc (Arm_input_section): New class definition.
9450         (Arm_input_section::init, Arm_input_section:do_write,
9451         Arm_input_section::set_final_data_size,
9452         Arm_input_section::do_reset_address_and_file_offset): New method
9453         definitions.
9454
9455 2009-10-21  Doug Kwan  <dougkwan@google.com>
9456
9457         * arm.cc (Stub_table, Arm_input_section): New forward class
9458         declarations.
9459         (Stub_table): New class defintion.
9460         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9461         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9462         New method definition.
9463
9464 2009-10-21  Doug Kwan  <dougkwan@google.com>
9465
9466         * arm.cc: Update copyright comments.
9467         (Target_arm): New forward class template declaration.
9468         (Arm_address): New type.
9469         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9470         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9471         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9472         constants.
9473         (Insn_template): Same.
9474         (DEF_STUBS): New macro.
9475         (Stub_type): New enum type.
9476         (Stub_template): New class definition.
9477         (Stub): Same.
9478         (Reloc_stub): Same.
9479         (Stub_factory): Same.
9480         (Target_arm::Target_arm): Initialize may_use_blx_ and
9481         should_force_pic_veneer_.
9482         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9483         Target_arm::should_force_pic_veneer,
9484         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9485         Target_arm::using_thumb_only, Target_arm:;default_target): New
9486         method defintions.
9487         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9488         New data member declarations.
9489         (Insn_template::size, Insn_template::alignment): New method defintions.
9490         (Stub_template::Stub_template): New method definition.
9491         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9492         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9493         (Stub_factory::Stub_factory): New method definition.
9494         * gold.h (string_hash): New template.
9495         * output.h (Input_section_specifier::hash_value): Use
9496         gold::string_hash.
9497         (Input_section_specifier::string_hash): Remove.
9498         * stringpool.cc (Stringpool_template::string_hash): Use
9499         gold::string_hash.
9500
9501 2009-10-20  Doug Kwan  <dougkwan@google.com>
9502
9503         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9504         symbols of relaxed input sections.
9505         * output.h (Output_section::find_relaxed_input_section): Make
9506         method public.
9507
9508 2009-10-16  Doug Kwan  <dougkwan@google.com>
9509
9510         * dynobj.cc (Versions::Versions): Initialize version_script_.
9511         Only insert base version symbol definition for a shared object
9512         if version script defines any version versions.
9513         (Versions::define_base_version): New method definition.
9514         (Versions::add_def): Check that base version is not needed.
9515         (Versions::add_need): Define base version lazily.
9516         * dynobj.h (Versions::define_base_version): New method declaration.
9517         (Versions::needs_base_version_): New data member declaration.
9518         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9519         (check_DATA): Add no_version_test.stdout.
9520         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9521         New make rules.
9522         * testsuite/Makefile.in: Regenerate.
9523         * testsuite/no_version_test.c: New file.
9524         * testsuite/no_version_test.sh: Ditto.
9525
9526 2009-10-16  Doug Kwan  <dougkwan@google.com>
9527
9528         * expression.cc (class Segment_start_expression): New class definition.
9529         (Segment_start_expression::value): New method definition.
9530         (script_exp_function_segment_start): Return a new
9531         Segment_start_expression.
9532         * gold/script-c.h (script_saw_segment_start_expression): New function
9533         prototype.
9534         * script-sections.cc (Script_sections::Script_sections): Initialize
9535         SAW_SEGMENT_START_EXPRESSION_ to false.
9536         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9537         and -Tbbs options to specify section addresses if given in
9538         command line and no SEGMENT_START expression is seen in a script.
9539         * script-sections.h (Script_sections::saw_segment_start_expression,
9540         Script_sections::set_saw_segment_start_expression): New method
9541         definition.
9542         (Script_sections::saw_segment_start_expression_): New data member
9543         declaration.
9544         * script.cc (script_saw_segment_start_expression): New function.
9545         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9546         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9547         script_test_7.sh and script_test_8.sh.
9548         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9549         script_test_8.stdout.
9550         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9551         (script_test_6, script_test_6.stdout, script_test_7,
9552         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9553         * Makefile.in: Regenerate.
9554         * testsuite/script_test_6.sh: New file.
9555         * testsuite/script_test_6.t: Same.
9556         * testsuite/script_test_7.sh: Same.
9557         * testsuite/script_test_7.t: Same.
9558         * testsuite/script_test_8.sh: Same.
9559
9560 2009-10-16  Doug Kwan  <dougkwan@google.com>
9561
9562         * output.cc (Output_segment::set_section_list_address): Cast
9563         expressions to unsigned long long type to avoid format warnings.
9564
9565 2009-10-15  Ian Lance Taylor  <iant@google.com>
9566
9567         * script.cc (Script_options::add_symbol_assignment): Always add a
9568         dot assignment to script_sections_.
9569         * script-sections.cc (Script_sections::add_dot_assignment):
9570         Initialize if necessary.
9571
9572         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9573         program headers with no load segment if there is a linker script.
9574
9575         * layout.cc (Layout::set_segment_offsets): Align the file offset
9576         to the segment aligment for -N or -n with no load segment.
9577         * output.cc (Output_segment::add_output_section): Don't crash if
9578         the first section is a TLS section.
9579         (Output_segment::set_section_list_addresses): Print an error
9580         message if the address moves backward in a linker script.
9581         * script-sections.cc
9582         (Output_section_element_input::set_section_addresses): Don't
9583         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9584         (Orphan_output_section::set_section_addresses): Likewise.
9585
9586 2009-10-15  Doug Kwan  <dougkwan@google.com>
9587
9588         * layout.cc (Layout::finish_dynamic_section): Generate tags
9589         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9590         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9591         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9592
9593 2009-10-14  Ian Lance Taylor  <iant@google.com>
9594
9595         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9596         fields.
9597         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9598         data_shdr fields of relinfo.
9599         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9600         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9601         R_386_TLS_LDO_32, adjust based on section flags.
9602         (Target_i386::Relocate::fix_up_ldo): Remove.
9603
9604 2009-10-13  Ian Lance Taylor  <iant@google.com>
9605
9606         Add support for -pie.
9607         * options.h (class General_options): Add -pie and
9608         --pic-executable.
9609         (General_options::output_is_position_independent): Test -pie.
9610         (General_options::output_is_executable): Return true if not shared
9611         and not relocatable.
9612         (General_options::output_is_pie): Remove.
9613         * options.cc (General_options::finalize): Reject incompatible uses
9614         of -pie.
9615         * gold.cc (queue_middle_tasks): A -pie link is not static.
9616         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9617         * symtab.cc (Symbol::final_value_is_known): Return false if
9618         output_is_position_independent.
9619         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9620         output_is_position_independent.
9621         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9622         output_is_position_independent.
9623         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9624         output_is_position_independent.
9625         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9626         two_file_pie_test.
9627         (basic_pie_test.o, basic_pie_test): New targets.
9628         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9629         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9630         (two_file_pie_test): New target.
9631         * testsuite/Makefile.in: Rebuild.
9632         * README: Remove note saying that -pie is not supported.
9633
9634 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9635
9636         * options.h (class General_options): Add -init and -fini.
9637         * layout.cc (Layout::finish_dynamic_section): Emit
9638         given init and fini functions.
9639
9640 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9641
9642         * gc.h (gc_process_relocs): Check if icf is enabled using new
9643         function.
9644         * gold.cc (queue_initial_tasks): Likewise.
9645         (queue_middle_tasks): Likewise.
9646         * object.cc (do_layout): Likewise.
9647         * symtab.cc (is_section_folded): Likewise.
9648         * main.cc (main): Likewise.
9649         * reloc.cc (Read_relocs::run): Likewise.
9650         (Sized_relobj::do_scan_relocs): Likewise.
9651         * icf.cc (is_function_ctor_or_dtor): New function.
9652         (Icf::find_identical_sections): Check if function is ctor or dtor when
9653         safe icf is chosen.
9654         * options.h (General_options::icf): Change option to be an enum.
9655         (Icf_status): New enum.
9656         (icf_enabled): New method.
9657         (icf_safe_folding): New method.
9658         (set_icf_status): New method.
9659         (icf_status_): New variable.
9660         * (options.cc) (General_options::finalize): Set icf_status_.
9661         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9662         icf_test and icf_keep_unique_test to use the --icf enum flag.
9663         * testsuite/icf_safe_test.sh: New file.
9664         * testsuite/icf_safe_test.cc: New file.
9665
9666 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9667
9668         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9669         includes to gc.h and icf.h.
9670         * arm.cc: Include gc.h.
9671         * gold.cc: Likewise.
9672         * i386.cc: Likewise.
9673         * powerpc.cc: Likewise.
9674         * sparc.cc: Likewise.
9675         * x86_64.cc: Likewise.
9676         * gc.h: Include icf.h.
9677
9678 2009-10-11  Ian Lance Taylor  <iant@google.com>
9679
9680         * plugin.cc: Include "gold.h" before other header files.
9681
9682 2009-10-10  Chris Demetriou  <cgd@google.com>
9683
9684         * options.h (Input_file_argument::Input_file_type): New enum.
9685         (Input_file_argument::is_lib_): Replace with...
9686         (Input_file_argument::type_): New member.
9687         (Input_file_argument::Input_file_argument): Take Input_file_type
9688         'type' rather than boolean 'is_lib' as second argument.
9689         (Input_file_argument::is_lib): Use type_.
9690         (Input_file_argument::is_searched_file): New function.
9691         (Input_file_argument::may_need_search): Handle is_searched_file.
9692         * options.cc (General_options::parse_library): Support -l:filename.
9693         (General_options::parse_just_symbols): Update for Input_file_argument
9694         changes.
9695         (Command_line::process): Likewise.
9696         * archive.cc (Archive::get_file_and_offset): Likewise.
9697         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9698         * script.cc (read_script_file, script_add_file): Likewise.
9699         * fileread.cc (Input_file::Input_file): Likewise.
9700         (Input_file::will_search_for): Handle is_searched_file.
9701         (Input_file::open): Likewise.
9702         * readsyms.cc (Read_symbols::get_name): Likewise.
9703         * testsuite/Makefile.am (searched_file_test): New test.
9704         * testsuite/Makefile.in: Regenerate.
9705         * testsuite/searched_file_test.cc: New file.
9706         * testsuite/searched_file_test_lib.cc: New file.
9707
9708 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9709             Ian Lance Taylor  <iant@google.com>
9710
9711         * descriptor.cc: Include <cstdio> and "binary-io.h".
9712         (Descriptors::open): Open the files in binary mode always.
9713         * script.cc (Lex::get_token): Treat \r as whitespace.
9714
9715 2009-10-09  Ian Lance Taylor  <iant@google.com>
9716
9717         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9718
9719 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9720             Ian Lance Taylor  <iant@google.com>
9721
9722         * configure.ac: Check for readv function also.
9723         * fileread.cc (readv): Define if not HAVE_READV.
9724         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9725         does not exist.
9726         * config.in: Regenerate.
9727         * configure: Regenerate.
9728
9729 2009-10-09  Doug Kwan  <dougkwan@google.com>
9730
9731         * layout.cc (Layout::make_output_section): Call target hook to make
9732         ordinary output section.
9733         (Layout::finalize): Adjust parameter list of call the
9734         Target::may_relax().
9735         * layout.h (class Layout::section_list): New method.
9736         * merge.h (Output_merge_base::entsize): Change visibility to public.
9737         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9738         New methods.
9739         (Output_merge_string::do_is_string): New method.
9740         * object.cc (Sized_relobj::do_setup): renamed from
9741         Sized_relobj::set_up.
9742         * object.h (Sized_relobj::adjust_shndx,
9743         Sized_relobj::initializ_input_to_output_maps,
9744         Sized_relobj::free_input_to_output_maps): Change visibilities to
9745         protected.
9746         (Sized_relobj::setup): Virtualize.
9747         (Sized_relobj::do_setup): New method declaration.
9748         (Sized_relobj::invalidate_section_offset,
9749         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9750         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9751         * options.cc (parse_int): New function.
9752         * options.h (parse_int): New declaration.
9753         (DEFINE_int): New macro.
9754         (stub_group_size): New option.
9755         * output.cc (Output_section::Output_section): Initialize memebers
9756         merge_section_map_, merge_section_by_properties_map_,
9757         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9758         (Output_section::add_input_section): Handled deferred code-fill
9759         generation and remove an old comment.
9760         (Output_section::add_relaxed_input_section): New method definition.
9761         (Output_section::add_merge_input_section): Use merge section by
9762         properties map to speed to search.  Update merge section maps
9763         as appropriate.
9764         (Output_section::build_relaxation_map): New method definition.
9765         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9766         Same.
9767         (Output_section::relax_input_section): Renamed to
9768         Output_section::convert_input_sections_to_relaxed_sections and change
9769         interface to take a vector of pointers to relaxed sections.
9770         (Output_section::find_merge_section,
9771         Output_section::find_relaxed_input_section): New method definitions.
9772         (Output_section::is_input_address_mapped,
9773         Output_section::output_offset, Output_section::output_address):
9774         Use output section data maps to speed up searching.
9775         (Output_section::find_starting_output_address): Add comments.
9776         (Output_section::do_write,
9777         Output_section::write_to_postprocessing_buffer): Do code-fill
9778         generation as appropriate.
9779         (Output_section::get_input_sections): Invalidate relaxed input section
9780         map.
9781         (Output_section::restore_states): Adjust type of checkpoint .
9782         Invalidate relaxed input section map.
9783         * output.h (Output_merge_base): New class declaration.
9784         (Input_section_specifier): New class defintion.
9785         (class Output_relaxed_input_section) Change base class to
9786         Output_section_data_build.
9787         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9788         base class initializer.
9789         (Output_section::add_relaxed_input_section): New method declaration.
9790         (Output_section::Input_section): Change visibility to protected.
9791         (Output_section::Input_section::relobj,
9792         Output_section::Input_section::shndx): Handle relaxed input sections.
9793         Output_section::input_sections) Change visibility to protected.  Also
9794         define overload to return a non-const pointer.
9795         (Output_section::Merge_section_properties): New class defintion.
9796         (Output_section::Merge_section_by_properties_map,
9797         Output_section::Output_section_data_by_input_section_map,
9798         Output_section::Relaxation_map): New types.
9799         (Output_section::relax_input_section): Rename method to
9800         Output_section::convert_input_sections_to_relaxed_sections and change
9801         interface to take a vector of relaxed section pointers.
9802         (Output_section::find_merge_section,
9803         Output_section::find_relaxed_input_section,
9804         Output_section::build_relaxation_map,
9805         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9806         New method declarations.
9807         (Output_section::merge_section_map_
9808         Output_section::merge_section_by_properties_map_,
9809         Output_section::relaxed_input_section_map_,
9810         Output_section::is_relaxed_input_section_map_valid_,
9811         Output_section::generate_code_fills_at_write_): New data members.
9812         * script-sections.cc
9813         (Output_section_element_input::set_section_addresses): Call
9814         current_data_size and addralign methods of relaxed input sections.
9815         (Orphan_output_section::set_section_addresses): Call current_data_size
9816         and addralign methods of relaxed input sections.
9817         * symtab.cc (Symbol_table::compute_final_value): Extract template
9818         from the body of Symbol_table::sized_finalize_symbol.
9819         (Symbol_table::sized_finalized_symbol): Call
9820         Symbol_table::compute_final_value.
9821         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9822         (Symbol_table::compute_final_value): New templated method declaration.
9823         * target.cc (Target::do_make_output_section): New method defintion.
9824         * target.h (Target::make_output_section): New method declaration.
9825         (Target::relax): Add more parameters for input objects, symbol table
9826         and layout.  Adjust call to do_relax.
9827         (Target::do_make_output_section): New method declaration.
9828         (Target::do_relax): Add parameters for input objects, symbol table
9829         and layout.
9830
9831 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9832
9833         * pread.c: Include stdio.h.
9834
9835 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9836
9837         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9838         defined.
9839
9840 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9841
9842         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9843         Change read_shndx type to unsigned int.
9844         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9845         int.
9846         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9847         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9848         Change read_shndx type to unsigned int.
9849         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9850         int.
9851         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9852         * layout.cc (Layout::create_symtab_sections): Cast the result of
9853         local_symcount * symsize to off_t in the gold_assert.
9854
9855 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9856
9857         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9858         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9859         R_ARM_BASE_ABS.
9860         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9861         (Arm_relocate_functions::thm_abs5): New function.
9862         (Arm_relocate_functions::abs12): New function.
9863         (Arm_relocate_functions::abs16): New function.
9864         (Arm_relocate_functions::base_abs): New function.
9865         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9866         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9867         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9868         R_ARM_BASE_ABS.
9869         (Scan::global): Likewise.
9870         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9871         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9872         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9873         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9874         R_ARM_BASE_ABS.
9875
9876 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9877
9878         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9879         (Arm_relocate_functions::movt_prel): New function.
9880         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9881         (Arm_relocate_functions::thm_movt_prel): New function.
9882         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9883         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9884         (Scan::global, Relocate::relocate): Likewise.
9885         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9886
9887 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9888
9889         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9890         Incremental_checker.
9891         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9892         unsigned int.
9893         (class Incremental_inputs_header): New class.
9894         (Incremental_inputs_header_writer): Edit comment.
9895         (Incremental_inputs_entry): New class.
9896         (Incremental_inputs_entry_writer): Edit comment.
9897         (Sized_incremental_binary::do_find_incremental_inputs_section):
9898         Add *strtab_shndx parameter, fill it.
9899         (Sized_incremental_binary::do_check_inputs): New method.
9900         (Incremental_checker::can_incrementally_link_output_file): Use
9901         Sized_incremental_binary::check_inputs.
9902         (Incremental_inputs::report_command_line): Save command line in
9903         command_line_.
9904         * incremental.h:
9905         (Incremental_binary::find_incremental_inputs_section): New
9906         method.
9907         (Incremental_binary::do_find_incremental_inputs_section): Add
9908         strtab_shndx parameter.
9909         (Incremental_binary::do_check_inputs): New pure virtual method.
9910         (Sized_incremental_binary::do_check_inputs): Declare.
9911         (Incremental_checker::Incremental_checker): Add incremental_inputs
9912         parameter, use it to initialize incremental_inputs_.
9913         (Incremental_checker::incremental_inputs_): New field.
9914         (Incremental_checker::command_line): New method.
9915         (Incremental_checker::inputs): New method.
9916         (Incremental_checker::command_line_): New field.
9917
9918 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9919
9920         * incremental.cc: Include <cstdarg> and "target-select.h".
9921         (vexplain_no_incremental): New function.
9922         (explain_no_incremental): New function.
9923         (Incremental_binary::error): New method.
9924         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9925         method.
9926         (make_sized_incremental_binary): New function.
9927         (open_incremental_binary): New function.
9928         (can_incrementally_link_file): Add checks if output is ELF and has
9929         inputs section.
9930         * incremental.h: Include "elfcpp_file.h" and "output.h".
9931         (Incremental_binary): New class.
9932         (Sized_incremental_binary): New class.
9933         (open_incremental_binary): Declare.
9934         * object.cc (is_elf_object): Use
9935         elfcpp::Elf_recognizer::is_elf_file.
9936         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9937         * output.h (Output_file::filesize): New method.
9938
9939 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9940
9941         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9942         New function.
9943         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9944         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9945         function.
9946         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9947         function.
9948         (Arm_relocate_functions::movw_abs_nc): New function.
9949         (Arm_relocate_functions::movt_abs): New function.
9950         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9951         (Arm_relocate_functions::thm_movt_abs): New function.
9952         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9953         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9954         (Scan::global): Likewise.
9955         (Relocate::relocate): Likewise.
9956         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9957
9958 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9959
9960         * arm.cc (Arm_relocate_functions::got_prel) New function.
9961         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9962         (Relocate::relocate): Likewise.
9963         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9964
9965 2009-10-06  Ian Lance Taylor  <iant@google.com>
9966
9967         * options.h (class General_options): Define
9968         split_stack_adjust_size parameter.
9969         * object.h (class Object): Add uses_split_stack_ and
9970         has_no_split_stack_ fields.  Add uses_split_stack and
9971         has_no_split_stack accessor functions.  Declare
9972         handle_split_stack_section.
9973         (class Reloc_symbol_changes): Define.
9974         (class Sized_relobj): Define Function_offsets.  Declare
9975         split_stack_adjust, split_stack_adjust_reltype, and
9976         find_functions.
9977         * object.cc (Object::handle_split_stack_section): New function.
9978         (Sized_relobj::do_layout): Call handle_split_stack_section.
9979         * dynobj.cc (Sized_dynobj::do_layout): Call
9980         handle_split_stack_section.
9981         * reloc.cc (Sized_relobj::relocate_sections): Call
9982         split_stack_adjust for executable sections in split_stack
9983         objects.  Pass reloc_map to relocate_section.
9984         (Sized_relobj::split_stack_adjust): New function.
9985         (Sized_relobj::split_stack_adjust_reltype): New function.
9986         (Sized_relobj::find_functions): New function.
9987         * target-reloc.h: Include "object.h".
9988         (relocate_section): Add reloc_symbol_changes parameter.  Change
9989         all callers.
9990         * target.h (class Target): Add calls_non_split method.  Declare
9991         do_calls_non_split virtual method.  Declare match_view and
9992         set_view_to_nop.
9993         * target.cc: Include "elfcpp.h".
9994         (Target::do_calls_non_split): New function.
9995         (Target::match_view): New function.
9996         (Target::set_view_to_nop): New function.
9997         * gold.cc (queue_middle_tasks): Give an error if mixing
9998         split-stack and non-split-stack objects with -r.
9999         * i386.cc (Target_i386::relocate_section): Add
10000         reloc_symbol_changes parameter.
10001         (Target_i386::do_calls_non_split): New function.
10002         * x86_64.cc (Target_x86_64::relocate_section): Add
10003         reloc_symbol_changes parameter.
10004         (Target_x86_64::do_calls_non_split): New function.
10005         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10006         parameter.
10007         * powerpc.cc (Target_powerpc::relocate_section): Add
10008         reloc_symbol_changes parameter.
10009         * sparc.cc (Target_sparc::relocate_section): Add
10010         reloc_symbol_changes parameter.
10011         * configure.ac: Call AM_CONDITIONAL for the default target.
10012         * configure: Rebuild.
10013         * testsuite/Makefile.am (TEST_AS): New variable.
10014         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10015         (check_DATA): Add split_i386 and split_x86_64 files.
10016         (SPLIT_DEFSYMS): Define.
10017         (split_i386_[1234n].o): New targets.
10018         (split_i386_[124]): New targets.
10019         (split_i386_[1234r].stdout): New targets.
10020         (split_x86_64_[1234n].o): New targets.
10021         (split_x86_64_[124]): New targets.
10022         (split_x86_64_[1234r].stdout): New targets.
10023         (MOSTLYCLEANFILES): Add new executables.
10024         * testsuite/split_i386.sh: New file.
10025         * testsuite/split_x86_64.sh: New file.
10026         * testsuite/split_i386_1.s: New file.
10027         * testsuite/split_i386_2.s: New file.
10028         * testsuite/split_i386_3.s: New file.
10029         * testsuite/split_i386_4.s: New file.
10030         * testsuite/split_i386_n.s: New file.
10031         * testsuite/split_x86_64_1.s: New file.
10032         * testsuite/split_x86_64_2.s: New file.
10033         * testsuite/split_x86_64_3.s: New file.
10034         * testsuite/split_x86_64_4.s: New file.
10035         * testsuite/split_x86_64_n.s: New file.
10036         * testsuite/testfile.cc (Target_test): Update relocation_section
10037         function.
10038         * testsuite/Makefile.in: Rebuild.
10039
10040 2009-10-06  Ian Lance Taylor  <iant@google.com>
10041
10042         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10043         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10044         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10045         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10046         the address on ldo_addrs_.
10047         (Target_i386::Relocate::fix_up_ldo): New function.
10048
10049 2009-10-06   Rafael Espindola  <espindola@google.com>
10050
10051         * plugin.cc (add_input_library): New.
10052         (Plugin::load): Add add_input_library to tv.
10053         (Plugin_manager::add_input_file): Add the is_lib argument.
10054         (add_input_file): Update call to Plugin_manager::add_input_file.
10055         (add_input_library): New.
10056         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10057
10058 2009-09-30  Doug Kwan  <dougkwan@google.com>
10059
10060         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10061         symbol and call Symbol::may_need_copy_reloc to determine if
10062         a copy reloc is needed.
10063         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10064         nocopyreloc is given in command line.
10065         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10066         given in command line.
10067         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10068         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10069         of the removed Target_i386::may_need_copy_reloc.
10070         * options.h (copyreloc): New option with default value false.
10071         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10072         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10073         instead of the removed Target_powerpc::may_need_copy_reloc.
10074         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10075         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10076         instead of the removed Target_sparc::may_need_copy_reloc.
10077         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10078         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10079         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10080         instead of the removed Target_x86_64::may_need_copy_reloc.
10081
10082 2009-09-30  Ian Lance Taylor  <iant@google.com>
10083
10084         * object.h (class Object): Remove target_ field, and target,
10085         sized_target, and set_target methods.
10086         (Object::sized_target): Remove.
10087         (class Sized_relobj): Update declarations.  Remove sized_target.
10088         * object.cc (Sized_relobj::setup): Remove target parameter.
10089         Change all callers.
10090         (Input_objects::add_object): Don't do anything with the target.
10091         (make_elf_sized_object): Add punconfigured parameter.  Change all
10092         callers.  Set or test parameter target.
10093         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10094         Change all callers.
10095         * parameters.cc (Parameters::set_target): Change parameter type to
10096         be non-const.
10097         (Parameters::default_target): Remove.
10098         (set_parameters_target): Change parameter type to be non-const.
10099         (parameters_force_valid_target): New function.
10100         (parameters_clear_target): New function.
10101         * parameters.h (class Parameters): Update declarations.  Remove
10102         default_target method.  Add sized_target and clear_target
10103         methods.  Change target_ to be non-const.
10104         (set_parameters_target): Update declaration.
10105         (parameters_force_valid_target): Declare.
10106         (parameters_clear_target): Declare.
10107         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10108         as NULL if we aren't searching.
10109         (Add_symbols::run): Don't check for compatible target.
10110         * fileread.cc (Input_file::open_binary): Call
10111         parameters_force_valid_target.
10112         * gold.cc (queue_middle_tasks): Likewise.
10113         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10114         set_target on object.
10115         * dynobj.h (class Sized_dynobj): Update declarations.
10116         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10117         make_elf_object returns NULL.
10118         (Archive::include_member): Don't check whether object target is
10119         compatible.
10120         * output.cc (Output_section::add_input_section): Get target from
10121         parameters.
10122         (Output_section::relax_input_section): Likewise.
10123         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10124         parameters.
10125         (Sized_relobj::do_scan_relocs): Likewise.
10126         (Sized_relobj::relocate_sections): Likewise.
10127         * resolve.cc (Symbol_table::resolve): Likewise.
10128         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10129         parameter.  Change all callers.
10130         (Symbol_table::add_from_object): Get target from parameters.
10131         (Symbol_table::add_from_relobj): Don't check object target.
10132         (Symbol_table::add_from_dynobj): Likewise.
10133         (Symbol_table::define_special_symbol): Get target from
10134         parameters.
10135         * symtab.h (class Symbol_table): Update declaration.
10136         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10137         parameter.  Change all callers.  Clear parameter target.
10138         (Binary_test): Test target here.
10139         * testsuite/object_unittest.cc (gold_testsuite): Remove
10140         target_test_pointer parameter.  Change all callers.
10141         (Object_test): Test target here.
10142
10143 2009-09-26  Ian Lance Taylor  <iant@google.com>
10144
10145         * testsuite/initpri1.c: Don't try to use constructor priorities if
10146         compiling with gcc before 4.3.
10147
10148 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10149
10150         * testsuite/retain_symbols_file_test.sh (check_present): Change
10151         output file name to retain_symbols_file_test.stdout.
10152         (check_absent): Likewise.
10153
10154 2009-09-18  Craig Silverstein  <csilvers@google.com>
10155
10156         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10157         * options.cc: Include <cerrno> and <fstream>.
10158         (General_options::finalize): Parse -retain-symbols-file tag.
10159         * options.h: New flag.
10160         (General_options): New method should_retain_symbol, new
10161         variable symbols_to_retain.
10162         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10163         should_retain_symbol map.
10164         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10165         * testsuite/Makefile.in: Regenerate.
10166         * testsuite/retain_symbols_file_test.sh: New file.
10167
10168 2009-09-18  Nick Clifton  <nickc@redhat.com>
10169
10170         * po/es.po: Updated Spanish translation.
10171
10172 2009-09-17  Doug Kwan  <dougkwan@google.com>
10173
10174         * debug.h (DEBUG_RELAXATION): New constant.
10175         (DEBUG_ALL): Add DEBUG_RELAXATION.
10176         (debug_string_to_enum): Add relaxation debug option.
10177         * layout.cc
10178         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10179         Layout::Relaxation_debug_check::read_sections,
10180         Layout::Relaxation_debug_check::read_sections): New method definitions.
10181         (Layout::Layout): Initialize data members
10182         record_output_section_data_from_scrips_,
10183         script_output_section_data_list_ and relaxation_debug_check_.
10184         (Layout::save_segments, Layout::restore_segments,
10185         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10186         Layout::relaxation_loop_body): New method definitions.
10187         (Layout::finalize): Support relaxation.  Move section layout code to
10188         Layout::relaxation_loop_body.
10189         (Layout::set_asection_address_from_script): Move code for orphan
10190         section placement out.
10191         (Layout::place_orphan_sections_in_script): New method definition.
10192         * layout.h (Output_segment_headers, Output_file_header):
10193         New forward class declarations.
10194         (Layout::~Layout): Define.
10195         (Layout::new_output_section_data_from_script): New method definition.
10196         (Layout::place_orphan_sections_in_script): New method declaration.
10197         (Layout::Segment_states): New type declaration.
10198         (Layout::save_segments, Layout::restore_segments,
10199         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10200         Layout::relaxation_loop_body): New method declarations.
10201         (Layout::Output_section_data_list): New type declaration.
10202         (Layout::Relaxation_debug_check): New class definition.
10203         (Layout::record_output_section_data_from_script_,
10204         Layout::script_output_section_data_list_, Layout::segment_states_,
10205         Layout::relaxation_debug_check_): New data members.
10206         * output.cc: (Output_section_headers::do_size): New method definition.
10207         (Output_section_headers::Output_section_headers): Move size
10208         computation to Output_section_headers::do_size.
10209         (Output_segment_headers::do_size): New method definition.
10210         (Output_file_header::Output_file_header): Move size computation to
10211         Output_file_header::do_size and call it.
10212         (Output_file_header::do_size): New method definition.
10213         (Output_data_group::Output_data_group): Adjust call to
10214         Output_section_data.
10215         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10216         (Output_symtab_xindex::do_write): Add array bound check.
10217         (Output_section::Input_section::print_to_mapfile): Handle
10218         RELAXED_INPUT_SECTION_CODE.
10219         (Output_section::Output_section): Initialize data member checkpoint_.
10220         (Output_section::~Output_section): Delete checkpoint object pointed
10221         by checkpoint_.
10222         (Output_section::add_input_section): Always add an Input_section if
10223         relaxing.
10224         (Output_section::add_merge_input_section): Add assert.
10225         (Output_section::relax_input_section): New method definition.
10226         (Output_section::set_final_data_size): Set load address to zero for
10227         an unallocated section.
10228         (Output_section::do_address_and_file_offset_have_reset_values):
10229         New method definition.
10230         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10231         Handle relaxed input section.
10232         (Output_section::sort_attached_input_sections): Checkpoint input
10233         section list lazily.
10234         (Output_section::get_input_sections): Change type of input_sections to
10235         list of Simple_input_section pointers.  Checkpoint input section list
10236         lazily.  Also handle relaxed input sections.
10237         (Output_section::add_input_section_for_script): Take a reference to
10238         a Simple_input_section object instead of Relobj pointer and section
10239         index as parameter.  Handle relaxed input sections.
10240         (Output_section::save_states, Output_section::restore_states): New
10241         method definitions.
10242         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10243         (Output_data::is_data_size_fixed): New method definition.
10244         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10245         if it is fixed.
10246         (Output_data::address_and_file_offset_have_reset_values): New method
10247         definition.
10248         (Output_data::do_address_and_file_offset_have_reset_values): New method
10249         definition.
10250         (Output_data::set_data_size): Check that data size is not fixed.
10251         (Output_data::fix_data_size): New method definition.
10252         (Output_data::is_data_size_fixed_): New data member.
10253         (Output_section_headers::set_final_data_size): New method definition.
10254         (Output_section_headers::do_size): New method declaration.
10255         (Output_segment_headers::set_final_data_size): New method definition.
10256         (Output_segment_headers::do_size): New method declaration.
10257         (Output_file_header::set_final_data_size)::New method definition.
10258         (Output_file_header::do_size)::New method declaration.
10259         (Output_section_data::Output_section_data): Add new parameter
10260         is_data_size_fixed and use it to fix data size.
10261         (Output_data_const::Output_data_const): Adjust call to base class
10262         constructor and fix data size.
10263         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10264         base class constructor and fix data size.
10265         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10266         base class constructor and fix data size.
10267         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10268         class constructor and fix data size.
10269         (Output_data_group::set_final_data_size): New method definition.
10270         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10271         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10272         class constructor and fix data size.
10273         (Output_relaxed_input_section): New class definition.
10274         (Output_section::Simple_input_section): New class definition.
10275         (Output_section::get_input_sections): Adjust parameter list.
10276         (Output_section::add_input_section_for_script): Same.
10277         (Output_section::save_states, Output_section::restore_states,
10278         Output_section::do_address_and_file_offset_have_reset_values,
10279         (Output_section::Input_section::Input_section): Handle
10280         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10281         Output_relaxed_input_section.
10282         (Output_section::Input_section::is_input_section,
10283         Output_section::Input_section::set_output_section): Handle relaxed
10284         input section.
10285         (Output_section::Input_section::is_relaxed_input_section,
10286         Output_section::Input_section::output_section_data,
10287         Output_section::Input_section::relaxed_input_section): New method
10288         definitions.
10289         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10290         value.
10291         (Output_section::Input_section::u1_): Update comments.
10292         (Output_section::Input_section::u2_): Add new union member poris.
10293         (Output_section::Checkpoint_output_section): New classs definition.
10294         (Output_section::relax_input_section): New method declaration.
10295         (Output_section::checkpoint_): New data member.
10296         (Output_segment): Update comments.
10297         (Output_segment::Output_segment): Un-privatize copy constructor.
10298         (Output_segment::operator=): Un-privatize.
10299         * script-sections.cc (Output_section_element::Input_section_list):
10300         Change element type to Output_section::Simple_input_section.
10301         (Output_section_element_dot_assignment::set_section_addresses):
10302         Register output section data for relaxation clean up.
10303         (Output_data_exression::Output_data_expression): Adjust call to base
10304         constructor to fix data size.
10305         (Output_section_element_data::set_section_addresses): Register
10306         Output_data_expression object for relaxation clean up.
10307         (struct Input_section_info): Replace Relobj pointer and section index
10308         pair with Output_section::Simple_input_section and Convert struct to a
10309         class.
10310         (Input_section_sorter::operator()): Adjust access to
10311         Input_section_info data member to use accessors.
10312         (Output_section_element_input::set_section_addresses): Use layout
10313         parameter.  Adjust code to use Output_section::Simple_input_section
10314         and Input_secction_info classes.  Register filler for relaxation
10315         clean up.
10316         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10317         and section index pair with Output_section::Simple_input_section
10318         class.  Adjust code accordingly.
10319         (Phdrs_element::release_segment): New method definition.
10320         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10321         segment list.
10322         (Script_sections::release_segments): New method definition.
10323         * gold/script-sections.h (Script_sections::release_segments): New
10324         method declaration.
10325         * gold/target.h (Target::may_relax, Target::relax,
10326         Target::do_may_relax, Target::do_relax): New method definitions.
10327
10328 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10329
10330         * arm.cc (has_signed_unsigned_overflow): New function.
10331         (Arm_relocate_functions::abs8): New function.
10332         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10333         (Target_arm::Scan::global): Likewise.
10334         (Target_arm::relocate::relocate): Likewise.
10335         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10336         Likewise.
10337
10338 2009-09-16  Cary Coutant  <ccoutant@google.com>
10339
10340         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10341         * testsuite/Makefile.in: Regenerate.
10342
10343 2009-09-11  Nick Clifton  <nickc@redhat.com>
10344
10345         * po/gold.pot: Updated by the Translation project.
10346
10347 2009-09-08  Cary Coutant  <ccoutant@google.com>
10348
10349         * output.cc (Output_file::open): Add execute permission to empty file.
10350         * testsuite/Makefile.am (permission_test): New test.
10351         * testsuite/Makefile.in: Regenerate.
10352
10353 2009-09-02  Ian Lance Taylor  <iant@google.com>
10354
10355         * output.cc (Output_file::resize): Call map_no_anonymous rather
10356         than map.
10357
10358 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10359
10360         * gold.cc: Include "incremental.h".
10361         (queue_initial_tasks): Call Incremental_checker methods.
10362         * incremental.cc: Include "output.h".
10363         (Incremental_checker::can_incrementally_link_output_file): New
10364         method.
10365         * incremental.h (Incremental_checker): New class.
10366
10367         * output.cc (Output_file::open_for_modification): New method.
10368         (Output_file::map_anonymous): Changed return type to bool.  Record
10369         map in base_ field.
10370         (Output_file::map_no_anonymous): New method, broken out of map.
10371         (Output_file::map): Use map_no_anonymous and map_anonymous.
10372         * output.h (class Output_file): Update declarations.
10373
10374 2009-08-24  Cary Coutant  <ccoutant@google.com>
10375
10376         * options.h (Command_line::Pre_options): New class.
10377         (Command_line::pre_options): New member.
10378         * options.cc (gold::options::ready_to_register): New variable.
10379         (One_option::register_option): Do nothing if not registering options.
10380         Assert if same short option registered twice.
10381         (General_options::General_options): Turn off option registration when
10382         done constructing.
10383         (Command_line::Pre_options::Pre_options): New constructor.
10384
10385 2009-08-24  Cary Coutant  <ccoutant@google.com>
10386
10387         * options.h (General_options::no_keep_memory): Remove incorrect
10388         short option.
10389
10390 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10391
10392         * Makefile.am (am__skiplex, am__skipyacc): New.
10393         * Makefile.in: Regenerate.
10394
10395 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10396
10397         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10398         (INCLUDES): ... this.
10399         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10400         (AM_CPPFLAGS): Renamed from ...
10401         (INCLUDE): ... this.
10402         * Makefile.in, testsuite/Makefile.in: Regenerate.
10403
10404         * Makefile.in: Regenerate.
10405         * aclocal.m4: Likewise.
10406         * config.in: Likewise.
10407         * configure: Likewise.
10408         * testsuite/Makefile.in: Likewise.
10409
10410         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10411         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10412         * Makefile.in: Regenerate.
10413         * testsuite/Makefile.in: Regenerate.
10414
10415 2009-08-19  Cary Coutant  <ccoutant@google.com>
10416
10417         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10418         symbols in shared libraries overridden by hidden or internal symbols
10419         in the main program.
10420
10421 2009-08-19  Chris Demetriou  <cgd@google.com>
10422
10423         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10424         checking source file names in error messages.
10425
10426 2009-08-18  Doug Kwan  <dougkwan@google.com>
10427
10428         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10429         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10430         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10431         an elfcpp::Ehdr as parameter.
10432         * object.cc (Object::set_target): Remove the version that looks up
10433         a target and sets it.
10434         (Sized_relobj::setup): Take a Target object instead of
10435         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10436         (make_elf_sized_object): Find target and ask target to
10437         make an ELF object.
10438         * object.h: (Object::set_target): Remove the version that looks up
10439         a target and sets it.
10440         (Sized_relobj::setup): Take a Target object instead of
10441         an elfcpp:Ehdr as parameter.
10442         * target.cc: Include dynobj.h.
10443         (Target::do_make_elf_object_implementation): New.
10444         (Target::do_make_elf_object): New.
10445         * target.h (Target::make_elf_object): New template declaration.
10446         (Target::do_make_elf_object): New method declarations.
10447         (Target::do_make_elf_object_implementation): New template declaration.
10448
10449 2009-08-14  Ian Lance Taylor  <iant@google.com>
10450
10451         * gold.h (FUNCTION_NAME): Define.
10452         (gold_unreachable): Use FUNCTION_NAME.
10453
10454 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10455
10456         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10457         symbol in the --keep-unique list is not found.
10458
10459 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10460
10461         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10462         been maked as --keep-unique.
10463         (Icf::unfold_section): New function.
10464         * icf.h (Icf::unfold_section): New function.
10465         * options.h (General_options::keep_unique): New option.
10466         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10467         * testsuite/Makefile.in: Regenerate.
10468         * testsuite/icf_keep_unique_test.sh: New file.
10469         * testsuite/icf_keep_unique_test.cc: New file.
10470
10471 2009-08-12  Cary Coutant  <ccoutant@google.com>
10472
10473         PR 10471
10474         * resolve.cc (Symbol_table::resolve): Check for references from
10475         dynamic objects to hidden and internal symbols.
10476         * testsuite/Makefile.am (hidden_test.sh): New test.
10477         * testsuite/Makefile.in: Regenerate.
10478         * testsuite/hidden_test.sh: New script.
10479         * testsuite/hidden_test_1.c: New test source.
10480         * testsuite/hidden_test_main.c: New test source.
10481
10482 2009-08-11  Doug Kwan  <dougkwan@google.com>
10483
10484         * arm.cc: Update comments.
10485         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10486         segment to locate the .ARM.exidx section if present.
10487
10488 2009-08-09  Doug Kwan  <dougkwan@google.com>
10489
10490         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10491         patch.
10492
10493 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10494         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10495         compiler warnings.
10496
10497 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10498
10499         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10500         valid tls_segment only for non-debug-section relocations.
10501         * testsuite/Makefile.am: Add gc_tls_test.
10502         * testsuite/Makefile.in: Regenerate.
10503         * testsuite/gc_tls_test.cc: New file.
10504         * testsuite/gc_tls_test.sh: New file.
10505
10506 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10507
10508         * icf.cc: New file.
10509         * icf.h: New file.
10510         * Makefile.am (CCFILES): Add icf.cc.
10511         (HFILES): Add icf.h
10512         * Makefile.in: Regenerate.
10513         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10514         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10515         section, symbol and addend information for the relocs.
10516         * gold.cc (queue_middle_tasks): Call identical code folding.
10517         * gold.h: Add defines for multimap.
10518         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10519         to the call of finalize_local_symbols.
10520         * main.cc (main): Create object of class Icf.
10521         * object.cc (Sized_relobj::do_layout): Allow this function to be
10522         called twice during icf.
10523         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10524         to sections marked as identical by icf.
10525         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10526         when available.
10527         (Sized_relobj::do_section_entsize): New function.
10528         * object.h (Object::section_entsize): New function.
10529         (Object::do_section_entsize): New pure virtual function.
10530         (Relobj::finalize_local_symbols): Add new parameter.
10531         (Relobj::do_section_entsize): New function.
10532         * options.h (General_options::icf): New option.
10533         (General_options::icf_iterations): New option.
10534         (General_options::print_icf_sections): New option.
10535         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10536         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10537         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10538         icf.
10539         * symtab.cc (Symbol_table::is_section_folded): New function.
10540         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10541         to sections marked as identical by icf.
10542         * symtab.h (Symbol_table::set_icf): New function.
10543         (Symbol_table::icf): New function.
10544         (Symbol_table::is_section_folded): New function.
10545         (Symbol_table::icf_): New data member.
10546         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10547         * testsuite/Makefile.am: Add commands to build icf_test.
10548         * testsuite/Makefile.in: Regenerate.
10549         * testsuite/icf_test.sh: New file.
10550         * testsuite/icf_test.cc: New file.
10551
10552 2009-07-24  Chris Demetriou  <cgd@google.com>
10553
10554         * layout.cc (is_compressible_debug_section): Fix incorrect
10555         comment about compressed section names.
10556
10557 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10558
10559         PR 10419
10560         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10561
10562 2009-07-16  Ian Lance Taylor  <iant@google.com>
10563
10564         PR 10400
10565         * layout.h: #include <map>.
10566         (class Kept_section): Change from struct to class.  Add accessors
10567         and setters.  Add section size to Comdat_group mapping.  Change
10568         Comdat_group to std::map.  Add is_comdat_ field.  Add
10569         linkonce_size field in union.
10570         (class Layout): Update declaration of find_or_add_kept_section.
10571         Don't declare find_kept_object.
10572         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10573         parameter.  Add object, shndx, is_comdat, and is_group_name
10574         parameters.  Change all callers.  Adjust for new Kept_section.
10575         (Layout::find_kept_object): Remove.
10576         * object.cc (Sized_relobj::include_section_group): Update use of
10577         Kept_section.  Rename secnum to shndx.  Only record
10578         Kept_comdat_section if sections are the same size.
10579         (Sized_relobj::include_linkonce_section): Update use of
10580         Kept_section.  Only record Kept_comdat_section if sections are the
10581         same size.  Set size of linkonce section.
10582         (Sized_relobj::map_to_kept_section): Update call to
10583         get_kept_comdat_section.
10584         * object.h (class Sized_relobj): Rename fields in
10585         Kept_comdat_section to drop trailing underscores; change object
10586         field to Relobj*.  Change Kept_comdat_section_table to store
10587         struct rather than pointer.
10588         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10589         Add kept_object and kept_shndx parameters.  Change all callers.
10590         (Sized_relobj::get_kept_comdat_section): Change return type to
10591         bool.  Add kept_object and kept_shndx parameters.  Change all
10592         callers.
10593         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10594         Layout::find_or_add_kept_section.
10595
10596 2009-07-09  Ian Lance Taylor  <iant@google.com>
10597
10598         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10599         Reserve space in the hash table.
10600
10601 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10602
10603         * fileread.cc (File_read::get_mtime): New method.
10604         * fileread.h (Timespec): New structure.
10605         (File_read::get_mtime): New method.
10606         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10607         Renamed from timestamp_nsec.
10608         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10609         Elf_Xword.
10610         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10611         timestamp_nsec.
10612         (Incremental_inputs::report_archive): Save mtime; style fix.
10613         (Incremental_inputs::report_obejct): Save mtime; style fix.
10614         (Incremental_inputs::report_script): Save mtime; style fix.
10615         (Incremental_inputs::finalize_inputs): Style fix.
10616         (Incremental_inputs::finalize): Style fix.
10617         (Incremental_inputs::create_input_section_data): Store inputs
10618         mtime.
10619         * incremental.h (Incremental_inputs::report_script): Add mtime
10620         argument.
10621         (Incremental_inputs::Input_info::Input_info): Intialize only one
10622         union member.
10623         (Incremental_inputs::Input_info::archive): Move to nameless
10624         union.
10625         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10626         (Incremental_inputs::Input_info::script): Move to nameless union.
10627         (Incremental_inputs::mtime): New field.
10628         * script.cc (read_input_script): Pass file mtime to
10629         Incremental_input.
10630         * script.h (Script_info::inputs): Style fix.
10631
10632 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10633
10634         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10635         instead of 32.
10636
10637 2009-06-24  Ian Lance Taylor  <iant@google.com>
10638
10639         PR 10156
10640         * layout.cc (Layout::choose_output_section): If we find an
10641         existing section, update the flags.
10642         (Layout::create_notes): New function, broken out of
10643         Layout::finalize.
10644         (Layout::finalize): Don't create note sections.
10645         (Layout::create_note): Don't crash if linker script discards
10646         section.
10647         (Layout::create_gold_note): Likewise.
10648         (Layout::create_build_id): Likewise.  Don't set
10649         after_input_sections on the section.
10650         (Layout::create_executable_stack_info): Remove target parameter.
10651         Change caller.
10652         * layout.h (class Layout): Declare create_notes.  Update
10653         declaration of create_executable_stack_info.
10654         * gold.cc (queue_middle_tasks): Call create_notes.
10655         * output.cc (Output_section::update_flags_for_input_section): Move
10656         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10657         invalid.
10658         * output.h (Output_data::mark_address_invalid): New function.
10659         (class Output_section): Only declare, not define,
10660         update_flags_for_input_section.  Remove set_flags.
10661
10662 2009-06-24  Ian Lance Taylor  <iant@google.com>
10663
10664         * script-sections.cc (Output_section_definition::
10665         set_section_addresses): Rename shadowing local load_address to
10666         laddr.
10667
10668 2009-06-24  Ian Lance Taylor  <iant@google.com>
10669
10670         PR 10244
10671         * reloc.cc (relocate_sections): Skip empty relocation sections.
10672
10673 2009-06-23  Ian Lance Taylor  <iant@google.com>
10674
10675         PR 10156
10676         * layout.cc (Layout::create_note): Use choose_output_section
10677         rather than make_output_section.
10678
10679 2009-06-23  Ian Lance Taylor  <iant@google.com>
10680
10681         PR 10237
10682         * options.cc (General_options::parse_V): Set printed_version_.
10683         (General_options::General_options): Initialize printed_version_.
10684         * options.h (class General_options): Add printed_version_ field.
10685         * gold.cc (queue_initial_tasks): If there are no input files,
10686         don't give a fatal error if we printed the version information.
10687         (queue_middle_tasks): If using -r with a shared object, give a
10688         fatal error rather than an ordinary error.
10689
10690 2009-06-23  Ian Lance Taylor  <iant@google.com>
10691
10692         PR 10219
10693         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10694         (Layout::make_output_section): Set have_stabstr_section_ if we see
10695         a .stab*str section.
10696         (Layout::finalize): Call link_stabs_sections.
10697         (Layout::link_stabs_sections): New file.
10698         * layout.h (class Layout): Add have_stabstr_section_ field.
10699         Declare link_stabs_sections.
10700
10701 2009-06-23  Doug Kwan  <dougkwan@google.com>
10702
10703         * Makefile.am (libgold_a_LIBADD): New.
10704         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10705         * Makefile.in: Regenerate.
10706         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10707         * configure: Regenerate.
10708         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10709         * fileread.cc: Include sys/state.h
10710         * gold.h: Declare memmem and strndup if found missing.
10711         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10712
10713 2009-06-23  Ian Lance Taylor  <iant@google.com>
10714
10715         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10716         * configure: Rebuild.
10717
10718 2009-06-23  Ian Lance Taylor  <iant@google.com>
10719
10720         PR 10147
10721         * object.cc (Object::section_contents): Don't try to get a view if
10722         the section has length zero.
10723         (Object::handle_gnu_warning_section): If the section is empty, use
10724         the name of the section as the warning.
10725
10726 2009-06-23  Ian Lance Taylor  <iant@google.com>
10727
10728         PR 10133
10729         * stringpool.h (class Stringpool_template): Add optimize_ field.
10730         (Stringpool_template::set_optimize): New function.
10731         * stringpool.cc (Stringpool_template::Stringpool_template):
10732         Initialize optimize_ field.
10733         (Stringpool_template::set_string_offsets): Test local optimize
10734         fild rather than parameter.
10735         * layout.cc (Layout::Layout): Call set_optimize on the section
10736         name stringpool.
10737
10738 2009-06-22  Ian Lance Taylor  <iant@google.com>
10739
10740         PR 10030
10741         * yyscript.y: Parse TARGET.
10742         * script.cc (script_set_target): New function.
10743         * script-c.h (script_set_target): Declare.
10744         * options.cc (General_options::string_to_object_format): Rename
10745         from string_to_object_format in anonymous namespace.  Change
10746         callers.
10747         * options.h (class General_options): Declare
10748         string_to_object_format.
10749
10750 2009-06-22  Ian Lance Taylor  <iant@google.com>
10751
10752         * script-sections.cc (Script_sections::create_segments): Don't put
10753         program headers in a PT_LOAD segment if -n or -N.
10754
10755 2009-06-22  Ian Lance Taylor  <iant@google.com>
10756
10757         PR 10141
10758         * options.h (class General_options): Add -z lazy and -z now.  Sort
10759         -z options into alphabetical order.
10760         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10761
10762 2009-06-21  Ian Lance Taylor  <iant@google.com>
10763
10764         * layout.cc (Layout::make_output_section): Call
10765         Target::new_output_section.
10766         (Layout::attach_allocated_section_to_segment): Put large section
10767         sections in a separate load segment with the large segment flag
10768         set.
10769         (Layout::segment_precedes): Sort large data segments after other
10770         load segments.
10771         (align_file_offset): New static function.
10772         (Layout::set_segment_offsets): Use align_file_offset.
10773         * output.h (class Output_section): Add is_small_section_ and
10774         is_large_section_ fields.
10775         (Output_section::is_small_section): New function.
10776         (Output_section::set_is_small_section):  New function.
10777         (Output_section::is_large_section): New function.
10778         (Output_section::set_is_large_section): New function.
10779         (Output_section::is_large_data_section): New function.
10780         (class Output_segment): Add is_large_data_segment_ field.
10781         (Output_segment::is_large_data_segment): New function.
10782         (Output_segment::set_is_large_data_segment): New function.
10783         * output.cc (Output_section::Output_section): Initialize new
10784         fields.
10785         (Output_segment::Output_segment): Likewise.
10786         (Output_segment::add_output_section): Add assertion that large
10787         data sections always go in large data segments.  Force small data
10788         sections to the end of the list of data sections.  Force small BSS
10789         sections to the start of the list of BSS sections.  For large BSS
10790         sections to the end of the list of BSS sections.
10791         * symtab.h (class Symbol): Declare is_common_shndx.
10792         (Symbol::is_defined): Check Symbol::is_common_shndx.
10793         (Symbol::is_common): Likewise.
10794         (class Symbol_table): Define enum Commons_section_type.  Update
10795         declarations.  Add small_commons_ and large_commons_ fields.
10796         * symtab.cc (Symbol::is_common_shndx): New function.
10797         (Symbol_table::Symbol_table): Initialize new fields.
10798         (Symbol_table::add_from_object): Put small and large common
10799         symbols in the right list.
10800         (Symbol_table::sized_finalized_symbol): Check
10801         Symbol::is_common_shndx.
10802         (Symbol_table::sized_write_globals): Likewise.
10803         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10804         common symbol lists.  Don't call do_allocate_commons_list if the
10805         list is empty.
10806         (Symbol_table::do_allocate_commons_list): Remove is_tls
10807         parameter.  Add comons_section_type parameter.  Change all
10808         callers.  Handle small and large common symbols.
10809         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10810         Symbol::is_common_shndx.
10811         * resolve.cc (symbol_to_bits): Likewise.
10812         * target.h (Target::small_common_shndx): New function.
10813         (Target::small_common_section_flags): New function.
10814         (Target::large_common_shndx): New function.
10815         (Target::large_common_section_flags): New function.
10816         (Target::new_output_section): New function.
10817         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10818         small_common_section_flags, and large_common_section_flags
10819         fields.
10820         (Target::do_new_output_section): New virtual function.
10821         * arm.cc (Target_arm::arm_info): Initialize new fields.
10822         * i386.cc (Target_i386::i386_info): Likewise.
10823         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10824         Likewise.
10825         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10826         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10827         (Target_x86_64::do_new_output_section): New function.
10828         * configure.ac: Define conditional MCMODEL_MEDIUM.
10829         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10830         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10831         (large_LDFLAGS): Define.
10832         * testsuite/large.c: New file.
10833         * testsuite/testfile.cc (Target_test::test_target_info):
10834         Initialize new fields.
10835         * configure, testsuite/Makefile.in: Rebuild.
10836
10837 2009-06-05  Doug Kwan  <dougkwan@google.com>
10838
10839         * Makefile.am (CCFILES): Add target.cc.
10840         * Makefile.in: Regenerate.
10841         * i386.cc (class Target_i386): Define new virtual method to
10842         override do_is_local_label_name in parent.
10843         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10844         local symbols if --discard-locals or -X is given.
10845         * options.h (class General_options): Declare new options
10846         '--discard-locals' and '-X' for discarding locals.
10847         * target.h (class Target): Define new methods is_local_label_name.
10848         Declare new virtual method do_is_local_label_name.
10849         * target.cc: New file.
10850         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10851         (check_SCRIPTS): Add discard_locals_test.sh.
10852         (check_DATA): Add discard_local_tests.syms.
10853         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10854         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10855         * testsuite/Makefile.in: Regenerate.
10856         * testsuite/discard_locals_test.c: New file.
10857         * testsuite/discard_locals_test.sh: Same.
10858
10859 2009-06-05  Doug Kwan  <dougkwan@google.com>
10860
10861         * object.cc (Sized_relobj::Sized_relobj): Initialize
10862         discarded_eh_frame_shndx_ to -1U.
10863         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10864         section.
10865         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10866         a discarded .eh_frame section.
10867         (Sized_relobj::do_finalize_local_symbols): Ditto.
10868         * object.h (class Sized_relobj): Declare new member
10869         discarded_eh_frame_shndx_.
10870         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10871         (local_labels_test.o, local_labels_test): New rules.
10872         * testsuite/Makefile.in: Regenerate.
10873
10874 2009-06-04  Doug Kwan  <dougkwan@google.com>
10875
10876         * layout.cc (Layout::section_name_mapping): Add mapping for
10877         special ARM sections.
10878
10879 2009-06-03  Doug Kwan  <dougkwan@google.com>
10880
10881         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10882         (utils::has_overflow): Same.
10883
10884 2009-06-03  Ian Lance Taylor  <iant@google.com>
10885
10886         * layout.cc (Layout::section_name_mapping): New array, replacing
10887         Layout::linkonce_mapping.
10888         (Layout::section_name_mapping_count): New variable, replacing
10889         Layout::linkonce_mapping_count.
10890         (Layout::linkonce_output_name): Remove.
10891         (Layout::output_section_name): Rewrite.
10892         * layout.h (class Layout): Rename Linkonce_mapping to
10893         Section_name_mapping, linkonce_mapping to section_name_mapping,
10894         linkonce_mapping_count to section_name_mapping_count.  Don't
10895         declare linkonce_output_name.
10896
10897 2009-06-03  Doug Kwan  <dougkwan@google.com>
10898
10899         * gold/arm.cc (namespace utils): New.
10900         (Target_arm::reloc_is_non_pic): Define new method.
10901         (class Arm_relocate_functions): New.
10902         (Target_arm::Relocate::relocate): Handle relocation types used by
10903         Android.
10904
10905 2009-06-03  Ian Lance Taylor  <iant@google.com>
10906
10907         * arm.cc (Target_arm::scan::global): Use || instead of |.
10908
10909 2009-06-02  Doug Kwan  <dougkwan@google.com>
10910
10911         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10912         issued_non_pic_error_.
10913         (class Target_arm::Scan): Declare new method check_non_pic.
10914         Define new method symbol_needs_plt_entry.
10915         Declare new data member issued_non_pic_error_.
10916         (class Target_arm::Relocate): Declare new method
10917         should_apply_static_reloc.
10918         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10919         (Target_arm::Scan::check_non_pic): Define new method.
10920         (Target_arm::Scan::local): Handle a small subset of reloc types used
10921         by Android.
10922         (Target_arm::Scan::local): Same.
10923         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10924
10925 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10926
10927         * incremental.cc (Incremental_inputs::report_command_line): Filter
10928         out --incremental-* options.
10929
10930 2009-05-29  Doug Kwan  <dougkwan@google.com>
10931
10932         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10933         template class.
10934         (class Target_arm): Update comment.
10935         (Target_arm::Target_arm): Initialize new data members GOT_,
10936         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10937         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10938         and Target_arm::rel_dyn_section.
10939         Declare new_enum Target_arm::Got_type.
10940         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10941         and DYNBSS_.
10942         Update commments for member do_dynsym_value.
10943         (Target_arm::got_size, Target_arm::plt_section,
10944         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10945         new methods inside class defintion.
10946         (Target_arm::got_section): Define new method.
10947         (Target_arm::rel_dyn_section): Same.
10948         (Output_data_plt_arm): New template class.
10949         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10950         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10951         (Output_data_plt_arm::add_entry): Same.
10952         (Output_data_plt_arm::first_plt_entry): Define new
10953         static data member for PLT instruction template.
10954         (Output_data_plt_arm::plt_entry): Same.
10955         (Output_data_plt_arm::do_write): Define new method.
10956         (Target_arm::make_plt_entry): Same.
10957         (Target_arm::do_finalize_sections): Same.
10958         (Target_arm::do_dynsym_value): Same.
10959
10960 2009-05-28  Doug Kwan  <dougkwan@google.com>
10961
10962         * Makefile.am (TARGETSOURCES): Add arm.cc.
10963         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10964         * Makefile.in: Regenerate.
10965         * arm.cc: New file.
10966         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10967
10968 2009-05-26  Doug Kwan  <dougkwan@google.com>
10969
10970         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10971         (General_options::check_excluded_libs): Strip off directories in
10972         archive name before matching like GNU ld does.
10973         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10974         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10975         (exclude_libs_test_LDFLAGS): Add linker option
10976         -Wl,--exclude-libs,libexclude_libs_test_3
10977         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10978         an explicit archive without using -l.
10979         (alt/libexclude_libs_test_3.a): New make rule.
10980         * testsuite/Makefile.in: Regenerate.
10981         * testsuite/exclude_libs_test.c : Declare lib3_default().
10982         (main): Call it.
10983         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10984         * exclude_libs_test_3.c: New file.
10985
10986 2009-05-26  Nick Clifton  <nickc@redhat.com>
10987
10988         * po/id.po: New Indonesian translation.
10989         * po/gold.pot: Updated template file.
10990
10991 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10992
10993         * testsuite/Makefile.am: Add -ffunction-sections to compile
10994         gc_comdat_test files.  Add -Wl,--gc-sections to build
10995         gc_comdat_test.
10996         * testsuite/Makefile.in: Regenerate.
10997         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10998
10999 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11000
11001         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11002         kept comdat section was garbage collected.
11003         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11004         * testsuite/Makefile.in: Regenerate.
11005         * testsuite/gc_comdat_test.sh: New file.
11006         * testsuite/gc_comdat_test_1.cc: New file.
11007         * testsuite/gc_comdat_test_2.cc: New file.
11008
11009 2009-05-19  Doug Kwan  <dougkwan@google.com>
11010
11011         * archive.cc (Archive::Archive): Move constructor from archive.h
11012         to here.  Initialize no_export_.
11013         (Archive::get_elf_object_for_member): Set no_export flag of object.
11014         * archive.h (Archive::Archive): Move constructor body to
11015         archive.cc.
11016         (Archive::no_export): New method.
11017         (Archive::no_export_): New field.
11018         * object.h (Object::Object): Initialize no_export_ to false.
11019         (Object::no_export, Object::set_no_export): New methods.
11020         (Object::no_export_): New field.
11021         * options.cc (General_options::parse_exclude_libs): New method.
11022         (General_options::check_excluded_libs) Same.
11023         * options.h (exclude_libs): New option.
11024         (General_options::check_excluded_libs): New method declaration.
11025         (General_options::excluded_libs_): New field.
11026         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11027         default or protected visibility if an object has no-export flag set.
11028         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11029         (check_SCRIPTS): Add exclude_libs_test.sh.
11030         (check_DATA): Add exclude_libs_test.syms.
11031         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11032         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11033         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11034         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11035         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11036         libexclude_libs_test_2.a): New rules.
11037         * testsuite/Makefile.in: Regenerate.
11038         * testsuite/exclude_libs_test.c: New file.
11039         * testsuite/exclude_libs_test.sh: Ditto.
11040         * testsuite/exclude_libs_test_1.c: Ditto.
11041         * testsuite/exclude_libs_test_2.c: Ditto.
11042
11043 2009-05-15  Ian Lance Taylor  <iant@google.com>
11044
11045         * configure.ac: Check for declarations for cases where libiberty.h
11046         checks HAVE_DECL_xxx.
11047         * configure, config.in: Rebuild.
11048
11049 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11050
11051         * gold.h (Incremental_argument_list): Remove (invalid) forward
11052         declaration.
11053         * incremental.cc (Incremental_inputs::report_achive): New method.
11054         (Incremental_inputs::report_object): New method.
11055         (Incremental_inputs::report_script): New method.
11056         (Incremental_inputs::finalize_inputs): New method.
11057         (Incremental_inputs::finalize): Call finalize_inputs().
11058         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11059         Create inputs entries.
11060         * incremental.h (Incremental_input_type): New enum.
11061         (Incremental_inputs::Incremental_input): Initialize new fields.
11062         (Incremental_inputs::report_inputs): New method.
11063         (Incremental_inputs::report_achive): New method.
11064         (Incremental_inputs::report_object): New method.
11065         (Incremental_inputs::report_script): New method.
11066         (Incremental_inputs::finalize_inputs): New method.
11067         (Incremental_inputs::Input_info): New struct.
11068         (Incremental_inputs::Input_info_map): New typedef.
11069         (Incremental_inputs::lock_): New field.
11070         (Incremental_inputs::Inputs_): New field.
11071         (Incremental_inputs::Inputs_map): New field.
11072         * main.cc (main): Call Incremental_input::report_inputs.
11073         * options.h (Input_argument_list): Typedef moved from
11074         Input_arguments.
11075         (Input_file_group::Files): Remove, use ::Input_argument_list.
11076         (Input_file_group::Input_argument_list): Remove, use
11077         ::Input_argument_list.
11078         * plugin.cc (Plugin_manager::add_input_file): Add error in
11079         incremental build.
11080         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11081         functions.
11082         * script.cc (read_input_script): Call
11083         Incremental_input::report_script.
11084         * script.h (Script_info): New class.
11085
11086 2009-04-27  Ian Lance Taylor  <iant@google.com>
11087
11088         * x86_64.cc (do_adjust_output_section): Set entsize to
11089         plt_entry_size.
11090
11091 2009-04-23  Elliott Hughes  <enh@google.com>
11092
11093         * output.cc (Output_file::close): After short writes, continue
11094         writing from the correct offset in the buffer being written.
11095
11096 2009-04-23  Chris Demetriou  <cgd@google.com>
11097
11098         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11099         * configure: Regenerate.
11100         * config.in: Regenerate.
11101         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11102         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11103
11104 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11105
11106         * incremental.cc (Incremental_inputs_header_data): Renamed from
11107         Incremental_input_header_data.
11108         (Incremental_inputs_header_data::data_size): New field.
11109         (Incremental_inputs_header_data::put_input_file_count): Renamed
11110         from input_file_count.
11111         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11112         from command_line_offset.
11113         (Incremental_inputs_header_data::put_reserved): Renamed from
11114         put_reserved.
11115         (Incremental_inputs_entry_data): Renamed from
11116         Incremental_input_entry_data.
11117         (Incremental_inputs_entry_data::data_size): New field.
11118         (Incremental_inputs::report_command_line): New method.
11119         (Incremental_inputs::finalize): New method.
11120         (Incremental_inputs::create_incremental_inputs_data): New method.
11121         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11122         * incremental.h: New file.
11123         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11124         (Layout::finalize): Create incremental inputs section in
11125         incremental builds.
11126         (Layout::create_incremental_info_sections): New method.
11127         * layout.h (Layout::incremental_inputs): New method.
11128         (Layout::create_incremental_info_sections): New method.
11129         (Layout::incremental_inputs_): New field.
11130         * main.cc (main): Notify Incremental_input of the command line.
11131
11132 2009-04-01  Ian Lance Taylor  <iant@google.com>
11133             Mikolaj Zalewski  <mikolajz@google.com>
11134
11135         * gold.h (reserve_unordered_map): Define, three versions, one for
11136         each version of Unordered_map.
11137         * layout.cc (Layout::Layout): Remove options parameter.  Add
11138         number_of_input_files parameter.  Don't initialize options_.
11139         Initialize number_of_input_files_ and resized_signatures_.  Move
11140         sections_are_attached_.
11141         (Layout::layout_group): Reserve space for group_signatures_.
11142         (Layout::find_or_add_kept_section): Change name parameter to be a
11143         reference.  Resize signatures_ map when it gets large enough.
11144         (Layout::layout_eh_frame): Use parameters->options() instead of
11145         this->options_.
11146         (Layout::make_output_section): Likewise.
11147         (Layout::attach_allocated_section_to_segment): Likewise.
11148         (Layout::finalize, Layout::create_executable_stack): Likewise.
11149         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11150         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11151         * layout.h (class Layout): Update declarations.  Remove options_
11152         field.  Add number_of_input_files_ and resized_signatures_
11153         fields.  Move sections_are_attached_ field.
11154         * main.cc (main): Pass number of input files to Layout
11155         constructor.  Don't pass options.
11156
11157 2009-03-30  Ian Lance Taylor  <iant@google.com>
11158
11159         * ffsll.c (ffsll): Correct implementation.
11160
11161 2009-03-27  Ian Lance Taylor  <iant@google.com>
11162
11163         * ffsll.c: New file.
11164         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11165         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11166         * ftruncate.c (ftruncate): Declare before definition.
11167         * mremap.c (mremap): Likewise.
11168         * pread.c (pread): Likewise.
11169         * configure, Makefile.in, config.in: Rebuild.
11170
11171         * mremap.c: New file.
11172         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11173         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11174         (mremap): Declare if HAVE_MREMAP is not defined.
11175         * configure, Makefile.in, config.in: Rebuild.
11176
11177 2009-03-27  Cary Coutant  <ccoutant@google.com>
11178
11179         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11180         position independent.
11181         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11182         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11183
11184 2009-03-24  Cary Coutant  <ccoutant@google.com>
11185
11186         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11187         an executable.
11188         (needs_dynamic_reloc): Likewise.
11189
11190 2009-03-24  Ian Lance Taylor  <iant@google.com>
11191
11192         * yyscript.y (file_cmd): Recognize EXTERN.
11193         (extern_name_list, extern_name_list_body): New nonterminals.
11194         * script.cc (script_add_extern): Define.
11195         * script-c.h (script_add_extern): Declare.
11196
11197 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11198
11199         * object.cc (is_elf_object): Define.
11200         * object.h (is_elf_object): Declare.
11201         * archive.cc (Archive::get_elf_object_for_member): Call
11202         is_elf_object.
11203         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11204
11205 2009-03-24  Elliott Hughes  <enh@google.com>
11206
11207         * output.cc (Output_file::map_anonymous): Define.
11208         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11209         try an anonymous one.  Report the size if the mmap fails.
11210         * output.h (class Output_file): Declare map_anonymous.
11211
11212 2009-03-24  Ian Lance Taylor  <iant@google.com>
11213
11214         * target-select.cc (instantiate_target): Don't acquire the lock if
11215         the instantiated_target_ field has already been set.
11216
11217 2009-03-23  Ian Lance Taylor  <iant@google.com>
11218
11219         * gold-threads.h (class Initialize_lock): Define.
11220         * gold-threads.cc (class Initialize_lock_once): Define.
11221         (initialize_lock_control): New static variable.
11222         (initialize_lock_pointer): New static variable.
11223         (initialize_lock_once): New static function.
11224         (Initialize_lock::Initialize_lock): Define.
11225         (Initialize_lock::initialize): Define.
11226         * target-select.h: Include "gold-threads.h".
11227         (class Target_selector): Add lock_ and initialize_lock_ fields.
11228         Don't define instantiate_target, just declare it.
11229         * target-select.cc (Target_selector::Target_selector): Initialize
11230         new fields.
11231         (Target_selector::instantiate_target): Define.
11232         * descriptors.h: Include "gold-threads.h".
11233         (class Descriptors): Add initialize_lock_ field.
11234         * descriptors.cc (Descriptors::Descriptors): Initialize new
11235         field.
11236         (Descriptors::open): Use initialize_lock_ field
11237         * errors.h (class Errors): Add initialize_lock_ field.
11238         * errors.cc (Errors::Errors): Initialize new field.
11239         (Errors::initialize_lock): Use initialize_lock_ field.
11240         * powerpc.cc (class Target_selector_powerpc): Remove
11241         instantiated_target_ field.  In do_recognize call
11242         instantiate_target rather than do_instantiate_target.  In
11243         do_instantiate_target just allocate a new target.
11244         * sparc.cc (class Target_selector_sparc): Likewise.
11245
11246         * freebsd.h: New file.
11247         * i386.cc: Include "freebsd.h".
11248         (Target_i386): Derive from Target_freebsd rather than
11249         Sized_target.
11250         (Target_selector_i386): Derive from Target_selector_freebsd rather
11251         than Target_selector.
11252         * x86_64.cc: Include "freebsd.h".
11253         (Target_x86_64): Derive from Target_freebsd rather than
11254         Sized_target.
11255         (Target_selector_x86_64): Derive from Target_selector_freebsd
11256         rather than Target_selector.
11257         * target.h (class Target): Add adjust_elf_header and
11258         do_adjust_elf_header.
11259         * output.cc (Output_file_header:: do_sized_write): Call target
11260         adjust_elf_header routine.
11261         * configure.tgt: Set targ_osabi.
11262         * configure.ac: Define GOLD_DEFAULT_OSABI.
11263         * parameters.cc (Parameters::default_target): Pass
11264         GOLD_DEFAULT_OSABI to select_target.
11265         * target-select.h (class Target_selector): Make instantiate_target
11266         protected rather than private.
11267         * Makefile.am (HFILES): Add freebsd.h.
11268         * configure, Makefile.in, config.in: Rebuild.
11269
11270         * merge.cc (do_add_input_section): Correct pend value.  Change
11271         message about last entry not being null terminated from error to
11272         warning.
11273
11274 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11275
11276         * incremental.cc: New file.
11277         * Makefile.am (CCFILES): Add incremental.cc.
11278         * Makefile.in: Rebuild.
11279
11280 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11281
11282         * layout.cc (Layout::output_section_name): Preserve names
11283         of '.note.' sections.
11284
11285 2009-03-19  Ian Lance Taylor  <iant@google.com>
11286
11287         * descriptors.cc (Descriptors::open): Check that the options are
11288         valid before using them.
11289
11290 2009-03-18  Ian Lance Taylor  <iant@google.com>
11291
11292         * script-sections.h: Include <list>.
11293         (class Script_sections): Change Sections_elements from std::vector
11294         to std::list.  Typedef public Elements_iterator.  Add
11295         orphan_section_placement_, data_segment_align_start_, and
11296         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11297         field.
11298         * script-sections.cc (class Orphan_section_placement): New class.
11299         (class Sections_element): Add virtual functions is_relro and
11300         orphan_section_init.  Remove virtual function place_orphan_here.
11301         (class Output_section_definition): Add is_relro and
11302         orphan_section_init.  Remove place_orphan_here.
11303         (class Orphan_output_section): Likewise.
11304         (Script_sections::Script_sections): Update for field changes.
11305         (Script_sections::data_segment_align): Set saw_data_segment_align_
11306         and data_segment_align_start_, not data_segment_align_index.
11307         (Script_sections::data_segment_relro_end): Check
11308         saw_data_segment_align_.  Use data_segment_align_start_ rather
11309         than data_segment_align_index_.
11310         (Script_sections::place_orphan): Rewrite to use
11311         Orphan_section_placement.
11312
11313 2009-03-17  Ian Lance Taylor  <iant@google.com>
11314
11315         * archive.cc (Archive::add_symbols): Check for a version attached
11316         to the symbol name in the archive map.
11317         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11318         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11319         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11320         (ver_test_11.a): New target.
11321         * testsuite/Makefile.in: Rebuild.
11322
11323         * configure.ac: Check for chsize and posix_fallocate.  Replace
11324         ftruncate.
11325         * ftruncate.c: New file, from gnulib.
11326         * output.cc (posix_fallocate): Define dummy version if not
11327         HAVE_POSIX_FALLOCATE.
11328         (Output_file::map): Call posix_fallocate rather than lseek and
11329         write.
11330         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11331         * configure, Makefile.in, config.in: Rebuild.
11332
11333 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11334
11335         * layout.h (Layout::create_note): Add section_name parameter.
11336         * layout.cc (Layout::create_note): Likewise.
11337         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11338
11339 2009-03-17  Ian Lance Taylor  <iant@google.com>
11340
11341         * descriptors.cc: Include "options.h".
11342         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11343         (Descriptors::open): Always use O_CLOEXEC when opening a new
11344         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11345         then set FD_CLOEXEC.
11346
11347         * sparc.cc (class Target_sparc): Add has_got_section.
11348         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11349         make sure we have a GOT section.
11350
11351         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11352         (Target_sparc::Scan::local): Likewise.
11353         (Target_sparc::Scan::global): Likewise.
11354         (Target_sparc::Relocate::relocate): Likewise.
11355         (Target_sparc::Relocate::relocate_tls): Likewise.
11356
11357         * symtab.cc (Symbol_table::define_default_version): New function,
11358         broken out of add_from_object.
11359         (Symbol_table::add_from_object): Call define_default_version.
11360         (Symbol_table::define_special_symbol): Add resolve_oldsym
11361         parameter.  Change all callers.  If the version for a symbol comes
11362         from a version script, resolve it with the symbol with the same
11363         name with no version.  Also add the symbol without a version if
11364         appropriate.
11365         (do_define_in_output_data): If resolving with oldsym, don't delete
11366         sym.
11367         (do_define_in_output_segment): Likewise.
11368         (do_define_as_constant): Likewise.
11369         * symtab.h (class Symbol_table): Update declarations.
11370
11371 2009-03-13  Ian Lance Taylor  <iant@google.com>
11372
11373         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11374         (Read_symbols::requeue): New function.
11375         (Read_symbols::do_read_symbols): If make_elf_object fails because
11376         the target type is not configured, and the file was searched for,
11377         issue a warning and retry with the next directory.
11378         (Add_symbols::run): If the file has an incompatible format, and
11379         it was searched for, requeue the Read_symbols task.  On error,
11380         release the object.
11381         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11382         dirindex parameter to constructor.  Change all callers.  Declare
11383         incompatible_warning and requeue.
11384         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11385         input_argument_ and input_group_ fields.  Add them to
11386         constructor.  Change all callers.
11387         (class Read_script): Add dirindex_ field.  Add it to constructor.
11388         Change all callers.
11389         * archive.cc (Archive::setup): Remove input_objects parameter.
11390         Change all callers.
11391         (Archive::get_file_and_offset): Likewise.
11392         (Archive::read_all_symbols): Likewise.
11393         (Archive::read_symbols): Likewise.
11394         (Archive::get_elf_object_for_member): Remove input_objects
11395         parameter.  Add punconfigured parameter.  Change all callers.
11396         (Archive::add_symbols): Change return type to bool.  Check return
11397         value of include_member.
11398         (Archive::include_all_members): Likewise.
11399         (Archive::include_member): Change return type to bool.  Return
11400         false if first included object has incompatible target.  Set
11401         included_member_ field.
11402         (Add_archive_symbols::run): If add_symbols returns false, requeue
11403         Read_symbols task.
11404         * archive.h (class Archive): Add included_member_ field.
11405         Initialize it in constructor.  Add input_file and searched_for
11406         methods.  Update declarations.
11407         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11408         input_argument_ fields.  Add them to constructor.  Change all
11409         callers.
11410         * script.cc: Include "target-select.h".
11411         (class Parser_closure): Add skip_on_incompatible_target_ and
11412         found_incompatible_target_ fields.  Add
11413         skip_on_incompatible_target parameter to constructor.  Change all
11414         callers.  Add methods skip_on_incompatible_target,
11415         clear_skip_on_incompatible_target, found_incompatible_target, and
11416         set_found_incompatible_target.
11417         (read_input_script): Add dirindex parameter.  Change all callers.
11418         If parser finds an incompatible target, requeue Read_symbols
11419         task.
11420         (script_set_symbol): Clear skip_on_incompatible_target in
11421         closure.
11422         (script_add_assertion, script_parse_option): Likewise.
11423         (script_start_sections, script_add_phdr): Likewise.
11424         (script_check_output_format): New function.
11425         * script.h (read_input_script): Update declaration.
11426         * script-c.h (script_check_output_format): Declare.
11427         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11428         (ignore_cmd): Remove OUTPUT_FORMAT.
11429         * fileread.cc (Input_file::Input_file): Add explicit this.
11430         (Input_file::will_search_for): New function.
11431         (Input_file::open): Add pindex parameter.  Change all callers.
11432         * fileread.h (class Input_file): Add input_file_argument method.
11433         Declare will_search_for.  Update declarations.
11434         * object.cc (make_elf_object): Add punconfigured parameter.
11435         Change all callers.
11436         * object.h (class Object): Make input_file public.  Add
11437         searched_for method.
11438         (make_elf_object): Update declaration.
11439         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11440         restart search.
11441         * dirsearch.h (class Dirsearch): Update declaration.
11442         * options.h (class General_options): Add --warn-search-mismatch.
11443         * parameters.cc (Parameters::is_compatible_target): New function.
11444         * parameters.h (class Parameters): Declare is_compatible_target.
11445         * workqueue.cc (Workqueue::add_blocker): New function.
11446         * workqueue.h (class Workqueue): Declare add_blocker.
11447
11448         * fileread.cc (Input_file::open): Remove options parameter.
11449         Change all callers.
11450         (Input_file::open_binary): Likewise.
11451         * script.cc (read_input_script): Likewise.
11452         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11453         options parameter from constructor.  Change all callers.
11454         (class Read_script): Likewise.
11455         * fileread.h (class Input_file): Update declarations.
11456         * script.h (read_input_script): Update declaration.
11457
11458 2009-03-10  Nick Clifton  <nickc@redhat.com>
11459
11460         * po/es.po: New Spanish translation.
11461
11462 2009-03-06  Cary Coutant  <ccoutant@google.com>
11463
11464         * options.cc (parse_short_option): Keep dash_z from registering itself.
11465
11466 2009-03-03  Ian Lance Taylor  <iant@google.com>
11467
11468         PR 9918
11469         * target-reloc.h (relocate_section): Pass output_section to
11470         relocate.
11471         * i386.cc (Target_i386::should_apply_static_reloc): Add
11472         output_section parameter.  Change all callers.
11473         (Target_i386::Relocate::relocate): Add output_section parameter.
11474         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11475         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11476         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11477         * testsuite/two_file_shared.sh: New script.
11478         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11479         (check_DATA): Add two_file_shared.dbg.
11480         (two_file_shared.dbg): New target.
11481         * testsuite/Makefile.in: Rebuild.
11482
11483 2009-03-01  Ian Lance Taylor  <iant@google.com>
11484
11485         * configure.ac: Check for byteswap.h.
11486         * configure: Rebuild.
11487         * config.in: Rebuild.
11488
11489 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11490
11491         * layout.cc (Layout::find_or_add_kept_section): New function.
11492         (Layout::add_comdat): Removed.
11493         * layout.h (struct Kept_section): Move out of class Layout.
11494         Remove trailing underscores from field names.  Add group_sections
11495         field.  Rename group_ field to is_group.  Change all uses.
11496         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11497         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11498         comdat_groups_ field.
11499         (Sized_relobj::include_section_group): Use
11500         find_or_add_kept_section and Kept_section::group_sections.
11501         (Sized_relobj::include_linkonce_section): Likewise.
11502         * object.cc (class Sized_relobj): Don't define Comdat_group or
11503         Comdat_group_table.  Remove find_comdat_group and
11504         add_comdat_group.  Remove comdat_groups_ field.
11505         * plugin.cc (include_comdat_group): Use
11506         Layout::find_or_add_kept_section.
11507
11508 2009-02-28  Ian Lance Taylor  <iant@google.com>
11509
11510         * README: --gc-sections and map files are now supported.  Document
11511         some build requirements.
11512
11513         PR 6992
11514         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11515         relocatable link set the value of the section symbol to zero.
11516         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11517         relocatable link don't include the section address in the local
11518         symbol value.
11519
11520 2009-02-27  Ian Lance Taylor  <iant@google.com>
11521
11522         PR 6811
11523         * options.h (class Search_directory): Add is_system_directory.
11524         (class General_options): Declare is_in_system_directory.
11525         * options.cc (get_relative_sysroot): Make static.
11526         (get_default_sysroot): Make static.
11527         (General_optoins::is_in_system_directory): New function.
11528         * fileread.cc (Input_file::is_in_system_directory): New function.
11529         * fileread.h (class Input_file): Declare is_in_system_directory.
11530         * object.h (class Object): Add is_in_system_directory.
11531         (class Input_objects): Remove system_library_directory_ field.
11532         * object.cc (Input_objects::add_object): Don't set
11533         system_library_directory_.
11534         (input_objects::found_in_system_library_directory): Remove.
11535         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11536         parameter.  Change all callers.
11537         (Symbol_table::sized_write_globals): Likewise.
11538         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11539         Call Object::is_in_system_directory.
11540         * symtab.h (class Symbol_table): Update declarations.
11541
11542         PR 5990
11543         * descriptors.h (Open_descriptor): Add is_on_stack field.
11544         * descriptors.cc (Descriptors::open): If the descriptor is on the
11545         top of the stack, remove it.  Initialize is_on_stack field.
11546         (Descriptors::release): Only add pod to stack if it is not on the
11547         stack already.
11548         (Descriptors::close_some_descriptor): Clear stack_next and
11549         is_on_stack fields.
11550
11551         PR 7091
11552         * output.cc (Output_section::find_starting_output_address): Rename
11553         from starting_output_address; add PADDR parameter; change return
11554         type.
11555         * output.h (class Output_section): Declare
11556         find_starting_output_address instead of starting_output_address.
11557         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11558         section symbol for which we can't find a merge section.
11559
11560         PR 9836
11561         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11562         hidden or internal, force the symbol to be local.
11563         * resolve.cc (Symbol::override_visibility): Define.
11564         (Symbol::override_base): Use override_visibility.
11565         (Symbol_table::resolve): Likewise.
11566         (Symbol::override_base_with_special): Likewise.
11567         (Symbol_table::override_with_special): If the visibility is hidden
11568         or internal, force the symbol to be local.
11569         * symtab.h (class Symbol): Add set_visibility and
11570         override_visibility.
11571         * testsuite/ver_test_1.sh: New file.
11572         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11573         (check_DATA): Add ver_test_1.syms.
11574         (ver_test_1.syms): New target.
11575         * testsuite/Makefile.in: Rebuild.
11576
11577 2009-02-25  Cary Coutant  <ccoutant@google.com>
11578
11579         * layout.cc (Layout::choose_output_section): Don't rename sections
11580         when using a linker script that has a SECTIONS clause.
11581         * Makefile.in: Regenerate.
11582
11583         * testsuite/Makefile.am (script_test_5.sh): New test case.
11584         * testsuite/Makefile.in: Regenerate.
11585         * testsuite/script_test_5.cc: New file.
11586         * testsuite/script_test_5.sh: New file.
11587         * testsuite/script_test_5.t: New file.
11588
11589 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11590
11591         * archive.cc (Archive::include_member): Update calls to add_symbols.
11592         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11593         the Layout argument.
11594         * dynobj.h (do_add_symbols): Add the Layout argument.
11595         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11596         Layout argument.
11597         * object.h (Object::add_symbols): Add the Layout argument.
11598         (Object::do_add_symbols): Add the Layout argument.
11599         (Sized_relobj::do_add_symbols): Add the Layout argument.
11600         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11601         Unify the two versions.
11602         (Add_plugin_symbols): Remove.
11603         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11604         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11605         (Add_plugin_symbols): Remove.
11606         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11607         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11608         (Add_symbols::run): Make it work with Pulginobj.
11609
11610 2009-02-06  Ian Lance Taylor  <iant@google.com>
11611
11612         * object.cc (Sized_relobj::do_layout): Make info message start
11613         with lower case letter.
11614
11615 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11616
11617         * binary.cc: Fix file comment.
11618
11619         * options.h (enum Incremental_disposition): Define.
11620         (class General_options): Add new options: --incremental,
11621         --incremental_changed, --incremental_unchanged,
11622         --incremental_unknown.  Add incremental_disposition_ and
11623         implicit_incremental_ fields.
11624         (General_options::incremental_disposition): New function.
11625         (class Position_dependent_options): Add incremental_disposition
11626         option.
11627         (Position_dependent_options::copy_from_options): Set incremental
11628         dispositions.
11629         * options.cc (General_options::parse_incremental_changed): New
11630         function.
11631         (General_options::parse_incremental_unchanged): New function.
11632         (General_options::parse_incremental_unknown): New function.
11633         (General_options::General_options): Initialize new fields
11634         incremental_disposition_ and implicit_incremental_.
11635         (General_options::finalize): Check for uasge of --incremental-*
11636         without --incremental.
11637
11638 2009-02-06  Chris Demetriou  <cgd@google.com>
11639
11640         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11641         pointer and to report location as the file name associated with
11642         the symbol.
11643         (gold_undefined_symbol_at_location): New function to replace the
11644         old gold_undefined_symbol functionality.
11645         * target-reloc.h (relocate_section): Update to use
11646         gold_undefined_symbol_at_location.
11647         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11648         Call gold_undefined_symbol function rather than gold_error.
11649         * errors.h (Errors::undefined_symbol): Take location as a
11650         string, rather than calculating it from a relocation.
11651         * errors.cc (Errors::fatal): Print "fatal error:" before the
11652         formatted message.
11653         (Errors::error, Errors::error_at_location): Print "error: "
11654         before the formatted message.
11655         (Errors::undefined_symbol): Take location as a string, rather
11656         than calculating it from a relocation.
11657         (gold_undefined_symbol_at_location): New function akin to
11658         old gold_undefined_symbol, calculates location from relocation.
11659         (gold_undefined_symbol): Change to take only a Symbol pointer
11660         and to report location as the file name associated with the symbol.
11661         * testsuite/debug_msg.sh: Update for changed error messages.
11662         * testsuite/undef_symbol.sh: Likewise.
11663
11664 2009-02-04  Duncan Sands  <baldrick@free.fr>
11665
11666         PR 9812
11667         * reduced_debug_output.h
11668         (Output_reduced_debug_abbrev_section::failed): Use format for
11669         gold_warning.
11670         (Output_reduced_debug_info_section::faild): Likewise.
11671
11672 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11673
11674         * script.cc (Lazy_demangler): New class.
11675         (Version_script_info::get_symbol_version_helper): Demangle a
11676         symbol only once.
11677
11678 2009-01-29  Cary Coutant  <ccoutant@google.com>
11679
11680         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11681         to __tls_get_addr.
11682         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11683
11684 2009-01-28  Ian Lance Taylor  <iant@google.com>
11685
11686         * version.cc (version_string): Bump to 1.9.
11687
11688         * gold.h: Include <cstring> and <stdint.h>.
11689         * version.cc: Include <cstdio>.
11690         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11691         warning.
11692         * reduced_debug_output.cc (insert_into_vector): Rename from
11693         Insert_into_vector; change all callers.  Use Swap_unaligned to
11694         avoid aliasing issue; remove union since it is unnecessary.
11695
11696 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11697
11698         * Makefile.am (CCFILES): Add gc.cc.
11699         (HFILES): Add gc.h.
11700         * Makefile.in: Regenerate.
11701         * gold.cc (Gc_runner): New class.
11702         (queue_initial_tasks): Call garbage collection related tasks
11703         when corresponding options are invoked.
11704         (queue_middle_gc_tasks): New function.
11705         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11706         processed early before laying out sections during garbage collection.
11707         * gold.h (queue_middle_gc_tasks): New function.
11708         (is_prefix_of): Move from "layout.cc".
11709         * i386.cc (Target_i386::gc_process_relocs): New function.
11710         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11711         * main.cc (main): Create object of class "Garbage_collection".
11712         * object.cc (Relobj::copy_symbols_data): New function.
11713         (Relobj::is_section_name_included): New function.
11714         (Sized_relobj::do_layout): Allow this function to be called twice
11715         during garbage collection and defer layout of section during the
11716         first call.
11717         * object.h (Relobj::get_symbols_data): New function.
11718         (Relobj::is_section_name_included): New function.
11719         (Relobj::copy_symbols_data): New function.
11720         (Relobj::set_symbols_data): New function.
11721         (Relobj::get_relocs_data): New function.
11722         (Relobj::set_relocs_data): New function.
11723         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11724         (Relobj::gc_process_relocs): New function.
11725         (Relobj::do_gc_process_relocs): New pure virtual function.
11726         (Relobj::sd_): New data member.
11727         (Sized_relobj::is_output_section_offset_invalid): New function.
11728         (Sized_relobj::do_gc_process_relocs): New function.
11729         * options.h (General_options::gc_sections): Modify to not be a no-op.
11730         (General_options::print_gc_sections): New option.
11731         * plugin.cc (Plugin_finish::run): Remove function call to
11732         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11733         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11734         * reloc.cc (Read_relocs::run): Add task to process relocs and
11735         determine unreferenced sections when doing garbage collection.
11736         (Gc_process_relocs): New class.
11737         (Sized_relobj::do_gc_process_relocs): New function.
11738         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11739         sections that are garbage collected.
11740         * reloc.h (Gc_process_relocs): New class.
11741         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11742         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11743         symbols whose corresponding sections are garbage collected.
11744         (Symbol_table::Symbol_table): Add new parameter for the garbage
11745         collection object.
11746         (Symbol_table::gc_mark_undef_symbols): New function.
11747         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11748         (Symbol_table::gc_mark_dyn_syms): New function.
11749         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11750         as garbage.
11751         (Symbol_table::add_from_object): Likewise.
11752         (Symbol_table::add_from_relobj): When building shared objects, do not
11753         treat externally visible symbols as garbage.
11754         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11755         table information for static and relocatable links.
11756         * symtab.h (Symbol_table::set_gc): New function.
11757         (Symbol_table::gc): New function.
11758         (Symbol_table::gc_mark_undef_symbols): New function.
11759         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11760         (Symbol_table::gc_mark_dyn_syms): New function.
11761         (Symbol_table::gc_): New data member.
11762         * target.h (Sized_target::gc_process_relocs): New pure virtual
11763         function.
11764         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11765         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11766
11767 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11768
11769         * options.h (General_options::gc_sections): Define as a no-op for now.
11770         (General_options::no_keep_memory): Ditto.
11771         (General_options::Bshareable): Define.
11772         * options.cc (General_options::finalize): Honor -Bshareable.
11773
11774 2009-01-20  Andreas Schwab  <schwab@suse.de>
11775
11776         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11777         read the value in the contents, since we don't use it.  Use the
11778         template endianness when writing.
11779         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11780
11781 2009-01-19  Andreas Schwab  <schwab@suse.de>
11782
11783         * configure.tgt (powerpc64-*): Fix targ_obj.
11784
11785 2009-01-15  Ian Lance Taylor  <iant@google.com>
11786
11787         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11788         local symbols when stripping all symbols.
11789
11790 2009-01-14  Cary Coutant  <ccoutant@google.com>
11791
11792         * output.cc (Output_reloc): Add explicit instantiations.
11793
11794 2009-01-14  Cary Coutant  <ccoutant@google.com>
11795
11796         * archive.cc (Archive::get_elf_object_for_member): Remove call
11797         to File_read::claim_for_plugin.
11798         * descriptors.cc (Descriptors::open): Remove reference to
11799         is_claimed.
11800         (Descriptors::claim_for_plugin): Remove.
11801         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11802         (Descriptors::is_claimed): Remove.
11803         (claim_descriptor_for_plugin): Remove.
11804         * fileread.cc (File_read::claim_for_plugin): Remove.
11805         * fileread.h (File_read::claim_for_plugin): Remove.
11806         (File_read::descriptor): Reopen descriptor if necessary.
11807         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11808         (Plugin_manager::all_symbols_read): Add task parameter. Change
11809         all callers.
11810         (Plugin_manager::get_input_file): New function.
11811         (Plugin_manager::release_input_file): New function.
11812         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11813         corresponding data member.
11814         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11815         and pass to base constructor. Change all callers.
11816         (get_input_file, release_input_file): New functions.
11817         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11818         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11819         (Plugin_manager::all_symbols_read): Add task parameter.
11820         (Plugin_manager::get_input_file): New function.
11821         (Plugin_manager::release_input_file): New function.
11822         (Plugin_manager::task_): New data member.
11823         (Pluginobj::Pluginobj): Add filesize parameter.
11824         (Pluginobj::filename): New function.
11825         (Pluginobj::descriptor): New function.
11826         (Pluginobj::filesize): New function.
11827         (Pluginobj::filesize_): New data member.
11828         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11829         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11830         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11831
11832         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11833         with archive libraries.
11834         * testsuite/Makefile.in: Regenerate.
11835         * testsuite/plugin_test.c (struct sym_info): New type.
11836         (get_input_file, release_input_file): New static variables.
11837         (onload): Capture new transfer vector entries.
11838         (claim_file_hook): Stop reading at end of file according to filesize.
11839         Factor out parsing of readelf output into separate function.
11840         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11841         APIs and get the source file name from the symbol table.  Convert
11842         source file name to corresponding object file name.  Print info
11843         message when adding new input files.
11844         (parse_readelf_line): New function.
11845         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11846         * testsuite/plugin_test_2.sh: Likewise.
11847         * testsuite/plugin_test_3.sh: Likewise.
11848         * testsuite/plugin_test_4.sh: New test case.
11849
11850 2009-01-07  Ian Lance Taylor  <iant@google.com>
11851
11852         * version.cc (version_string): Bump to 1.8.
11853
11854 2008-12-23  Cary Coutant  <ccoutant@google.com>
11855
11856         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11857         * plugin.cc (Plugin_manager::finish): Rename as
11858         layout_deferred_objects.  Move cleanup to separate function.
11859         (Plugin_manager::cleanup): New function.
11860         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11861         separately.
11862         * plugin.h (Plugin_manager::finish): Rename as
11863         layout_deferred_objects.
11864         (Plugin_manager::cleanup): New function.
11865         (Plugin_manager::cleanup_done): New field.
11866
11867 2008-12-23  Cary Coutant  <ccoutant@google.com>
11868
11869         * plugin.cc (is_visible_from_outside): New function.
11870         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11871         so we don't return "IR only" status for exported symbols or -r links.
11872
11873         * testsuite/Makefile.am (plugin_test_3): New test case.
11874         * testsuite/Makefile.in: Regenerate.
11875         * testsuite/plugin_test_3.sh: New file.
11876
11877 2008-12-22  Cary Coutant  <ccoutant@google.com>
11878
11879         * object.cc (Sized_relobj::layout_section): New function.
11880         (Sized_relobj::do_layout): Defer layout of input sections until after
11881         plugin has provided replacement files.
11882         (Sized_relobj::do_layout_deferred_sections): New function.
11883         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11884         (Relobj::layout_deferred_sections): New function.
11885         (Relobj::do_layout_deferred_sections): New function.
11886         (Sized_relobj::do_layout_deferred_sections): New function.
11887         (Sized_relobj::layout_section): New function.
11888         (Sized_relobj::Deferred_layout): New structure.
11889         (Sized_relobj::deferred_layout_): New field.
11890         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11891         Change all callers.  Layout deferred sections.
11892         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11893         references.
11894         (Plugin_hook::run): Move code from do_plugin_hook inline.
11895         (Plugin_hook::do_plugin_hook): Remove.
11896         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11897         (Plugin_manager::finish): Renamed, was cleanup.
11898         (Plugin_manager::should_defer_layout): New function.
11899         (Plugin_manager::add_deferred_layout_object): New function.
11900         (Plugin_manager::Deferred_layout_list): New type.
11901         (Plugin_manager::deferred_layout_objects_): New field.
11902         (Plugin_hook::do_plugin_hook): Remove.
11903
11904 2008-12-17  Ian Lance Taylor  <iant@google.com>
11905
11906         * options.h (class General_options): Add --no case for
11907         --export-dynamic.
11908
11909 2008-12-16  Cary Coutant  <ccoutant@google.com>
11910
11911         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11912         vector.
11913         (Plugin_manager::claim_file): Create plugin object even if
11914         plugin did not call the add_symbols callback.
11915         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11916         asking for more symbols than were added.
11917         * testsuite/Makefile.am (plugin_test_1): Add test case with
11918         no global symbols.
11919         (empty.syms): New target.
11920         * testsuite/Makefile.in: Regenerate.
11921         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11922         message. Don't call add_symbols if no globals.
11923         (all_symbols_read_hook): Don't provide replacement for empty
11924         claimed file.
11925
11926 2008-12-12  Ian Lance Taylor  <iant@google.com>
11927
11928         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11929         r_type == 0 for a local symbol with r_sym == 0.
11930         (scan_relocatable_relocs): Pass r_sym to
11931         local_non_section_strategy.
11932         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11933         r_sym parameter.
11934
11935         * configure.ac: Update test for TLS descriptors: they are
11936         supported as of glibc 2.9.
11937         * configure: Rebuild.
11938
11939 2008-12-11  Ian Lance Taylor  <iant@google.com>
11940
11941         PR 7091
11942         * target-reloc.h (Default_scan_relocatable_relocs): For each
11943         function, map r_type == 0 to RELOC_DISCARD.
11944
11945 2008-12-10  Cary Coutant  <ccoutant@google.com>
11946
11947         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11948         object to override a kept COMDAT group from a plugin object.
11949
11950 2008-12-09  Ian Lance Taylor  <iant@google.com>
11951
11952         PR 7088
11953         * yyscript.y (file_cmd): Handle INPUT.
11954
11955         * testsuite/initpri1.c: Change all declarations to be full
11956         prototypes by adding void, to avoid compiler warnings.
11957
11958 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11959
11960         * options.cc (General_options::parse_plugin_opt): New.
11961         (General_options::add_plugin): The argument now is just the filename.
11962         (General_options::add_plugin_option): New.
11963         * options.h (plugin_opt): New.
11964         (add_plugin): Change argument name.
11965         (add_plugin_option): New.
11966         * plugin.cc (Plugin::load): Don't parse the plugin option.
11967         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11968         (Plugin::add_option): New.
11969         (Plugin::args_): Change type.
11970         (Plugin::filename_): New.
11971         (Plugin_manager::add_plugin_option): New.
11972         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11973         * testsuite/Makefile.in: Regenerate.
11974
11975 2008-12-05  Cary Coutant  <ccoutant@google.com>
11976
11977         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11978         Handle --strip-lto-sections option.
11979         * options.h (strip_lto_sections): New option.
11980
11981 2008-12-01  Cary Coutant  <ccoutant@google.com>
11982
11983         * plugin.cc (ld_plugin_message): Change format parameter to const.
11984         Fix mismatch between new[] and delete.
11985
11986 2008-11-14  Cary Coutant  <ccoutant@google.com>
11987
11988         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11989         instead of -1U.
11990
11991 2008-11-05  Craig Silverstein  <csilvers@google.com>
11992
11993         * options.cc (General_options::parse_dynamic_list): New function.
11994         * options.h (General_options): New flags dynamic_list,
11995         dynamic_list_data, dynamic_list_cpp_new, and
11996         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11997         (General_options::in_dynamic_list): New function.
11998         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11999         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12000         (Lex::can_continue_name): Likewise.
12001         (yylex): Likewise.
12002         (read_script_file): New parameter script_options.
12003         (read_dynamic_list): New function.
12004         (Script_options::define_dynamic_list): New function.
12005         (dynamic_list_keyword_parsecodes): New variable.
12006         (dynamic_list_keywords): New variable.
12007         * script.h (Script_options::define_dynamic_list): New function
12008         prototype.
12009         (read_dynamic_list): New function prototype.
12010         * symtab.cc (strprefix): New macro.
12011         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12012         dynamic_list_data, dynamic_list_cpp_new, and
12013         dynamic_list_cpp_typeinfo.
12014         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12015         (dynamic_list_expr): New rule.
12016         (dynamic_list_nodes): Likewise.
12017         (dynamic_list_node): Likewise.
12018         * testsuite/Makefile.am (dynamic_list): New test.
12019         * testsuite/Makefile.in: Regenerated.
12020         * testsuite/dynamic_list.t: New file.
12021         * testsuite/dynamic_list.sh: New file.
12022
12023 2008-11-05  Craig Silverstein  <csilvers@google.com>
12024
12025         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12026         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12027         (t11_last): Likewise.
12028         * testsuite/ver_test_6.c (main): Likewise.
12029
12030 2008-10-07  Cary Coutant  <ccoutant@google.com>
12031
12032         * options.c (General_options::finalize): Add check for -static and
12033         -shared.
12034         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12035         is not empty.
12036
12037 2008-10-02  Cary Coutant  <ccoutant@google.com>
12038
12039         * plugin.cc (make_sized_plugin_object): Fix conditional
12040         compilation to work when not all targets are enabled.
12041
12042 2008-09-29  Cary Coutant  <ccoutant@google.com>
12043
12044         * archive.cc (Archive::get_file_and_offset): Use filename instead
12045         of name to get library path.
12046         (Archive::include_member): Unlock external member of a thin archive.
12047
12048         * testsuite/Makefile.am (TEST_AR): New variable.
12049         (thin_archive_test_1): New test.
12050         (thin_archive_test_2): New test.
12051         * testsuite/Makefile.in: Regenerate.
12052         * testsuite/thin_archive_main.cc: New file.
12053         * testsuite/thin_archive_test_1.cc: New file.
12054         * testsuite/thin_archive_test_2.cc: New file.
12055         * testsuite/thin_archive_test_3.cc: New file.
12056         * testsuite/thin_archive_test_4.cc: New file.
12057
12058 2008-09-29  Cary Coutant  <ccoutant@google.com>
12059
12060         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12061         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12062         instead of -1U.
12063         (Sized_relobj::do_finalize_local_symbols): Likewise.
12064         (Sized_relobj::map_to_kept_section): Likewise.
12065         * object.h (Sized_relobj::invalid_address): New constant.
12066         (Sized_relobj::do_output_section_offset): Check for invalid_address
12067         and return -1ULL.
12068         * output.cc (Output_reloc::local_section_offset): Use constant
12069         invalid_address instead of -1U.
12070         (Output_reloc::get_address): Likewise.
12071         (Output_section::output_address): Change -1U to -1ULL.
12072         * output.h (Output_reloc::invalid_address): New constant.
12073         * reloc.cc (Sized_relobj::write_sections): Use constant
12074         invalid_address instead of -1U.
12075         (Sized_relobj::relocate_sections): Likewise.
12076         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12077         values for merge sections.
12078         * target-reloc.h (relocate_for_relocatable): Use constant
12079         invalid_address instead of -1U.
12080
12081 2008-09-19  Cary Coutant  <ccoutant@google.com>
12082
12083         Add plugin functionality for link-time optimization (LTO).
12084         * configure.ac (plugins): Add --enable-plugins option.
12085         * configure: Regenerate.
12086         * config.in: Regenerate.
12087         * Makefile.am (LIBDL): New variable.
12088         (CCFILES): Add plugin.cc.
12089         (HFILES): Add plugin.h.
12090         (ldadd_var): Add LIBDL.
12091         * Makefile.in: Regenerate.
12092
12093         * archive.cc: Include "plugin.h".
12094         (Archive::setup): Don't preread archive symbols when using a plugin.
12095         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12096         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12097         files.
12098         (Archive::include_member): Add symbols from plugin objects.
12099         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12100         * descriptors.cc (Descriptors::open): Check for file descriptors
12101         abandoned by plugins.
12102         (Descriptors::claim_for_plugin): New function.
12103         * descriptors.h (Descriptors::claim_for_plugin): New function.
12104         (Open_descriptor::is_claimed): New field.
12105         (claim_descriptor_for_plugin): New function.
12106         * fileread.cc (File_read::claim_for_plugin): New function.
12107         * fileread.h (File_read::claim_for_plugin): New function.
12108         (File_read::descriptor): New function.
12109         * gold.cc: Include "plugin.h".
12110         (queue_initial_tasks): Add task to call plugin hooks for generating
12111         new object files.
12112         * main.cc: Include "plugin.h".
12113         (main): Load plugin libraries.
12114         * object.h (Pluginobj): Declare.
12115         (Object::pluginobj): New function.
12116         (Object::do_pluginobj): New function.
12117         (Object::set_target): New function.
12118         * options.cc: Include "plugin.h".
12119         (General_options::parse_plugin): New function.
12120         (General_options::General_options): Initialize plugins_ field.
12121         (General_options::add_plugin): New function.
12122         * options.h (Plugin_manager): Declare.
12123         (General_options): Add --plugin option.
12124         (General_options::has_plugins): New function.
12125         (General_options::plugins): New function.
12126         (General_options::add_plugin): New function.
12127         (General_options::plugins_): New field.
12128         * plugin.cc: New file.
12129         * plugin.h: New file.
12130         * readsyms.cc: Include "plugin.h".
12131         (Read_symbols::do_read_symbols): Check for archive before checking
12132         for ELF file.  Call plugin hooks to claim files.
12133         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12134         from a real object file; force override when processing replacement
12135         files.
12136         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12137         (Symbol::init_base_object): Likewise.
12138         (Symbol::init_base_output_data): Likewise.
12139         (Symbol::init_base_output_segment): Likewise.
12140         (Symbol::init_base_constant): Likewise.
12141         (Symbol::init_base_undefined): Likewise.
12142         (Symbol::output_section): Assert that object is not a plugin.
12143         (Symbol_table::add_from_pluginobj): New function.
12144         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12145         undefined.
12146         (Symbol_table::sized_write_globals): Likewise.
12147         (Symbol_table::add_from_pluginobj): Instantiate template.
12148         * symtab.h (Sized_pluginobj): Declare.
12149         (Symbol::in_real_elf): New function.
12150         (Symbol::set_in_real_elf): New function.
12151         (Symbol::in_real_elf_): New field.
12152         (Symbol_table::add_from_pluginobj): New function.
12153
12154         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12155         (LIBDL): New variable.
12156         (LDADD): Add LIBDL.
12157         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12158         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12159         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12160         (MOSTLYCLEANFILES): Likewise.
12161         * testsuite/Makefile.in: Regenerate.
12162         * testsuite/plugin_test.c: New file.
12163         * testsuite/plugin_test_1.sh: New file.
12164         * testsuite/plugin_test_2.sh: New file.
12165
12166 2008-09-16  Ian Lance Taylor  <iant@google.com>
12167
12168         * target-reloc.h (relocate_section): Check whether a symbol is
12169         defined by the ABI before reporting an undefined symbol error.
12170         * target.h (Target::is_defined_by_abi): Make parameter const.
12171         (Target::do_is_defined_by_abi): Likewise.
12172         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12173         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12174         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12175         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12176         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12177         * testsuite/Makefile.in: Rebuild.
12178
12179         * fileread.cc (make_view): Add casts to avoid warning.
12180
12181 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12182
12183         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12184         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12185
12186 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12187
12188         * options.h (General_options::output_is_executable): New.
12189         (General_options::output_is_pie): New.
12190         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12191         for shared libraries.
12192         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12193
12194 2008-09-11  Chris Demetriou  <cgd@google.com>
12195
12196         * options.h (origin): New -z option.
12197         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12198         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12199         in DT_FLAGS_1.
12200
12201 2008-09-05  Cary Coutant  <ccoutant@google.com>
12202
12203         * fileread.cc (File_read::make_view): Add check for attempt to map
12204         beyond end of file.
12205
12206 2008-09-05  Cary Coutant  <ccoutant@google.com>
12207
12208         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12209         explicit instantiations.
12210
12211 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12212
12213         PR gold/6858
12214         * options.cc (General_options::finalize): Allow undefined symbols
12215         in shlibs if linking -shared.
12216
12217         PR gold/6859
12218         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12219         symbols as not needing a dynsym entry.
12220
12221 2008-08-20  Craig Silverstein  <csilvers@google.com>
12222
12223         * fileread.cc (File_read::open): Do not lock the file unless it
12224         was successfully opened.
12225
12226 2008-08-14  Cary Coutant  <ccoutant@google.com>
12227
12228         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12229         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12230         * testsuite/tls_test.cc (struct int128): 128-bit struct
12231         for testing TLS relocs with non-zero addend.
12232         (v12): New TLS variable.
12233         (t12): New test.
12234         (t_last): Add check for v12.
12235         * testsuite/tls_test.h (t12): New function.
12236         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12237
12238 2008-08-13  Ian Lance Taylor  <iant@google.com>
12239
12240         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12241         set tls_segment_ or relro_segment_.
12242         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12243         when appropriate.
12244         * output.h (Output_section::clear_is_relro): New function.
12245         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12246         sections specially even when output_data_ is empty.
12247         (Output_segment::maximum_alignment): When first section is relro,
12248         only force alignment for PT_LOAD segments.
12249         * script.cc (script_data_segment_align): New function.
12250         (script_data_segment_relro_end): New function.
12251         * script-c.h (script_data_segment_align): Declare.
12252         (script_data_segment_relro_end): Declare.
12253         * script-sections.h (class Script_sections): Declare
12254         data_segment_align and data_segment_relro_end.  Add fields
12255         segment_align_index_ and saw_relro_end_.
12256         * script-sections.cc (class Sections_element): Add set_is_relro
12257         virtual function.  Add new bool* parameter to place_orphan_here.
12258         Add get_output_section virtual function.
12259         (class Output_section_definition): Add set_is_relro.  Add new
12260         bool* parameter to place_orphan_here.  Add get_output_section.
12261         Add is_relro_ field.
12262         (Output_section_definition::Output_section_definition): Initialize
12263         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12264         and is_relro_ fields.
12265         (Output_section_definition::place_orphan_here): Add is_relro
12266         parameter.
12267         (Output_section_definition::set_section_addresses): Set relro for
12268         output section.
12269         (Output_section_definition::alternate_constraint): Likewise.
12270         (class Orphan_output_section): Add new bool* parameter to
12271         place_orphan_here.  Add get_output_section.
12272         (Orphan_output_section::place_orphan_here): Add is_relro
12273         parameter.
12274         (Script_sections::Script_sections): Initialize
12275         data_segment_align_index_ and saw_relro_end_.
12276         (Script_sections::data_segment_align): New function.
12277         (Script_sections::data_segment_relro_end): New function.
12278         (Script_sections::place_orphan): Set or clear is_relro.
12279         (Script_sections::set_section_addresses): Force alignment of first
12280         TLS section.
12281         * yyscript.y (exp): Call script_data_segment_align and
12282         script_data_segment_relro_end.
12283         * testsuite/relro_script_test.t: New file.
12284         * testsuite/relro_test.cc (using_script): Declare.
12285         (t1, t2): Test using_script.
12286         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12287         (relro_script_test_SOURCES): Define.
12288         (relro_script_test_DEPENDENCIES): Define.
12289         (relro_script_test_LDFLAGS): Define.
12290         (relro_script_test_LDADD): Define.
12291         (relro_script_test.so): New target.
12292         * testsuite/Makefile.in: Rebuild.
12293
12294 2008-08-06  Cary Coutant <ccoutant@google.com>
12295
12296         * archive.cc (Archive::total_archives, Archive::total_members)
12297         (Archive::total_members_loaded): New variables.
12298         (Archive::setup): Add parameter.  Add option to preread
12299         archive symbols.
12300         (Archive::read_armap): Add counter.
12301         (Archive::get_file_and_offset): New function.
12302         (Archive::get_elf_object_for_member): New function.
12303         (Archive::read_all_symbols): New function.
12304         (Archive::read_symbols): New function.
12305         (Archive::add_symbols): Add counters.
12306         (Archive::include_all_members): Use armap to find members if it's
12307         already built.
12308         (Archive::include_member): Skip reading symbols if already read.
12309         Factored code into Archive::get_file_and_offset and
12310         Archive::get_elf_object_for_member.  Changed call to
12311         Mapfile::report_include_archive_member.
12312         (Archive::print_stats): New function.
12313         * archive.h: Declare Object and Read_symbols_data classes.
12314         (Archive::Archive): Add initializers for new members.
12315         (Archive::setup): Add parameter.
12316         (Archive::print_stats): New function.
12317         (Archive::total_archives, Archive::total_members)
12318         (Archive::total_members_loaded): New variables.
12319         (Archive::get_file_and_offset): New function.
12320         (Archive::get_elf_object_for_member): New function.
12321         (Archive::read_all_symbols): New function.
12322         (Archive::read_symbols): New function.
12323         (Archive::Archive_member): New class.
12324         (Archive::members_): New member.
12325         (Archive::num_members_): New member.
12326         * main.cc: Include archive.h.
12327         (main): Call Archive::print_stats.
12328         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12329         archive parameter; member_name is now the fully-decorated name.
12330         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12331         * options.h: (General_options): Add --preread-archive-symbols option.
12332         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12333         Archive::setup.
12334
12335 2008-08-04  Ian Lance Taylor  <iant@google.com>
12336
12337         * symtab.h (Symbol::use_plt_offset): New function.
12338         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12339         * powerpc.cc (Relocate::relocate): Likewise.
12340         * sparc.cc (Relocate::relocate): Likewise.
12341         * x86_64.cc (Relocate::relocate): Likewise.
12342         * testsuite/weak_plt.sh: New test.
12343         * testsuite/weak_plt_main.cc: New test.
12344         * testsuite/weak_plt_shared.cc: New test.
12345         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12346         (check_PROGRAMS): Add weak_plt.
12347         (check_DATA): Add weak_plt_shared.so.
12348         (weak_plt_main_pic.o, weak_plt): New targets.
12349         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12350         * testsuite/Makefile.in: Rebuild.
12351
12352         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12353         gcctestdir/ld.
12354         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12355         * testsuite/Makefile.in: Rebuild.
12356
12357 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12358
12359         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12360         * Makefile.in: Regenerate.
12361         * po/POTFILES.in: Regenerate.
12362
12363 2008-07-29  Ian Lance Taylor  <iant@google.com>
12364
12365         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12366         symbols before other symbols.
12367         * testsuite/script_test_2.cc (test_addr): Declare.
12368         (test_addr_alias): Declare.
12369         (main): Check that test_addr and test_addr_alias have the right
12370         values.
12371         * testsuite/script_test_2.t: Define test_addr_alias and
12372         test_addr.
12373
12374 2008-07-24  Ian Lance Taylor  <iant@google.com>
12375
12376         PR 5990
12377         * descriptors.cc: New file.
12378         * descriptors.h: New file.
12379         * gold-threads.h (class Hold_optional_lock): New class.
12380         * fileread.cc: Include "descriptors.h".
12381         (File_read::~File_read): Release descriptor rather than closing
12382         it.
12383         (File_read::open) [file]: Call open_descriptor rather than open.
12384         Set is_descriptor_opened_.
12385         (File_read::open) [memory]: Assert that descriptor is not open.
12386         (File_read::reopen_descriptor): New function.
12387         (File_read::release): Release descriptor.
12388         (File_read::do_read): Make non-const.  Reopen descriptor.
12389         (File_read::read): Make non-const.
12390         (File_read::make_view): Reopen descriptor.
12391         (File_read::do_readv): Likewise.
12392         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12393         Update declarations.
12394         * layout.cc: Include "descriptors.h".
12395         (Layout::create_build_id): Use open_descriptor rather than open.
12396         * output.cc: Include "descriptors.h".
12397         (Output_file::open): Use open_descriptor rather than open.
12398         * archive.cc (Archive::const_iterator): Change Archive to be
12399         non-const.
12400         (Archive::begin, Archive::end): Make non-const.
12401         (Archive::count_members): Likewise.
12402         * archive.h (class Archive): Update declarations.
12403         * object.h (Object::read): Make non-const.
12404         * Makefile.am (CCFILES): Add descriptors.cc.
12405         (HFILES): Add descriptors.h.
12406         * Makefile.in: Rebuild.
12407
12408         PR 6716
12409         * gold.h: Always include <clocale>.  Add Solaris workarounds
12410         following code in binutils/sysdep.h.
12411
12412         PR 6048
12413         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12414         this->eh_frame_hdr_ is NULL before using it.
12415
12416         * dynobj.cc (Versions::Versions): Update comment.
12417
12418         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12419         the base version name.
12420
12421         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12422         array size plus one.
12423         (Stringpool_template::set_string_offsets): Subtract one from key
12424         before using it as an array index.
12425         (Stringpool_template::get_offset_with_length): Likewise.
12426         (Stringpool_template::write_to_buffer): Likewise.
12427         * stringpool.h (Stringpool_template::get_offset_from_key):
12428         Likewise.
12429
12430 2008-07-23  Ian Lance Taylor  <iant@google.com>
12431
12432         PR 6658
12433         * object.h (Merged_symbol_value::value): Do our best to handle a
12434         negative addend.
12435
12436         PR 6647
12437         * script.cc (Version_script_info::get_versions): Don't add empty
12438         version tag to return value.
12439         (Version_script_info::get_symbol_version_helper): Change return
12440         type to bool.  Add pversion parameter.  Change all callers.
12441         (script_register_vers_node): Don't require a non-NULL tag.
12442         * script.h (class Version_script_info): Update declarations.
12443         (Version_script_info::get_symbol_version): Change return type to
12444         bool.  Add version parameter.  Change all callers.
12445         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12446         handling.  Handle an empty version from a version script.
12447         (Symbol_table::define_special_symbol): Likewise.
12448         * testsuite/ver_test_10.script: New file.
12449         * testsuite/ver_test_10.sh: New file.
12450         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12451         (check_DATA): Add ver_test_10.syms.
12452         (ver_test_10.syms, ver_test_10.so): New target.
12453         * testsuite/Makefile.in: Rebuild.
12454
12455 2008-07-23  Simon Baldwin  <simonb@google.com>
12456
12457         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12458         to zero for undefined symbols from dynamic libraries.
12459
12460 2008-07-23  Ian Lance Taylor  <iant@google.com>
12461
12462         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12463         Change all callers.
12464         * symtab.h (class Symbol_table): Update declaration.
12465         * testsuite/ver_test_9.cc: New file.
12466         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12467         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12468         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12469         (ver_test_9.so, ver_test_9.o): New targets.
12470         * testsuite/Makefile.in: Rebuild.
12471
12472 2008-07-22  Ian Lance Taylor  <iant@google.com>
12473
12474         * options.h (class General_options): Define --check-sections.
12475         * layout.cc (Layout::set_segment_offsets): Handle
12476         --check-sections.
12477
12478         * options.h (class General_options): Define -n/--nmagic and
12479         -N/--omagic.
12480         * options.cc (General_options::finalize): For -n/--nmagic or
12481         -N/--omagic, set -static.
12482         * layout.cc (Layout::attach_allocated_section_to_segment): If
12483         -N/--omagic, don't put read-only and read-write sections in
12484         different segments.
12485         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12486         finding a read-only segment.
12487         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12488         don't set the minimum segment alignment to the common page size,
12489         and don't set the file offset to the address modulo the page size.
12490         * script-sections.cc (Script_sections::create_segments): If
12491         -n/--omagic, don't put read-only and read-write sections in
12492         different segments.
12493
12494         * cref.cc: New file.
12495         * cref.h: New file.
12496         * options.h (class General_options): Add --print-symbol-counts.
12497         * main.cc (main): Issue defined symbol report if requested.
12498         * archive.cc (Archive::interpret_header): Make into a const member
12499         function.
12500         (Archive::add_symbols): Call Input_objects::archive_start and
12501         archive_stop.
12502         (Archive::const_iterator): Define new class.
12503         (Archive::begin, Archive::end): New functions.
12504         (Archive::include_all_members): Rewrite to use iterator.
12505         (Archive::count_members): New function.
12506         * archive.h (class Archive): Update declarations.
12507         (Archive::filename): New function.
12508         * object.cc: Include "cref.h".
12509         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12510         (Sized_relobj::do_get_global_symbol_counts): New function.
12511         (Input_objects::add_object): Add object to cross-referencer.
12512         (Input_objects::archive_start): New function.
12513         (Input_objects::archive_stop): New function.
12514         (Input_objects::print_symbol_counts): New function.
12515         * object.h: Declare Cref and Archive.
12516         (Object::get_global_symbol_counts): New function.
12517         (Object::do_get_global_symbol_counts): New pure virtual function.
12518         (class Sized_relobj): Add defined_count_ field.  Update
12519         declarations.
12520         (class Input_objects): Add cref_ field.  Update constructor.
12521         Update declarations.
12522         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12523         defined_count_.
12524         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12525         symbol counts.
12526         (Sized_dynobj::do_get_global_symbol_counts): New function.
12527         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12528         defined_count_.  Update declarations.  Define Symbols typedef.
12529         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12530         parameter.  Change all callers.
12531         (Symbol_table::add_from_dynobj): Add sympointers and defined
12532         parameters.  Change all callers.
12533         * symtab.h (class Symbol_table): Update declarations.
12534         * Makefile.am (CCFILES): Add cref.cc.
12535         (HFILES): Add cref.h.
12536         * Makefile.in: Rebuild.
12537
12538 2008-07-22  Simon Baldwin  <simonb@google.com>
12539
12540         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12541         to zero when writing undefined symbols.
12542
12543 2008-07-22  Ian Lance Taylor  <iant@google.com>
12544
12545         * output.cc (Output_section::add_input_section): Don't try to
12546         merge empty merge sections.
12547
12548 2008-07-21  Craig Silverstein  <csilvers@google.com>
12549
12550         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12551         Include symbol version in error message.
12552
12553 2008-07-20  Chris Demetriou  <cgd@google.com>
12554
12555         * configure.ac (gold_cv_c_random_seed): New configured variable.
12556         (RANDOM_SEED_CFLAGS): New substituted variable.
12557         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12558         * configure: Rebuild.
12559         * Makefile.in: Likewise.
12560         * testsuite/Makefile.in: Likewise.
12561
12562 2008-07-18  Ian Lance Taylor  <iant@google.com>
12563
12564         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12565         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12566         * testsuite/ver_test_main.cc (main): Call t4.
12567         (t4, t4_2a): Define.
12568         * testsuite/ver_test_2.cc (t4_2): Define.
12569         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12570         * testsuite/ver_test_4.cc (t4_2a): Define.
12571         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12572         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12573
12574 2008-07-17  Ian Lance Taylor  <iant@google.com>
12575
12576         * dynobj.cc (Versions::add_def): If we give an error about a
12577         missing version, go ahead and create the version anyhow.
12578
12579 2008-07-10  Ian Lance Taylor  <iant@google.com>
12580
12581         Handle output sections with more than 0x7fffffff bytes.
12582         * object.h (class Relobj): Change map_to_output_ to
12583         output_sections_, and just keep a section pointer.  Change all
12584         uses.  Move comdat group support to Sized_relobj.
12585         (Relobj::is_section_specially_mapped): Remove.
12586         (Relobj::output_section): Remove poff parameter.  Change all
12587         callers.
12588         (Relobj::output_section_offset): New function.
12589         (Relobj::set_section_offset): Rewrite.
12590         (Relobj::map_to_output): Remove.
12591         (Relobj::output_sections): New function.
12592         (Relobj::do_output_section_offset): New pure virtual function.
12593         (Relobj::do_set_section_offset): Likewise.
12594         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12595         group support from Relobj.  Update declarations.
12596         (Sized_relobj::get_output_section_offset): New function.
12597         (Sized_relobj::do_output_section_offset): New function.
12598         (Sized_relobj::do_set_section_offset): New function.
12599         * object.cc (Relobj::output_section_address): Remove.
12600         (Sized_relobj::Sized_relobj): Initialize new fields.
12601         (Sized_relobj::include_section_group): Cast find_kept_object to
12602         Sized_relobj.
12603         (Sized_relobj::include_linkonce_section): Likewise.
12604         (Sized_relobj::do_layout): Use separate arrays for output section
12605         and output offset.
12606         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12607         output_sections.
12608         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12609         output_sections and section_offsets.
12610         (Sized_relobj::write_local_symbols): Likewise.
12611         (map_to_kept_section): Compute output address directly.
12612         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12613         output_sections and section_offsets.
12614         (Sized_relobj::write_sections): Likewise.
12615         (Sized_relobj::relocate_sections): Likewise.
12616         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12617         * output.h (class Output_reloc): Update declarations.  Change
12618         u2_.relobj to Sized_relobj*.
12619         (class Output_data_reloc): Change add functions to use
12620         Sized_relobj*.
12621         * output.cc (Output_reloc::Output_reloc): Change relobj to
12622         Sized_relobj*.
12623         (Output_reloc::local_section_offset): Change return type to
12624         Elf_Addr.  Use get_output_section_offset.
12625         (Output_reloc::get_address): Likewise.
12626         (Output_section::is_input_address_mapped): Don't call
12627         is_section_specially_mapped.
12628         (Output_section::output_offset): Likewise.
12629         (Output_section::output_address): Likewise.
12630         (Output_section::starting_output_address): Likewise.
12631         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12632         parameter to Sized_relobj*.
12633         (Copy_relocs::need_copy_reloc): Likewise.
12634         (Copy_relocs::save): Likewise.
12635         * copy-relocs.h (class Copy_relocs): Update declarations.
12636         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12637         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12638         * target-reloc.h (relocate_for_relocatable): Change
12639         offset_in_output_section type to Elf_Addr.  Change code that uses
12640         it as well.
12641         * layout.cc (Layout::layout): Always set *off.
12642         * mapfile.cc (Mapfile::print_input_section): Use
12643         output_section_offset.
12644         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12645         Sized_relobj*.
12646         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12647         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12648         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12649
12650 2008-07-03  Ian Lance Taylor  <iant@google.com>
12651
12652         * layout.cc (Layout::include_section): Do not discard unrecognized
12653         SHT_STRTAB sections.
12654
12655 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12656
12657         * script.cc (Lex::can_continue_name): Make '?' allowable in
12658         version-script names.
12659         * testsuite/version_script.map: Change glob pattern to use '?'
12660
12661 2008-06-30  Manish Singh  <yosh@gimp.org>
12662
12663         PR 6585
12664         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12665         Correct typo.
12666
12667 2008-06-30  Ian Lance Taylor  <iant@google.com>
12668
12669         PR 6660
12670         PR 6682
12671         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12672         versions]: Don't try to read the value in the contents, since we
12673         don't use it.  Use the template endianness when writing.
12674
12675 2008-06-25  Cary Coutant  <ccoutant@google.com>
12676
12677         * fileread.cc (File_read::make_view): Assert on zero-length view.
12678         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12679         symbol table when there are no symbols to read.
12680
12681 2008-06-23  Craig Silverstein  <csilvers@google.com>
12682
12683         * version.cc (version_string): Bump to 1.7
12684
12685 2008-06-18  Craig Silverstein  <csilvers@google.com>
12686
12687         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12688         constant 0xFFFF to type Valtype.
12689         (Powerpc_relocate_functions::rel16_ha): Likewise.
12690
12691 2008-06-17  Ian Lance Taylor  <iant@google.com>
12692
12693         * output.h (Output_section::Input_section): Initialize p2align_ to
12694         zero for Output_section_data constructors.
12695         (Output_section::Input_section::addralign): If not an input
12696         section, return the alignment of the Output_section_data.
12697         * testsuite/copy_test.cc: New file.
12698         * testsuite/copy_test_1.cc: New file.
12699         * testsuite/copy_test_2.cc: New file.
12700         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12701         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12702         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12703         (copy_test_1_pic.o, copy_test_1.so): New targets.
12704         (copy_test_2_pic.o, copy_test_2.so): New targets.
12705         * testsuite/Makefile.in: Rebuild.
12706
12707         * script-sections.cc (Script_sections::place_orphan): Initialize
12708         local variable exact.
12709
12710 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12711
12712         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12713
12714 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12715             David S. Miller  <davem@davemloft.net>
12716
12717         * powerpc.cc: New file.
12718         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12719         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12720         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12721         * Makefile.in: Rebuild.
12722
12723 2008-06-09  Ian Lance Taylor  <iant@google.com>
12724
12725         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12726         <exception>.
12727         (throwing, orig_terminate): New static variables.
12728         (terminate_handler): New static function.
12729         (t2): Set terminate handler.
12730
12731 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12732
12733         PR 6584
12734         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12735         alignment.
12736
12737 2008-05-30  Cary Coutant  <ccoutant@google.com>
12738
12739         * archive.cc (Archive::include_all_members) Correct to step
12740         over symbol table and extended name table in thin archives.
12741
12742 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12743
12744         PR 6407
12745         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12746         calculation.
12747
12748 2008-05-28  Caleb Howe  <cshowe@google.com>
12749
12750         * reduced_debug_output.cc: New file.
12751         * reduced_debug_output.h: New file.
12752         * options.h (class General_options): Add --strip-debug-non-line.
12753         * options.cc (General_options::finalize): Add strip_debug_non_line
12754         to the strip heirarchy.
12755         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12756         fields.
12757         * layout.cc: Include "reduced_debug_output.h".
12758         (Layout::Layout): Initialize new fields.
12759         (line_only_debug_sections): New static array.
12760         (is_lines_only_debug_sections): New static inline function.
12761         (Layout::include_section): Handle --strip-debug-non-line.
12762         (Layout::make_output_section): If --strip-debug-non-line, build
12763         new output sections for .debug_abbrev and .debug_info.
12764         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12765         gold.  Warn about possible overflow.
12766         (read_signed_LEB_128): Likewise.
12767         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12768         (read_signed_LEB_128): Declare.
12769         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12770         (HFILES): Add reduced_debug_output.h.
12771         * Makefile.in: Rebuild.
12772
12773 2008-05-21  Ian Lance Taylor  <iant@google.com>
12774
12775         * mapfile.cc: New file.
12776         * mapfile.h: New file.
12777         * options.h (class General_options): Add -M/--print-map and -Map.
12778         * options.cc (General_options::finalize): Make -M equivalent to
12779         -Map -.
12780         * main.cc: Include <cstdio> and "mapfile.h".
12781         (main): Open mapfile if requested.
12782         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12783         constructor.  Change caller.
12784         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12785         (queue_middle_tasks): Likewise.
12786         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12787         declarations.
12788         * archive.cc: Include "mapfile.h".
12789         (Archive::add_symbols): Add mapfile parameter.  Change all
12790         callers.  Pass mapfile, symbol, and reason to include_member.
12791         (Archive::include_all_members): Add mapfile parameter.  Change all
12792         callers.
12793         (Archive::include_member): Add mapfile, sym, and why parameters.
12794         Change all callers.  Report inclusion to map file.
12795         * archive.h: Include "fileread.h".
12796         (class Archive): Update declarations.
12797         (Archive::file): New const method.
12798         (class Add_archive_symbols): Add mapfile_ field.  Update
12799         constructor.  Change all callers.
12800         * readsyms.h (class Read_symbols): Likewise.
12801         (class Finish_group): Likewise.
12802         (class Read_script): Likewise.
12803         * common.cc: Include "mapfile.h".
12804         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12805         all callers.
12806         (Symbol_table::do_allocate_commons): Likewise.
12807         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12808         symbol allocation to mapfile.
12809         * common.h (class Allocate_commons_task): Add mapfile_ field.
12810         Update constructor.  Change all callers.
12811         * symtab.h (class Symbol_table): Update declarations.
12812         * layout.cc: Include "mapfile.h".
12813         (Layout_task_runner::run): Print information to mapfile.
12814         (Layout::create_gold_note): Change Output_data_fixed_space to
12815         Output_data_zero_fill.
12816         (Layout::create_build_id): Likewise.
12817         (Layout::print_to_mapfile): New function.
12818         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12819         constructor.  Change caller.
12820         (class Layout): Declare print_to_mapfile.
12821         * output.cc (Output_section::Input_section::print_to_mapfile): New
12822         function.
12823         (Output_section::add_input_section): If producing a map, always
12824         add to input_sections_ list.
12825         (Output_section::do_print_to_mapfile): New function.
12826         (Output_segment::print_sections_to_mapfile): New function.
12827         (Output_segment::print_section_list_to_mapfile): New function.
12828         * output.h: Include "mapfile.h".
12829         (Output_data::print_to_mapfile): New function.
12830         (Output_data::do_print_to_mapfile): New virtual function.
12831         (Output_segment_headers::do_print_to_mapfile): New function.
12832         (Output_file_header::do_print_to_mapfile): New function.
12833         (Output_data_const::do_print_to_mapfile): New function.
12834         (class Output_data_const_buffer): Add map_name_ field.  Update
12835         constructor.  Change all callers.  Add do_print_to_mapfile
12836         function.
12837         (class Output_data_fixed_space): Likewise.
12838         (class Output_data_space): Likewise.
12839         (class Output_data_zero_fill): New class.
12840         (Output_data_strtab::do_print_to_mapfile): New function.
12841         (Output_data_reloc_base::do_print_to_mapfile): New function.
12842         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12843         (Output_data_group::do_print_to_mapfile): New function.
12844         (Output_data_got::do_print_to_mapfile): New function.
12845         (Output_data_dynamic::do_print_to_mapfile): New function.
12846         (Output_symtab_xindex::do_print_to_mapfile): New function.
12847         (class Output_section): Declare do_print_to_mapflie.  Declare
12848         print_to_mapfile in Input_section.
12849         (class Output_segment): Declare new functions.
12850         * object.h (Sized_relobj::symbol_count): New function.
12851         * script-sections.cc
12852         (Output_section_element_dot_assignment::set_section_addresses):
12853         Change Output_data_fixed_space to Output_data_zero_fill.
12854         (Output_data_expression::do_print_to_mapfile): New function.
12855         * script.cc (read_input_script): Add mapfile parameter.  Change
12856         all callers.
12857         * script.h (read_input_script): Update declaration.
12858         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12859         (Eh_frame::do_print_to_mapfile): New function.
12860         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12861         (Output_merge_string::do_print_to_mapfile): New function.
12862         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12863         function.
12864         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12865         function.
12866         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12867         function.
12868         * Makefile.am (CCFILES): Add mapfile.cc.
12869         (HFILES): Add mapfile.h.
12870         * Makefile.in: Rebuild.
12871
12872 2008-05-19  Ian Lance Taylor  <iant@google.com>
12873
12874         * options.h (class General_options): Add -z relro.
12875         * layout.cc (Layout::Layout): Initialize relro_segment_.
12876         (Layout::add_output_section_data): Return the output section.
12877         (Layout::make_output_section): Rcognize relro sections and mark
12878         them appropriately.
12879         (Layout::attach_allocated_section_to_segment): Put relro sections
12880         in a PT_GNU_RELRO segment.
12881         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12882         section as relro.
12883         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12884         PT_TLS segments.
12885         (Layout::linkonce_mapping): Map d.rel.ro.local to
12886         .data.rel.ro.local.
12887         (Layout::output_section_name): Us .data.rel.ro.local for any
12888         section which begins with that.
12889         * layout.h (class Layout): Update add_output_section_data
12890         declaration.  Add relro_segment_ field.
12891         * output.cc (Output_section::Output_section): Initialize is_relro_
12892         and is_relro_local_ fields.
12893         (Output_segment::add_output_section): Group relro sections.
12894         (Output_segment::is_first_section_relro): New function.
12895         (Output_segment::maximum_alignment): If there is a relro section,
12896         align the segment to the common page size.
12897         (Output_segment::set_section_addresses): Track whether we are
12898         looking at relro sections.  If the last section is a relro
12899         section, align to the common page size.
12900         (Output_segment::set_section_list_addresses): Add in_relro
12901         parameter.  Change all callers.  Align to the page size when
12902         moving from relro to non-relro section.
12903         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12904         segment.
12905         * output.h (class Output_section): Add is_relro_ and
12906         is_relro_local_ fields.
12907         (Output_section::is_relro): New function.
12908         (Output_section::set_is_relro): New function.
12909         (Output_section::is_relro_local): New function.
12910         (Output_section::set_is_relro_local): New function.
12911         (class Output_segment): Update declarations.
12912         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12913         * sparc.cc (Target_sparc::got_section): Likewise.
12914         * x86_64.cc (Target_x86_64::got_section): Likewise.
12915         * testsuite/relro_test_main.cc: New file.
12916         * testsuite/relro_test.cc: New file.
12917         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12918         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12919         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12920         (relro_test.so, relro_test_pic.o): New targets.
12921         * testsuite/Makefile.in: Rebuild.
12922
12923 2008-05-16  Ian Lance Taylor  <iant@google.com>
12924
12925         * output.cc (Output_segment::add_output_section): Remove front
12926         parameter.
12927         * output.h (class Output_segment): Remove
12928         add_initial_output_section and overloaded add_output_section.
12929         Update declaration of remaining add_output_section.
12930         * layout.cc (Layout::create_interp): Call add_output_section
12931         rather than add_initial_output_section.
12932         (Layout::finish_dynamic_section): Likewise.
12933
12934         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12935         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12936         know the dynamic type.
12937         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12938         field.  Initialize it in constructor.
12939         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12940         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12941         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12942         reloc.
12943
12944         * output.cc (Output_reloc::get_address): Change return type to
12945         Elf_Addr.
12946         * output.h (class Output_reloc): Update get_address declaration.
12947         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12948         for section addresses.
12949
12950 2008-05-09  Ian Lance Taylor  <iant@google.com>
12951
12952         PR 6493
12953         * gold.cc (gold_nomem): Use return value of write.
12954
12955 2008-05-08  Ian Lance Taylor  <iant@google.com>
12956
12957         * symtab.c (Symbol::init_base_output_data): Add version
12958         parameter.  Change all callers.
12959         (Symbol::init_base_output_segment): Likewise.
12960         (Symbol::init_base_constant): Likewise.
12961         (Symbol::init_base_undefined): Likewise.
12962         (Sized_symbol::init_output_data): Likewise.
12963         (Sized_symbol::init_output_segment): Likewise.
12964         (Sized_symbol::init_constant): Likewise.
12965         (Sized_symbol::init_undefined): Likewise.
12966         (Symbol_table::do_define_in_output_data): If the new symbol has a
12967         version, mark it as the default.
12968         (Symbol_table::do_define_in_output_segment): Likewise.
12969         (Symbol_table::do_define_as_constant): Likewise.
12970         * symtab.h (class Symbol): Update declarations.
12971         (class Sized_symbol): Likewise.
12972         * resolve.cc (Symbol::override_version): New function.
12973         (Symbol::override_base): Call override_version.
12974         (Symbol::override_base_with_special): Likewise.
12975         * testsuite/ver_script_8.script: New file.
12976         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12977         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12978         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12979         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12980
12981 2008-05-06  Ian Lance Taylor  <iant@google.com>
12982
12983         PR 6049
12984         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12985         functions.
12986         (class General_options): Remove existing --undefined, and add
12987         --no-undefined instead.  Add new --undefined as synonym for -u.
12988         * archive.cc (Archive::add_symbols): Check whether symbol was
12989         named with -u.
12990         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12991         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12992         all uses.  Add IS_UNDEFINED.  Update declarations to split
12993         different versions of init_base.  Declare init_base_undefined.
12994         (Symbol::is_defined): Handle IS_UNDEFINED.
12995         (Symbol::is_undefined): Likewise.
12996         (Symbol::is_weak_undefined): Call is_undefined.
12997         (Symbol::is_absolute): Handle IS_CONSTANT.
12998         (class Sized_symbol): Update declarations to split different
12999         versions of init.  Declare init_undefined.
13000         (class Symbol_table): Declare new functions.
13001         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13002         Change all callers.
13003         (Symbol::init_base_output_data): Likewise.
13004         (Symbol::init_base_output_segment): Likewise.
13005         (Symbol::init_base_constant): Likewise.
13006         (Symbol::init_base_undefined): New function.
13007         (Sized_symbol::init_object): Rename from init.  Change all
13008         callers.
13009         (Sized_symbol::init_output_data): Likewise.
13010         (Sized_symbol::init_output_segment): Likewise.
13011         (Sized_symbol::init_constant): Likewise.
13012         (Sized_symbol::init_undefined): New function.
13013         (Symbol_table::add_undefined_symbols_from_command_line): New
13014         function.
13015         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13016         function.
13017         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13018         (Symbol::output_section): Likewise.
13019         (Symbol::set_output_section): Likewise.
13020         (Symbol_table::sized_finalize_symbol): Likewise.
13021         (Symbol_table::sized_write_globals): Likewise.
13022         * resolve.cc (Symbol_table::should_override): Likewise.
13023         (Symbol::override_base_with_special): Likewise.
13024
13025         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13026         symbol, change it to have default visibility.
13027         * testsuite/protected_1.cc: New file.
13028         * testsuite/protected_2.cc: New file.
13029         * testsuite/protected_3.cc: New file.
13030         * testsuite/protected_main_1.cc: New file.
13031         * testsuite/protected_main_2.cc: New file.
13032         * testsuite/protected_main_3.cc: New file.
13033         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13034         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13035         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13036         (protected_1.so): New target.
13037         (protected_1_pic.o, protected_2_pic.o): New targets.
13038         (protected_3_pic.o): New target.
13039         (check_PROGRAMS): Add protected_2.
13040         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13041         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13042         * testsuite/Makefile.in: Rebuild.
13043
13044         * options.h (DEFINE_var): Add set_user_set_##varname__.
13045         (DEFINE_bool_alias): New macro.
13046         (class General_options): Define -Bstatic using DEFINE_bool_alias
13047         rather than DEFINE_special.  Add --undefined as an alias for -z
13048         defs.
13049         * options.cc (General_options::parse_Bstatic): Remove.
13050
13051         * options.h (class General_options): Add --fatal-warnings.
13052         * main.cc (main): Implement --fatal-warnings.
13053         * errors.h (Errors::warning_count): New function.
13054
13055         * options.h (class General_options): Add -Bsymbolic-functions.
13056         * symtab.h (Symbol::is_preemptible): Check for
13057         -Bsymbolic-functions.
13058
13059 2008-05-05  Ian Lance Taylor  <iant@google.com>
13060
13061         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13062         as noVARNAME rather than no-VARNAME.
13063         (class General_options): Add option -z combreloc.
13064         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13065         get_address.
13066         (Output_reloc::sort_before) [SHT_REL]: New function.
13067         (Output_reloc::sort_before) [SHT_RELA]: New function.
13068         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13069         Sort_relocs_comparison.
13070         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13071         parameter.  Change all callers.
13072         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13073         sort_relocs parameter.  Change all callers.
13074         * output.cc (Output_reloc::get_address): New function, broken out
13075         of write_rel.
13076         (Output_reloc::write_rel): Call it.
13077         (Output_reloc::compare): New function.
13078         (Output_data_reloc_base::do_write): Optionally sort relocs.
13079
13080         * configure.ac: If targ_extra_obj is set, link it in.
13081         * configure.tgt: Initialize all variables.
13082         (x86_64*): Set targ_extra_obj and targ_extra_size.
13083         * configure: Rebuild.
13084
13085         * object.cc (Sized_relobj::include_section_group): Adjust section
13086         indexes read from group data.  Build vector to pass to
13087         layout_group.
13088         * layout.cc (Layout::layout_group): Add flags and shndxes
13089         parameters.  Remove contents parameter.  Change caller.  Update
13090         explicit instantiations.
13091         * layout.h (class Layout): Update layout_group declaration.
13092         * output.cc (Output_data_group::Output_data_group): Add flags and
13093         input_shndxes parameters.  Remove contents parameter.  Change
13094         caller.
13095         (Output_data_group::do_write): Change input_sections_ to
13096         input_shndxes_.
13097         * output.h (class Output_data_group): Update constructor
13098         declaration.  Rename input_sections_ to input_shndxes_.
13099         * testsuite/many_sections_test.cc: Add template.
13100
13101 2008-04-30  Cary Coutant  <ccoutant@google.com>
13102
13103         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13104
13105         * layout.cc (Layout::include_section): Refactored check for debug
13106         info section.
13107         (Layout::add_comdat): Add new parameters.  Change type
13108         of signature parameter.  Add object and shndx to signatures table.
13109         (Layout::find_kept_object): New function.
13110         * layout.h: Include <cstring>.
13111         (Layout::is_debug_info_section): New function.
13112         (Layout::add_comdat): Add new parameters.
13113         (Layout::find_kept_object): New function.
13114         (Layout::Kept_section): New struct.
13115         (Layout::Signatures): Change type of map range.
13116         * object.cc (Relobj::output_section_address): New function.
13117         (Sized_relobj::include_section_group): Add new parameters.  Change
13118         calls to Layout::add_comdat.  Change to build table of kept comdat
13119         groups and table mapping discarded sections to kept sections.
13120         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13121         (Sized_relobj::do_layout): Change calls to include_section_group and
13122         include_linkonce_section.
13123         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13124         value to zero when section is discarded.
13125         (Sized_relobj::map_to_kept_section): New function.
13126         * object.h (Relobj::output_section_address): New function.
13127         (Relobj::Comdat_group): New type.
13128         (Relobj::find_comdat_group): New function.
13129         (Relobj::Comdat_group_table): New type.
13130         (Relobj::Kept_comdat_section): New type.
13131         (Relobj::Kept_comdat_section_table): New type.
13132         (Relobj::add_comdat_group): New function.
13133         (Relobj::set_kept_comdat_section): New function.
13134         (Relobj::get_kept_comdat_section): New function.
13135         (Relobj::comdat_groups_): New field.
13136         (Relobj::kept_comdat_sections_): New field.
13137         (Symbol_value::input_value): Update comment.
13138         (Sized_relobj::map_to_kept_section) New function.
13139         (Sized_relobj::include_linkonce_section): Add new parameter.
13140         * target-reloc.h (Comdat_behavior): New type.
13141         (get_comdat_behavior): New function.
13142         (relocate_section): Add code to map a discarded section to the
13143         corresponding kept section when applying a relocation.
13144
13145 2008-04-30  Craig Silverstein  <csilvers@google.com>
13146
13147         * dwarf_reader.cc (next_generation_count): New static var.
13148         (Addr2line_cache_entry): New struct.
13149         (addr2line_cache): New static var.
13150         (Dwarf_line_info::one_addr2line): Added caching.
13151         (Dwarf_line_info::clear_addr2line_cache): New function.
13152         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13153         cache-size parameter.
13154         (Dwarf_line_info::one_addr2line_cache): New function.
13155         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13156         new cache-size argument to one_addr2line(), and clear cache.
13157
13158 2008-04-28  Cary Coutant  <ccoutant@google.com>
13159
13160         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13161         R_386_PC8 relocations.
13162
13163 2008-04-23  Ian Lance Taylor  <iant@google.com>
13164
13165         * object.cc (Sized_relobj::include_section_group): Check for
13166         invalid section group.
13167
13168         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13169         header size.
13170
13171         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13172         than read for file header.
13173         * archive.cc (Archive::include_member): Likewise.
13174
13175 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13176
13177         * aclocal.m4: Regenerate.
13178         * configure: Regenerate.
13179
13180 2008-04-19  Ian Lance Taylor  <iant@google.com>
13181
13182         * version.cc (version_string): Bump to 1.6.
13183
13184         * testsuite/Makefile.am (many_sections_r_test): New target.
13185         (many_sections_r_test_SOURCES): Remove.
13186         (many_sections_r_test_DEPENDENCIES): Remove.
13187         (many_sections_r_test_LDFLAGS): Remove.
13188         (many_sections_r_test_LDADD): Remove.
13189
13190         * object.cc (Sized_relobj::do_add_symbols): Always pass
13191         local_symbol_count_ to add_from_relobj.
13192
13193         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13194         every thousand variables.
13195         * testsuite/Makefile.in: Rebuild.
13196
13197         * object.cc (Xindex::initialize_symtab_xindex): New function.
13198         (Xindex::read_symtab_xindex): New function.
13199         (Xindex::sym_xindex_to_shndx): New function.
13200         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13201         available.
13202         (Sized_relobj::do_initialize_xindex): New function.
13203         (Sized_relobj::do_read_symbols): Adjust section links.
13204         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13205         parameter.  Change all callers.
13206         (Sized_relobj::include_section_group): Adjust section links and
13207         symbol section indexes.
13208         (Sized_relobj::do_layout): Adjust section links.
13209         (Sized_relobj::do_count_local_symbols): Adjust section links and
13210         symbol section indexes.
13211         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13212         ordinary and special symbols.
13213         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13214         dynsym_xindex parameters.  Change all callers.  Adjust section
13215         links.  Use SHN_XINDEX when needed.
13216         (Sized_relobj::get_symbol_location_info): Adjust section links.
13217         Don't get fooled by special symbols.
13218         * object.h (class Xindex): Define.
13219         (class Object): Add xindex_ parameter.  Declare virtual functoin
13220         do_initialize_xindex.
13221         (Object::adjust_sym_shndx): New function.
13222         (Object::set_xindex): New protected function.
13223         (class Symbol_value): Add is_ordinary_shndx_ field.
13224         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13225         (Symbol_value::value): Assert ordinary section.
13226         (Symbol_value::initialize_input_to_output_map): Likewise.
13227         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13228         Change all callers.
13229         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13230         all callers.
13231         (class Sized_relobj): Update declarations.
13232         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13233         parameter.  Change all callers.
13234         (Sized_relobj::adjust_shndx): New function.
13235         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13236         field.
13237         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13238         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13239         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13240         (Sized_dynobj::read_dynsym_section): Adjust section links.
13241         (Sized_dynobj::read_dynamic): Likewise.
13242         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13243         section links.
13244         (Sized_dynobj::do_initialize_xindex): New function.
13245         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13246         do_initialize_xindex.
13247         (Sized_dynobj::adjust_shndx): New function.
13248         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13249         dynsym_xindex_ fields.
13250         (Layout::finalize): Add a call to set_section_indexes before
13251         creating the symtab sections.
13252         (Layout::set_section_indexes): Don't do anything if the section
13253         already has a section index.
13254         (Layout::create_symtab_sections): Add shnum parameter.  Change
13255         caller.  Create .symtab_shndx section if needed.
13256         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13257         caller.
13258         (Layout::allocated_output_section_count): New function.
13259         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13260         needed.
13261         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13262         fields.  Update declarations.
13263         (Layout::symtab_xindex): New function.
13264         (Layout::dynsym_xindex): New function.
13265         (class Write_symbols_task): Add layout_ field.
13266         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13267         Change caller.
13268         * output.cc (Output_section_headers::Output_section_headers): Add
13269         shstrtab_section parameter.  Change all callers.
13270         (Output_section_headers::do_sized_write): Store overflow values
13271         for section count and section string table section index in
13272         section header zero.
13273         (Output_file_header::do_sized_write): Check for overflow of
13274         section count and section string table section index.
13275         (Output_symtab_xindex::do_write): New function.
13276         (Output_symtab_xindex::endian_do_write): New function.
13277         * output.h (class Output_section_headers): Add shstrtab_section_.
13278         Update declarations.
13279         (class Output_symtab_xindex): Define.
13280         (Output_section::has_out_shndx): New function.
13281         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13282         field.
13283         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13284         Change all callers.
13285         (Sized_symbol::init): Likewise.
13286         (Symbol::output_section): Check for ordinary symbol.
13287         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13288         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13289         callers.
13290         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13291         Change all callers.  Simplify handling of symbols from sections
13292         not included in the link.
13293         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13294         distinction.
13295         (Weak_alias_sorter::operator()): Assert that symbols are
13296         ordinary.
13297         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13298         distinction.
13299         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13300         parameters.  Change all callers.
13301         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13302         symbol distinction.  Use SHN_XINDEX when needed.
13303         (Symbol_table::write_section_symbol): Add symtab_xindex
13304         parameter.  Change all callers.
13305         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13306         SHN_XINDEX when needed.
13307         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13308         declarations.
13309         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13310         (Symbol::is_defined): Check is_ordinary.
13311         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13312         (Symbol::is_absolute, Symbol::is_common): Likewise.
13313         (class Sized_symbol): Update declarations.
13314         (class Symbol_table): Update declarations.
13315         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13316         parameters.  Change all callers.
13317         (Sized_symbol::override): Likewise.
13318         (Symbol_table::override): Likewise.
13319         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13320         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13321         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13322         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13323         to be in an ordinary section.
13324         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13325         object and is_ordinary parameters.  Change all callers.
13326         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13327         Change all callers.  Don't add undefined or non-ordinary symbols
13328         to reloc_map_.
13329         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13330         Change all callers.
13331         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13332         declarations.
13333         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13334         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13335         (Sized_relobj::relocate_sections): Likewise.
13336         * target-reloc.h (scan_relocs): Adjust section symbol index.
13337         (scan_relocatable_relocs): Likewise.
13338         * i386.cc (Scan::local): Check for ordinary symbols.
13339         * sparc.cc (Scan::local): Likewise.
13340         * x86_64.cc (Scan::local): Likewise.
13341         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13342         to symbol_section_and_value.
13343         * testsuite/many_sections_test.cc: New file.
13344         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13345         (check_PROGRAMS): Add many_sections_test.
13346         (many_sections_test_SOURCES): Define.
13347         (many_sections_test_DEPENDENCIES): Define.
13348         (many_sections_test_LDFLAGS): Define.
13349         (BUILT_SOURCES): Add many_sections_define.h.
13350         (many_sections_define.h): New target.
13351         (BUILT_SOURCES): Add many_sections_check.h.
13352         (many_sections_check.h): New target.
13353         (check_PROGRAMS): Add many_sections_r_test.
13354         (many_sections_r_test_SOURCES): Define.
13355         (many_sections_r_test_DEPENDENCIES): Define.
13356         (many_sections_r_test_LDFLAGS): Define.
13357         (many_sections_r_test_LDADD): Define.
13358         (many_sections_r_test.o): New target.
13359         * testsuite/Makefile.in: Rebuild.
13360
13361 2008-04-17  Cary Coutant  <ccoutant@google.com>
13362
13363         * errors.cc (Errors::info): New function.
13364         (gold_info): New function.
13365         * errors.h (Errors::info): New function.
13366         * gold.h (gold_info): New function.
13367         * object.cc (Input_objects::add_object): Print trace output.
13368         * options.cc (options::parse_set): New function.
13369         (General_options::parse_wrap): Deleted.
13370         (General_options::General_options): Deleted initializer.
13371         * options.h (options::String_set): New typedef.
13372         (options::parse_set): New function.
13373         (DEFINE_set): New macro.
13374         (General_options::wrap): Changed to use DEFINE_set. Changed
13375         callers of any_wrap_symbols and is_wrap_symbol.
13376         (General_options::trace, General_options::trace_symbol):
13377         New options.
13378         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13379         (General_options::wrap_symbols_): Deleted.
13380         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13381
13382 2008-04-17  David S. Miller  <davem@davemloft.net>
13383
13384         * options.cc (General_options::parse_V): New function.
13385         * options.h: Add entries for -V and -Qy.
13386
13387 2008-04-17  Ian Lance Taylor  <iant@google.com>
13388
13389         * common.cc (Symbol_table::allocate_commons): Remove options
13390         parameter.  Change caller.
13391         (Symbol_table::do_allocate_commons): Remove options parameter.
13392         Change caller.  Just call do_allocate_commons_list twice.
13393         (Symbol_table::do_allocate_commons_list): New function, broken out
13394         of do_allocate_commons.
13395         * common.h (class Allocate_commons_task): Remove options_ field.
13396         Update constructor.
13397         * symtab.cc (Symbol_table::Symbol_table): Initialize
13398         tls_commons_.
13399         (Symbol_table::add_from_object): Put TLS common symbols on
13400         tls_commons_ list.
13401         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13402         which are IN_OUTPUT_DATA.
13403         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13404         allocate_commons and do_allocate_commons declarations.  Declare
13405         do_allocate_commons_list.
13406         * gold.cc (queue_middle_tasks): Update creation of
13407         Allocate_commons_task to not pass options.
13408         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13409         (TLS_TEST_C_FLAGS): New variable.
13410         (tls_test_c_pic.o): New target.
13411         (tls_test_shared.so): Link in tls_test_c_pic.o.
13412         (tls_test_c_pic_ie.o): New target.
13413         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13414         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13415         (tls_test_c.o): New target.
13416         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13417         (tls_pic_test_LDADD): Likewise.
13418         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13419         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13420         (tls_test_c_gnu2.o): New target.
13421         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13422         tls_test_c_gnu2.o.
13423         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13424         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13425         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13426         * testsuite/tls_test.cc: Include "config.h".
13427         (t_last): Call t11_last.
13428         * testsuite/tls_test.h (t11, t11_last): Declare.
13429         * testsuite/tls_test_c.c: New file.
13430         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13431         * configure.ac: Check for OpenMP support.
13432         * configure, config.in, Makefile.in: Rebuild.
13433         * testsuite/Makefile.in: Rebuild.
13434
13435 2008-04-16  Cary Coutant  <ccoutant@google.com>
13436
13437         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13438         (Target_i386::tls_base_symbol_defined_): New field.
13439         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13440         (Target_i386::Scan::global): Likewise.
13441         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13442         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13443         (Target_x86_64::tls_base_symbol_defined_): New field.
13444         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13445         (Target_x86_64::Scan::global): Likewise.
13446
13447 2008-04-16  Cary Coutant  <ccoutant@google.com>
13448
13449         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13450         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13451         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13452         building shared libraries.
13453         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13454         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13455         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13456         * testsuite/Makefile.in: Rebuild.
13457         * testsuite/weak_undef.h: New file.
13458         * testsuite/weak_undef_file1.cc: Add extra test cases.
13459         * testsuite/weak_undef_file2.cc: Likewise.
13460         * testsuite/weak_undef_test.cc: Likewise.
13461
13462 2008-04-16  David S. Miller  <davem@davemloft.net>
13463
13464         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13465         Add issued_non_pic_error_ field.  Declare check_non_pic.
13466         (Target_sparc::Scan::check_non_pic): New function.
13467         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13468         (Target_sparc::Scan::global): Likewise.
13469
13470         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13471         * configure: Rebuild.
13472
13473         * options.h (DEFINE_enable): New macro.
13474         (new_dtags): New enable option.
13475         (initfirst, interpose, loadfltr, nodefaultlib,
13476         nodelete, nodlopen, nodump): New -z options.
13477         * layout.cc (Layout:finish_dynamic_section): If new
13478         dtags enabled, emit DT_RUNPATH.  Also, emit a
13479         DT_FLAGS_1 containing any specified -z flags.
13480
13481 2008-04-16  Ian Lance Taylor  <iant@google.com>
13482
13483         * copy-relocs.cc: New file.
13484         * copy-relocs.h: New file.
13485         * reloc.cc: Remove Copy_relocs code.
13486         * reloc.h: Likewise.
13487         * reloc-types.h (struct Reloc_types) [both versions]: Add
13488         get_reloc_addend_noerror.
13489         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13490         variants of add_global which take an addend which must be zero.
13491         * i386.cc: Include "copy-relocs.h".
13492         (class Target_i386): Change type of copy_relocs_ to variable,
13493         update initializer.
13494         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13495         Change all callers.
13496         (Target_i386::do_finalize_sections): Change handling of
13497         copy_relocs_.
13498         * sparc.cc: Include "copy-relocs.h".
13499         (class Target_sparc): Change type of copy_relocs_ to variable,
13500         update initializer.
13501         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13502         Change all callers.
13503         (Target_sparc::do_finalize_sections): Change handling of
13504         copy_relocs_.
13505         * x86_64.cc: Include "copy-relocs.h".
13506         (class Target_x86_64): Change type of copy_relocs_ to variable,
13507         update initializer.
13508         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13509         class.  Change all callers.
13510         (Target_x86_64::do_finalize_sections): Change handling of
13511         copy_relocs_.
13512         * Makefile.am (CCFILES): Add copy-relocs.cc.
13513         (HFILES): Add copy-relocs.h.
13514
13515         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13516
13517         * testsuite/script_test_4.sh: Permit leading zeroes.
13518
13519 2008-04-15  Ian Lance Taylor  <iant@google.com>
13520
13521         * script-sections.cc (Script_sections::create_segments): Use
13522         header_size_adjustment even when there is enough room for the
13523         headers.
13524         * testsuite/script_test_4.sh: New file.
13525         * testsuite/script_test_4.t: New file.
13526         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13527         (check_DATA): Add script_test_4.stdout.
13528         (MOSTLYCLEANFILES): Likewise.
13529         (script_test_4): New target.
13530         (script_test_4.stdout): New target.
13531         * testsuite/Makefile.in: Rebuild.
13532
13533         * sparc.cc: Add definitions for Output_data_plt_sparc class
13534         constants.
13535
13536 2008-04-14  David S. Miller  <davem@davemloft.net>
13537
13538         * sparc.cc: New file.
13539         * Makefile.am (TARGETSOURCES): Add sparc.cc
13540         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13541         * configure.tgt: Document targ_extra_size and
13542         targ_extra_big_endian.  Add entries for sparc-* and
13543         sparc64-*.
13544         * configure.ac: Handle targ_extra_size and
13545         targ_extra_big_endian.
13546         * Makefile.in: Rebuild.
13547         * configure: Likewise.
13548         * po/POTFILES.in: Likewise.
13549         * po/gold.pot: Likewise.
13550
13551 2008-04-14  Ian Lance Taylor  <iant@google.com>
13552
13553         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13554         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13555         in the name/type/flags to section mapping.  Don't call
13556         allocate_output_section.
13557         (Layout::choose_output_section): Change parameter from adjust_name
13558         to is_input_section.  Don't permit input sections after sections
13559         are attached to segments.  Don't call allocate_output_section.
13560         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13561         not write_enable_output_section.
13562         (Layout::make_output_section): Don't push to
13563         unattached_section_list_ nor call attach_to_segment.  Call
13564         attach_section_to_segment if sections are attached.
13565         (Layout::attach_sections_to_segments): New function.
13566         (Layout::attach_section_to_segment): New function.
13567         (Layout::attach_allocated_section_to_segment): Rename from
13568         attach_to_segment.  Remove flags parameter.
13569         (Layout::allocate_output_section): Remove function.
13570         (Layout::write_enable_output_section): Remove function.
13571         * layout.h (class Layout): Update for above changes.  Add new
13572         field sections_are_attached_.
13573         * output.h (Output_section::update_flags_for_input_section): New
13574         function.
13575         * output.cc (Output_section::add_input_section): Call
13576         update_flags_for_input_section.
13577         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13578
13579 2008-04-11  Cary Coutant  <ccoutant@google.com>
13580
13581         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13582         thought unnecessary.
13583         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13584
13585 2008-04-11  Ian Lance Taylor  <iant@google.com>
13586
13587         * output.h (class Output_section_data): Remove inline definition
13588         of set_addralign.
13589         * output.cc (Output_section_data::set_addralign): New function.
13590
13591 2008-04-11  Cary Coutant  <ccoutant@google.com>
13592
13593         Add support for TLS descriptors for i386 and x86_64.
13594         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13595         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13596         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13597         GOT_TYPE_TLS_DESC.
13598         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13599         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13600         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13601         relocations.
13602         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13603         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13604         Fix problem with initial-exec relocations.
13605         (Target_i386::Relocate::relocate_tls): Likewise.
13606         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13607         relaxation.
13608         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13609         support for section-plus-offset dynamic table entries.
13610         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13611         (Output_data_dynamic::Dynamic_entry): Add support for
13612         section-plus-offset dynamic table entries.
13613         (Output_data_dynamic::Classification): Likewise.
13614         (Output_data_dynamic::classification_): Renamed offset_.
13615         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13616         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13617         (Target_x86_64::make_plt_section): New function.
13618         (Target_x86_64::reserve_tlsdesc_entries): New function.
13619         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13620         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13621         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13622         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13623         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13624         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13625         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13626         add extra PLT entry for TLS descriptors.
13627         (Output_data_plt_x86_64::got_): New field.
13628         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13629         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13630         fields.
13631         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13632         descriptors.
13633         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13634         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13635         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13636         R_386_TLS_DESC_CALL relocations.
13637         (Target_x86_64::Scan::global): Likewise.
13638         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13639         for TLS descriptors.
13640         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13641         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13642         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13643         GD-to-IE relaxation.
13644         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13645         and TLS_DESCRIPTORS.
13646         * Makefile.in: Rebuild.
13647         * configure: Rebuild.
13648         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13649         (tls_test_shared2.so): New target.
13650         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13651         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13652         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13653         (tls_shared_gd_to_ie_test_LDADD): New variable.
13654         (tls_shared_gnu2_gd_to_ie_test): New target.
13655         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13656         New targets.
13657         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13658         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13659         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13660         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13661         (tls_shared_gnu2_test): New target.
13662         (tls_test_gnu2_shared.so): New target.
13663         (tls_shared_gnu2_test_SOURCES): New variable.
13664         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13665         (tls_shared_gnu2_test_LDFLAGS): New variable.
13666         (tls_shared_gnu2_test_LDADD): New variable.
13667         * testsuite/Makefile.in: Rebuild.
13668         * testsuite/Makefile.
13669
13670 2008-04-11  Ian Lance Taylor  <iant@google.com>
13671
13672         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13673         justsyms.t.
13674         * testsuite/Makefile.in: Rebuild.
13675
13676         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13677         long.
13678         * testsuite/script_test_2.cc (main): Adjust test.
13679
13680 2008-04-11  David S. Miller  <davem@davemloft.net>
13681             Ian Lance Taylor  <iant@google.com>
13682
13683         * options.h (General_options): Add entries for '-Y' and
13684         '-relax'.
13685         * options.cc (General_options:finalize): If -Y was used, add those
13686         entries to the library path instead of the default "/lib" and
13687         "/usr/lib".
13688
13689 2008-04-11  David S. Miller  <davem@davemloft.net>
13690
13691         * testsuite/justsyms.t: Start at 0x100.
13692         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13693         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13694         long.
13695         * testsuite/script_test_2.cc: Adjust string and section length
13696         checks.
13697
13698 2008-04-09  Ian Lance Taylor  <iant@google.com>
13699
13700         PR gold/5996
13701         * script-sections.cc (Sections_element::allocate_to_segment): Add
13702         orphan parameter.
13703         (Output_section_definition::allocate_to_segment): Likewise.
13704         (Orphan_output_section::allocate_to_segment): Likewise.
13705         (Script_sections::attach_sections_using_phdrs_clause): Don't
13706         propagate non-PT_LOAD segments to orphan sections.
13707         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13708         readelf rather than objdump.
13709         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13710         .interp section and PT_INTERP segment are the same size.
13711         * testsuite/Makefile.in: Rebuild.
13712
13713         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13714         aliases for symbols defined in the same object.
13715         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13716         (weak_alias_test_SOURCES): New variable.
13717         (weak_alias_test_DEPENDENCIES): New variable.
13718         (weak_alias_test_LDFLAGS): New variable.
13719         (weak_alias_test_LDADD): New variable.
13720         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13721         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13722         (weak_alias_test_3.o): New target.
13723         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13724         * testsuite/weak_alias_test_main.cc: New file.
13725         * testsuite/weak_alias_test_1.cc: New file.
13726         * testsuite/weak_alias_test_2.cc: New file.
13727         * testsuite/weak_alias_test_3.cc: New file.
13728
13729 2008-04-08  Ian Lance Taylor  <iant@google.com>
13730
13731         * options.h (class General_options): Add --noinhibit-exec option.
13732         * main.cc (main): Check --noinhibit-exec.
13733
13734         * options.h (class General_options): Define --wrap as a special
13735         option.  Add wrap_symbols_ field.
13736         (General_options::any_wrap_symbols): New function.
13737         (General_options::is_wrap_symbol): New function.
13738         * options.cc (General_options::parse_wrap): New function.
13739         (General_options::General_options): Initialize wrap_symbols_.
13740         * symtab.cc (Symbol_table::wrap_symbol): New function.
13741         (Symbol_table::add_from_object): Handle --wrap.
13742         * symtab.h (class Symbol_table): Declare wrap_symbol.
13743         * target.h (Target::wrap_char): New function.
13744         (Target::Target_info): Add wrap_char field.
13745         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13746         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13747         * testsuite/testfile.cc (Target_test::test_target_info):
13748         Likewise.
13749
13750         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13751         there is one.
13752
13753         * layout.h (class Layout): Add added_eh_frame_data_ field.
13754         * layout.cc (Layout::Layout): Initialize new field.
13755         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13756         output section until we find a section we merged successfully.
13757         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13758         that the size be non-zero.
13759
13760         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13761         qualifier.
13762
13763 2008-04-08  Craig Silverstein  <csilvers@google.com>
13764
13765         * configure.ac: Export new conditional variable HAVE_ZLIB.
13766         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13767         on HAVE_ZLIB.
13768         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13769         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13770
13771 2008-04-07  Ian Lance Taylor  <iant@google.com>
13772
13773         * version.cc (version_string): Set to "1.5".
13774
13775         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13776         Add issued_non_pic_error_ field.  Declare check_non_pic.
13777         (Target_x86_64::Scan::check_non_pic): New function.
13778         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13779         (Target_x86_64::Scan::global): Likewise.
13780
13781         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13782         addend parameter.  Change caller.  Handle merge sections.
13783         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13784         Address to Addend.  Don't add in the result of
13785         local_section_offset, pass down the addend and use the returned
13786         value.
13787         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13788         Update declarations of local_section_offset and symbol_value.
13789         * testsuite/two_file_test_1.cc (t18): New function.
13790         * testsuite/two_file_test_2.cc (f18): New function.
13791         * testsuite/two_file_test_main.cc (main): Call t18.
13792         * testsuite/two_file_test.h (t18, f18): Declare.
13793
13794         * configure.ac: Don't test for objdump, c++filt, or readelf.
13795         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13796         conditionals.
13797         (TEST_READELF): New variable.
13798         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13799         (check_PROGRAMS): Add two_file_strip_test.
13800         (two_file_strip_test): New target.
13801         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13802         (two_file_same_shared_strip_test_SOURCES): New variable.
13803         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13804         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13805         (two_file_same_shared_strip_test_LDADD): New variable.
13806         (two_file_shared_strip.so): New target.
13807         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13808         (ver_test_5.syms, ver_test_7.syms): Likewise.
13809         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13810         (strip_test_3.stdout): Use TEST_OBJDUMP.
13811         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13812
13813 2008-04-04  Cary Coutant  <ccoutant@google.com>
13814
13815         * symtab.h (Symbol::is_weak_undefined): New function.
13816         (Symbol::is_strong_undefined): New function.
13817         (Symbol::is_absolute): New function.
13818         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13819         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13820         absolute symbols.
13821         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13822         (weak_undef_test): New target.
13823         * testsuite/Makefile.in: Rebuild.
13824         * testsuite/weak_undef_file1.cc: New file.
13825         * testsuite/weak_undef_file2.cc: New file.
13826         * testsuite/weak_undef_test.cc: New file.
13827
13828 2008-04-03  Craig Silverstein  <csilvers@google.com>
13829
13830         * compressed_output.h (class Output_compressed_section): Use
13831         unsigned buffer.
13832         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13833         add zlib header.
13834         (zlib_compressed_suffix): Removed.
13835         (Output_compressed_section::set_final_data_size): Use unsigned
13836         buffers.
13837         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13838         Fix linker invocation.
13839         (flagstest_o_specialfile_and_compress_debug_sections):
13840         Likewise.
13841         * testsuite/Makefile.in: Regenerated.
13842
13843 2008-04-02  David S. Miller  <davem@davemloft.net>
13844
13845         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13846         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13847
13848 2008-04-02  Craig Silverstein  <csilvers@google.com>
13849
13850         * TODO: New file.
13851
13852 2008-04-02  Ian Lance Taylor  <iant@google.com>
13853
13854         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13855         parameters.  Update for new key type to views_.  Change all
13856         callers.
13857         (File_read::read): Adjust for byteshift in returned view.
13858         (File_read::add_view): New function, broken out of
13859         find_and_make_view.
13860         (File_read::make_view): New function, broken out of
13861         find_and_make_view.
13862         (File_read::find_or_make_view): Add offset and aligned
13863         parameters.  Rewrite accordingly.  Change all callers.
13864         (File_read::get_view): Add offset and aligned parameters.  Adjust
13865         for byteshift in return value.
13866         (File_read::get_lasting_view): Likewise.
13867         * fileread.h (class File_read): Update declarations.
13868         (class File_read::View): Add byteshift_ field.  Add byteshift to
13869         constructor.  Add byteshift method.
13870         * archive.h (Archive::clear_uncached_views): New function.
13871         (Archive::get_view): Add aligned parameter.  Change all callers.
13872         * object.h (Object::get_view): Add aligned parameter.  Change all
13873         callers.
13874         (Object::get_lasting_view): Likewise.
13875
13876         * fileread.cc (File_read::release): Don't call clear_views if
13877         there are multiple objects.
13878         * fileread.h (File_read::clear_uncached_views): New function.
13879         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13880         on the archive.
13881
13882 2008-03-31  Cary Coutant  <ccoutant@google.com>
13883
13884         Add thin archive support.
13885         * archive.cc (Archive::armagt): New const.
13886         (Archive::setup): Remove task parameter and calls to unlock.
13887         (Archive::unlock_nested_archives): New function.
13888         (Archive::read_header): Add nested_off parameter. Change
13889         all callers.
13890         (Archive::interpret_header): Likewise.
13891         (Archive::include_all_members): Change to handle thin
13892         archives.
13893         (Archive::include_member): Likewise.
13894         * archive.h (Archive::Archive): Add new parameters and
13895         initializers.
13896         (Archive::armagt): New const.
13897         (Archive::setup): Remove task parameter.
13898         (Archive::unlock_nested_archives): New function.
13899         (Archive::read_header): Add nested_off parameter.
13900         (Archive::interpret_header): Likewise.
13901         (Archive::Nested_archive_table): New typedef.
13902         (Archive::is_thin_archive_): New field.
13903         (Archive::nested_archives_): New field.
13904         (Archive::options_): New field.
13905         (Archive::dirpath_): New field.
13906         (Archive::task_): New field.
13907         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13908         for thin archives.  Pass additional parameters to
13909         Archive::Archive.  Unlock the archive file after calling
13910         Archive::setup.
13911
13912 2008-03-29  Ian Lance Taylor  <iant@google.com>
13913
13914         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13915         version symbol to be local.
13916         * testsuite/ver_test_4.sh: New file.
13917         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13918         (check_DATA): Add ver_test_4.syms.
13919         (ver_test_4.syms): New target.
13920         * testsuite/Makefile.in: Rebuild.
13921
13922         * output.cc
13923         (Output_section::Input_section_sort_entry::has_priority): New
13924         function.
13925         (Output_section::Input_section_sort_entry::match_file_name): New
13926         function.
13927         (Output_section::Input_section_sort_entry::match_section_name):
13928         Remove.
13929         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13930         Remove.
13931         (Output_section::Input_section_sort_entry::match_section_file):
13932         Remove.
13933         (Output_section::Input_section_sort_compare::operator()): Rewrite
13934         using new Input_section_sort_entry functions.  Sort crtbegin and
13935         crtend first.  Sort sections with no priority before sections with
13936         a priority.
13937         * testsuite/initpri1.c (d3): Check j != 4.
13938         (cd5): New constructor/destructor function.
13939         (main): Check j != 2.
13940
13941         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13942         new symbol when resolving, don't call set_is_default.
13943         * testsuite/ver_test_7.cc: New file.
13944         * testsuite/ver_test_7.sh: New file.
13945         * testsuite/Makefile.am (ver_test_7.so): New target.
13946         (ver_test_7.o): New target.
13947         (check_SCRIPTS): Add ver_test_7.sh.
13948         (check_DATA): Add ver_test_7.syms.
13949         (ver_test_7.syms): New target.
13950
13951 2008-03-28  Ian Lance Taylor  <iant@google.com>
13952
13953         * layout.cc (Layout::layout): If we see an input section with a
13954         name that needs sorting, set the must_sort flag for the output
13955         section.
13956         (Layout::make_output_section): If the name of the output section
13957         indicates that it might require sorting, set the may_sort flag.
13958         * output.h (Output_section::may_sort_attached_input_sections): New
13959         function.
13960         (Output_section::set_may_sort_attached_input_sections): New
13961         function.
13962         (Output_section::must_sort_attached_input_sections): New
13963         function.
13964         (Output_section::set_must_sort_attached_input_sections): New
13965         function.
13966         (class Output_section): Declare Input_section_sort_entry.  Define
13967         Input_section_sort_compare.  Declare
13968         sort_attached_input_sections.  Add new fields:
13969         may_sort_attached_input_sections_,
13970         must_sort_attached_input_sections_,
13971         attached_input_sections_are_sorted_.
13972         * output.cc (Output_section::Output_section): Initialize new
13973         fields.
13974         (Output_section::add_input_section): Add an entry to
13975         input_sections_ if may_sort or must_sort are true.
13976         (Output_section::set_final_data_size): Call
13977         sort_attached_input_sections if necessary.
13978         (Output_section::Input_section_sort_entry): Define new class.
13979         (Output_section::Input_section_sort_compare::operator()): New
13980         function.
13981         (Output_section::sort_attached_input_sections): New function.
13982         * configure.ac: Check whether the compiler supports constructor
13983         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13984         * testsuite/initpri1.c: New file.
13985         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13986         CONSTRUCTOR_PRIORITY.
13987         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13988         (initpri1_LDFLAGS): New variable.
13989         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13990
13991 2008-03-27  Ian Lance Taylor  <iant@google.com>
13992
13993         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13994         * testsuite/common_test_1.c: New file.
13995         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13996         (common_test_1_SOURCES): New variable.
13997         (common_test_1_DEPENDENCIES): New variable.
13998         (common_test_1_LDFLAGS): New variable.
13999
14000         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14001         and commons_ correctly when NAME/VERSION does not override
14002         NAME/NULL.
14003         * testsuite/ver_test_6.c: New file.
14004         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14005         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14006         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14007
14008 2008-03-26  Ian Lance Taylor  <iant@google.com>
14009
14010         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14011         of an undefined symbol from a version script.
14012         * testsuite/Makefile.am (ver_test_5.so): New target.
14013         (ver_test_5.o): New target.
14014         (check_SCRIPTS): Add ver_test_5.sh.
14015         (check_DATA): Add ver_test_5.syms.
14016         (ver_test_5.syms): New target.
14017         * testsuite/ver_test_5.cc: New file.
14018         * testsuite/ver_test_5.script: New file.
14019         * testsuite/ver_test_5.sh: New file.
14020         * Makefile.in, testsuite/Makefile.in: Rebuild.
14021
14022         PR gold/5986
14023         Fix problems building gold with gcc 4.3.0.
14024         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14025         (gold_error_at_location, gold_warning_at_location): Use it.
14026         * configure.ac: Check whether we can compile and use a template
14027         function with a printf attribute.
14028         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14029         when jumping over bytes.
14030         * object.cc: Instantiate Object::read_section_data.
14031         * debug.h: Include <cstring>
14032         * dwarf_reader.cc: Include <algorithm>
14033         * main.cc: Include <cstring>.
14034         * options.cc: Include <cstring>.
14035         * output.cc: Include <cstring>.
14036         * script.cc: Include <cstring>.
14037         * script.h: Include <string>.
14038         * symtab.cc: Include <cstring> and <algorithm>.
14039         * target-select.cc: Include <cstring>.
14040         * version.cc: Include <string>.
14041         * testsuite/testmain.cc: Include <cstdlib>.
14042         * configure, config.in: Rebuild.
14043
14044 2008-03-25  Ian Lance Taylor  <iant@google.com>
14045
14046         * options.cc: Include "../bfd/bfdver.h".
14047         (options::help): Print bug reporting address.
14048
14049         * version.cc (print_version): Adjust output for current value of
14050         BFD_VERSION_STRING.
14051
14052         * NEWS: New file.
14053
14054         * options.cc (options::help): Print list of supported targets.
14055         * target-select.h: Include <vector>.
14056         (class Target_selector): Make machine_, size_, and is_big_endian_
14057         fields const.  Add bfd_name_ and instantiated_target_ fields.
14058         (Target_selector::Target_selector): Add bfd_name parameter.
14059         (Target_selector::recognize): Make non-virtual, call
14060         do_recognize.
14061         (Target_selector::recognize_by_name): Make non-virtual, call
14062         do_recognize_by_name.
14063         (Target_selector::supported_names): New function.
14064         (Target_selector::bfd_name): New function.
14065         (Target_selector::do_instantiate_target): New pure virtual
14066         function.
14067         (Target_selector::do_recognize): New virtual function.
14068         (Target_selector::do_recognize_by_name): New virtual function.
14069         (Target_selector::instantiate_target): New private function.
14070         (supported_target_names): Declare.
14071         * target-select.cc (Target_selector::Target_selector): Update for
14072         new parameter and fields.
14073         (select_target_by_name): Check that the name matches before
14074         calling recognize_by_name.
14075         (supported_target_names): New function.
14076         * i386.cc (class Target_selector_i386): Update Target_selector
14077         constructor call.  Remove recognize and recognize_by_name.  Add
14078         do_instantiate_target.
14079         * x86_64.cc (class Target_selector_x86_64): Likewise.
14080         * testsuite/testfile.cc (class Target_selector_test): Update for
14081         changes to Target_selector.
14082
14083         * README: Rewrite, with some notes on unsupported features.
14084
14085 2008-03-24  Cary Coutant  <ccoutant@google.com>
14086
14087         * i386.cc (Target_i386::Got_type): New enum declaration.
14088         (Target_i386::Scan::local): Updated callers of Output_data_got
14089         member functions.
14090         (Target_i386::Scan::global): Likewise.
14091         (Target_i386::Relocate::relocate): Likewise.
14092         (Target_i386::Relocate::relocate_tls): Likewise.
14093         * object.h (Got_offset_list): New class.
14094         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14095         (Sized_relobj::local_got_offset): Likewise.
14096         (Sized_relobj::set_local_got_offset): Likewise.
14097         (Sized_relobj::local_has_tls_got_offset): Removed.
14098         (Sized_relobj::local_tls_got_offset): Removed.
14099         (Sized_relobj::set_local_tls_got_offset): Removed.
14100         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14101         * output.cc (Output_data_got::add_global): Added got_type parameter.
14102         (Output_data_got::add_global_with_rel): Likewise.
14103         (Output_data_got::add_global_with_rela): Likewise.
14104         (Output_data_got::add_global_pair_with_rel): New function.
14105         (Output_data_got::add_global_pair_with_rela): New function.
14106         (Output_data_got::add_local): Added got_type parameter.
14107         (Output_data_got::add_local_with_rel): Likewise.
14108         (Output_data_got::add_local_with_rela): Likewise.
14109         (Output_data_got::add_local_pair_with_rel): New function.
14110         (Output_data_got::add_local_pair_with_rela): New function.
14111         (Output_data_got::add_global_tls): Removed.
14112         (Output_data_got::add_global_tls_with_rel): Removed.
14113         (Output_data_got::add_global_tls_with_rela): Removed.
14114         (Output_data_got::add_local_tls): Removed.
14115         (Output_data_got::add_local_tls_with_rel): Removed.
14116         (Output_data_got::add_local_tls_with_rela): Removed.
14117         * output.h (Output_data_got::add_global): Added got_type parameter.
14118         (Output_data_got::add_global_with_rel): Likewise.
14119         (Output_data_got::add_global_with_rela): Likewise.
14120         (Output_data_got::add_global_pair_with_rel): New function.
14121         (Output_data_got::add_global_pair_with_rela): New function.
14122         (Output_data_got::add_local): Added got_type parameter.
14123         (Output_data_got::add_local_with_rel): Likewise.
14124         (Output_data_got::add_local_with_rela): Likewise.
14125         (Output_data_got::add_local_pair_with_rel): New function.
14126         (Output_data_got::add_local_pair_with_rela): New function.
14127         (Output_data_got::add_global_tls): Removed.
14128         (Output_data_got::add_global_tls_with_rel): Removed.
14129         (Output_data_got::add_global_tls_with_rela): Removed.
14130         (Output_data_got::add_local_tls): Removed.
14131         (Output_data_got::add_local_tls_with_rel): Removed.
14132         (Output_data_got::add_local_tls_with_rela): Removed.
14133         * resolve.cc (Symbol::override_base_with_special): Removed
14134         reference to has_got_offset_ field.
14135         * symtab.cc (Symbol::init_fields): Replaced initialization
14136         of got_offset_ with got_offsets_.  Removed initialization
14137         of has_got_offset_
14138         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14139         (Symbol::got_offset): Likewise.
14140         (Symbol::set_got_offset): Likewise.
14141         (Symbol::has_tls_got_offset): Removed.
14142         (Symbol::tls_got_offset): Removed.
14143         (Symbol::set_tls_got_offset): Removed.
14144         (Symbol::got_offset_): Removed.
14145         (Symbol::tls_mod_got_offset_): Removed.
14146         (Symbol::tls_pair_got_offset_): Removed.
14147         (Symbol::got_offsets_): New field.
14148         (Symbol::has_got_offset): Removed.
14149         (Symbol::has_tls_mod_got_offset): Removed.
14150         (Symbol::has_tls_pair_got_offset): Removed.
14151         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14152         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14153         member functions.
14154         (Target_x86_64::Scan::global): Likewise.
14155         (Target_x86_64::Relocate::relocate): Likewise.
14156         (Target_x86_64::Relocate::relocate_tls): Likewise.
14157
14158 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14159
14160         * yyscript.y: Fix spelling error in comment.
14161
14162 2008-03-24  Ian Lance Taylor  <iant@google.com>
14163
14164         * options.h (class General_options): Define build_id option.
14165         * layout.h (class Layout): Declare write_build_id, create_note,
14166         create_build_id.  Add build_id_note_ member.
14167         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14168         "libiberty.h", "md5.h", "sha1.h".
14169         (Layout::Layout): Initialize eh_frame_data_,
14170         eh_frame_hdr_section_, and build_id_note_.
14171         (Layout::finalize): Call create_build_id.
14172         (Layout::create_note): New function, broken out of
14173         Layout::create_gold_note.
14174         (Layout::create_gold_note): Call create_note.
14175         (Layout::create_build_id): New function.
14176         (Layout::write_build_id): New function.
14177         (Close_task_runner::run): Call write_build_id.
14178
14179         * x86_64.cc: Correct license to GPLv3.
14180
14181 2008-03-23  Ian Lance Taylor  <iant@google.com>
14182
14183         * options.cc: Include "demangle.h".
14184         (parse_optional_string): New function.
14185         (parse_long_option): Handle takes_optional_argument.
14186         (parse_short_option): Update dash_z initializer.  Handle
14187         takes_optional_argument.
14188         (General_options::General_options): Initialize do_demangle_.
14189         (General_options::finalize): Set do_demangle_.  Handle demangling
14190         style.
14191         * options.h (parse_optional_string): Declare.
14192         (struct One_option): Add optional_arg field.  Update constructor.
14193         Update call constructor calls.  Add takes_optional_argument
14194         function.
14195         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14196         (DEFINE_optional_string): Define.
14197         (General_options::demangle): Change from DEFINE_bool to
14198         DEFINE_optional_string.
14199         (General_options::no_demangle): New function.
14200         (General_options::do_demangle): New function.
14201         (General_options::set_do_demangle): New function.
14202         (General_options::execstack_status_): Move definition to end of
14203         class definition.
14204         (General_options::static_): Likewise.
14205         (General_options::do_demangle_): New field.
14206         * object.cc (big_endian>::get_symbol_location_info): Call
14207         Options::do_demangle, not Options::demangle.
14208         * symtab.cc (demangle): Likewise.
14209
14210 2008-03-22  Ian Lance Taylor  <iant@google.com>
14211
14212         * gold.h: Include <cstddef> and <sys/types.h>
14213         * options.h: Include <cstring>.
14214
14215 2008-03-21  Ian Lance Taylor  <iant@google.com>
14216
14217         * Added source code to GNU binutils.
14218 \f
14219 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14220
14221 Copying and distribution of this file, with or without modification,
14222 are permitted in any medium without royalty provided the copyright
14223 notice and this notice are preserved.
14224
14225 Local Variables:
14226 mode: change-log
14227 left-margin: 8
14228 fill-column: 74
14229 version-control: never
14230 End: