* powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
[platform/upstream/binutils.git] / gold / ChangeLog
1 2012-12-10  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
4         Set EM_PPC64 or EM_PPC here.
5         (Target_selector_powerpc::do_recognize): Delete.
6
7 2012-12-10  Alan Modra  <amodra@gmail.com>
8
9         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
10         stub_table_.
11         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
12
13 2012-12-07  Roland McGrath  <mcgrathr@google.com>
14
15         * testsuite/binary_unittest.cc (Sized_binary_test):
16         Use open_descriptor rather than ::open.
17
18 2012-12-07  Alan Modra  <amodra@gmail.com>
19
20         * powerpc.cc (Stub_table::do_write): Delete redundant Address
21         typedef and invalid_address constant.
22         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
23         instantiate constants.
24
25 2012-12-06  Roland McGrath  <mcgrathr@google.com>
26
27         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
28         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
29         * aclocal.m4: Regenerate.
30         * configure: Regenerate.
31         * Makefile.in: Regenerate.
32         * testsuite/Makefile.in: Regenerate.
33
34 2012-12-07  Alan Modra  <amodra@gmail.com>
35
36         * options.h (General_options): Add no_toc_optimize.
37         * powerpc.cc (ok_lo_toc_insn): New function.
38         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
39
40 2012-12-06  Alan Modra  <amodra@gmail.com>
41
42         * options.h (General_options): Add plt_align, plt_static_chain,
43         plt_thread_safe.  Update stub_group_size help text.
44         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
45         for new plt_thread_safe_ var.
46         (use_plt_offset): Correct comments.
47         (Target_powerpc::do_relax): Look for thread creation symbols to
48         determine default plt_thread_safe value.  Clear plt call stubs
49         as well as branch stubs each iteration.
50         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
51         insn constants.
52         (l, hi, ha, write_insn): Move earlier.
53         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
54         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
55         plt stubs too.
56         (Stub_table::update_size): Adjust.
57         (Stub_table::prev_size, set_prev_size): Delete.
58         (Stub_table::stub_align): Let --plt-align affect result.
59         (Stub_table::plt_call_size): Calculate sizes for various stubs.
60         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
61         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
62         (Stub_table::do_write): Support more stub variants.
63
64 2012-12-04  Alan Modra  <amodra@gmail.com>
65
66         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
67         (Target_powerpc::do_define_standard_symbols): New function.
68
69 2012-12-03  Alan Modra  <amodra@gmail.com>
70
71         * output.h: Formatting, whitespace.
72
73 2012-12-03  Alan Modra  <amodra@gmail.com>
74
75         * layout.h (Layout::get_executable_sections): Declare.
76         * layout.cc (Layout::get_executable_sections): New function.
77         * arm.cc (Target_arm::group_sections): Use it.
78         (Arm_output_section::group_sections): Delete now redundant test.
79         * output.cc (Output_reloc::Output_reloc): Add is_relative.
80         param to handle relative relocs.
81         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
82         (Output_data_reloc::add_absolute): Adjust.
83         (Output_data_reloc::add_relative): New function.
84         (Output_data::reset_data_size): New function.
85         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
86         (Output_section::set_addralign): New function.
87         (Output_section::checkpoint_set_addralign): New function.
88         (Output_section::clear_section_offsets_need_adjustment): New function.
89         (Output_section::input_sections): Make public.
90         * powerpc.cc (class Output_data_brlt_powerpc): New.
91         (class Stub_table, class Stub_control): New.
92         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
93         stub_table_, set_stub_table, stub_table): New vectors and accessor
94         functions.
95         (Target_powerpc::do_may_relax, do_relax, push_branch,
96         new_stub_table, stub_tables, brlt_section, group_sections,
97         add_branch_lookup_table, find_branch_lookup_table,
98         write_branch_lookup_table, make_brlt_section): New functions.
99         (Target_powerpc::struct Sort_sections, class Branch_info): New.
100         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
101         branch_info_): New vars.
102         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
103         make call stubs here.
104         (Output_data_glink): Remove all call stub handling from this class.
105         (Target_powerpc::Scan::local, global): Save interesting branch
106         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
107         (Target_powerpc::do_finalize_sections): Only make reg save/restore
108         functions on final link.
109         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
110         Handle long branch destinations too.
111         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
112         do_plt_address_for_local): Adjust lookup of plt call stubs.
113
114 2012-11-30  Alan Modra  <amodra@gmail.com>
115
116         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
117         relocs against protected symbols when building 32-bit shared libs.
118
119 2012-11-30  Alan Modra  <amodra@gmail.com>
120
121         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
122         param.  Call got_section() to make .got.  Update all callers
123         and their callers and so on.
124
125 2012-11-30  Alan Modra  <amodra@gmail.com>
126
127         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
128         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
129         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
130         value if it already exists.
131
132 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
133
134         PR gold/14858
135         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
136
137 2012-11-14  Roland McGrath  <mcgrathr@google.com>
138
139         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
140         than bfc instruction for data sandboxing.
141
142 2012-11-08  Alan Modra  <amodra@gmail.com>
143
144         * po/POTFILES.in: Regenerate.
145
146 2012-11-05  Alan Modra  <amodra@gmail.com>
147
148         * configure.ac: Apply 2012-09-10 change to config.in here.
149         * configure: Regenerate.
150
151 2012-11-05  Alan Modra  <amodra@gmail.com>
152
153         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
154         (struct Opd_ent): Use "Address" rather than "Offset".
155         (Output_data_got_powerpc::got_base_offset): Return Valtype.
156         (Target_powerpc::got_section): Make public.
157         (Target_powerpc::scan_relocs): Move code setting symbols..
158         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
159         Create _SDA_BASE_ only when referenced.
160
161 2012-11-02  Roland McGrath  <mcgrathr@google.com>
162
163         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
164         from last change.
165
166 2012-11-01  Roland McGrath  <mcgrathr@google.com>
167
168         * target.h (Sized_target::relocate_relocs): Use Elf_Off
169         for offset_in_output_section parameter.
170         (Sized_target::relocate_special_relocatable): Likewise.
171         * arm.cc (Target_arm::relocate_relocs): Likewise.
172         (Target_arm::relocate_special_relocatable): Likewise.
173         * i386.cc (Target_i386::relocate_relocs): Likewise.
174         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
175         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
176         * target-reloc.h (relocate_relocs): Likewise.
177         * testsuite/testfile.cc (Target_test): Likewise.
178         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
179         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
180
181         * system.h: Move inclusion of <clocale> to after <libintl.h> in
182         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
183
184         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
185         parameter, which is unused in the [!F_SETFD] case.
186
187         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
188         SYMNDX to off_t before comparing it to this->data_size().
189         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
190         * incremental.cc (Output_section_incremental_inputs::do_write):
191         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
192
193         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
194
195 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
196
197         * gold.cc (Target_arm::do_adjust_elf_header): Add the
198         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
199         in EABI_VER5.
200
201 2012-10-29  Cary Coutant  <ccoutant@google.com>
202
203         * dwp.cc (usage): Add file and exit status parameters;
204         add --help and --version options.
205         (print_version): New function.
206         (main): Add --help and --version options.
207
208 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
209
210         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
211         final_layout_sequence.txt.
212         * testsuite/Makefile.in: Regenerated.
213
214 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
215
216         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
217         COMPILE generated by automake.
218         (LINK1): Likewise.
219         (CXXCOMPILE1): Likewise.
220         (CXXLINK1): Likewise.
221         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
222         (LINK): Likewise.
223         (CXXCOMPILE): Likewise.
224         (CXXLINK): Likewise.
225         * testsuite/Makefile.in: Regenerated.
226
227 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
228
229         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
230         on bad fwrite return.
231
232 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
233
234         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
235         on val.
236
237 2012-10-23  Cary Coutant  <ccoutant@google.com>
238
239         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
240         * testsuite/Makefile.in: Regenerate.
241         * testsuite/dwp_test.h: New source file.
242         * testsuite/dwp_test_1.cc: New source file.
243         * testsuite/dwp_test_1.s: New source file.
244         * testsuite/dwp_test_1.sh: New source file.
245         * testsuite/dwp_test_1b.cc: New source file.
246         * testsuite/dwp_test_1b.s: New source file.
247         * testsuite/dwp_test_2.cc: New source file.
248         * testsuite/dwp_test_2.s: New source file.
249         * testsuite/dwp_test_2.sh: New source file.
250         * testsuite/dwp_test_main.cc: New source file.
251         * testsuite/dwp_test_main.s: New source file.
252
253 2012-10-23  Cary Coutant  <ccoutant@google.com>
254
255         * dwp.h: New header file.
256         * dwp.cc: New source file.
257         * gold.h: Move shared declarations to system.h.
258         * system.h: New header file.
259         * Makefile.am: Add dwp.
260         * Makefile.in: Regenerate.
261
262 2012-10-23  Cary Coutant  <ccoutant@google.com>
263
264         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
265         Dwarf_info_reader::read_from_pointer.
266         (Dwarf_pubnames_table::read_header): Likewise.
267         (Dwarf_pubnames_table::next_name): Likewise.
268         (Dwarf_die::read_attributes): Likewise.
269         (Dwarf_die::skip_attributes): Likewise.
270         (Dwarf_info_reader::read_from_pointer): New function template.
271         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
272         (Dwarf_pubnames_table): Likewise.
273         (Dwarf_info_reader::read_from_pointer): New function template.
274         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
275         Dwarf_pubnames_table ctor.
276
277 2012-10-23  Cary Coutant  <ccoutant@google.com>
278
279         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
280         abbrev_shndx.
281         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
282         abbrev_shndx_.
283         (Dwarf_info_reader::set_abbrev_shndx): New method.
284         (Dwarf_info_reader::abbrev_shndx_): New data member.
285
286 2012-10-23  Cary Coutant  <ccoutant@google.com>
287
288         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
289         from object, not parameters.
290         (Dwarf_info_reader::parse): Likewise.
291         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
292         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
293         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
294         methods.
295
296 2012-10-23  Cary Coutant  <ccoutant@google.com>
297
298         * fileread.cc (Input_file::Input_file): New constructor.
299         * fileread.h (class Input_file): Add new constructor.
300
301 2012-10-18  Alan Modra  <amodra@gmail.com>
302
303         PR gold/14727
304         * object.cc (Relobj::is_section_name_included): Also match
305         .sdata personality section.
306
307 2012-10-18  Alan Modra  <amodra@gmail.com>
308
309         * target-reloc.h (class Default_comdat_behavior): New, package up..
310         (get_comdat_behaviour): ..this.
311         (relocate_section): Add Relocate_comdat_behavior template arg,
312         adjust code to suit.
313         * arm.cc (Target_arm::relocate_section): Adjust to suit.
314         (Target_arm::scan_reloc_section): Likewise.
315         * i386.cc (Target_i386::relocate_section): Likewise.
316         * sparc.cc (Target_sparc::relocate_section): Likewise.
317         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
318         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
319         * powerpc.cc (class Relocate_comdat_behavior): New.
320         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
321         gold::relocate_section with new template arg.
322
323 2012-10-18  Alan Modra  <amodra@gmail.com>
324
325         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
326         dynamic relocs for GOT_TPREL got entries, without symbol if
327         resolving locally.
328         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
329         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
330         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
331
332 2012-10-17  Alan Modra  <amodra@gmail.com>
333
334         PR gold/14726
335         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
336
337 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
338
339         * layout.cc (Layout::include_section): Keep sections marked
340         SHF_EXCLUDE when doing relocatable links.
341
342 2012-10-16  Alan Modra  <amodra@gmail.com>
343
344         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
345         (Target_powerpc::do_finalize_sections): Call it.
346         (Output_data_save_res): New class and supporting functions.
347         (Target_powerpc::symval_for_branch): Only look up .opd entry for
348         normal symbols defined in object files.
349
350 2012-10-12  Alan Modra  <amodra@gmail.com>
351
352         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
353         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
354         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
355         section if scan_opd_relocs not yet called.
356         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
357
358 2012-10-12  Alan Modra  <amodra@gmail.com>
359
360         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
361         add_local_ifunc_entry): Revert last change.
362         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
363
364 2012-10-05  Alan Modra  <amodra@gmail.com>
365
366         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
367         do_plt_address_for_global): New functions.
368         (Output_data_got_powerpc::do_write): Don't segfault when linking
369         statically.
370         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
371         add_local_ifunc_entry): Return true on adding entry..
372         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
373         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
374         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
375         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
376         set up symbols here.
377         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
378         syms here.  Do so even when no .iplt.  Don't segfault when linking
379         statically.
380         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
381         new variants without reloc param.
382         (Glink_sym_ent::Glink_sym_ent): Likewise.
383         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
384         reloc when refs will resolve to plt call stub.
385         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
386         R_PPC_PLTREL24 to resolve locally.
387         (Target_powerpc::Scan::global): Correct ifunc handling.
388         (Target_powerpc::Relocate::relocate): Correct local sym glink
389         lookup.  Don't destroy "value" when we have a plt call stub,
390         and when checking plt call validity.
391         (Target_powerpc::do_dynsym_value): Simplify.
392
393 2012-10-05  Alan Modra  <amodra@gmail.com>
394
395         * i386.cc (Output_data_plt_i386::address_for_global,
396         address_for_local): Add plt offset to returned value.  Adjust uses.
397         * sparc.cc (Output_data_plt_sparc::address_for_global,
398         address_for_local): Likewise.
399         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
400         address_for_local): Likewise.
401         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
402         address_for_local): Likewise.
403         * target.h (Target::plt_address_for_global, plt_address_for_local):
404         Update comment.
405         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
406         (Output_data_got::Got_entry::write): Nor here.
407         * output.h: Comment fix.
408
409 2012-10-02  Jiong Wang  <jiwang@tilera.com>
410
411         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
412         global_offset_table_ value for larget got.
413         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
414
415 2012-09-29  Alan Modra  <amodra@gmail.com>
416
417         * powerpc.cc (Target_powerpc::iplt_): New output section.
418         (Target_powerpc::iplt_section, make_iplt_section,
419         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
420         (Target_powerpc::make_plt_entry): Handle ifunc syms.
421         Target_powerpc::plt_entry_count): Count iplt entries too.
422         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
423         reloc section in constructor.  New params.
424         (Target_powerpc::make_plt_section): Create reloc section here instead.
425         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
426         functions.
427         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
428         (Output_data_glink::add_entry, find_entry): New functions to
429         deal with local syms.
430         (Glink_sym_ent): Add support for local syms.
431         (Output_data_glink::do_write): Handle ifunc plt entries.
432         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
433         (Target_powerpc::Scan::local, global): Handle ifunc syms.
434         (Target_powerpc::Relocate::relocate): Likewise.
435         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
436
437 2012-09-25  Alan Modra  <amodra@gmail.com>
438
439         * object.h (Sized_relobj_file::adjust_local_symbol,
440         do_adjust_local_symbol): New functions.
441         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
442         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
443         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
444         and irregular opd entry spacing.
445         (Powerpc_relobj::do_read_relocs): Add opd size checks.
446         (Global_symbol_visitor_opd): New functor.
447         (Target_powerpc::do_finalize_sections): Omit global symbols defined
448         on deleted opd entries.
449
450 2012-09-15  Jiong Wang  <jiwang@tilera.com>
451
452         * tilegx.cc: New file.
453         * Makefile.am (TARGETSOURCES): Add tilegx.cc
454         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
455         * configure.tgt: Add entries for tilegx*.
456         * configure.ac: Likewise.
457         * Makefile.in: Rebuild.
458         * configure: Likewise.
459         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
460         tilegx.
461
462 2012-09-13  Alan Modra  <amodra@gmail.com>
463
464         * target-reloc.h (scan_relocs): Call scan.local for relocs
465         against symbols in discarded sections.  Pass is_discarded
466         param.
467         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
468         Add is_discarded param.
469         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
470         is_discarded to flag opd entry as discarded.  Don't emit dyn
471         relocs on such entries.
472         (Target_powerpc::Scan::global): Similarly detect and handle
473         such opd entries.
474         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
475         opd_ent_.  Update all uses.
476         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
477         (Target_powerpc::relocate_section): Zero out discarded opd
478         entry relocs.
479
480 2012-09-12  Ian Lance Taylor  <iant@google.com>
481
482         PR gold/14570
483         * output.cc: Rename Output_data_got template parameter from size
484         to got_size for all functions.  Compile all variants of
485         Output_data_got.
486         (Output_data_got::Got_entry::write): Correct use of size for
487         symbol value.  Use local_is_tls rather than casting to
488         Sized_relobj_file.
489         * object.h (class Object): Add local_is_tls and do_local_is_tls.
490         (class Sized_relobj_file): Add do_local_is_tls.
491         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
492
493 2012-09-11  Alan Modra  <amodra@gmail.com>
494
495         PR gold/14566
496         * layout.cc (Layout::set_segment_offsets): When using
497         common-page-size alignment, ensure we are on a new max-page-size
498         page.
499         * output.cc (Output_segment::set_section_addresses): Use
500         abi_pagesize, not common_pagesize for relro boundary.
501         (Output_segment::set_offset): Likewise.
502
503 2012-09-11  Alan Modra  <amodra@gmail.com>
504
505         * output.h (Output_data_got::add_global_tls, add_local_tls,
506         add_local_tls_pair): New functions.
507         (Output_data_got::add_local_pair_with_rel): Remove second
508         reloc param.  Expand comment.
509         (Output_data_got::Got_entry): Rename use_plt_offset_ to
510         use_plt_or_tls_offset_, similarly for constructor param.
511         (Output_data_got::Got_entry::write): Add got_index param.
512         * output.cc (Output_data_got::add_global_tls, add_local_tls,
513         add_local_tls_pair): New functions.
514         (Output_data_got::Got_entry::write): Handle tls symbols
515         with use_plt_or_tls_offset_ set specially.
516         (Output_data_got::add_local_pair_with_rel): Only one reloc.
517         (Output_data_got::do_write): Replace iterator with index, pass
518         index to entry write function.
519         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
520         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
521         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
522         call.
523         * i386.cc (Target_i386::Scan::local): Likewise.
524         * sparc.cc (Target_sparc::Scan::local): Likewise.
525         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
526         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
527         do_tls_offset_for_global): New functions.
528         (Target_powerpc::Scan::local): Correct TLS relocations and got
529         entry values.
530         (Target_powerpc::Scan::global): Don't emit unnecessary
531         dynamic relocations on TLS GOT entries.
532
533 2012-09-10  Matthias Klose  <doko@ubuntu.com>
534
535         * config.in: Disable sanity check for kfreebsd.
536
537 2012-09-10  Sterling Augustine  <saugustine@google.com>
538
539         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
540         (Gdb_index::pubtypes_read): New parameter.
541         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
542         to calls.
543         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
544         pubtypes_object_.
545
546 2012-09-09  Alan Modra  <amodra@gmail.com>
547
548         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
549         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
550         * gc.h (gc_process_relocs): Call target gc_add_reference.
551         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
552         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
553         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
554         unnecessary cast.
555         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
556         to cater for when we don't need code offset.  Update use.
557         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
558         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
559         set_opd_valid): New functions.
560         (Target_powerpc::do_gc_add_reference): New function.
561         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
562         stashed refs.
563         (Target_powerpc::do_gc_mark_symbol): New function.
564
565 2012-09-06  Cary Coutant  <ccoutant@google.com>
566
567         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
568         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
569         (Dwarf_die::skip_attributes): Likewise.
570         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
571         * testsuite/gdb_index_test.cc (inline_func_1): New function.
572         (main): Call it.
573         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
574
575 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
576
577         * testsuite/script_test_3.t: Add .got.plt output section
578         statement.
579         * testsuite/script_test_4.t: Likewise.
580
581 2012-09-05  Alan Modra  <amodra@gmail.com>
582
583         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
584         update all uses and lose "enum" when using type.
585
586 2012-09-05  Alan Modra  <amodra@gmail.com>
587
588         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
589         * configure: Regenerate.
590         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
591         (plugin_final_layout.stdout): Likewise.
592         (memory_test): Set page sizes to 0x1000.
593         * testsuite/Makefile.in: Regenerate.
594         * testsuite/discard_locals_test.sh: Add FIXME comment.
595         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
596         * testsuite/pr14265.t: Add .got output section statement.
597         * testsuite/script_test_2.t: Likewise.
598         * testsuite/script_test_3.t: Likewise.
599         * testsuite/script_test_4.t: Likewise.
600         * testsuite/script_test_5.t: Likewise.
601         * testsuite/script_test_6.t: Likewise.
602         * testsuite/script_test_7.t: Likewise.
603         * testsuite/script_test_9.t: Likewise.
604
605 2012-09-05  Alan Modra  <amodra@gmail.com>
606
607         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
608         (Powerpc_relocate_functions::Status): New typedef.
609         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
610         (Target_powerpc::Scan::local): Handle REL64.
611         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
612         for REL32 and REL64.
613         (Target_powerpc::symval_for_branch): New function, extracted from..
614         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
615         checks.  Report overflow errors.
616
617 2012-09-05  Alan Modra  <amodra@gmail.com>
618
619         * object.h (Sized_relobj_file::emit_relocs): Delete.
620         (Sized_relobj_file::emit_relocs_reltype): Delete.
621         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
622         relocate_relocs for --emit-relocs.
623         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
624         * output.h: Update comment.
625         (Output_segment::first_section): New function.
626         (Output_segment::first_section_load_address): Use first_section.
627         * output.cc (Output_segment::first_section): New function extracted..
628         (Output_segment::first_section_load_address): ..from here.  Delete.
629         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
630         * target.h (Sized_target::relocate_for_relocatable): Likewise.
631         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
632         adjust call to target.h function.
633         * i386.cc (Target_i386): Likewise.
634         * sparc.cc (Target_sparc): Likewise.
635         * x86_64.cc (Target_x86_64): Likewise.
636         * powerpc.cc (Target_powerpc): Likewise.
637         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
638         first tls section has section symbol for optimised local dynamic
639         output relocs.
640         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
641         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
642         optimised tls code.
643         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
644         Rename to relocate_relocs.  Update error message.
645
646 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
647
648         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
649         --just-symbols.
650
651 2012-08-31  Alan Modra  <amodra@gmail.com>
652
653         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
654         (Powerpc_relobj::toc_base_offset): New stub function.
655         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
656         got_mod_index_offset to tlsld_got_offset.  Update all refs.
657         (Target_powerpc::Relocate::enum skip_tls): New.
658         (Target_powerpc::call_tls_get_addr_): New var.
659         (Target_powerpc::is_branch_reloc): Move to file scope.
660         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
661         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
662         New functions.
663         (Target_powerpc::enum Got_type): Delete old values, add new ones.
664         (powerpc_info): Correct common_pagesize for ppc64.
665         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
666         (Powerpc_relocate_functions): Add overflow check enums and functions.
667         Add non-shift version of rela, rela_ua.  Delete all rel public
668         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
669         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
670         addr16_ha3, addr14 functions.
671         (Output_data_got_powerpc::add_constant_pair): New function.
672         (Output_data_got_powerpc::got_base_offset): Likewise.
673         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
674         (instruction constants): Sort, add some more.
675         (Output_data_glink::do_write): Add and use Address typedef.  Use
676         object->toc_base_offset() stub for 64-bit.
677         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
678         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
679         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
680         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
681         Always treat .opd relocs as against locally defined symbol.
682         Correct condition for RELATIVE relocs.
683         (Target_powerpc::do_finalize_sections): Test for NULL sections.
684         (Target_powerpc::Relocate::relocate): Use plt call stub as value
685         for 32-bit syms with a plt entry.  Correct ppc64 toc base
686         calculations.  Handle TLS relocs, and more.  Add overflow
687         checking and adjust for Powerpc_relocate_functions changes.
688         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
689         Reinstate --emit-relocs code with FIXME.
690
691 2012-08-30  Alan Modra  <amodra@gmail.com>
692
693         * layout.cc (Layout::set_segment_offsets): Set p_align to
694         abi_pagesize, not common_pagesize.
695         (Layout::relaxation_loop_body): Similarly use abi_pagesize
696         to determine whether file header can go in segment.
697
698 2012-08-30  Alan Modra  <amodra@gmail.com>
699
700         * output.h (Output_reloc::Output_reloc <output section>): Add
701         is_relative param.  Adjust calls.
702         (Output_reloc::add_output_section_relative): New functions.
703         * output.cc (Output_reloc::Output_reloc <output section>): Handle
704         is_relative.
705         (Output_reloc::symbol_value): Handle SECTION_CODE.
706
707 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
708
709         * gold.cc (queue_middle_tasks): Call layout again when unique
710         segments for sections is desired.
711         * layout.cc (Layout::Layout): Initialize new members.
712         (Layout::get_output_section_flags): New function.
713         (Layout::choose_output_section): Call get_output_section_flags.
714         (Layout::layout): Make output section for mapping to a unique segment.
715         (Layout::insert_section_segment_map): New function.
716         (Layout::attach_allocated_section_to_segment): Make unique segment for
717         output sections marked so.
718         (Layout::segment_precedes): Check for unique segments when sorting.
719         * layout.h (Layout::Unique_segment_info): New struct.
720         (Layout::Section_segment_map): New typedef.
721         (Layout::insert_section_segment_map): New function.
722         (Layout::get_output_section_flags): New function.
723         (Layout::is_unique_segment_for_sections_specified): New function.
724         (Layout::set_unique_segment_for_sections_specified): New function.
725         (Layout::unique_segment_for_sections_specified_): New member.
726         (Layout::section_segment_map_): New member.
727         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
728         Rename is_gc_pass_one to is_pass_one.
729         Rename is_gc_pass_two to is_pass_two.
730         Rename is_gc_or_icf to is_two_pass.
731         Check for which pass based on whether symbols data is present.
732         Make it two pass when unique segments for sections is desired.
733         * output.cc (Output_section::Output_section): Initialize new
734         members.
735         * output.h (Output_section::is_unique_segment): New function.
736         (Output_section::set_is_unique_segment): New function.
737         (Output_section::is_unique_segment_): New member.
738         (Output_section::extra_segment_flags): New function.
739         (Output_section::set_extra_segment_flags): New function.
740         (Output_section::extra_segment_flags_): New member.
741         (Output_section::segment_alignment): New function.
742         (Output_section::set_segment_alignment): New function.
743         (Output_section::segment_alignment_): New member.
744         (Output_segment::Output_segment): Initialize is_unique_segment_.
745         (Output_segment::is_unique_segment): New function.
746         (Output_segment::set_is_unique_segment): New function.
747         (Output_segment::is_unique_segment_): New member.
748         * plugin.cc (allow_unique_segment_for_sections): New function.
749         (unique_segment_for_sections): New function.
750         (Plugin::load): Add new functions to transfer vector.
751         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
752         * Makefile.in: Regenerate.
753         * testsuite/plugin_final_layout.sh: Check if unique segment
754         functionality works.
755         * testsuite/plugin_section_order.c (onload): Check if new interfaces
756         are available.
757         (allow_unique_segment_for_sections): New global.
758         (unique_segment_for_sections): New global.
759         (claim_file_hook): Call allow_unique_segment_for_sections.
760         (all_symbols_read_hook): Call unique_segment_for_sections.
761
762 2012-08-22  Cary Coutant  <ccoutant@google.com>
763
764         * layout.cc (Layout::include_section): Don't assert on GROUP
765         sections with --emit-relocs.
766
767 2012-08-21  Cary Coutant  <ccoutant@google.com>
768
769         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
770         if --export-dynamic-symbol names an undef symbol.
771
772 2012-08-18  Alan Modra  <amodra@gmail.com>
773
774         * powerpc.cc: Formatting and white space.
775         (Powerpc_relobj): Rename got2_section_ to special_.
776         Add opd_ent_shndx_ and opd_ent_off_ vectors.
777         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
778         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
779         (Target_powerpc): Add Address typedef and invalid_address.  Use
780         throughout.
781         (Target_powerpc::is_branch_reloc): New function.
782         (Powerpc_relocate_functions): Add Address typedef, use throughout.
783         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
784         for dst_mask, value and addend.
785         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
786         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
787         (Output_data_glink::do_write): Correct toc base.  Don't try to use
788         uint16_t for 24-bit offset.  Use get_output_section_offset and
789         check return.
790         (Target_powerpc::Scan::local): Handle more relocs.
791         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
792         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
793         Plug in toc restoring insn after plt calls.  Translate branches
794         to function descriptor symbols to corresponding entry point.
795         (Target_powerpc::relocate_for_relocatable): Check return from
796         get_output_section_offset.
797         * symtab.h: Comment typo.
798
799 2012-08-14  Ian Lance Taylor  <iant@google.com>
800
801         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
802         unsupported_relocal_local to call unsupported_reloc_global.
803
804 2012-08-14  Nick Clifton  <nickc@redhat.com>
805
806         PR ld/14265
807         * script-sections.cc (Sections_element::output_section_name): Add
808         keep return parameter.
809         (Output_section_element::match_name): Add keep return parameter.
810         Return the value of the keep_ member.
811         * script-sections.h (class Output_section): Update
812         output_section_name prototype.
813         * layout.cc (Layout::keep_input_section): New public member
814         function.
815         (Layout::choose_output_section): Pass keep parameter to
816         output_section_name.
817         * layout.h (class Layout): Add keep_input_section.
818         * object.cc (Sized_relobj_file::do_layout): Check for kept input
819         sections.
820         * testsuite/Makefile.am: Add a test.
821         * testsuite/Makefile.in: Regenerate.
822         * testsuite/pr14265.c: Source file for the test.
823         * testsuite/pr14265.t: Linker script for the test.
824         * testsuite/pr14265.sh: Shell script for the test.
825
826 2012-08-14  Alan Modra  <amodra@gmail.com>
827
828         * target.h (Target::output_section_name): New function.
829         (Target::do_output_section_name): New function.
830         * layout.cc (Layout::choose_output_section): Call the above.
831         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
832
833 2012-08-14  Alan Modra  <amodra@gmail.com>
834
835         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
836         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
837         for replace_constant call.
838         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
839         (Output_data_glink::do_print_to_mapfile): New function.
840         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
841         (Target_powerpc::Relocate::relocate): Likewise.
842
843 2012-08-14  Alan Modra  <amodra@gmail.com>
844
845         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
846         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
847         (Output_data_glink::add_entry,find_entry): Remove shndx param.
848         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
849         all references to shndx_.  Handle special case for R_PPC_PLTREL24
850         here.
851         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
852         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
853         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
854         here.
855         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
856         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
857
858 2012-08-12  Alan Modra  <amodra@gmail.com>
859
860         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
861         (glink insn constants): Use uint32_t.
862         (Output_data_glink::add_entry): Use insert, not [] operator.
863
864 2012-08-11  Alan Modra  <amodra@gmail.com>
865
866         * object.h (Sized_relobj_file::find_shdr): New function.
867         (Sized_relobj_file::find_special_sections): New function.
868         * object.cc (Sized_relobj_file::find_shdr): New function.
869         (Sized_relobj_file::find_eh_frame): Use find_shdr.
870         (Sized_relobj_file::find_special_sections): New function, split out..
871         (Sized_relobj_file::do_read_symbols): ..from here.
872         * output.h (Output_data_got::replace_constant): New function.
873         (Output_data_got::num_entries): New function.
874         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
875         (Output_data_got::got_offset): Protected rather than private.
876         (Output_data_got::replace_got_entry): New function.
877         * output.cc (Output_data_got::replace_got_entry): New function.
878         * powerpc.cc (class Powerpc_relobj): New.
879         (class Powerpc_relocate_functions): Delete all psymval variants or
880         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
881         Implement _ha functions using corresponding _hi function.
882         (Powerpc_relobj::find_special_sections): New function.
883         (Target_powerpc::do_make_elf_object): New function.
884         (class Output_data_got_powerpc): New.
885         (class Output_data_glink): New.
886         (class Powerpc_scan_relocatable_reloc): New.
887         Many more changes througout file.
888
889 2012-08-09  Nick Clifton  <nickc@redhat.com>
890
891         * po/vi.po: Updated Vietnamese translation.
892
893 2012-08-07  Ian Lance Taylor  <iant@google.com>
894
895         * layout.cc (Layout::add_target_dynamic_tags): If
896         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
897         plt_rel.
898
899 2012-07-30  Nick Clifton  <nickc@redhat.com>
900
901         * po/gold.pot: Updated template.
902         * po/es.po: Updated Spanish translation.
903
904 2012-07-18  Cary Coutant  <ccoutant@google.com>
905
906         PR gold/14344
907         * configure.ac: Add check for -gpubnames support.
908         * configure: Regenerate.
909         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
910         support; force -gno-pubnames.
911         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
912         support.
913         (gdb_index_test_4): New test.
914         * testsuite/Makefile.in: Regenerate.
915         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
916         * testsuite/gdb_index_test_2.sh: Likewise.
917         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
918         * testsuite/gdb_index_test_4.sh: New script.
919         * testsuite/gdb_index_test_comm.sh: New script with common code;
920         don't look for space after colon.
921
922 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
923
924         * gold.cc (queue_middle_tasks): Update function order only after
925         deferred objects due to plugins are processed.
926
927 2012-07-11  Ian Lance Taylor  <iant@google.com>
928
929         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
930         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
931         (Target_arm::scan_reloc_for_stub): Likewise.
932         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
933         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
934         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
935         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
936         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
937
938 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
939             Ian Lance Taylor  <iant@google.com>
940
941         PR gold/14309
942         * configure.ac: Test whether std::tr1::hash<off_t> works.
943         * gold.h: Add a specialization for std::tr1::hash<off_t> if
944         needed.
945         * output.h (class Output_fill): Add virtual destructor.
946         * configure, config.in: Rebuild.
947
948 2012-06-22  Roland McGrath  <mcgrathr@google.com>
949
950         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
951
952 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
953
954         * plugin.cc (Plugin::load): Handle position independent executables.
955
956 2012-06-06  Cary Coutant  <ccoutant@google.com>
957
958         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
959         add .debug_macro.
960         (lines_only_debug_sections): Likewise.
961         (gdb_fast_lookup_sections): New static array.
962         (is_gdb_debug_section): Rename formal parameter.
963         (is_lines_only_debug_section): Likewise.
964         (is_gdb_fast_lookup_section): New function.
965         (Layout::include_section): Check for ".zdebug_" prefix; pass
966         section name suffix to is_gdb_debug_section, et al.; check for
967         fast-lookup sections when building .gdb_index.
968         * options.h (--strip-debug-gdb): Update GDB version number.
969
970 2012-06-06  Cary Coutant  <ccoutant@google.com>
971
972         * configure.ac: Add check for fallocate.
973         * configure: Regenerate.
974         * config.in: Regenerate.
975
976         * options.h (class General_options): Add --mmap-output-file and
977         --posix-fallocate options.
978         * output.cc: (posix_fallocate): Remove; replace with...
979         (gold_fallocate): New function.
980         (Output_file::map_no_anonymous): Call gold_fallocate.
981         (Output_file::map): Check --mmap-output-file option.
982
983 2012-06-05  Jing Yu  <jingyu@google.com>
984
985         * gold.h (textdomain): Add do {} to empty while(0).
986         (bindtextdomain): Likewise.
987
988 2012-06-04  Cary Coutant  <ccoutant@google.com>
989
990         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
991         has_dynsym_index.
992
993 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
994
995         * symtab.cc (Symbol_table::define_special_symbol):
996         Initialize *poldsym to prevent uninitialized variable errors.
997
998 2012-05-23  Cary Coutant  <ccoutant@google.com>
999
1000         * layout.cc (Layout::section_name_mapping): Add rules to handle
1001         exact match on .data.rel.ro.local or .data.rel.ro.
1002         (Layout::output_section_name): Check for exact matches.
1003
1004 2012-05-23  Cary Coutant  <ccoutant@google.com>
1005
1006         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1007         more carefully.
1008
1009 2012-05-22  Cary Coutant  <ccoutant@google.com>
1010
1011         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1012         object before exporting symbol.
1013
1014 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1015
1016         * testsuite/tls_test.cc: Include "config.h" first.
1017         * testsuite/tls_test_c.c: Likewise.
1018
1019 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1020             Nick Clifton  <nickc@redhat.com>
1021
1022         PR 14072
1023         * configure.in: Add check that sysdep.h has been included before
1024         any system header files.
1025         * configure: Regenerate.
1026         * config.in: Regenerate.
1027
1028 2012-05-14  Cary Coutant  <ccoutant@google.com>
1029
1030         * layout.cc (Layout::make_output_section): Mark .tdata section
1031         as RELRO.
1032         * testsuite/relro_test.cc: Add a TLS variable.
1033
1034 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1035
1036         PR gold/14091
1037         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1038         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1039         R_X86_64_64.
1040
1041 2012-05-08  Cary Coutant  <ccoutant@google.com>
1042
1043         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1044         (lines_only_debug_sections): Likewise.
1045
1046 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1047
1048         * nacl.cc: New file.
1049         * nacl.h: New file.
1050         * Makefile.am (CCFILES, HFILES): Add them.
1051         * Makefile.in: Regenerate.
1052         * i386.cc (Output_data_plt_i386_nacl): New class.
1053         (Output_data_plt_i386_nacl_exec): New class.
1054         (Output_data_plt_i386_nacl_dyn): New class.
1055         (Target_i386_nacl): New class.
1056         (Target_selector_i386_nacl): New class.
1057         (target_selector_i386): Use it instead of Target_selector_i386.
1058         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1059         (Target_x86_64_nacl): New class.
1060         (Target_selector_x86_64_nacl): New class.
1061         (target_selector_x86_64, target_selector_x32): Use it instead of
1062         Target_selector_x86_64.
1063         * arm.cc (Output_data_plt_arm_nacl): New class.
1064         (Target_arm_nacl): New class.
1065         (Target_selector_arm_nacl): New class.
1066         (target_selector_arm, target_selector_armbe): Use it instead of
1067         Target_selector_arm.
1068
1069         * target-select.cc (select_target): Take new Input_file* and off_t
1070         arguments, pass them on to recognize method of selector.
1071         * object.cc (make_elf_sized_object): Update caller.
1072         * parameters.cc (parameters_force_valid_target): Likewise.
1073         * incremental.cc (make_sized_incremental_binary): Likewise.
1074         * target-select.h: Update decl.
1075         (Target_selector::recognize): Take new Input_file* argument,
1076         pass it on to do_recognize.
1077         (Target_selector::do_recognize): Take new Input_file* argument.
1078         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1079         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1080         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1081         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1082
1083         * target.h (Target::Target_info): New members isolate_execinstr
1084         and rosegment_gap.
1085         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1086         * arm.cc (Target_arm::arm_info): Update initializer.
1087         * i386.cc (Target_i386::i386_info): Likewise.
1088         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1089         * sparc.cc (Target_sparc::sparc_info): Likewise.
1090         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1091         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1092         * layout.cc (Layout::attach_allocated_section_to_segment):
1093         Take new const Target* argument.  If target->isolate_execinstr(), act
1094         like --rosegment.
1095         (Layout::find_first_load_seg): Take new const Target* argument;
1096         if target->isolate_execinstr(), reject PF_X segments.
1097         (Layout::relaxation_loop_body): Update caller.
1098         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1099         reset file offset to zero when we hit LOAD_SEG, and then do a second
1100         loop over the segments before LOAD_SEG to reassign offsets after
1101         addresses have been determined.  Handle target->rosegment_gap().
1102         (Layout::attach_section_to_segment): Take new const Target* argument;
1103         pass it to attach_allocated_section_to_segment.
1104         (Layout::make_output_section): Update caller.
1105         (Layout::attach_sections_to_segments): Take new const Target* argument;
1106         pass it to attach_section_to_segment.
1107         * gold.cc (queue_middle_tasks): Update caller.
1108         * layout.h (Layout): Update method decls with new arguments.
1109
1110         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1111         Target_info pointer to use.
1112         (Target_arm::do_make_data_plt): New virtual method.
1113         (Target_arm::make_data_plt): New method that calls it.
1114         (Target_arm::make_plt_entry): Use it.
1115         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1116         for the section alignment.
1117         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1118         method.
1119         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1120         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1121         method.
1122         (Output_data_plt_arm::get_plt_entry_size): Call it.
1123         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1124         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1125         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1126         method.
1127         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1128         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1129         method instead of sizeof(plt_entry).
1130         (Output_data_plt_arm::add_entry): Likewise.
1131         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1132         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1133         than static method.
1134         (Target_arm::plt_entry_size): Likewise.
1135         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1136         Move to ...
1137         (Output_data_plt_arm_standard): ... here, new class.
1138         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1139         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1140         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1141
1142         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1143         Take additional argument for the PLT entry size.
1144         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1145         Use get_plt_entry_size method rather than plt_entry_size variable.
1146         (Output_data_plt_x86_64::reserve_slot): Likewise.
1147         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1148         (Output_data_plt_x86_64::add_entry): Likewise.
1149         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1150         (Output_data_plt_x86_64::address_for_global): Likewise.
1151         (Output_data_plt_x86_64::address_for_local): Likewise.
1152         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1153         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1154         Make method non-static.
1155         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1156         method.
1157         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1158         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1159         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1160         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1161         virtual method.
1162         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1163         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1164         virtual method.
1165         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1166         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1167         virtual method.
1168         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1169         (Output_data_plt_x86_64::plt_entry_size)
1170         (Output_data_plt_x86_64::first_plt_entry)
1171         (Output_data_plt_x86_64::plt_entry)
1172         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1173         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1174         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1175         (Output_data_plt_x86_64_standard): ... here, new class.
1176         (Target_x86_64::Target_x86_64): Take optional argument for the
1177         Target_info pointer to use.
1178         (Target_x86_64::do_make_data_plt): New virtual method.
1179         (Target_x86_64::make_data_plt): New method to call it.
1180         (Target_x86_64::init_got_plt_for_update): Use that.
1181         Call this->plt_->add_eh_frame method here.
1182         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1183         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1184         rather than static method.
1185         (Target_x86_64::plt_entry_size): Likewise.
1186         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1187         rather than plt_entry_size variable.  Move guts of PLT filling to...
1188         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1189         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1190         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1191
1192         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1193         additional argument for the section alignment.
1194         Don't do add_eh_frame_for_plt here.
1195         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1196         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1197         variable.
1198         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1199         method.
1200         (Output_data_plt_i386::get_plt_entry_size): Call it.
1201         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1202         (Output_data_plt_i386::add_eh_frame): New method to call it.
1203         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1204         method.
1205         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1206         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1207         method.
1208         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1209         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1210         method instead of plt_entry_size.
1211         (Output_data_plt_i386::plt_entry_size)
1212         (Output_data_plt_i386::plt_eh_frame_fde_size)
1213         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1214         (Output_data_plt_i386_standard): ... here, new class.
1215         (Output_data_plt_i386_exec): New class.
1216         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1217         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1218         (Output_data_plt_i386::exec_plt_entry): Move to ...
1219         (Output_data_plt_i386_exec::plt_entry): ... here.
1220         (Output_data_plt_i386_dyn): New class.
1221         (Output_data_plt_i386::first_plt_entry): Move to ...
1222         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1223         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1224         (Output_data_plt_i386_dyn::plt_entry): ... here.
1225         (Target_i386::Target_i386): Take optional argument for the Target_info
1226         pointer to use.
1227         (Target_i386::do_make_data_plt): New virtual method.
1228         (Target_i386::make_data_plt): New method to call it.
1229         (Target_i386::make_plt_section): Use that.
1230         Call this->plt_->add_eh_frame method here.
1231         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1232         rather than plt_entry_size variable.
1233         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1234         (Output_data_plt_i386::address_for_local): Likewise.
1235         (Output_data_plt_i386::do_write): Likewise.
1236         Move guts of PLT filling to...
1237         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1238         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1239         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1240         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1241
1242 2012-05-01  Cary Coutant  <ccoutant@google.com>
1243
1244         * dwarf_reader.cc (Dwarf_die::read_attributes)
1245         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1246         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1247         * reduced_debug_output.cc
1248         (Output_reduced_debug_info_section::get_die_end): Remove
1249         DW_FORM_GNU_ref_index.  Add default case.
1250
1251 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1252
1253         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1254         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1255         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1256         DW_AT_high_pc as offset from DW_AT_low_pc.
1257
1258         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1259         * testsuite/Makefile.in: Regenerate.
1260         * testsuite/gdb_index_test_3.c: New test source file.
1261         * testsuite/gdb_index_test_3.sh: New test source file.
1262
1263 2012-04-25  Ian Lance Taylor  <iant@google.com>
1264
1265         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1266         pointer.
1267         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1268         as a class, not a struct.
1269         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1270         (Target_arm::apply_cortex_a8_workaround): Likewise.
1271         * gc.h: Declare Reloc_types as a struct, not a class.
1272         * object.h: Declare Symbols_data as a struct.
1273         * reloc.h: Declare Read_relocs_data as a struct.
1274         * target.h: Declare Relocate_info as a struct.
1275
1276 2012-04-24  David S. Miller  <davem@davemloft.net>
1277
1278         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1279         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1280         and R_SPARC_WPLT30.
1281
1282 2012-04-24  Cary Coutant  <ccoutant@google.com>
1283
1284         * incremental-dump.cc (find_input_containing_global): Replace
1285         magic number with symbolic constant.
1286         (dump_incremental_inputs): Update version number.
1287         * incremental.cc (Output_section_incremental_inputs): Update version
1288         number; import symbolic constants from Incremental_inputs_reader.
1289         (Incremental_inputs::create_data_sections): Align relocations
1290         section correctly for 64-bit targets.
1291         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1292         constants; add padding.
1293         (Output_section_incremental_inputs::write_header): Add assert for
1294         header_size.
1295         (Output_section_incremental_inputs::write_input_files): Add assert
1296         for input_entry_size.
1297         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1298         add assert for object_info_size, input_section_entry_size,
1299         global_sym_entry_size.
1300         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1301         for data structure sizes; use them.
1302         (Incremental_input_entry_reader): Import symbolic constants from
1303         Incremental_inputs_reader; use them.
1304
1305 2012-04-23  David S. Miller  <davem@davemloft.net>
1306
1307         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1308         and elf_flags_set_.
1309         (Target_sparc::Target_sparc): Initialize new fields.
1310         (Target_sparc::do_make_elf_object): New function.
1311         (Target_sparc::do_adjust_elf_header): New function.
1312
1313 2012-04-23  Cary Coutant  <ccoutant@google.com>
1314
1315         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1316         CU range table of gdb index.
1317
1318 2012-04-20  David S. Miller  <davem@davemloft.net>
1319
1320         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1321         instead of false.
1322
1323 2012-04-16  David S. Miller  <davem@davemloft.net>
1324
1325         * sparc.cc (Target_sparc::got_address): New function.
1326         (Sparc_relocate_functions::gdop_hix22): New function.
1327         (Sparc_relocate_functions::gdop_lox10): New function.
1328         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1329         relocs.
1330         (Target_sparc::Scan::local): Likewise if the global symbol is not
1331         preemptible and is not IFUNC.
1332         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1333         transformations for local and non-preemptible non-IFUNC global
1334         symbols.
1335
1336         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1337         writing out 64-bit part of ranges.
1338
1339         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1340         -fpic and -fpie respectively.
1341         * Makefile.in: Regenerate.
1342
1343         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1344         (Target_sparc::Target_sparc): Initialize new field.
1345         (Target_sparc::do_plt_section_for_global): New function.
1346         (Target_sparc::do_plt_section_for_local): New function.
1347         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1348         (Target_sparc::make_plt_section): New function, broken out of
1349         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1350         (Target_sparc::make_plt_entry): Call make_plt_section.
1351         (Target_sparc::make_local_ifunc_plt_entry): New function.
1352         (Target_sparc::rela_ifunc_section): New function.
1353         (Target_sparc::plt_section): Remove const.
1354         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1355         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1356         and ifunc_count_ fields.
1357         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1358         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1359         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1360         (Output_data_plt_sparc::rela_ifunc): New function.
1361         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1362         (Output_data_plt_sparc::has_ifunc_section): New function.
1363         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1364         (Output_data_plt_sparc::address_for_global): New function.
1365         (Output_data_plt_sparc::address_for_local): New function.
1366         (Output_data_plt_sparc::plt_index_to_offset): New function.
1367         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1368         and entry_count.
1369         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1370         entry_count.
1371         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1372         R_SPARC_JMP_IREL to switch.
1373         (Target_sparc::Scan::check_non_pic): Likewise.
1374         (Target_sparc::Scan::local): Handle IFUNC symbols.
1375         (Target_sparc::Scan::local): Likewise.
1376         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1377         and plt_address_for_local.
1378         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1379         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1380
1381         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1382         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1383         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1384         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1385         global relocs too.
1386         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1387         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1388         calls.
1389         * sparc.cc (Target_sparc::Scan::global): Likewise.
1390         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1391
1392 2012-04-16  Cary Coutant  <ccoutant@google.com>
1393
1394         * archive.cc (Library_base::should_include_member): Check for
1395         --export-dynamic-symbol.
1396         * options.h (class General_options): Add --export-dynamic-symbol.
1397         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1398         --export-dynamic-symbol.
1399         (Symbol_table::gc_mark_undef_symbols): Likewise.
1400         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1401
1402 2012-04-12  David S. Miller  <davem@davemloft.net>
1403
1404         * sparc.cc (Reloc::wdisp10): New relocation method.
1405         (Reloc::h34): Likewise.
1406         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1407         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1408         R_SPARC_WDISP10.
1409         (Target_sparc::Scan::local): Likewise.
1410         (Target_sparc::Scan::global): Likewise.
1411         (Target_sparc::Relocate::relocate): Likewise.
1412
1413 2012-04-09  Cary Coutant  <ccoutant@google.com>
1414
1415         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1416         low_pc == 0.
1417
1418 2012-04-06  Ian Lance Taylor  <iant@google.com>
1419
1420         * timer.cc: #include <unistd.h>.
1421
1422 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1423
1424         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1425         * config.in: Regenerate.
1426         * configure: Regenerate.
1427
1428 2012-04-05  Nick Clifton  <nickc@redhat.com>
1429
1430         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1431         (AM_LC_MESSAGES): Add.
1432         * aclocal.m4: Regenerate.
1433         * config.in: Regenerate.
1434         * configure: Regenerate.
1435
1436 2012-03-21  Cary Coutant  <ccoutant@google.com>
1437
1438         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1439         * Makefile.in: Regenerate.
1440         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1441         (Sized_elf_reloc_mapper::symbol_section): New function.
1442         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1443         (make_elf_reloc_mapper): New function.
1444         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1445         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1446         (Dwarf_abbrev_table::do_get_abbrev): New function.
1447         (Dwarf_ranges_table::read_ranges_table): New function.
1448         (Dwarf_ranges_table::read_range_list): New function.
1449         (Dwarf_pubnames_table::read_section): New function.
1450         (Dwarf_pubnames_table::read_header): New function.
1451         (Dwarf_pubnames_table::next_name): New function.
1452         (Dwarf_die::Dwarf_die): New function.
1453         (Dwarf_die::read_attributes): New function.
1454         (Dwarf_die::skip_attributes): New function.
1455         (Dwarf_die::set_name): New function.
1456         (Dwarf_die::set_linkage_name): New function.
1457         (Dwarf_die::attribute): New function.
1458         (Dwarf_die::string_attribute): New function.
1459         (Dwarf_die::int_attribute): New function.
1460         (Dwarf_die::uint_attribute): New function.
1461         (Dwarf_die::ref_attribute): New function.
1462         (Dwarf_die::child_offset): New function.
1463         (Dwarf_die::sibling_offset): New function.
1464         (Dwarf_info_reader::check_buffer): New function.
1465         (Dwarf_info_reader::parse): New function.
1466         (Dwarf_info_reader::do_parse): New function.
1467         (Dwarf_info_reader::do_read_string_table): New function.
1468         (Dwarf_info_reader::lookup_reloc): New function.
1469         (Dwarf_info_reader::get_string): New function.
1470         (Dwarf_info_reader::visit_compilation_unit): New function.
1471         (Dwarf_info_reader::visit_type_unit): New function.
1472         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1473         Sized_elf_reloc_mapper.
1474         (Sized_dwarf_line_info::symbol_section): Remove function.
1475         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1476         (Sized_dwarf_line_info::read_line_mappings): Remove object
1477         parameter, adjust callers.
1478         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1479         * dwarf_reader.h: Include <sys/types.h>.
1480         (class Track_relocs): Remove forward declaration.
1481         (class Elf_reloc_mapper): New class.
1482         (class Sized_elf_reloc_mapper): New class.
1483         (class Dwarf_abbrev_table): New class.
1484         (class Dwarf_range_list): New class.
1485         (class Dwarf_ranges_table): New class.
1486         (class Dwarf_pubnames_table): New class.
1487         (class Dwarf_die): New class.
1488         (class Dwarf_info_reader): New class.
1489         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1490         (Sized_dwarf_line_info::symbol_section): Remove member function.
1491         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1492         base class.
1493         * gdb-index.cc: New source file.
1494         * gdb-index.h: New source file.
1495         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1496         and .debug_types sections, call Layout::add_to_gdb_index.
1497         (Sized_relobj_incr::do_section_name): Implement.
1498         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1499         return type; Implement.
1500         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1501         return type.
1502         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1503         parameter list and return type.
1504         (Sized_incr_dynobj::do_section_contents): Likewise.
1505         * layout.cc: Include gdb-index.h.
1506         (Layout::Layout): Initialize gdb_index_data_.
1507         (Layout::init_fixed_output_section): Check for .gdb_index section.
1508         (Layout::add_to_gdb_index): New function. Instantiate.
1509         * layout.h: Add forward declaration for class Gdb_index.
1510         (Layout::add_to_gdb_index): New member function.
1511         (Layout::gdb_index_data_): New data member.
1512         * main.cc: Include gdb-index.h.
1513         (main): Print statistics for gdb index.
1514         * object.cc (Object::section_contents): Move code into
1515         do_section_contents.
1516         (need_decompressed_section): Check for sections needed when building
1517         gdb index.
1518         (build_compressed_section_map): Likewise.
1519         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1520         gdb index.
1521         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1522         sections; call Layout::add_to_gdb_index.
1523         (Sized_relobj_file::do_decompressed_section_contents): Call
1524         do_section_contents directly.
1525         * object.h (Object::do_section_contents): Adjust parameter list and
1526         return type.
1527         (Object::do_decompressed_section_contents): Call do_section_contents
1528         directly.
1529         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1530         return type.
1531         * options.h (class General_options): Add --gdb-index option.
1532         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1533         list and return type.
1534         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1535         * reloc.h (Track_relocs::checkpoint): New function.
1536         (Track_relocs::reset): New function.
1537
1538         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1539         New test cases.
1540         * testsuite/Makefile.in: Regenerate.
1541         * testsuite/gdb_index_test.cc: New test source file.
1542         * testsuite/gdb_index_test_1.sh: New test source file.
1543         * testsuite/gdb_index_test_2.sh: New test source file.
1544
1545 2012-03-19  Doug Kwan  <dougkwan@google.com>
1546
1547         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1548         (Target_arm::do_finalize_sections): Remove code which defines
1549         __exidx_start and __exidx_end.  Make symbol table parameter
1550         anonymous as it is not used.
1551         * gold.cc (queue_middle_tasks): Call target hook to define any
1552         target-specific symbols.
1553         * target.h (Target::define_standard_symbols): New method.
1554         (Target::do_define_standard_symbols): Same.
1555         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1556         * testsuite/Makefile.in: Regenerate.
1557         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1558         and __exidx_end.
1559         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1560         relocations are generated for __exidx_start and __exidx_end.
1561
1562 2012-03-16  Doug Kwan  <dougkwan@google.com>
1563
1564         * testsuite/Makefile.am: Disable test initpri3b.
1565         * testsuite/Makefile.in: Regenerate.
1566
1567 2012-03-15  Doug Kwan  <dougkwan@google.com>
1568
1569         * arm.cc (Target_arm::got_section): Make .got section read-only
1570         if -z now is given.
1571
1572 2012-03-15  Ian Lance Taylor  <iant@google.com>
1573
1574         PR gold/13850
1575         * layout.cc (Layout::make_output_section): Correctly mark
1576         SHT_INIT_ARRAY, et. al., as relro.
1577
1578 2012-03-14  Doug Kwan  <dougkwan@google.com>
1579
1580         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1581         dynamic relocations for protected symbols in shared objects.
1582
1583 2012-03-13  Ian Lance Taylor  <iant@google.com>
1584
1585         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1586         keep the larger alignment.
1587
1588 2012-03-12  Cary Coutant  <ccoutant@google.com>
1589
1590         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1591         handling of DW_LNE_define_file.
1592
1593 2012-03-12  Cary Coutant  <ccoutant@google.com>
1594
1595         * reduced_debug_output.cc
1596         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1597         codes to switch.
1598
1599 2012-02-29  Cary Coutant  <ccoutant@google.com>
1600
1601         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1602
1603 2012-02-29  Cary Coutant  <ccoutant@google.com>
1604
1605         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1606         Call Object::decompressed_section_contents.
1607         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1608         New dtor.
1609         (Sized_dwarf_line_info::buffer_start_): New data member.
1610         * merge.cc (Output_merge_data::do_add_input_section): Call
1611         Object::decompressed_section_contents.
1612         (Output_merge_string::do_add_input_section): Likewise.
1613         * object.cc (need_decompressed_section): New function.
1614         (build_compressed_section_map): Decompress sections needed later.
1615         (Sized_relobj_file::do_decompressed_section_contents): New function.
1616         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1617         * object.h (Object::decompressed_section_contents): New function.
1618         (Object::discard_decompressed_sections): New function.
1619         (Object::do_decompressed_section_contents): New function.
1620         (Object::do_discard_decompressed_sections): New function.
1621         (Compressed_section_info): New type.
1622         (Compressed_section_map): Include decompressed section contents.
1623         (Sized_relobj_file::do_decompressed_section_contents): New function.
1624         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1625
1626 2012-02-16  Cary Coutant  <ccoutant@google.com>
1627
1628         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1629         * testsuite/Makefile.in: Regenerate.
1630
1631 2012-02-14  Cary Coutant  <ccoutant@google.com>
1632
1633         * options.cc (General_options::finalize): Disallow -pie and -static.
1634
1635 2012-02-03  Doug Kwan  <dougkwan@google.com>
1636
1637         * arm.cc (Arm_relocate_functions::abs8,
1638         Arm_relocate_functions::abs16): Use
1639         Bits::has_signed_unsigned_overflow32.
1640         (Arm_relocate_functions::thm_abs8): Correct range of
1641         overflow check.
1642         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1643         in assertions.
1644
1645 2012-02-02  Doug Kwan  <dougkwan@google.com>
1646
1647         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1648         position independent outputs, not just shared objects.
1649
1650 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1651
1652         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1653         * configure: Regenerated.
1654
1655 2012-01-27  Ian Lance Taylor  <iant@google.com>
1656
1657         * reloc.h (Bits): New class with static functions, copied from
1658         namespace utils in arm.cc.
1659         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1660         instead.
1661
1662 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1663
1664         * incremental.cc (write_info_blocks): Correct relocation offset.
1665
1666 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1667
1668         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1669         (Relocate::tls_gd_to_le): Likewise.
1670
1671 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1672
1673         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1674
1675 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1676
1677         * configure.ac: Check if -mcmodel=medium works.
1678         * configure: Regenerated.
1679
1680 2012-01-24  Cary Coutant  <ccoutant@google.com>
1681
1682         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1683         definition and ...
1684         (read_unsigned_LEB_128_x): ... this new function.
1685         (read_signed_LEB_128): Replaced with inline definition and ...
1686         (read_signed_LEB_128_x): ... this new function.
1687         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1688         (read_unsigned_LEB_128): Add inline definition.
1689         (read_signed_LEB_128_x): New function.
1690         (read_signed_LEB_128): Add inline definition.
1691         * testsuite/Makefile.am (leb128_unittest): New unit test.
1692         * testsuite/Makefile.in: Regenerate.
1693         * testsuite/leb128_unittest.cc: New unit test.
1694
1695 2012-01-23  Ian Lance Taylor  <iant@google.com>
1696
1697         PR gold/13617
1698         * i386.cc (Target_i386::do_code_fill): When using a jmp
1699         instruction, pad with nop instructions.
1700         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1701
1702 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1703
1704         * x86_64.cc (gc_process_relocs): Add typename on types used in
1705         template.
1706         (scan_relocs): Likewise.
1707         (relocate_section): Likewise.
1708         (apply_relocation): Likewise.
1709
1710 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1711
1712         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1713         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1714         under x32.
1715
1716 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1717
1718         * x86_64.cc: Initial support for x32.
1719
1720 2012-01-03  Cary Coutant  <ccoutant@google.com>
1721
1722         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1723         Use abstract base class for GOT.
1724         * gold/output.h (class Output_data_got_base): New abstract base class.
1725         (class Output_data_got): Derive from new base class, adjust ctors.
1726         (Output_data_got::reserve_slot): Make virtual; rename to
1727         do_reserve_slot; Adjust callers.
1728         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1729         pointer to abstract base class.
1730         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1731
1732 2011-12-18  Ian Lance Taylor  <iant@google.com>
1733
1734         * object.h (Relobj::local_symbol_value): New function.
1735         (Relobj::local_plt_offset): New function.
1736         (Relobj::local_has_got_offset): New function.
1737         (Relobj::local_got_offset): New function.
1738         (Relobj::set_local_got_offset): New function.
1739         (Relobj::do_local_symbol_value): New pure virtual function.
1740         (Relobj::do_local_plt_offset): Likewise.
1741         (Relobj::do_local_has_got_offset): Likewise.
1742         (Relobj::do_local_got_offset): Likewise.
1743         (Relobj::do_set_local_got_offset): Likewise.
1744         (Sized_relobj::do_local_has_got_offset): Rename from
1745         local_has_got_offset.
1746         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1747         (Sized_relobj::do_set_local_got_offset): Rename from
1748         set_local_got_offset.
1749         (Sized_relobj_file::do_local_plt_offset): Rename from
1750         local_plt_offset.
1751         (Sized_relobj_file::do_local_symbol_value): New function.
1752         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1753         local_plt_offset.
1754         * output.cc (Output_data_got::Got_entry::write): Change object to
1755         Relobj.  Use local_symbol_value.
1756         (Output_data_got::add_global_with_rel): Change rel_dyn to
1757         Output_data_reloc_generic*.  Use add_global_generic.
1758         (Output_data_got::add_global_with_rela): Remove.  Change all
1759         callers to use add_global_with_rel.
1760         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1761         Output_data_reloc_generic*.  Use add_global_generic.
1762         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1763         callers to use add_global_pair_with_rel.
1764         (Output_data_got::add_local): Change object to Relobj*.
1765         (Output_data_got::add_local_plt): Likewise.
1766         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1767         change rel_dyn to Output_data_reloc_generic*.  Use
1768         add_local_generic.
1769         (Output_data_got::add_local_with_rela): Remove.  Change all
1770         callers to use all_local_with_rel.
1771         (Output_data_got::add_local_pair_with_rel): Change object to
1772         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1773         add_output_section_generic.
1774         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1775         callers to use add_local_pair_with_rel.
1776         (Output_data_got::reserve_local): Change object to Relobj*.
1777         * output.h: (class Output_data_reloc_generic): Add pure virtual
1778         declarations for add_global_generic, add_local_generic,
1779         add_output_section_generic.
1780         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1781         functions for Output_data_reloc_generic.  Update declarations for
1782         changes listed in output.cc.
1783         (class Output_data_got): Change template parameter to got_size.
1784         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1785         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1786         function.
1787         (Sized_relobj_incr::do_local_plt_offset): New function.
1788         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1789         add_global_generic.
1790
1791 2011-12-17  Cary Coutant  <ccoutant@google.com>
1792
1793         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1794         * resolve.cc (Symbol_table::resolve): Likewise.
1795         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1796         arrays.
1797         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1798
1799 2011-12-16  Ian Lance Taylor  <iant@google.com>
1800
1801         * output.h (Output_data_reloc_generic::add): Only call
1802         add_dynamic_reloc if this is a dynamic reloc section.
1803
1804 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1805
1806         PR gold/13505
1807         * target-reloc.h (apply_relocation): Replace <64, false> with
1808         <size, big_endian>.
1809
1810 2011-11-25  Nick Clifton  <nickc@redhat.com>
1811
1812         * po/it.po: New Italian translation.
1813
1814 2011-11-17  Sterling Augustine  <saugustine@google.com>
1815
1816         * script.cc (script_include_directive): Implement.
1817         (read_script_file): New local variables name and search_path. Update
1818         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1819         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1820         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1821
1822 2011-11-11  Sterling Augustine  <saugustine@google.com>
1823
1824         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1825         (file_or_sections_cmd): Likewise.
1826
1827 2011-11-11  Doug Kwan  <dougkwan@google.com>
1828
1829         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1830         if --just-symbols is given.
1831
1832 2011-11-10  Doug Kwan  <dougkwan@google.com>
1833
1834         PR gold/13362
1835         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1836         when processing data relocs.
1837         * reloc.h (Relocate_functions::rel_unaligned): New method.
1838         (Relocate_functions::pcrel_unaligned): Ditto.
1839         (Relocate_functions::rel32_unaligned): Ditto.
1840         (Relocate_functions::pcrel32_unaligned): Ditto.
1841
1842 2011-11-09  Doug Kwan  <dougkwan@google.com>
1843
1844         PR gold/13362
1845         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1846         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1847         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1848         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1849         (Relocate_functions::rel_unaligned): New.
1850         (Relocate_functions::rel32_unaligned): New.
1851         * target-reloc.h (relocate_for_relocatable): Add code to handle
1852         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1853         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1854         arm_unaligned_reloc_r): New targets.
1855         * testsuite/Makefile.in: Regenerate.
1856         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1857         linking.
1858
1859 2011-11-02  Ian Lance Taylor  <iant@google.com>
1860
1861         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1862         NATIVE_LINKER.
1863         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1864         * options.cc (General_options::finalize): Use library search path
1865         from configure script if specified.  If not native and no sysroot,
1866         only search TOOLLIBDIR.
1867         * options.h (Search_directory::Search_directory): Change name to
1868         const std::string&.
1869         (General_options::add_to_library_path_with_sysroot): Change arg to
1870         const std::string&.
1871         * configure, Makefile.in, config.in: Rebuild.
1872
1873 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1874
1875         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1876         we are working around the ARM1176 Erratum.
1877         * options.h (General_options::fix_arm1176): Add option.
1878         * testsuite/Makefile.am: Add testcases, and keep current ones
1879         working.
1880         * testsuite/Makefile.in: Regenerate.
1881         * testsuite/arm_fix_1176.s: New file.
1882         * testsuite/arm_fix_1176.sh: Likewise.
1883
1884 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1885
1886         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1887         may_use_blx_.
1888         (Target_arm::may_use_blx): Remove method.
1889         (Target_arm::set_may_use_blx): Likewise.
1890         (Target_arm::may_use_v4t_interworking): New method.
1891         (Target_arm::may_use_v5t_interworking): Likewise.
1892         (Target_arm::may_use_blx_): Remove member variable.
1893         (Arm_relocate_functions::arm_branch_common): Check for v5T
1894         interworking.
1895         (Arm_relocate_functions::thumb_branch_common): Likewise.
1896         (Reloc_stub::stub_type_for_reloc): Likewise.
1897         (Target_arm::do_finalize_sections): Correct interworking checks.
1898         * testsuite/Makefile.am: Add new tests.
1899         * testsuite/Makefile.in: Regenerate.
1900         * testsuite/arm_farcall_arm_arm.s: New test.
1901         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1902         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1903         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1904         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1905         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1906         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1907         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1908
1909 2011-10-31  Cary Coutant  <ccoutant@google.com>
1910
1911         PR gold/13023
1912         * expression.cc (Expression::eval_with_dot): Add
1913         is_section_dot_assignment parameter.
1914         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1915         absolute and assigning to dot within a section.
1916         * script-sections.cc
1917         (Output_section_element_assignment::set_section_addresses): Pass
1918         dot_section to set_if_absolute.
1919         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1920         as is_section_dot_assignment flag to eval_with_dot.
1921         (Output_section_element_dot_assignment::set_section_addresses):
1922         Likewise.
1923         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1924         parameter.  Also set value if relative to dot_section; set the
1925         symbol's output_section.
1926         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1927         parameter.  Adjust all callers.
1928         (Expression::eval_maybe_dot): Likewise.
1929         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1930         Adjust all callers.
1931         * testsuite/script_test_2.t: Test assignment of an absolute value
1932         to dot within an output section element.
1933
1934 2011-10-31  Cary Coutant  <ccoutant@google.com>
1935
1936         * options.h (class General_options): Add --[no-]gnu-unique options.
1937         * symtab.cc (Symbol_table::sized_write_globals): Convert
1938         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1939
1940 2011-10-31  Cary Coutant  <ccoutant@google.com>
1941
1942         PR gold/13359
1943         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1944         unnecessary assertion.
1945         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1946
1947 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1948
1949         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1950         gc_mark_symbol.
1951         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1952         gc_mark_symbol.
1953         Change to just keep the section associated with symbol.
1954         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1955         they are externally visible and --export-dynamic is turned on.
1956         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1957
1958 2011-10-19  Ian Lance Taylor  <iant@google.com>
1959
1960         PR gold/13163
1961         * script-sections.cc
1962         (Output_section_element_dot_assignment::needs_output_section): New
1963         function.
1964
1965 2011-10-19  Ian Lance Taylor  <iant@google.com>
1966
1967         PR gold/13204
1968         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1969         --section-start option was seen.
1970         * options.h (General_options::any_section_start): New function.
1971
1972 2011-10-18  David S. Miller  <davem@davemloft.net>
1973
1974         PR binutils/13301
1975         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1976         member to track relocation locations that have moved during TLS
1977         reloc optimizations.
1978         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1979         (Target_sparc::Relocate::relocate): Adjust view down by 4
1980         bytes if it matches reloc_adjust_addr_.
1981         (Target_sparc::Relocate::relocate_tls): Always move the
1982         __tls_get_addr call delay slot instruction forward 4 bytes when
1983         performing relaxation.
1984
1985 2011-10-18  Cary Coutant  <ccoutant@google.com>
1986
1987         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1988         (Output_file::map_no_anonymous): Check for non-zero
1989         return code from posix_fallocate.
1990
1991 2011-10-17  Cary Coutant  <ccoutant@google.com>
1992
1993         PR gold/13245
1994         * plugin.cc (is_visible_from_outside): Check for symbols
1995         referenced from dynamic objects.
1996         * resolve.cc (Symbol_table::resolve): Don't count references
1997         from dynamic objects as references from real ELF files.
1998         * testsuite/plugin_test_2.sh: Adjust expected result.
1999
2000 2011-10-17  Cary Coutant  <ccoutant@google.com>
2001
2002         * gold.cc: Include timer.h.
2003         (queue_middle_tasks): Stamp time.
2004         (queue_final_tasks): Likewise.
2005         * main.cc (main): Store timer in parameters.  Print timers
2006         for each pass.
2007         * parameters.cc (Parameters::Parameters): Initialize timer_.
2008         (Parameters::set_timer): New function.
2009         (set_parameters_timer): New function.
2010         * parameters.h (Parameters::set_timer): New function.
2011         (Parameters::timer): New function.
2012         (Parameters::timer_): New data member.
2013         (set_parameters_timer): New function.
2014         * timer.cc (Timer::stamp): New function.
2015         (Timer::get_pass_time): New function.
2016         * timer.h (Timer::stamp): New function.
2017         (Timer::get_pass_time): New function.
2018         (Timer::pass_times_): New data member.
2019
2020 2011-10-17  Cary Coutant  <ccoutant@google.com>
2021
2022         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2023         task for members of lib groups.
2024
2025 2011-10-17  Cary Coutant  <ccoutant@google.com>
2026
2027         PR gold/13288
2028         * fileread.cc (File_read::find_view): Add assert.
2029         (File_read::make_view): Move bounds check (replace with assert)...
2030         (File_read::find_or_make_view): ... to here.
2031
2032 2011-10-12  Cary Coutant  <ccoutant@google.com>
2033
2034         * output.cc (Output_file::open_base_file): Handle case where
2035         ::read returns less than requested size.
2036
2037 2011-10-10  Cary Coutant  <ccoutant@google.com>
2038
2039         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2040         Initialize defined_count_.
2041         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2042         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2043         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2044         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2045         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2046         * incremental.h (Sized_relobj_incr::defined_count_): New data
2047         member.
2048         (Sized_incr_dynobj::defined_count_): New data member.
2049         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2050         Return zeroes instead of internal error.
2051
2052 2011-10-10  Cary Coutant  <ccoutant@google.com>
2053
2054         PR gold/13249
2055         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2056         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2057         * output.h (class Output_reloc): Add use_plt_offset flag.
2058         (Output_reloc::type_): Adjust size of bit field.
2059         (Output_reloc::use_plt_offset_): New bit field.
2060         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2061         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2062         flag.  Adjust all callers.
2063         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2064         creating RELATIVE relocations.
2065
2066 2011-10-10  Nick Clifton  <nickc@redhat.com>
2067
2068         * po/es.po: Updated Spanish translation.
2069         * po/fi.po: Updated Finnish translation.
2070
2071 2011-10-03   Diego Novillo  <dnovillo@google.com>
2072
2073         * options.cc (parse_uint): Fix dereference of RETVAL.
2074
2075 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2076
2077         * layout.h (section_order_map_): New member.
2078         (get_section_order_map): New member function.
2079         * output.cc (Output_section::add_input_section): Check for patterns
2080         only when --section-ordering-file is specified.
2081         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2082         output_sections have been formed.
2083         * layout.cc (Layout_Layout): Initialize section_order_map_.
2084         * plugin.cc (update_section_order): Store order in order_map. Do not
2085         update the order.
2086         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2087         * testsuite/Makefile.in: Regenerate.
2088         * testsuite/plugin_section_order.c: New file.
2089         * testsuite/plugin_final_layout.cc: New file.
2090         * testsuite/plugin_final_layout.sh: New file.
2091
2092 2011-09-29  Cary Coutant  <ccoutant@google.com>
2093
2094         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2095         Check for NULL.
2096         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2097         symbols during incremental update.
2098         (Symbol_table::add_from_dynobj): Likewise.
2099
2100 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2101             Ian Lance Taylor  <iant@google.com>
2102
2103         * symtab.cc (Symbol_table::define_special_symbol): Always
2104         canonicalize version string.
2105
2106 2011-09-26  Cary Coutant  <ccoutant@google.com>
2107
2108         * gold.cc (queue_initial_tasks): Move option checks ...
2109         * options.cc (General_options::finalize): ... to here. Disable
2110         some options; make others fatal.
2111
2112 2011-09-26  Cary Coutant  <ccoutant@google.com>
2113
2114         gcc PR lto/47247
2115         * plugin.cc (get_symbols_v2): New function.
2116         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2117         (is_referenced_from_outside): New function.
2118         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2119         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2120         (get_symbols): Pass version parameter.
2121         (get_symbols_v2): New function.
2122         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2123         parameter.
2124         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2125         (onload): Add LDPT_GET_SYMBOLS_V2.
2126         (all_symbols_read_hook): Use get_symbols_v2; check for
2127         LDPR_PREVAILING_DEF_IRONLY_EXP.
2128         * testsuite/plugin_test_3.sh: Update expected results.
2129
2130 2011-09-23  Simon Baldwin  <simonb@google.com>
2131
2132         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2133         configuration options.
2134         * configure: Regenerate.
2135         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2136         * Makefile.in: Regenerate.
2137         * testsuite/Makefile.in: Regenerate.
2138
2139 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2140
2141         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2142
2143 2011-09-19  Cary Coutant  <ccoutant@google.com>
2144
2145         * incremental.cc (can_incremental_update): Fix typo in comment.
2146         * incremental.h (can_incremental_update): Likewise.
2147
2148 2011-09-18  Cary Coutant  <ccoutant@google.com>
2149
2150         * incremental.cc (can_incremental_update): New function.
2151         * incremental.h (can_incremental_update): New function.
2152         * layout.cc (Layout::init_fixed_output_section): Call it.
2153         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2154         * object.cc (Sized_relobj_file::do_layout): Call
2155         can_incremental_update.
2156
2157 2011-09-13  Cary Coutant  <ccoutant@google.com>
2158
2159         * configure.ac: Check for glibc support for gnu_indirect_function
2160         support with static linking, setting automake conditional
2161         IFUNC_STATIC.
2162         * Makefile.in: Regenerate.
2163         * configure: Regenerate.
2164
2165         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2166         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2167         for IFUNC_STATIC.
2168         * testsuite/Makefile.in: Regenerate.
2169
2170 2011-09-13  Cary Coutant  <ccoutant@google.com>
2171
2172         * incremental.cc (Sized_relobj_incr::do_layout): Call
2173         report_comdat_group for kept comdat sections.
2174         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2175         * testsuite/Makefile.in: Regenerate.
2176         * testsuite/incr_comdat_test_1.cc: New source file.
2177         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2178         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2179         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2180
2181 2011-09-13  Ian Lance Taylor  <iant@google.com>
2182
2183         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2184         variable external_symbols_offset.
2185
2186 2011-09-12  Ian Lance Taylor  <iant@google.com>
2187
2188         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2189         triggered if object has no symbols.
2190
2191 2011-09-09  David S. Miller  <davem@davemloft.net>
2192
2193         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2194         (Output_fill_debug_line::do_write): Likewise.
2195
2196 2011-08-29  Cary Coutant  <ccoutant@google.com>
2197
2198         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2199         casts to match formatting specs.
2200         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2201
2202 2011-08-26  Cary Coutant  <ccoutant@google.com>
2203
2204         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2205         remaining hole size when allocating.
2206         (Layout::make_output_section): Set fill methods for debug sections.
2207         * layout.h (Free_list::Free_list_node): Move from private to
2208         public.
2209         (Free_list::set_min_hole_size): New function.
2210         (Free_list::begin, Free_list::end): New functions.
2211         (Free_list::min_hole_): New data member.
2212         * output.cc: Include dwarf.h.
2213         (Output_fill_debug_info::do_minimum_hole_size): New function.
2214         (Output_fill_debug_info::do_write): New function.
2215         (Output_fill_debug_line::do_minimum_hole_size): New function.
2216         (Output_fill_debug_line::do_write): New function.
2217         (Output_section::Output_section): Initialize new data member.
2218         (Output_section::set_final_data_size): Ensure patch space is larger
2219         than minimum hole size.
2220         (Output_section::do_write): Fill holes in debug sections.
2221         * output.h (Output_fill): New class.
2222         (Output_fill_debug_info): New class.
2223         (Output_fill_debug_line): New class.
2224         (Output_section::set_free_space_fill): New function.
2225         (Output_section::free_space_fill_): New data member.
2226         * testsuite/Makefile.am (incremental_test_3): Add
2227         --incremental-patch option.
2228         (incremental_test_4): Likewise.
2229         (incremental_test_5): Likewise.
2230         (incremental_test_6): Likewise.
2231         (incremental_copy_test): Likewise.
2232         (incremental_common_test_1): Likewise.
2233         * testsuite/Makefile.in: Regenerate.
2234
2235 2011-08-26  Nick Clifton  <nickc@redhat.com>
2236
2237         * po/es.po: Updated Spanish translation.
2238
2239 2011-08-01  Cary Coutant  <ccoutant@google.com>
2240
2241         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2242         * gold/testsuite/Makefile.in: Regenerate.
2243         * gold/testsuite/justsyms_exec.c: New source file.
2244         * gold/testsuite/justsyms_lib.c: New source file.
2245
2246 2011-08-01  Cary Coutant  <ccoutant@google.com>
2247
2248         * layout.cc (Layout::set_segment_offsets): Don't realign text
2249         segment if -Ttext was specified.
2250         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2251         file type.
2252         * object.h (Sized_relobj_file::e_type): New function.
2253         (Sized_relobj_file::e_type_): New data member.
2254         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2255         base address for ET_EXEC files.
2256         * target.cc (Target::do_make_elf_object_implementation): Allow
2257         ET_EXEC files with --just-symbols option.
2258
2259 2011-07-28  Cary Coutant  <ccoutant@google.com>
2260
2261         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2262         Add thread_number parameter.
2263         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2264         * workqueue-threads.cc
2265         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2266         current thread if its thread number is greater than desired thread
2267         count.
2268         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2269         Add thread_number parameter.
2270         (Workqueue::should_cancel_thread): Likewise.
2271         (Workqueue::find_runnable_or_wait): Pass thread_number to
2272         should_cancel_thread.
2273         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2274         parameter.
2275
2276 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2277
2278         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2279         only after checking if it cannot be forced local.
2280         * symtab.h (is_externally_visible): Check if the symbol is not forced
2281         local.
2282
2283 2011-07-15  Ian Lance Taylor  <iant@google.com>
2284
2285         * options.h (class General_options): Add --print-output-format.
2286         Move -EL next to -EB, for  better --help output.
2287         * target-select.cc: Include <cstdio>, "options.h", and
2288         "parameters.h".
2289         (Target_selector::do_target_bfd_name): New function.
2290         (print_output_format): New function.
2291         * target-select.h (class Target_selector): Update declarations.
2292         (Target_selector::target_bfd_name): New function.
2293         (print_output_format): Declare.
2294         * main.cc: Include "target-select.h".
2295         (main): Handle --print-output-format.
2296         * gold.cc: Include "target-select.h".
2297         (queue_initial_tasks): Handle --print-output-format when there are
2298         no input files.
2299         * parameters.cc (parameters_force_valid_target): Give a better
2300         error message if -EB/-EL does not match target.
2301         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2302         function.
2303
2304 2011-07-15  Ian Lance Taylor  <iant@google.com>
2305
2306         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2307         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2308         (Output_data_plt_i386::do_write): Write address of .dynamic
2309         section to first entry in .got.plt section.
2310         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2311         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2312         Initialize layout_.
2313         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2314         section to first entry in .got.plt section.
2315         * layout.h (Layout::dynamic_section): New function.
2316
2317 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2318
2319         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2320         to claim_file call.
2321         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2322         input_section_position_, and input_section_glob_.
2323         (read_layout_from_file): Call function section_ordering_specified.
2324         * layout.h (is_section_ordering_specified): New function.
2325         (section_ordering_specified): New function.
2326         (section_ordering_specified_): New boolean member.
2327         * main.cc(main): Call load_plugins after layout object is defined.
2328         * output.cc (Output_section::add_input_section): Use
2329         function section_ordering_specified to check if section ordering is
2330         needed.
2331         * output.cc (Output_section::add_relaxed_input_section): Use
2332         function section_ordering_specified to check if section ordering is
2333         needed.
2334         (Output_section::update_section_layout): New function.
2335         (Output_section::sort_attached_input_sections): Check if input section
2336         must be reordered.
2337         * output.h (Output_section::update_section_layout): New function.
2338         * plugin.cc (get_section_count): New function.
2339         (get_section_type): New function.
2340         (get_section_name): New function.
2341         (get_section_contents): New function.
2342         (update_section_order): New function.
2343         (allow_section_ordering): New function.
2344         (Plugin::load): Add the new interfaces to the transfer vector.
2345         (Plugin_manager::load_plugins): New parameter.
2346         (Plugin_manager::all_symbols_read): New parameter.
2347         (Plugin_manager::claim_file): New parameter. Save the elf object for
2348         unclaimed objects.
2349         (Plugin_manager::get_elf_object): New function.
2350         (Plugin_manager::get_view): Change to directly use the bool to check
2351         if get_view is called from claim_file_hook.
2352         * plugin.h (input_objects): New function
2353         (Plugin__manager::load_plugins): New parameter.
2354         (Plugin_manager::claim_file): New parameter.
2355         (Plugin_manager::get_elf_object): New function.
2356         (Plugin_manager::in_claim_file_handler): New function.
2357         (Plugin_manager::in_claim_file_handler_): New member.
2358         (layout): New function.
2359         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2360         handler with an extra parameter. Make the elf object before calling
2361         claim_file handler.
2362         * testsuite/plugin_test.c (get_section_count): New function pointer.
2363         (get_section_type): New function pointer.
2364         (get_section_name): New function pointer.
2365         (get_section_contents): New function pointer.
2366         (update_section_order): New function pointer.
2367         (allow_section_ordering): New function pointer.
2368         (onload): Check if the new interfaces exist.
2369
2370 2011-07-13  Ian Lance Taylor  <iant@google.com>
2371
2372         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2373         relro section.
2374         * x86_64.cc (Target_x86_64::got_section): Likewise.
2375         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2376         (relro_now_test_SOURCES): New variable.
2377         (relro_now_test_DEPENDENCIES): New variable.
2378         (relro_now_test_LDFLAGS): New variable.
2379         (relro_now_test_LDADD): New variable.
2380         (relro_now_test.so): New target.
2381         * testsuite/Makefile.in: Rebuild.
2382
2383 2011-07-12  Ian Lance Taylor  <iant@google.com>
2384
2385         PR gold/12980
2386         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2387         GLOB_DAT relocation rather than a RELATIVE relocation for a
2388         protected symbol when creating a shared library.
2389         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2390         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2391         * testsuite/protected_main_1.cc (main): Test that protected
2392         function has same address.
2393
2394 2011-07-11  Ian Lance Taylor  <iant@google.com>
2395
2396         PR gold/12979
2397         * options.h (class General_options): Add -Bgroup.
2398         * options.cc (General_options::finalize): If -Bgroup is set,
2399         default to --unresolved-symbols=report-all.
2400         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2401         * target-reloc.h (issue_undefined_symbol_error): Handle
2402         --unresolved-symbols=report-all.
2403
2404 2011-07-08  Ian Lance Taylor  <iant@google.com>
2405
2406         PR gold/11985
2407         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2408         if linker script discards key sections.
2409         (Layout::create_dynamic_symtab): Likewise.
2410         (Layout::assign_local_dynsym_offsets): Likewise.
2411         (Layout::sized_create_version_sections): Likewise.
2412         (Layout::create_interp): Likewise.
2413         (Layout::finish_dynamic_section): Likewise.
2414         (Layout::set_dynamic_symbol_size): Likewise.
2415
2416 2011-07-08  Ian Lance Taylor  <iant@google.com>
2417
2418         PR gold/12386
2419         * options.h (class General_options): Add --unresolved-symbols.
2420         * target-reloc.h (issue_undefined_symbol_error): Check
2421         --unresolved-symbols.  Add comments.
2422
2423 2011-07-08  Ian Lance Taylor  <iant@google.com>
2424
2425         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2426         expression more complex.
2427
2428 2011-07-08  Ian Lance Taylor  <iant@google.com>
2429
2430         PR gold/11317
2431         * target-reloc.h (issue_undefined_symbol_error): New inline
2432         function, broken out of relocate_section.
2433         (relocate_section): Call issue_undefined_symbol_error.
2434         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2435         there is no TLS segment if we are about to issue an undefined
2436         symbol error.
2437         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2438
2439 2011-07-08  Ian Lance Taylor  <iant@google.com>
2440
2441         PR gold/12279
2442         * resolve.cc (Symbol_table::should_override): Add fromtype
2443         parameter.  Change all callers.  Give error when linking together
2444         TLS and non-TLS symbol.
2445         (Symbol_table::should_override_with_special): Add fromtype
2446         parameter.  Change all callers.
2447         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2448         there is no TLS segment if we have reported some errors.
2449         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2450
2451 2011-07-08  Ian Lance Taylor  <iant@google.com>
2452
2453         PR gold/12372
2454         * target.h (Target::plt_address_for_global): New function.
2455         (Target::plt_address_for_local): New function.
2456         (Target::plt_section_for_global): Remove.
2457         (Target::plt_section_for_local): Remove.
2458         (Target::do_plt_address_for_global): New virtual function.
2459         (Target::do_plt_address_for_local): New virtual function.
2460         (Target::do_plt_section_for_global): Remove.
2461         (Target::do_plt_section_for_local): Remove.
2462         (Target::register_global_plt_entry): Add Symbol_table and Layout
2463         parameters.
2464         * output.cc (Output_data_got::Got_entry::write): Use
2465         plt_address_for_global and plt_address_for_local.
2466         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2467         address of output section.
2468         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2469         got_irelative_, and irelative_count_ fields.  Update
2470         declarations.
2471         (Output_data_plt_i386::has_irelative_section): New function.
2472         (Output_data_plt_i386::entry_count): Add irelative_count_.
2473         (Output_data_plt_i386::set_final_data_size): Likewise.
2474         (class Target_i386): Add got_irelative_ and rel_irelative_
2475         fields.  Update declarations.
2476         (Target_i386::Target_i386): Initialize new fields.
2477         (Target_i386::do_plt_address_for_global): New function replacing
2478         do_plt_section_for_global.
2479         (Target_i386::do_plt_address_for_local): New function replacing
2480         do_plt_section_for_local.
2481         (Target_i386::got_section): Create got_irelative_.
2482         (Target_i386::rel_irelative_section): New function.
2483         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2484         fields.  Don't define __rel_iplt_{start,end}.
2485         (Output_data_plt_i386::add_entry): Add symtab and layout
2486         parameters.  Change all callers.  Use different PLT and GOT for
2487         IFUNC symbols.
2488         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2489         layout parameters.  Change all callers.  Use different PLT and
2490         GOT.
2491         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2492         (Output_data_plt_i386::rel_irelative): New function.
2493         (Output_data_plt_i386::address_for_global): New function.
2494         (Output_data_plt_i386::address_for_local): New function.
2495         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2496         IRELATIVE GOT when changing IFUNC GOT entries.
2497         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2498         reloc.
2499         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2500         if we didn't create an IRELATIVE GOT.
2501         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2502         plt_address_for_local.
2503         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2504         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2505         got_irelative_, and irelative_count_ fields.  Update
2506         declarations.
2507         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2508         Initialize new fields.  Remove symtab parameter.  Change all
2509         callers.
2510         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2511         irelative_count_.
2512         (Output_data_plt_x86_64::has_irelative_section): New function.
2513         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2514         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2515         fields.  Update declarations.
2516         (Target_x86_64::Target_x86_64): Initialize new fields.
2517         (Target_x86_64::do_plt_address_for_global): New function replacing
2518         do_plt_section_for_global.
2519         (Target_x86_64::do_plt_address_for_local): New function replacing
2520         do_plt_section_for_local.
2521         (Target_x86_64::got_section): Create got_irelative_.
2522         (Target_x86_64::rela_irelative_section): New function.
2523         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2524         all callers.  Don't create __rel_iplt_{start,end}.
2525         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2526         parameters.  Change all callers.  Use different PLT and GOT for
2527         IFUNC symbols.
2528         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2529         layout parameters.  Change all callers.  Use different PLT and
2530         GOT.
2531         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2532         parameters.  Change all callers.  Use different PLT and GOT for
2533         IFUNC symbols.
2534         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2535         (Output_data_plt_x86_64::rela_irelative): New function.
2536         (Output_data_plt_x86_64::address_for_global): New function.
2537         (Output_data_plt_x86_64::address_for_local): New function.
2538         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2539         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2540         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2541         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2542         parameters.
2543         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2544         reloc.
2545         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2546         symbols if we didn't create an IRELATIVE GOT.
2547         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2548         plt_address_for_local.
2549         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2550         * testsuite/ifuncvar1.c: New test file.
2551         * testsuite/ifuncvar2.c: New test file.
2552         * testsuite/ifuncvar3.c: New test file.
2553         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2554         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2555         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2556         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2557         * testsuite/Makefile.in: Rebuild.
2558
2559 2011-07-07  Cary Coutant  <ccoutant@google.com>
2560
2561         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2562         (two_file_test_1_ndebug.o): Likewise.
2563         (two_file_test_1b_ndebug.o): Likewise.
2564         (two_file_test_2_ndebug.o): Likewise.
2565         (two_file_test_main_ndebug.o): Likewise.
2566         (incremental_test_2): Link with no-debug versions.
2567
2568 2011-07-06  Cary Coutant  <ccoutant@google.com>
2569
2570         * gold/incremental.cc
2571         (Output_section_incremental_inputs::write_info_blocks): Check for
2572         hidden and internal symbols.
2573
2574 2011-07-06  Cary Coutant  <ccoutant@google.com>
2575
2576         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2577         Check disposition for startup file.
2578         (Incremental_inputs::report_command_line): Ignore
2579         --incremental-startup-unchanged option.
2580         * options.cc (General_options::parse_incremental_startup_unchanged):
2581         New function.
2582         (General_options::General_options): Initialize new data member.
2583         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2584         (General_options): Add --incremental-startup-unchanged option.
2585         (General_options::incremental_startup_disposition): New function.
2586         (General_options::incremental_startup_disposition_): New data member.
2587
2588 2011-07-06  Cary Coutant  <ccoutant@google.com>
2589
2590         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2591         input file index to Script_info ctor.
2592         (Sized_incremental_binary::do_file_has_changed): Find the
2593         command-line argument for files named in scripts.
2594         * incremental.h (Script_info::Script_info): New ctor
2595         with input file index.
2596         (Script_info::input_file_index): New function.
2597         (Script_info::input_file_index_): New data member.
2598         (Incremental_binary::get_library): Add const.
2599         (Incremental_binary::get_script_info): Add const.
2600         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2601         * testsuite/Makefile.am (incremental_test_5): New test case.
2602         (incremental_test_6): New test case.
2603         * testsuite/Makefile.in: Regenerate.
2604
2605 2011-07-06  Cary Coutant  <ccoutant@google.com>
2606
2607         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2608         debug output when command lines differ.
2609
2610 2011-07-06  Cary Coutant  <ccoutant@google.com>
2611
2612         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2613         --incremental-patch option.
2614         * layout.cc (Free_list::allocate): Extend allocation beyond original
2615         end if enabled.
2616         (Layout::make_output_section): Mark sections that should get
2617         patch space.
2618         * options.cc (parse_percent): New function.
2619         * options.h (parse_percent): New function.
2620         (DEFINE_percent): New macro.
2621         (General_options): Add --incremental-patch option.
2622         * output.cc (Output_section::Output_section): Initialize new data
2623         members.
2624         (Output_section::add_input_section): Print section name when out
2625         of patch space.
2626         (Output_section::add_output_section_data): Likewise.
2627         (Output_section::set_final_data_size): Add patch space when
2628         doing --incremental-full.
2629         (Output_section::do_reset_address_and_file_offset): Remove patch
2630         space.
2631         (Output_segment::set_section_list_addresses): Print debug output
2632         only if --incremental-update.
2633         * output.h (Output_section::set_is_patch_space_allowed): New function.
2634         (Output_section::is_patch_space_allowed_): New data member.
2635         (Output_section::patch_space_): New data member.
2636         * parameters.cc (Parameters::incremental_full): New function.
2637         * parameters.h (Parameters::incremental_full): New function
2638         * testsuite/Makefile.am (incremental_test_2): Add test for
2639         --incremental-patch option.
2640         * testsuite/Makefile.in: Regenerate.
2641         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2642         (t18): Remove function body.
2643
2644 2011-07-05  Doug Kwan  <dougkwan@google.com>
2645
2646         PR gold/12771
2647         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2648         Arm_Address type for relocation result.
2649         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2650         overflow check.
2651         (Arm_relocate_functions::abs32): Use unaligned access.
2652         (Arm_relocate_functions::rel32): Ditto.
2653         (Arm_relocate_functions::prel31): Ditto.
2654         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2655         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2656         static data relocations.
2657         * testsuite/Makefile.in: Regnerate.
2658         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2659
2660 2011-07-05  Ian Lance Taylor  <iant@google.com>
2661
2662         PR gold/12392
2663         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2664         symbols if necessary.
2665         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2666
2667 2011-07-05  Ian Lance Taylor  <iant@google.com>
2668
2669         PR gold/12952
2670         * resolve.cc (Symbol::override_base_with_special): Simply override
2671         version with special symbol version, ignoring previous version.
2672
2673 2011-07-05  Ian Lance Taylor  <iant@google.com>
2674
2675         * object.cc (Sized_relobj_file::include_section_group): Add
2676         information to comment about signature location.
2677
2678 2011-07-02  Ian Lance Taylor  <iant@google.com>
2679
2680         PR gold/12957
2681         * options.h (class General_options): Add -f and -F.
2682         * options.cc (General_options::finalize): Fatal error if -f/-F
2683         are used without -shared.
2684         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2685
2686 2011-07-02  Ian Lance Taylor  <iant@google.com>
2687
2688         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2689
2690 2011-07-01  Ian Lance Taylor  <iant@google.com>
2691
2692         PR gold/12525
2693         PR gold/12952
2694         * resolve.cc (Symbol::override_base_with_special): Don't override
2695         the version if the overriding symbol has a different name.
2696         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2697         all callers.  If we give an error about an undefined version,
2698         define the base version if necessary.
2699         * dynobj.h (class Versions): Update declaration.
2700         * testsuite/weak_alias_test_5.cc: New file.
2701         * testsuite/weak_alias_test.script: New file.
2702         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2703         and versioned_alias have the right value, and call t2.
2704         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2705         weak_alias_test_5.so.
2706         (weak_alias_test_LDADD): Likewise.
2707         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2708         * testsuite/Makefile.in: Rebuild.
2709
2710 2011-07-01  Ian Lance Taylor  <iant@google.com>
2711
2712         PR gold/12525
2713         * options.h (class General_options): Support -z notext.
2714         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2715         -Wl,-z,notext.
2716         (two_file_shared_nonpic.so): Likewise.
2717         (two_file_shared_mixed.so): Likewise.
2718         (two_file_shared_mixed_1.so): Likewise.
2719         (weak_undef_lib_nonpic.so): Likewise.
2720         (alt/weak_undef_lib_nonpic.so): Likewise.
2721         (tls_test_shared_nonpic.so): Likewise.
2722         * testsuite/Makefile.in: Rebuild.
2723
2724 2011-07-01  Ian Lance Taylor  <iant@google.com>
2725
2726         PR gold/12525
2727         * configure.ac: Test whether static linking works, setting
2728         the automake conditional HAVE_STATIC.
2729         * testsuite/Makefile.am: Disable tests using -static if
2730         HAVE_STATIC is not true.
2731         * configure, testsuite/Makefile.in: Rebuild.
2732
2733 2011-07-01  Ian Lance Taylor  <iant@google.com>
2734
2735         PR gold/12525
2736         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2737         Assert if we see DW_EH_PE_indirect.
2738         * target.h (Target::ehframe_datarel_base): New function.
2739         (Target::do_ehframe_datarel_base): New target function.
2740         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2741         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2742         function.
2743
2744 2011-07-01  Ian Lance Taylor  <iant@google.com>
2745
2746         PR gold/12571
2747         * options.h (class General_options): Add
2748         --ld-generated-unwind-info.
2749         * ehframe.cc (Fde::write): Add address parameter.  Change all
2750         callers.  If associated with PLT, fill in address and size.
2751         (Cie::set_output_offset): Only add merge mapping if there is an
2752         object.
2753         (Cie::write): Add address parameter.  Change all callers.
2754         (Eh_frame::add_ehframe_for_plt): New function.
2755         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2756         input_offset_ fields into union u_, with new plt field.
2757         (Fde::Fde): Adjust for new union field.
2758         (Fde::Fde) [Output_data version]: New constructor.
2759         (Fde::add_mapping): Only add merge mapping if there is an object.
2760         (class Cie): Update declarations.
2761         (class Eh_frame): Declare add_ehframe_for_plt.
2762         * layout.cc (Layout::layout_eh_frame): Break out code into
2763         make_eh_frame_section, and call it.
2764         (Layout::make_eh_frame_section): New function.
2765         (Layout::add_eh_frame_for_plt): New function.
2766         * layout.h (class Layout): Update declarations.
2767         * merge.cc (Merge_map::add_mapping): Add assertion.
2768         * i386.cc: Include "dwarf.h".
2769         (class Output_data_plt_i386): Make first_plt_entry,
2770         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2771         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2772         and plt_eh_frame_fde.
2773         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2774         boundary.  Call add_eh_frame_for_plt if appropriate.
2775         * x86_64.cc: Include "dwarf.h".
2776         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2777         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2778         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2779         and plt_eh_frame_fde.
2780         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2781         appropriate.
2782
2783 2011-06-29  Ian Lance Taylor  <iant@google.com>
2784
2785         PR gold/12629
2786         * object.cc (Sized_relobj_file::layout_section): Change shdr
2787         parameter to be const.
2788         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2789         out of do_layout.
2790         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2791         appropriate.  Call layout_eh_frame_section.
2792         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2793         sections.
2794         * object.h (class Sized_relobj_file): Update declarations.
2795
2796 2011-06-29  Ian Lance Taylor  <iant@google.com>
2797
2798         PR gold/12652
2799         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2800         modifier.
2801         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2802
2803 2011-06-29  Ian Lance Taylor  <iant@google.com>
2804
2805         PR gold/12675
2806         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2807         SHT_X86_64_UNWIND.
2808         * layout.cc (Layout::layout_eh_frame): Likewise.
2809
2810 2011-06-29  Ian Lance Taylor  <iant@google.com>
2811
2812         PR gold/12695
2813         * layout.cc (Layout::symtab_section_shndx): New function.
2814         * layout.h (class Layout): Declare symtab_section_shndx.
2815         * output.cc (Output_section::write_header): Call it.
2816
2817 2011-06-29  Ian Lance Taylor  <iant@google.com>
2818
2819         PR gold/12818
2820         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2821         symbols which are not used in a relocation.
2822
2823 2011-06-28  Ian Lance Taylor  <iant@google.com>
2824
2825         PR gold/12898
2826         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2827         script create indistinguishable segments.
2828         (Layout::set_segment_offsets): Use stable_sort when sorting
2829         segments.  Pass this to Compare_segments constructor.
2830         * layout.h (class Layout): Make segment_precedes non-static.
2831         (class Compare_segments): Change from struct to class.  Add
2832         layout_ field.  Add constructor.
2833         * script-sections.cc
2834         (Script_sections::attach_sections_using_phdrs_clause): Rename
2835         local orphan to is_orphan.  Don't report failure to put empty
2836         section in segment.  On attachment failure, report name of
2837         section, and attach to first PT_LOAD segment.
2838
2839 2011-06-28  Ian Lance Taylor  <iant@google.com>
2840
2841         PR gold/12934
2842         * target-select.cc (Target_selector::Target_selector): Add
2843         emulation parameter.  Change all callers.
2844         (select_target_by_bfd_name): Rename from select_target_by_name.
2845         Change all callers.
2846         (select_target_by_emulation): New function.
2847         (supported_emulation_names): New function.
2848         * target-select.h (class Target_selector): Add emulation_ field.
2849         Update declarations.
2850         (Target_selector::recognize_by_bfd_name): Rename from
2851         recognize_by_name.  Change all callers.
2852         (Target_selector::supported_bfd_names): Rename from
2853         supported_names.  Change all callers.
2854         (Target_selector::recognize_by_emulation): New function.
2855         (Target_selector::supported_emulations): New function.
2856         (Target_selector::emulation): New function.
2857         (Target_selector::do_recognize_by_bfd_name): Rename from
2858         do_recognize_by_name.  Change all callers.
2859         (Target_selector::do_supported_bfd_names): Rename from
2860         do_supported_names.  Change all callers.
2861         (Target_selector::do_recognize_by_emulation): New function.
2862         (Target_selector::do_supported_emulations): New function.
2863         (select_target_by_bfd_name): Change name in declaration.
2864         (select_target_by_emulation): Declare.
2865         (supported_emulation_names): Declare.
2866         * parameters.cc (parameters_force_valid_target): Try to find
2867         target based on emulation from -m option.
2868         * options.h (class General_options): Change doc string for -m.
2869         * options.cc (help): Print emulations.
2870         (General_options::parse_V): Likewise.
2871         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2872         Add emulation parameter.  Change all callers.
2873
2874 2011-06-28  Ian Lance Taylor  <iant@google.com>
2875
2876         * target.h (class Target): Add osabi_ field.
2877         (Target::osabi): New function.
2878         (Target::set_osabi): New function.
2879         (Target::Target): Initialize osabi_.
2880         (Target::do_adjust_elf_header): Make pure virtual.
2881         (Sized_target::do_adjust_elf_header): Declare.
2882         * target.cc (Sized_target::do_adjust_elf_header): New function.
2883         (class Sized_target): Instantiate all versions.
2884         * freebsd.h (class Target_freebsd): Remove.
2885         (Target_selector_freebsd::do_recognize): Call set_osabi on
2886         Target.
2887         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2888         (Target_selector_freebsd::set_osabi): Remove.
2889         * i386.cc (class Target_i386): Inherit from Sized_target rather
2890         than Target_freebsd.
2891         * x86_64.cc (class Target_x86_64): Likewise.
2892
2893 2011-06-28  Ian Lance Taylor  <iant@google.com>
2894
2895         * target.h (Target::can_check_for_function_pointers): Rewrite.
2896         Make non-virtual.
2897         (Target::can_icf_inline_merge_sections): Likewise.
2898         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2899         (Target::Target_info): Add can_icf_inline_merge_sections field.
2900         (Target::do_can_check_for_function_pointers): New virtual
2901         function.
2902         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2903         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2904         from can_check_for_function_pointers, move in file.
2905         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2906         section_may_have_icf_unsafe_poineters, move in file.
2907         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2908         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2909         Rename from can_check_for_function_pointers, move in file.
2910         (Target_i386::can_icf_inline_merge_sections): Remove.
2911         (Target_i386::i386_info): Initialize
2912         can_icf_inline_merge_sections.
2913         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2914         Initialize can_icf_inline_merge_sections.
2915         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2916         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2917         Rename from can_check_for_function_pointers, move in file.
2918         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2919         (Target_x86_64::x86_64_info): Initialize
2920         can_icf_inline_merge_sections.
2921         * testsuite/testfile.cc (Target_test::test_target_info):
2922         Likewise.
2923         * icf.cc (get_section_contents): Correct formatting.
2924
2925 2011-06-27  Ian Lance Taylor  <iant@google.com>
2926
2927         * symtab.cc (Symbol::versioned_name): New function.
2928         (Symbol_table::add_to_final_symtab): Use versioned_name when
2929         appropriate.
2930         (Symbol_table::sized_write_symbol): Likewise.
2931         * symtab.h (class Symbol): Declare versioned_name.
2932         * stringpool.h (class Stringpool_template): Add variant of add
2933         which takes a std::basic_string.
2934         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2935         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2936         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2937         (ver_test_12.o): New target.
2938         * testsuite/Makefile.in: Rebuild.
2939
2940 2011-06-27  Doug Kwan  <dougkwan@google.com>
2941
2942         * arm.cc (Arm_relocate_functions::thm_jump8,
2943         Arm_relocate_functions::thm_jump11): Use a wider signed
2944         type to compute offset.
2945         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2946         arm_thm_jump8.
2947         * testsuite/Makefile.in: Regenerate.
2948         * testsuite/arm_branch_in_range.sh: Check test results of
2949         arm_thm_jump11 and arm_thm_jump8.
2950         * testsuite/arm_thm_jump11.s: New test source file.
2951         * testsuite/arm_thm_jump11.t: New linker script.
2952         * testsuite/arm_thm_jump8.s: New test source file.
2953         * testsuite/arm_thm_jump8.t: New linker script.
2954
2955 2011-06-24  Ian Lance Taylor  <iant@google.com>
2956
2957         * layout.cc: Include "object.h".
2958         (ctors_sections_in_init_array): New static variable.
2959         (Layout::is_ctors_in_init_array): New function.
2960         (Layout::layout): Add entry to ctors_sections_in_init_array if
2961         appropriate.
2962         * layout.h (class Layout): Declare is_ctors_in_init_array.
2963         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2964         is_ctors_reverse_view is set.
2965         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2966         all callers.  Set is_ctors_reverse_view field of View_size.
2967         (Sized_relobj_file::reverse_words): New function.
2968         * object.h (Sized_relobj_file::View_size): Add
2969         is_ctors_reverse_view field.
2970         (class Sized_relobj_file): Update declarations.
2971         * testsuite/initpri3.c: New test.
2972         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2973         initpri3b.
2974         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2975         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2976         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2977         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2978         * testsuite/Makefile.in: Rebuild.
2979
2980 2011-06-24  Cary Coutant  <ccoutant@google.com>
2981
2982         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2983         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2984         (debug_msg_cdebug.err): New targets.
2985         * testsuite/Makefile.in: Regenerate.
2986         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2987         Fix checks for link with shared library.
2988
2989 2011-06-24  Doug Kwan  <dougkwan@google.com>
2990
2991         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2992         skip empty text sections.
2993         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2994
2995 2011-06-22  Ian Lance Taylor  <iant@google.com>
2996
2997         PR gold/12910
2998         * options.h (class General_options): Add --ctors-in-init-array.
2999         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3000         friends as SHT_PROGBITS for merging sections.
3001         (Layout::layout): Remove special handling of .init_array and
3002         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3003         and .dtors if ctors_in_init_array.
3004         (Layout::make_output_section): Force correct section types for
3005         .init_array and friends.  Don't sort if doing relocatable link,
3006         Don't sort .ctors and .dtors if ctors_in_init_array.
3007         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3008         (Layout::output_section_name): Add relobj parameter.  Change all
3009         callers.  Handle .ctors. and .dtors. in code rather than table.
3010         Handle .ctors and .dtors if ctors_in_init_array.
3011         (Layout::match_file_name): New function, moved from output.cc.
3012         * layout.h (class Layout): Update declarations.
3013         * output.cc: Include "layout.h".
3014         (Input_section_sort_entry::get_priority): New function.
3015         (Input_section_sort_entry::match_file_name): Just call
3016         Layout::match_file_name.
3017         (Output_section::Input_section_sort_init_fini_compare::operator()):
3018         Handle .ctors and .dtors.  Sort by explicit priority rather than
3019         by name.
3020         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3021         * testsuite/initpri2.c: New test.
3022         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3023         (check_PROGRAMS): Add initpri2.
3024         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3025         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3026         * configure, testsuite/Makefile.in: Rebuild.
3027
3028 2011-06-19  Ian Lance Taylor  <iant@google.com>
3029
3030         PR gold/12880
3031         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3032         .interp section to a PT_INTERP segment even if we have seen a
3033         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3034         clause in a linker script.
3035         (Layout::finalize): Don't create a .interp section if we've
3036         already create a PT_INTERP segment.
3037         (Layout::create_interp): Always call choose_output_section (revert
3038         patch of 2011-06-17).  Don't create PT_INTERP segment.
3039         * script-sections.cc
3040         (Script_sections::create_note_and_tls_segments): Add a .interp
3041         section to a PT_INTERP segment even if we have seen a
3042         --dynamic-linker option.
3043
3044 2011-06-18  Ian Lance Taylor  <iant@google.com>
3045
3046         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3047         merely because a non-PT_LOAD segment has a dynamic reloc.
3048
3049 2011-06-18  Ian Lance Taylor  <iant@google.com>
3050
3051         * layout.cc (Layout::finish_dynamic_section): Don't create
3052         DT_FLAGS entry if not needed.
3053
3054 2011-06-18  Ian Lance Taylor  <iant@google.com>
3055
3056         PR gold/12745
3057         * layout.cc (Layout::layout_eh_frame): Correct handling of
3058         writable .eh_frame section.
3059
3060 2011-06-17  Ian Lance Taylor  <iant@google.com>
3061
3062         PR gold/12893
3063         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3064         symbol is redefined with the exact same object and value.
3065
3066 2011-06-17  Ian Lance Taylor  <iant@google.com>
3067
3068         PR gold/12880
3069         * layout.h (class Layout): Add interp_segment_ field.
3070         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3071         (Layout::attach_allocated_section_to_segment): If making shared
3072         library, put .interp section in PT_INTERP segment.
3073         (Layout::finalize): Also call create_interp if -dynamic-linker
3074         option was used.
3075         (Layout::create_interp): Assert that there is no PT_INTERP
3076         segment.  If not using a SECTIONS clause, use make_output_section.
3077         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3078         * script-sections.cc
3079         (Script_sections::create_note_and_tls_segments): If making shared
3080         library, put .interp section in PT_INTERP segment.
3081
3082 2011-06-17  Ian Lance Taylor  <iant@google.com>
3083
3084         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3085         when making a shared library.
3086
3087 2011-06-17  Ian Lance Taylor  <iant@google.com>
3088
3089         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3090         parameter.  Change all callers.  Don't issue warning about PC32
3091         against locally defined symbol.
3092
3093 2011-06-16  Ian Lance Taylor  <iant@google.com>
3094
3095         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3096         occurs in same object.
3097
3098 2011-06-14  Alan Modra  <amodra@gmail.com>
3099
3100         * po/POTFILES.in: Regenerate.
3101
3102 2011-06-09  Ian Lance Taylor  <iant@google.com>
3103
3104         * script-sections.cc
3105         (Orphan_output_section::set_section_addresses): For a relocatable
3106         link set address to 0.
3107
3108 2011-06-09  Cary Coutant  <ccoutant@google.com>
3109
3110         PR gold/12804
3111         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3112         used with --compress-debug-sections.
3113         * gold/object.cc (Sized_relobj_file::do_layout): Report
3114         uncompressed size of compressed input sections.
3115
3116 2011-06-08  Cary Coutant  <ccoutant@google.com>
3117
3118         PR gold/12804
3119         * testsuite/two_file_test_2_v1.cc: Change initialization of
3120         v2 to keep it in .data.
3121
3122 2011-06-07  Cary Coutant  <ccoutant@google.com>
3123
3124         * common.cc (Symbol_table::do_allocate_commons_list): Call
3125         gold_fallback.
3126         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3127         (Errors::fallback): New function.
3128         (gold_fallback): New function.
3129         * errors.h (Errors::fallback): New function.
3130         * gold.cc (gold_exit): Change status parameter to enum; adjust
3131         all callers.
3132         (queue_initial_tasks): Call gold_fallback.
3133         * gold.h: Include cstdlib.
3134         (Exit_status): New enum type.
3135         (gold_exit): Change status parameter to enum.
3136         (gold_fallback): New function.
3137         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3138         (Layout::create_symtab_sections): Likewise.
3139         (Layout::create_shdrs): Likewise.
3140         * main.cc (main): Adjust call to gold_exit.
3141         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3142         (Output_data_got::add_got_entry_pair): Likewise.
3143         (Output_section::add_input_section): Likewise.
3144         (Output_section::add_output_section_data): Likewise.
3145         (Output_segment::set_section_list_addresses): Likewise.
3146         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3147
3148 2011-06-07  Cary Coutant  <ccoutant@google.com>
3149
3150         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3151         for incremental links.
3152         * output.cc (Output_segment::set_section_list_addresses): Remove
3153         FIXME and test for TLS or BSS.
3154
3155 2011-06-07  Cary Coutant  <ccoutant@google.com>
3156
3157         * testsuite/Makefile.am: Add incremental_copy_test,
3158         incremental_common_test_1.
3159         * testsuite/Makefile.in: Regenerate.
3160         * testsuite/common_test_1_v1.c: New source file.
3161         * testsuite/common_test_1_v2.c: New source file.
3162         * testsuite/copy_test_v1.cc: New source file.
3163
3164 2011-06-07  Cary Coutant  <ccoutant@google.com>
3165
3166         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3167         update, allocate common from bss section's free list.
3168         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3169         linker-defined symbols.
3170         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3171         Skip GOT and PLT entries that are no longer referenced.
3172         (Output_section_incremental_inputs::write_info_blocks): Mark
3173         linker-defined symbols.
3174         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3175         * output.cc (Output_section::allocate): New function.
3176         * output.h (Output_section::allocate): New function.
3177         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3178         linker-defined symbols.
3179         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3180         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3181         (Symbol::init_base_output_data): Likewise.
3182         (Symbol::init_base_output_segment): Likewise.
3183         (Symbol::init_base_constant): Likewise.
3184         (Sized_symbol::init_output_data): Likewise.
3185         (Sized_symbol::init_output_segment): Likewise.
3186         (Sized_symbol::init_constant): Likewise.
3187         (Symbol_table::do_define_in_output_data): Likewise.
3188         (Symbol_table::do_define_in_output_segment): Likewise.
3189         (Symbol_table::do_define_as_constant): Likewise.
3190         * symtab.h (Symbol::is_predefined): New function.
3191         (Symbol::init_base_output_data): Add is_predefined parameter.
3192         (Symbol::init_base_output_segment): Likewise.
3193         (Symbol::init_base_constant): Likewise.
3194         (Symbol::is_predefined_): New data member.
3195         (Sized_symbol::init_output_data): Add is_predefined parameter.
3196         (Sized_symbol::init_output_segment): Likewise.
3197         (Sized_symbol::init_constant): Likewise.
3198         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3199
3200 2011-06-07  Cary Coutant  <ccoutant@google.com>
3201
3202         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3203         instead of emit_copy_reloc.
3204         (Copy_relocs::emit_copy_reloc): Refactor.
3205         (Copy_relocs::make_copy_reloc): New function.
3206         (Copy_relocs::add_copy_reloc): Remove.
3207         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3208         section.
3209         (Copy_relocs::make_copy_reloc): New function.
3210         (Copy_relocs::add_copy_reloc): Remove.
3211         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3212         unchanged input files.
3213         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3214         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3215         Reserve BSS space for COPY relocations.
3216         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3217         (Output_section_incremental_inputs::write_info_blocks): Record
3218         whether a symbol is copied from a shared object.
3219         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3220         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3221         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3222         (Incremental_input_entry_reader::get_output_symbol_index): Add
3223         is_copy parameter.
3224         (Incremental_binary::emit_copy_relocs): New function.
3225         (Incremental_binary::do_emit_copy_relocs): New function.
3226         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3227         new data member.
3228         (Sized_incremental_binary::add_copy_reloc): New function.
3229         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3230         (Sized_incremental_binary::Copy_reloc): New struct.
3231         (Sized_incremental_binary::Copy_relocs): New typedef.
3232         (Sized_incremental_binary::copy_relocs_): New data member.
3233         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3234         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3235         * target.h (Sized_target::emit_copy_reloc): New function.
3236         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3237
3238 2011-06-02  Cary Coutant  <ccoutant@google.com>
3239
3240         PR gold/12163
3241         * gold/archive.cc (Archive::Archive): Initialize new data member.
3242         (Archive::include_all_members): Return if archive has already been
3243         included.
3244         * gold/archive.h (Archive::include_all_members_): New data member.
3245
3246 2011-06-02  Nick Clifton  <nickc@redhat.com>
3247
3248         * dynobj.h: Fix spelling mistake in comment.
3249         * output.cc: Likewise.
3250
3251 2011-05-31  Doug Kwan  <dougkwan@google.com>
3252             Asier Llano
3253
3254         PR gold/12826
3255         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3256         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3257         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3258         redundant arm_exidx_test.so.
3259         * testsuite/Makefile.in: Regenerate.
3260         (check_SCRIPTS): Add pr12826.sh
3261         (check_DATA): Add pr12826.stdout
3262         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3263         * testsuite/pr12826.sh: New file.
3264         * testsuite/pr12826_1.s: Ditto.
3265         * testsuite/pr12826_1.s: Ditto.
3266
3267 2011-05-30  Ian Lance Taylor  <iant@google.com>
3268
3269         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3270         sections.
3271
3272 2011-05-29  Ian Lance Taylor  <iant@google.com>
3273
3274         PR gold/12804
3275         * testsuite/Makefile.am: Use different file name for two_file_test
3276         temporary file for each incremental test.
3277         * testsuite/Makefile.in: Rebuild.
3278
3279 2011-05-29  Ian Lance Taylor  <iant@google.com>
3280
3281         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3282         binary input file is empty.
3283
3284 2011-05-27  Ian Lance Taylor  <iant@google.com>
3285
3286         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3287         (ver_test_9.so): Likewise.
3288         * testsuite/Makefile.in: Rebuild.
3289
3290 2011-05-26 Cary Coutant  <ccoutant@google.com>
3291
3292         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3293         * incremental.cc (Incremental_inputs::report_input_section): Fix
3294         comment, indentation.
3295         (Incremental_inputs::report_comdat_group): New function.
3296         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3297         of data for incremental input file entry.
3298         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3299         group count, COMDAT group signatures.
3300         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3301         an unchanged input file.
3302         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3303         Initialize new data member.
3304         (Incremental_object_entry::add_comdat_group): New function.
3305         (Incremental_object_entry::get_comdat_group_count): New function.
3306         (Incremental_object_entry::get_comdat_signature_key): New function.
3307         (Incremental_object_entry::groups_): New data member.
3308         (Incremental_inputs::report_comdat_group): New function.
3309         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3310         data for incremental input file entry.
3311         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3312         (Incremental_input_entry_reader::get_input_section): Adjust size of
3313         data for incremental input file entry.
3314         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3315         (Incremental_input_entry_reader::get_comdat_group_signature): New
3316         function.
3317         * object.cc (Sized_relobj::include_section_group): Report kept
3318         COMDAT groups for incremental links.
3319
3320 2011-05-24  David Meyer  <pdox@google.com>
3321
3322         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3323         with name parameter.  Add found_name parameter.
3324         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3325         * dirsearch.h (class Dirsearch): Update declaration.
3326
3327 2011-05-24  Ian Lance Taylor  <iant@google.com>
3328
3329         * archive.cc (Library_base::should_include_member): Pull in object
3330         from archive if it defines the entry symbol.
3331         * parameters.cc (Parameters::entry): New function.
3332         * parameters.h (class Parameters): Declare entry.
3333         * output.h (class Output_file_header): Remove entry_ field.
3334         * output.cc (Output_file_header::Output_file_header): Remove entry
3335         parameter.  Change all callers.
3336         (Output_file_header::entry): Use parameters->entry.
3337         * gold.cc (queue_middle_tasks): Likewise.
3338         * plugin.cc (Plugin_hook::run): Likewise.
3339
3340 2011-05-24 Cary Coutant  <ccoutant@google.com>
3341
3342         * gold.cc (queue_initial_tasks): Pass incremental base filename
3343         to Output_file::open_base_file; don't print error message.
3344         * incremental-dump.cc (main): Adjust call to
3345         Output_file::open_for_modification.
3346         * incremental-dump.cc (main): Likewise.
3347         * incremental.cc (Incremental_inputs::report_command_line):
3348         Ignore --incremental-base option when comparing command lines.
3349         Ignore parameter when given as separate argument.
3350         * options.h (class General_options): Add --incremental-base.
3351         * output.cc (Output_file::Output_file):
3352         (Output_file::open_base_file): Add base_name and writable parameters;
3353         read base file into new file; print error message here.
3354         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3355         callers.
3356         * output.h (Output_file::open_for_modification): Rename to...
3357         (Output_file::open_base_file): ...this; add base_name and
3358         writable parameters; adjust all callers.
3359         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3360         callers.
3361         * testsuite/Makefile.am (incremental_test_4): Test
3362         --incremental-base.
3363         * testsuite/Makefile.in: Regenerate.
3364
3365 2011-05-24 Cary Coutant  <ccoutant@google.com>
3366
3367         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3368         incremental_test_4.
3369         * testsuite/Makefile.in: Regenerate.
3370         * testsuite/two_file_test_1_v1.cc: New test source file.
3371         * testsuite/two_file_test_1b_v1.cc: New test source file.
3372         * testsuite/two_file_test_2_v1.cc: New test source file.
3373
3374 2011-05-24 Cary Coutant  <ccoutant@google.com>
3375
3376         * dynobj.h (Dynobj::do_dynobj): New function.
3377         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3378         flag and soname for shared objects.
3379         * incremental.cc (Incremental_inputs::report_object): Make
3380         either Incremental_object_entry or Incremental_dynobj_entry; add
3381         soname to string table.
3382         (Incremental_inputs::report_input_section): Add assertion.
3383         (Output_section_incremental_inputs::set_final_data_size): Adjust
3384         type of input file entry for shared libraries; adjust size of
3385         shared library info entry.
3386         (Output_section_incremental_inputs::write_input_files): Write
3387         as_needed flag for shared libraries.
3388         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3389         of input file entry for shared libraries; write soname.
3390         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3391         soname from incremental info.
3392         * incremental.h (enum Incremental_input_flags): Add
3393         INCREMENTAL_INPUT_AS_NEEDED.
3394         (Incremental_input_entry::Incremental_input_entry): Initialize new
3395         data member.
3396         (Incremental_input_entry::set_as_needed): New function.
3397         (Incremental_input_entry::as_needed): New function.
3398         (Incremental_input_entry::do_dynobj_entry): New function.
3399         (Incremental_input_entry::as_needed_): New data member.
3400         (Incremental_object_entry::Incremental_object_entry): Don't check
3401         for shared library.
3402         (Incremental_object_entry::do_type): Likewise.
3403         (class Incremental_dynobj_entry): New class.
3404         (Incremental_input_entry_reader::as_needed): New function.
3405         (Incremental_input_entry_reader::get_soname): New function.
3406         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3407         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3408         size of shared library info entry.
3409         * layout.cc (Layout::finish_dynamic_section): Don't test for
3410         incremental link when adding DT_NEEDED entries.
3411         * object.h (Object::Object): Initialize new data member.
3412         (Object::dynobj): New function.
3413         (Object::set_as_needed): New function.
3414         (Object::as_needed): New function.
3415         (Object::do_dynobj): New function.
3416         (Object::as_needed_): New data member.
3417
3418 2011-05-24 Cary Coutant  <ccoutant@google.com>
3419
3420         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3421         info; adjust display of GOT entries.
3422         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3423         vector of input objects; remove file_status_.
3424         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3425         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3426         got_plt reader; call target hooks to reserve GOT entries.
3427         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3428         of input file info header and GOT info entry.
3429         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3430         relocation info.
3431         (Got_plt_view_info::got_descriptor): Remove.
3432         (Got_plt_view_info::sym_index): New data member.
3433         (Got_plt_view_info::input_index): New data member.
3434         (Local_got_offset_visitor::visit): Write input file index.
3435         (Global_got_offset_visitor::visit): Write 0 for input file index.
3436         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3437         with sym_index and input_index.
3438         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3439         incremental info GOT entry; replace got_descriptor with input_index.
3440         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3441         map from input file index to object.
3442         (Sized_relobj_incr::do_layout): Replace direct data member reference
3443         with accessor function.
3444         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3445         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3446         Adjust size of input file info header.
3447         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3448         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3449         (Incremental_input_entry_reader::get_input_section): Adjust size of
3450         input file info header.
3451         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3452         of incremental info GOT entry.
3453         (Incremental_got_plt_reader::get_got_desc): Remove.
3454         (Incremental_got_plt_reader::get_got_symndx): New function.
3455         (Incremental_got_plt_reader::get_got_input_index): New function.
3456         (Sized_incremental_binary::Sized_incremental_binary): Remove
3457         file_status_; add input_objects_.
3458         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3459         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3460         (Sized_incremental_binary::file_is_unchanged): Remove.
3461         (Sized_incremental_binary::set_input_object): New function.
3462         (Sized_incremental_binary::input_object): New function.
3463         (Sized_incremental_binary::file_status_): Remove.
3464         (Sized_incremental_binary::input_objects_): New data member.
3465         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3466         references.
3467         (Sized_relobj_incr::invalid_address): Move to base class.
3468         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3469         class.
3470         (Sized_relobj_incr::do_output_section_offset): Likewise.
3471         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3472         (Sized_relobj_incr::section_offsets_): Likewise.
3473         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3474         function.
3475         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3476         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3477         with accessor function.
3478         (Sized_relobj_file::do_layout): Likewise.
3479         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3480         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3481         (Sized_relobj_file::compute_final_local_value): Replace refs to
3482         section_offsets_ with accessor function.
3483         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3484         * object.h (Relobj::Relobj): Initialize new data members.
3485         (Relobj::add_dyn_reloc): New function.
3486         (Relobj::first_dyn_reloc): New function.
3487         (Relobj::dyn_reloc_count): New function.
3488         (Relobj::first_dyn_reloc_): New data member.
3489         (Relobj::dyn_reloc_count_): New data member.
3490         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3491         references.
3492         (Sized_relobj::Address): New typedef.
3493         (Sized_relobj::invalid_address): Move here from child class.
3494         (Sized_relobj::Sized_relobj): Initialize new data members.
3495         (Sized_relobj::sized_relobj): New function.
3496         (Sized_relobj::is_output_section_offset_invalid): Move here from
3497         child class.
3498         (Sized_relobj::get_output_section_offset): Likewise.
3499         (Sized_relobj::local_has_got_offset): Likewise.
3500         (Sized_relobj::local_got_offset): Likewise.
3501         (Sized_relobj::set_local_got_offset): Likewise.
3502         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3503         (Sized_relobj::clear_got_offsets): New function.
3504         (Sized_relobj::section_offsets): Move here from child class.
3505         (Sized_relobj::do_output_section_offset): Likewise.
3506         (Sized_relobj::do_set_section_offset): Likewise.
3507         (Sized_relobj::Local_got_offsets): Likewise.
3508         (Sized_relobj::local_got_offsets_): Likewise.
3509         (Sized_relobj::section_offsets_): Likewise.
3510         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3511         references.
3512         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3513         class.
3514         (Sized_relobj_file::sized_relobj): New function
3515         (Sized_relobj_file::local_has_got_offset): Move to base class.
3516         (Sized_relobj_file::local_got_offset): Likewise.
3517         (Sized_relobj_file::set_local_got_offset): Likewise.
3518         (Sized_relobj_file::get_output_section_offset): Likewise.
3519         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3520         (Sized_relobj_file::do_output_section_offset): Likewise.
3521         (Sized_relobj_file::do_set_section_offset): Likewise.
3522         (Sized_relobj_file::Local_got_offsets): Likewise.
3523         (Sized_relobj_file::local_got_offsets_): Likewise.
3524         (Sized_relobj_file::section_offsets_): Likewise.
3525         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3526         (all constructors).
3527         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3528         (Output_reloc::get_symbol_index): Likewise.
3529         (Output_reloc::local_section_offset): Likewise.
3530         (Output_reloc::get_address): Likewise.
3531         (Output_reloc::symbol_value): Likewise.
3532         (Output_data_got::reserve_slot): Move to class definition.
3533         (Output_data_got::reserve_local): New function.
3534         (Output_data_got::reserve_slot_for_global): Remove.
3535         (Output_data_got::reserve_global): New function.
3536         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3537         (all constructors, two instantiations).
3538         (Output_reloc::get_relobj): New function (two instantiations).
3539         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3540         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3541         (Output_data_reloc::add_global): Adjust type of relobj.
3542         (Output_data_reloc::add_global_relative): Likewise.
3543         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3544         (Output_data_reloc::add_local): Likewise.
3545         (Output_data_reloc::add_local_relative): Likewise.
3546         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3547         (Output_data_reloc::add_local_section): Likewise.
3548         (Output_data_reloc::add_output_section): Likewise.
3549         (Output_data_reloc::add_absolute): Likewise.
3550         (Output_data_reloc::add_target_specific): Likewise.
3551         (Output_data_got::reserve_slot): Move definition here.
3552         (Output_data_got::reserve_local): New function.
3553         (Output_data_got::reserve_global): New function.
3554         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3555         section_offsets_ with accessor function.
3556         (Sized_relobj_file::write_sections): Likewise.
3557         (Sized_relobj_file::do_relocate_sections): Likewise.
3558         * target.h (Sized_target::reserve_local_got_entry): New function.
3559         (Sized_target::reserve_global_got_entry): New function.
3560         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3561         (Target_x86_64::reserve_global_got_entry): New function.
3562         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3563
3564 2011-05-23 Cary Coutant  <ccoutant@google.com>
3565
3566         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3567         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3568         bit when checking got_type.
3569         * incremental.cc (Sized_incremental_binary::setup_readers):
3570         Store symbol table and string table locations; initialize bit vector
3571         of file status flags.
3572         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3573         unchanged files.
3574         (Sized_incremental_binary::do_process_got_plt): New function.
3575         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3576         (Output_section_incremental_inputs::set_final_data_size): Record
3577         file index for each input file.
3578         (Output_section_incremental_inputs::write_got_plt): Store file index
3579         instead of input entry offset for each GOT entry.
3580         * incremental.h
3581         (Incremental_input_entry::Incremental_input_entry): Initialize new
3582         data member.
3583         (Incremental_input_entry::set_offset): Store file index.
3584         (Incremental_input_entry::get_file_index): New function.
3585         (Incremental_input_entry::file_index_): New data member.
3586         (Incremental_binary::process_got_plt): New function.
3587         (Incremental_binary::do_process_got_plt): New function.
3588         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3589         data members.
3590         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3591         (Sized_incremental_binary::set_file_is_unchanged): New function.
3592         (Sized_incremental_binary::file_is_unchanged): New function.
3593         (Sized_incremental_binary::do_process_got_plt): New function.
3594         (Sized_incremental_binary::file_status_): New data member.
3595         (Sized_incremental_binary::main_symtab_loc_): New data member.
3596         (Sized_incremental_binary::main_strtab_loc_): New data member.
3597         * output.cc (Output_data_got::Got_entry::write): Add case
3598         RESERVED_CODE.
3599         (Output_data_got::add_global): Call add_got_entry.
3600         (Output_data_got::add_global_plt): Likewise.
3601         (Output_data_got::add_global_with_rel): Likewise.
3602         (Output_data_got::add_global_with_rela): Likewise.
3603         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3604         (Output_data_got::add_global_pair_with_rela): Likewise.
3605         (Output_data_got::add_local): Call add_got_entry.
3606         (Output_data_got::add_local_plt): Likewise.
3607         (Output_data_got::add_local_with_rel): Likewise.
3608         (Output_data_got::add_local_with_rela): Likewise.
3609         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3610         (Output_data_got::add_local_pair_with_rela): Likewise.
3611         (Output_data_got::reserve_slot): New function.
3612         (Output_data_got::reserve_slot_for_global): New function.
3613         (Output_data_got::add_got_entry): New function.
3614         (Output_data_got::add_got_entry_pair): New function.
3615         (Output_section::add_output_section_data): Edit FIXME.
3616         * output.h
3617         (Output_section_data_build::Output_section_data_build): New
3618         constructor with size parameter.
3619         (Output_data_space::Output_data_space): Likewise.
3620         (Output_data_got::Output_data_got): Initialize new data member; new
3621         constructor with size parameter.
3622         (Output_data_got::add_constant): Call add_got_entry.
3623         (Output_data_got::reserve_slot): New function.
3624         (Output_data_got::reserve_slot_for_global): New function.
3625         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3626         (Output_data_got::add_got_entry): New function.
3627         (Output_data_got::add_got_entry_pair): New function.
3628         (Output_data_got::free_list_): New data member.
3629         * target.h (Sized_target::init_got_plt_for_update): New function.
3630         (Sized_target::register_global_plt_entry): New function.
3631         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3632         Initialize new data member; call init; add constructor with PLT count.
3633         (Output_data_plt_x86_64::init): New function.
3634         (Output_data_plt_x86_64::add_relocation): New function.
3635         (Output_data_plt_x86_64::reserve_slot): New function.
3636         (Output_data_plt_x86_64::free_list_): New data member.
3637         (Target_x86_64::init_got_plt_for_update): New function.
3638         (Target_x86_64::register_global_plt_entry): New function.
3639         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3640         incremental updates.
3641         (Output_data_plt_x86_64::add_relocation): New function.
3642         * testsuite/object_unittest.cc (Object_test): Set default options.
3643
3644 2011-05-16  Ian Lance Taylor  <iant@google.com>
3645
3646         * options.h (class General_options): Make -i a synonym for -r.
3647
3648 2011-05-16  Ian Lance Taylor  <iant@google.com>
3649
3650         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3651
3652 2011-05-10 Cary Coutant  <ccoutant@google.com>
3653
3654         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3655         strip_all (-s).
3656
3657 2011-05-06  Ian Lance Taylor  <iant@google.com>
3658
3659         * layout.cc (Layout::layout): If the output section flags change,
3660         update the ordering.
3661
3662 2011-04-25 Cary Coutant  <ccoutant@google.com>
3663
3664         * incremental-dump.cc (dump_incremental_inputs): Print local
3665         symbol info for each input file.
3666         * incremental.cc
3667         (Output_section_incremental_inputs::set_final_data_size): Add local
3668         symbol info to input file entries in incremental info.
3669         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3670         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3671         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3672         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3673         implementation.
3674         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3675         (Sized_incr_relobj::do_relocate): Write the local symbols.
3676         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3677         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3678         Adjust size of input file header.
3679         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3680         (Incremental_inputs_reader::get_local_symbol_count): New function.
3681         (Incremental_inputs_reader::get_input_section): Adjust size of input
3682         file header.
3683         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3684         (Sized_incr_relobj::This): New typedef.
3685         (Sized_incr_relobj::sym_size): New const data member.
3686         (Sized_incr_relobj::Local_symbol): New struct.
3687         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3688         (Sized_incr_relobj::do_local_symbol_offset): New function.
3689         (Sized_incr_relobj::local_symbol_count_): New data member.
3690         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3691         (Sized_incr_relobj::local_symbol_index_): New data member.
3692         (Sized_incr_relobj::local_symbol_offset_): New data member.
3693         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3694         (Sized_incr_relobj::local_symbols_): New data member.
3695         * object.h (Relobj::output_local_symbol_count): New function.
3696         (Relobj::local_symbol_offset): New function.
3697         (Relobj::do_output_local_symbol_count): New function.
3698         (Relobj::do_local_symbol_offset): New function.
3699         (Sized_relobj::do_output_local_symbol_count): New function.
3700         (Sized_relobj::do_local_symbol_offset): New function.
3701
3702 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3703
3704         * descriptors.cc (set_close_on_exec): New function.
3705         (Descriptors::open): Use set_close_on_exec.
3706         * output.cc (S_ISLNK): Define if not defined.
3707
3708 2011-04-22 Cary Coutant  <ccoutant@google.com>
3709
3710         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3711         global symbol map.
3712         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3713         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3714         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3715         relocations.
3716         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3717         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3718         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3719         * incremental.h
3720         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3721         function.
3722         (Incremental_binary::apply_incremental_relocs): New function.
3723         (Incremental_binary::do_apply_incremental_relocs): New function.
3724         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3725         data member.
3726         (Sized_incremental_binary::add_global_symbol): New function.
3727         (Sized_incremental_binary::global_symbol): New function.
3728         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3729         (Sized_incremental_binary::symbol_map_): New data member.
3730         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3731         * target.h (Sized_target::apply_relocation): New function.
3732         * target-reloc.h (apply_relocation): New function.
3733         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3734
3735 2011-04-22  Doug Kwan  <dougkwan@google.com>
3736
3737         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3738         flag of a SHT_ARM_EXIDX section.
3739         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3740         * testsuite/Makefile.in: Regenerate.
3741         * testsuite/arm_exidx_test.s: New file.
3742         * testsuite/arm_exidx_test.sh: Same.
3743
3744 2011-04-20 Cary Coutant  <ccoutant@google.com>
3745
3746         PR gold/12689
3747         * archive.h (Incremental_archive_entry::Archive_member):
3748         Initialize arg_serial_ (second constructor).
3749
3750 2011-04-17  Ian Lance Taylor  <iant@google.com>
3751
3752         * object.cc (Relocate_info::location): Simplify location string.
3753         * errors.cc (Errors::error_at_location): Don't print program
3754         name.
3755         (Errors::warning_at_location): Likewise.
3756         (Errors::undefined_symbol): Likewise.
3757         * testsuite/debug_msg.sh: Update accordingly.
3758
3759 2011-04-14 Cary Coutant  <ccoutant@google.com>
3760
3761         * gold/layout.cc (Layout::symtab_section_offset): New function.
3762         * gold/layout.h (Layout::symtab_section_offset): New function.
3763         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3764
3765 2011-04-12  Ian Lance Taylor  <iant@google.com>
3766
3767         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3768         with MREMAP_MAYMOVE.
3769         * output.h (class Output_file): Add map_is_allocated_ field.
3770         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3771         not available, provide stubs.  If mremap is not available, #define
3772         it to gold_mremap.
3773         (MREMAP_MAYMOVE): Define if not defined.
3774         (Output_file::Output_file): Initialize map_is_allocated_.
3775         (Output_file::resize): Check map_is_allocated_.
3776         (Output_file::map_anonymous): If mmap fails, use malloc.
3777         (Output_file::unmap): Don't do anything for an anonymous map.
3778         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3779         is not available, provide stubs.
3780         (File_read::View::~View): Use free rather than delete[].
3781         (File_read::make_view): Use malloc rather than new[].  If mmap
3782         fails, use malloc.
3783         (File_read::find_or_make_view): Use malloc rather than new[].
3784         * gold.h: Remove HAVE_REMAP code.
3785         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3786         exists.  Rename mremap to gold_mremap.  If mmap is not available
3787         don't do anything.
3788         * configure, config.in: Rebuild.
3789
3790 2011-04-11  Ian Lance Taylor  <iant@google.com>
3791
3792         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3793         initialize local variable v.
3794
3795 2011-04-11  Cary Coutant  <ccoutant@google.com>
3796
3797         * archive.cc (Archive::include_member): Adjust call to
3798         report_object.
3799         (Add_archive_symbols::run): Track argument serial numbers.
3800         (Lib_group::include_member): Likewise.
3801         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3802         * archive.h (Incremental_archive_entry::Archive_member):
3803         Initialize arg_serial_.
3804         (Archive_member::arg_serial_): New data member.
3805         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3806         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3807         incremental link.
3808         (Sized_dynobj::do_for_all_local_got_entries): New function.
3809         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3810         function.
3811         * fileread.cc (get_mtime): New function.
3812         * fileread.h (get_mtime): New function.
3813         * gold.cc (queue_initial_tasks): Check for incremental update.
3814         (process_incremental_input): New function.
3815         (queue_middle_tasks): Don't force valid target for incremental
3816         update.
3817         * incremental-dump.cc (find_input_containing_global): Adjust
3818         size of symbol info entry.
3819         (dump_incremental_inputs): Dump argument serial number and
3820         in_system_directory flag; bias shndx by 1; print symbol names
3821         when dumping per-file symbol lists; use new symbol info readers.
3822         * incremental.cc
3823         (Output_section_incremental_inputs:update_data_size): New function.
3824         (Sized_incremental_binary::setup_readers): Setup input readers
3825         for each input file; build maps for files added from libraries
3826         and scripts.
3827         (Sized_incremental_binary::check_input_args): New function.
3828         (Sized_incremental_binary::do_check_inputs): Build map of argument
3829         serial numbers to input arguments.
3830         (Sized_incremental_binary::do_file_has_changed): Rename
3831         do_file_is_unchanged to this; compare file modification times.
3832         (Sized_incremental_binary::do_init_layout): New function.
3833         (Sized_incremental_binary::do_reserve_layout): New function.
3834         (Sized_incremental_binary::do_get_input_reader): Remove.
3835         (Sized_incremental_binary::get_symtab_view): New function.
3836         (Incremental_checker::can_incrementally_link_output_file): Remove.
3837         (Incremental_inputs::report_command_line): Exclude --debug options.
3838         (Incremental_inputs::report_archive_begin): Add parameter; track
3839         argument serial numbers; don't put input file entry for archive
3840         before archive members.
3841         (Incremental_inputs::report_archive_end): Put input file entry
3842         for archive after archive members.
3843         (Incremental_inputs::report_object): Add parameter; track argument
3844         serial numbers and in_system_directory flag.
3845         (Incremental_inputs::report_script): Add parameter; track argument
3846         serial numbers.
3847         (Output_section_incremental_inputs::set_final_data_size): Adjust
3848         size of symbol info entry; check for forwarding symbols.
3849         (Output_section_incremental_inputs::write_input_files): Write
3850         in_system_directory flag and argument serial number.
3851         (Output_section_incremental_inputs::write_info_blocks): Map section
3852         indices between incremental info and original input file; store
3853         input section index for each symbol.
3854         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3855         change operator() to visit().
3856         (class Global_got_offset_visitor): Likewise.
3857         (class Global_symbol_visitor_got_plt):
3858         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3859         classes.
3860         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3861         (Sized_incr_relobj::do_read_symbols): New function.
3862         (Sized_incr_relobj::do_layout): New function.
3863         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3864         (Sized_incr_relobj::do_add_symbols): New function.
3865         (Sized_incr_relobj::do_should_include_member): New function.
3866         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3867         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3868         (Sized_incr_relobj::do_section_size): New function.
3869         (Sized_incr_relobj::do_section_name): New function.
3870         (Sized_incr_relobj::do_section_contents): New function.
3871         (Sized_incr_relobj::do_section_flags): New function.
3872         (Sized_incr_relobj::do_section_entsize): New function.
3873         (Sized_incr_relobj::do_section_address): New function.
3874         (Sized_incr_relobj::do_section_type): New function.
3875         (Sized_incr_relobj::do_section_link): New function.
3876         (Sized_incr_relobj::do_section_info): New function.
3877         (Sized_incr_relobj::do_section_addralign): New function.
3878         (Sized_incr_relobj::do_initialize_xindex): New function.
3879         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3880         (Sized_incr_relobj::do_read_relocs): New function.
3881         (Sized_incr_relobj::do_gc_process_relocs): New function.
3882         (Sized_incr_relobj::do_scan_relocs): New function.
3883         (Sized_incr_relobj::do_count_local_symbols): New function.
3884         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3885         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3886         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3887         (Sized_incr_relobj::do_relocate): New function.
3888         (Sized_incr_relobj::do_set_section_offset): New function.
3889         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3890         (Sized_incr_dynobj::do_read_symbols): New function.
3891         (Sized_incr_dynobj::do_layout): New function.
3892         (Sized_incr_dynobj::do_add_symbols): New function.
3893         (Sized_incr_dynobj::do_should_include_member): New function.
3894         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3895         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3896         (Sized_incr_dynobj::do_section_size): New function.
3897         (Sized_incr_dynobj::do_section_name): New function.
3898         (Sized_incr_dynobj::do_section_contents): New function.
3899         (Sized_incr_dynobj::do_section_flags): New function.
3900         (Sized_incr_dynobj::do_section_entsize): New function.
3901         (Sized_incr_dynobj::do_section_address): New function.
3902         (Sized_incr_dynobj::do_section_type): New function.
3903         (Sized_incr_dynobj::do_section_link): New function.
3904         (Sized_incr_dynobj::do_section_info): New function.
3905         (Sized_incr_dynobj::do_section_addralign): New function.
3906         (Sized_incr_dynobj::do_initialize_xindex): New function.
3907         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3908         (make_sized_incremental_object): New function.
3909         (Incremental_library::copy_unused_symbols): New function.
3910         (Incremental_library::do_for_all_unused_symbols): New function.
3911         * incremental.h (enum Incremental_input_flags): New type.
3912         (class Incremental_checker): Remove.
3913         (Incremental_input_entry::Incremental_input_entry): Add argument
3914         serial number.
3915         (Incremental_input_entry::arg_serial): New function.
3916         (Incremental_input_entry::set_is_in_system_directory): New function.
3917         (Incremental_input_entry::is_in_system_directory): New function.
3918         (Incremental_input_entry::arg_serial_): New data member.
3919         (Incremental_input_entry::is_in_system_directory_): New data member.
3920         (class Script_info): Move here from script.h.
3921         (Script_info::Script_info): Add filename parameter.
3922         (Script_info::filename): New function.
3923         (Script_info::filename_): New data member.
3924         (Incremental_script_entry::Incremental_script_entry): Add argument
3925         serial number.
3926         (Incremental_object_entry::Incremental_object_entry): Likewise.
3927         (Incremental_object_entry::add_input_section): Build list of input
3928         sections with map to original shndx.
3929         (Incremental_object_entry::get_input_section_index): New function.
3930         (Incremental_object_entry::shndx_): New data member.
3931         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3932         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3933         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3934         serial number.
3935         (Incremental_inputs::report_archive_begin): Likewise.
3936         (Incremental_inputs::report_object): Likewise.
3937         (Incremental_inputs::report_script): Likewise.
3938         (class Incremental_global_symbol_reader): New class.
3939         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3940         and store flags and input file type.
3941         (Incremental_input_entry_reader::arg_serial): New function.
3942         (Incremental_input_entry_reader::type): Extract type from flags.
3943         (Incremental_input_entry_reader::is_in_system_directory): New function.
3944         (Incremental_input_entry_reader::get_input_section_count): Call
3945         accessor function for type.
3946         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3947         function for type; adjust size of global symbol entry.
3948         (Incremental_input_entry_reader::get_global_symbol_count): Call
3949         accessor function for type.
3950         (Incremental_input_entry_reader::get_object_count): Likewise.
3951         (Incremental_input_entry_reader::get_object_offset): Likewise.
3952         (Incremental_input_entry_reader::get_member_count): Likewise.
3953         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3954         (Incremental_input_entry_reader::get_member_offset): Likewise.
3955         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3956         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3957         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3958         (Incremental_input_entry_reader::get_global_symbol_reader): New
3959         function.
3960         (Incremental_input_entry_reader::get_output_symbol_index): New
3961         function.
3962         (Incremental_input_entry_reader::type_): Remove.
3963         (Incremental_input_entry_reader::flags_): New data member.
3964         (Incremental_inputs_reader::input_file_offset): New function.
3965         (Incremental_inputs_reader::input_file_index): New function.
3966         (Incremental_inputs_reader::input_file): Call input_file_offset.
3967         (Incremental_inputs_reader::input_file_at_offset): New function.
3968         (Incremental_relocs_reader::get_r_type): Reformat.
3969         (Incremental_relocs_reader::get_r_shndx): Reformat.
3970         (Incremental_relocs_reader::get_r_offset): Reformat.
3971         (Incremental_relocs_reader::data): New function.
3972         (Incremental_binary::Incremental_binary): Initialize new data members.
3973         (Incremental_binary::check_inputs): Add cmdline parameter.
3974         (Incremental_binary::file_is_unchanged): Remove.
3975         (Input_reader::arg_serial): New function.
3976         (Input_reader::get_unused_symbol_count): New function.
3977         (Input_reader::get_unused_symbol): New function.
3978         (Input_reader::do_arg_serial): New function.
3979         (Input_reader::do_get_unused_symbol_count): New function.
3980         (Input_reader::do_get_unused_symbol): New function.
3981         (Incremental_binary::input_file_count): New function.
3982         (Incremental_binary::get_input_reader): Change signature to use
3983         index instead of filename.
3984         (Incremental_binary::file_has_changed): New function.
3985         (Incremental_binary::get_input_argument): New function.
3986         (Incremental_binary::get_library): New function.
3987         (Incremental_binary::get_script_info): New function.
3988         (Incremental_binary::init_layout): New function.
3989         (Incremental_binary::reserve_layout): New function.
3990         (Incremental_binary::output_file): New function.
3991         (Incremental_binary::do_check_inputs): New function.
3992         (Incremental_binary::do_file_is_unchanged): Remove.
3993         (Incremental_binary::do_file_has_changed): New function.
3994         (Incremental_binary::do_init_layout): New function.
3995         (Incremental_binary::do_reserve_layout): New function.
3996         (Incremental_binary::do_input_file_count): New function.
3997         (Incremental_binary::do_get_input_reader): Change signature.
3998         (Incremental_binary::input_args_map_): New data member.
3999         (Incremental_binary::library_map_): New data member.
4000         (Incremental_binary::script_map_): New data member.
4001         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4002         new data members.
4003         (Sized_incremental_binary::output_section): New function.
4004         (Sized_incremental_binary::inputs_reader): Add const.
4005         (Sized_incremental_binary::symtab_reader): Add const.
4006         (Sized_incremental_binary::relocs_reader): Add const.
4007         (Sized_incremental_binary::got_plt_reader): Add const.
4008         (Sized_incremental_binary::get_symtab_view): New function.
4009         (Sized_incremental_binary::Inputs_reader): New typedef.
4010         (Sized_incremental_binary::Input_entry_reader): New typedef.
4011         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4012         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4013         (Sized_incremental_binary::do_file_has_changed): New function.
4014         (Sized_incremental_binary::do_init_layout): New function.
4015         (Sized_incremental_binary::do_reserve_layout): New function.
4016         (Sized_input_reader::Inputs_reader): Remove.
4017         (Sized_input_reader::Input_entry_reader): Remove.
4018         (Sized_input_reader::do_arg_serial): New function.
4019         (Sized_input_reader::do_get_unused_symbol_count): New function.
4020         (Sized_input_reader::do_get_unused_symbol): New function.
4021         (Sized_incremental_binary::do_input_file_count): New function.
4022         (Sized_incremental_binary::do_get_input_reader): Change signature;
4023         use index instead of filename.
4024         (Sized_incremental_binary::section_map_): New data member.
4025         (Sized_incremental_binary::input_entry_readers_): New data member.
4026         (class Sized_incr_relobj): New class.
4027         (class Sized_incr_dynobj): New class.
4028         (make_sized_incremental_object): New function.
4029         (class Incremental_library): New class.
4030         * layout.cc (Free_list::num_lists): New static data member.
4031         (Free_list::num_nodes): New static data member.
4032         (Free_list::num_removes): New static data member.
4033         (Free_list::num_remove_visits): New static data member.
4034         (Free_list::num_allocates): New static data member.
4035         (Free_list::num_allocate_visits): New static data member.
4036         (Free_list::init): New function.
4037         (Free_list::remove): New function.
4038         (Free_list::allocate): New function.
4039         (Free_list::dump): New function.
4040         (Free_list::print_stats): New function.
4041         (Layout_task_runner::run): Resize output file for incremental updates.
4042         (Layout::Layout): Initialize new data members.
4043         (Layout::set_incremental_base): New function.
4044         (Layout::init_fixed_output_section): New function.
4045         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4046         incremental updates.
4047         (Layout::create_gold_note): Do not create gold note section for
4048         incremental updates.
4049         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4050         for incremental updates.
4051         (Layout::set_section_offsets): For incremental updates, allocate space
4052         from free list.
4053         (Layout::create_symtab_sections): Layout with offsets relative to
4054         start of section; for incremental updates, allocate space from free
4055         list.
4056         (Layout::create_shdrs): For incremental updates, allocate space from
4057         free list.
4058         (Layout::finish_dynamic_section): For incremental updates, do not
4059         check --as-needed (fixed in subsequent patch).
4060         * layout.h (class Free_list): New class.
4061         (Layout::set_incremental_base): New function.
4062         (Layout::incremental_base): New function.
4063         (Layout::init_fixed_output_section): New function.
4064         (Layout::allocate): New function.
4065         (Layout::incremental_base_): New data member.
4066         (Layout::free_list_): New data member.
4067         * main.cc (main): Print Free_list statistics.
4068         * object.cc (Relobj::finalize_incremental_relocs): Add
4069         clear_counts parameter; clear counts only when clear_counts is set.
4070         (Sized_relobj::Sized_relobj): Initialize new base class.
4071         (Sized_relobj::do_layout): Don't report special sections.
4072         (Sized_relobj::do_for_all_local_got_entries): New function.
4073         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4074         symtab_off to all symbol table offsets.
4075         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4076         * object.h (class Got_offset_list): Move to top of file.
4077         (Object::Object): Allow case where input_file == NULL.
4078         (Object::~Object): Likewise.
4079         (Object::input_file): Assert that input_file != NULL.
4080         (Object::lock): Allow case where input_file == NULL.
4081         (Object::unlock): Likewise.
4082         (Object::is_locked): Likewise.
4083         (Object::token): Likewise.
4084         (Object::release): Likewise.
4085         (Object::is_incremental): New function.
4086         (Object::get_mtime): New function.
4087         (Object::for_all_local_got_entries): New function.
4088         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4089         (Object::set_is_in_system_directory): New function.
4090         (Object::is_in_system_directory): New function.
4091         (Object::do_is_incremental): New function.
4092         (Object::do_get_mtime): New function.
4093         (Object::do_for_all_local_got_entries): New function.
4094         (Object::is_in_system_directory_): New data member.
4095         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4096         (class Sized_relobj_base): New class.
4097         (class Sized_relobj): Derive from Sized_relobj_base.
4098         (class Sized_relobj::Symbols): Redeclare from base class.
4099         (class Sized_relobj::local_got_offset_list): Remove.
4100         (class Sized_relobj::Output_sections): Redeclare from base class.
4101         (class Sized_relobj::do_for_all_local_got_entries): New function.
4102         (class Sized_relobj::write_local_symbols): Add offset parameter.
4103         (class Sized_relobj::local_symbol_offset_): Update comment.
4104         (class Sized_relobj::local_dynsym_offset_): Update comment.
4105         * options.cc (Input_arguments::add_file): Remove const.
4106         * options.h (Input_file_argument::Input_file_argument):
4107         Initialize arg_serial_ (all constructors).
4108         (Input_file_argument::set_arg_serial): New function.
4109         (Input_file_argument::arg_serial): New function.
4110         (Input_file_argument::arg_serial_): New data member.
4111         (Input_arguments::Input_arguments): Initialize file_count_.
4112         (Input_arguments::add_file): Remove const.
4113         (Input_arguments::number_of_input_files): New function.
4114         (Input_arguments::file_count_): New data member.
4115         (Command_line::number_of_input_files): Call
4116         Input_arguments::number_of_input_files.
4117         * output.cc (Output_segment_headers::Output_segment_headers):
4118         Set current size.
4119         (Output_section::Input_section::current_data_size): New function.
4120         (Output_section::Output_section): Initialize new data members.
4121         (Output_section::add_input_section): Don't do merge sections for
4122         an incremental link; allocate space from free list for an
4123         incremental update.
4124         (Output_section::add_output_section_data): Allocate space from
4125         free list for an incremental update.
4126         (Output_section::update_data_size): New function.
4127         (Output_section::set_fixed_layout): New function.
4128         (Output_section::reserve): New function.
4129         (Output_segment::set_section_addresses): Remove const.
4130         (Output_segment::set_section_list_addresses): Remove const; allocate
4131         space from free list for an incremental update.
4132         (Output_segment::set_offset): Adjust size of RELRO segment for an
4133         incremental update.
4134         * output.h (Output_data::current_data_size): Move here from
4135         child classes.
4136         (Output_data::pre_finalize_data_size): New function.
4137         (Output_data::update_data_size): New function.
4138         (Output_section_headers::update_data_size): new function.
4139         (Output_section_data_build::current_data_size): Move to Output_data.
4140         (Output_data_strtab::update_data_size): New function.
4141         (Output_section::current_data_size): Move to Output_data.
4142         (Output_section::set_fixed_layout): New function.
4143         (Output_section::has_fixed_layout): New function.
4144         (Output_section::reserve): New function.
4145         (Output_section::update_data_size): New function.
4146         (Output_section::has_fixed_layout_): New data member.
4147         (Output_section::free_list_): New data member.
4148         (Output_segment::set_section_addresses): Remove const.
4149         (Output_segment::set_section_list_addresses): Remove const.
4150         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4151         New function.
4152         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4153         New function.
4154         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4155         parameter when calling Add_symbols constructor; store argument
4156         serial number for members of a lib group.
4157         (Add_symbols::locks): Allow case where token == NULL.
4158         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4159         (Read_member::~Read_member): New function.
4160         (Read_member::is_runnable): New function.
4161         (Read_member::locks): New function.
4162         (Read_member::run): New function.
4163         (Check_script::~Check_script): New function.
4164         (Check_script::is_runnable): New function.
4165         (Check_script::locks): New function.
4166         (Check_script::run): New function.
4167         (Check_library::~Check_library): New function.
4168         (Check_library::is_runnable): New function.
4169         (Check_library::locks): New function.
4170         (Check_library::run): New function.
4171         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4172         (Add_symbols::library_): New data member.
4173         (class Read_member): New class.
4174         (class Check_script): New class.
4175         (class Check_library): New class.
4176         * reloc.cc (Read_relocs::is_runnable): Allow case where
4177         token == NULL.
4178         (Read_relocs::locks): Likewise.
4179         (Scan_relocs::locks): Likewise.
4180         (Relocate_task::locks): Likewise.
4181         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4182         to clear counters.
4183         (Sized_relobj::incremental_relocs_scan): Fix comment.
4184         (Sized_relobj::do_relocate): Pass output file offset to
4185         write_local_symbols.
4186         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4187         from class declaration.
4188         * script.cc (read_input_script): Allocate Script_info; pass
4189         argument serial number to report_script.
4190         * script.h (class Script_info): Move to incremental.h.
4191         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4192         * symtab.h (Symbol_table::add_from_incrobj): New function.
4193         (Symbol_table::set_file_offset): New function.
4194
4195 2011-04-05  Cary Coutant  <ccoutant@google.com>
4196
4197         * incremental-dump.cc (dump_incremental_inputs): Change signature
4198         to take a Sized_incremental_binary; change caller.  Use readers
4199         in Sized_incremental_binary.
4200         * incremental.cc
4201         (Sized_incremental_binary::find_incremental_inputs_sections):
4202         Rename do_find_incremental_inputs_sections to this.
4203         (Sized_incremental_binary::setup_readers): New function.
4204         (Sized_incremental_binary::do_check_inputs): Check
4205         has_incremental_info_ flag; move setup code to setup_readers;
4206         use input readers.
4207         (Sized_incremental_binary::do_file_is_unchanged): New function.
4208         (Sized_incremental_binary::do_get_input_reader): New function.
4209         * incremental.h (class Incremental_binary): Move to end of file.
4210         (Incremental_binary::file_is_unchanged): New function.
4211         (Incremental_binary::do_file_is_unchanged): New function.
4212         (Incremental_binary::Input_reader): New class.
4213         (Incremental_binary::get_input_reader): New function.
4214         (class Sized_incremental_binary): Move to end of file.
4215         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4216         input section reader classes.
4217         (Sized_incremental_binary::has_incremental_info): New function.
4218         (Sized_incremental_binary::inputs_reader): New function.
4219         (Sized_incremental_binary::symtab_reader): New function.
4220         (Sized_incremental_binary::relocs_reader): New function.
4221         (Sized_incremental_binary::got_plt_reader): New function.
4222         (Sized_incremental_binary::do_file_is_unchanged): New function.
4223         (Sized_incremental_binary::Sized_input_reader): New class.
4224         (Sized_incremental_binary::get_input_reader): New function.
4225         (Sized_incremental_binary::find_incremental_inputs_sections):
4226         Rename do_find_incremental_inputs_sections to this.
4227         (Sized_incremental_binary::setup_readers): New function.
4228         (Sized_incremental_binary::has_incremental_info_): New data member.
4229         (Sized_incremental_binary::inputs_reader_): New data member.
4230         (Sized_incremental_binary::symtab_reader_): New data member.
4231         (Sized_incremental_binary::relocs_reader_): New data member.
4232         (Sized_incremental_binary::got_plt_reader_): New data member.
4233         (Sized_incremental_binary::current_input_file_): New data member.
4234
4235 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4236
4237         PR gold/12640
4238         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4239         violation.
4240
4241 2011-03-30  Cary Coutant  <ccoutant@google.com>
4242
4243         * archive.cc (Archive::include_member): Adjust call to report_object.
4244         (Add_archive_symbols::run): Add script_info to call to
4245         report_archive_begin.
4246         (Lib_group::include_member): Adjust call to report_object.
4247         (Add_lib_group_symbols::run): Adjust call to report_object.
4248         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4249         blocks.  Add object count for script input files.
4250         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4251         script_info parameter; change all callers.
4252         (Incremental_inputs::report_object): Add script_info parameter;
4253         change all callers.
4254         (Incremental_inputs::report_script): Store backpointer to
4255         incremental info entry.
4256         (Output_section_incremental_inputs::set_final_data_size): Record
4257         additional information for scripts.
4258         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4259         * incremental.h (Incremental_script_entry::add_object): New function.
4260         (Incremental_script_entry::get_object_count): New function.
4261         (Incremental_script_entry::get_object): New function.
4262         (Incremental_script_entry::objects_): New data member; adjust
4263         constructor.
4264         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4265         (Incremental_inputs::report_object): Add script_info parameter.
4266         (Incremental_inputs_reader::get_object_count): New function.
4267         (Incremental_inputs_reader::get_object_offset): New function.
4268         * options.cc (Input_arguments::add_file): Return reference to
4269         new input argument.
4270         * options.h (Input_argument::set_script_info): New function.
4271         (Input_argument::script_info): New function.
4272         (Input_argument::script_info_): New data member; adjust all
4273         constructors.
4274         (Input_file_group::add_file): Return reference to new input argument.
4275         (Input_file_lib::add_file): Likewise.
4276         (Input_arguments::add_file): Likewise.
4277         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4278         * script.cc (Parser_closure::Parser_closure): Add script_info
4279         parameter; adjust all callers.
4280         (Parser_closure::script_info): New function.
4281         (Parser_closure::script_info_): New data member.
4282         (read_input_script): Report scripts earlier to incremental info.
4283         (script_add_file): Set script_info in Input_argument.
4284         (script_add_library): Likewise.
4285         * script.h (Script_options::Script_info): Rewrite class.
4286
4287 2011-03-29  Cary Coutant  <ccoutant@google.com>
4288
4289         * archive.cc (Library_base::should_include_member): Move
4290         method here from class Archive.
4291         (Archive::Archive): Initialize base class.
4292         (Archive::should_include_member): Move to base class.
4293         (Archive::do_for_all_unused_symbols): New function.
4294         (Add_archive_symbols::run): Remove redundant access to
4295         incremental_inputs.
4296         (Lib_group::Lib_group): Initialize base class.
4297         (Lib_group::do_filename): New function.
4298         (Lib_group::include_member): Pass pointer to Lib_group to
4299         report_object.
4300         (Lib_group::do_for_all_unused_symbols): New function.
4301         (Add_lib_group_symbols::run): Report archive information for
4302         incremental links.
4303         * archive.h (class Library_base): New base class.
4304         (class Archive): Derive from Library_base.
4305         (Archive::filename): Move to base class.
4306         (Archive::set_incremental_info): Likewise.
4307         (Archive::incremental_info): Likewise.
4308         (Archive::Should_include): Likewise.
4309         (Archive::should_include_member): Likewise.
4310         (Archive::Armap_entry): Remove.
4311         (Archive::Unused_symbol_iterator): Remove.
4312         (Archive::unused_symbols_begin): Remove.
4313         (Archive::unused_symbols_end): Remove.
4314         (Archive::do_filename): New function.
4315         (Archive::do_get_mtime): New function.
4316         (Archive::do_for_all_unused_symbols): New function.
4317         (Archive::task_): Move to base class.
4318         (Archive::incremental_info_): Likewise.
4319         (class Lib_group): Derive from Library_base.
4320         (Lib_group::do_filename): New function.
4321         (Lib_group::do_get_mtime): New function.
4322         (Lib_group::do_for_all_unused_symbols): New function.
4323         (Lib_group::task_): Move to base class.
4324         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4325         function.
4326         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4327         function.
4328         * incremental.cc (Incremental_inputs::report_archive_begin):
4329         Use Library_base; call library's get_mtime; add incremental inputs
4330         entry before members.
4331         (class Unused_symbol_visitor): New class.
4332         (Incremental_inputs::report_archive_end): Use Library_base; use
4333         visitor class to record unused symbols; don't add incremental inputs
4334         entry after members.
4335         (Incremental_inputs::report_object): Use Library_base.
4336         * incremental.h
4337         (Incremental_archive_entry::Incremental_archive_entry): Remove
4338         unused Archive parameter.
4339         (Incremental_inputs::report_archive_begin): Use Library_base.
4340         (Incremental_inputs::report_archive_end): Likewise.
4341         (Incremental_inputs::report_object): Likewise.
4342         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4343         function.
4344         * object.h (Object::for_all_global_symbols): New function.
4345         (Object::do_for_all_global_symbols): New function.
4346         (Sized_relobj::do_for_all_global_symbols): New function.
4347         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4348         function.
4349         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4350         function.
4351
4352 2011-03-27  Ian Lance Taylor  <iant@google.com>
4353
4354         * archive.cc (Archive::interpret_header): Return -1 if something
4355         goes wrong.  Change callers accordingly.
4356
4357 2011-03-25  Cary Coutant  <ccoutant@google.com>
4358
4359         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4360         * testsuite/Makefile.in: Regenerate.
4361
4362 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4363
4364         * plugin.cc (get_view): New.
4365         (Plugin::load): Pass get_view to the plugin.
4366         (Plugin_manager::get_view): New.
4367
4368 2011-03-21  Ian Lance Taylor  <iant@google.com>
4369
4370         * testsuite/final_layout.sh: Rewrite to not use dc.
4371         * testsuite/relro_test.sh: Fail if dc is not present.
4372
4373 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4374
4375         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4376         Change == to -eq.
4377         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4378         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4379         Change == to -eq.
4380         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4381         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4382
4383 2011-03-14  Ian Lance Taylor  <iant@google.com>
4384
4385         * script-sections.cc (Sort_output_sections::script_compare):
4386         Rename from is_before, change return type.
4387         (Sort_output_sections::operator()): Adjust accordingly.
4388
4389 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4390
4391         PR gold/12572
4392         * testsuite/odr_violation2.cc: Add comment to make all error line
4393         numbers double digits.
4394         * testsuite/debug_msg.sh: Adjust expected errors.
4395
4396 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4397
4398         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4399         but mark earlier ones as non-canonical
4400         (offset_to_iterator): Update search target and example
4401         (do_addr2line): Return extra lines in a vector*
4402         (format_file_lineno): Extract from do_addr2line
4403         (one_addr2line): Add vector* out-param
4404         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4405         when a lineno entry appeared last for its instruction
4406         (Dwarf_line_info): Add vector* out-param
4407         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4408         * symtab.cc (Odr_violation_compare): Include the lineno in the
4409         comparison again.
4410         (linenos_from_loc): New. Combine the canonical line for an
4411         address with its other lines.
4412         (True_if_intersect): New. Helper functor to make
4413         std::set_intersection a query.
4414         (detect_odr_violations): Compare sets of lines instead of just
4415         one line for each function. This became less deterministic, but
4416         has fewer false positives.
4417         * symtab.h: Declarations.
4418         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4419         mix an optimized and non-optimized object in the same binary
4420         (odr_violation2.so): Same.
4421         * testsuite/Makefile.in: Regenerate from Makefile.am.
4422         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4423         * testsuite/debug_msg.sh: Update line numbers and add
4424         assertions.
4425         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4426         non-optimized context.
4427         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4428         isn't inlined, and use OdrDerived in an optimized context.
4429         * testsuite/odr_header1.h: Defines OdrDerived, where
4430         optimization will change the
4431         first-instruction-in-the-destructor's file and line number.
4432         * testsuite/odr_header2.h: Defines OdrBase.
4433
4434 2011-03-09  Ian Lance Taylor  <iant@google.com>
4435
4436         * fileread.cc (File_read::clear_views): Don't delete the whole
4437         file view.
4438
4439 2011-03-08  Ian Lance Taylor  <iant@google.com>
4440
4441         PR gold/12525
4442         * fileread.cc: #include <climits>.
4443         (GOLD_IOV_MAX): Define.
4444         (File_read::read_multiple): Limit number of entries by iov_max.
4445         * fileread.h (class File_read): Always set max_readv_entries to
4446         128.
4447
4448 2011-03-07  Ian Lance Taylor  <iant@google.com>
4449
4450         PR gold/12525
4451         * options.h (class General_options): Add -dy and -dn.
4452
4453 2011-03-02  Cary Coutant  <ccoutant@google.com>
4454
4455         * testsuite/script_test_9.t: Add TLS segment.
4456
4457 2011-03-02  Simon Baldwin  <simonb@google.com>
4458
4459         * configure.ac: Add check for gnu_indirect_function support in
4460         the toolchain building binutils.
4461         * configure: Rebuild.
4462
4463 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4464
4465         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4466         plugin only symbols.
4467         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4468         in plugin files as not needed in the symbol table.
4469
4470 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4471
4472         * output.cc (Output_section::add_input_section): Delay fill
4473         generation for section ordering.
4474
4475 2011-02-09  Ian Lance Taylor  <iant@google.com>
4476
4477         PR gold/12316
4478         * object.h (class Sized_relobj): Remove clear_local_symbols.
4479         * reloc.cc (Sized_relobj::do_relocate): Don't call
4480         clear_local_symbols.
4481
4482 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4483
4484         * plugin.cc (is_visible_from_outside): Return true for symbols
4485         in the -u option.
4486
4487 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4488
4489         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4490         filename.
4491
4492 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4493
4494         * icf.h (is_section_foldable_candidate): Change type of parameter
4495         to std::string.
4496         * icf.cc (Icf::find_identical_sections): Change type of local variable
4497         section_name to be std::string.
4498         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4499
4500 2011-01-25  Ian Lance Taylor  <iant@google.com>
4501
4502         * script.cc (script_add_extern): Rewrite to use
4503         add_symbol_reference.
4504
4505 2011-01-25  Doug Kwan  <dougkwan@google.com>
4506
4507         * icf.cc (get_section_contents): Always lock section's object.
4508
4509 2011-01-24  Ian Lance Taylor  <iant@google.com>
4510
4511         * options.h (class General_options): Accept
4512         --no-detect-odr-violations.
4513
4514 2011-01-24  Ian Lance Taylor  <iant@google.com>
4515
4516         * version.cc (version_string): Bump to 1.11.
4517
4518 2011-01-24  Ian Lance Taylor  <iant@google.com>
4519
4520         * plugin.cc (class Plugin_rescan): Define new class.
4521         (Plugin_manager::claim_file): Set any_claimed_.
4522         (Plugin_manager::save_archive): New function.
4523         (Plugin_manager::save_input_group): New function.
4524         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4525         necessary.
4526         (Plugin_manager::new_undefined_symbol): New function.
4527         (Plugin_manager::rescan): New function.
4528         (Plugin_manager::rescannable_defines): New function.
4529         (Plugin_manager::add_input_file): Set any_added_.
4530         * plugin.h (class Plugin_manager): define new fields rescannable_,
4531         undefined_symbols_, any_claimed_, and any_added_.  Declare
4532         Plugin_rescan as friend.  Declare new functions.
4533         (Plugin_manager::Rescannable): Define type.
4534         (Plugin_manager::Rescannable_list): Define type.
4535         (Plugin_manager::Undefined_symbol_list): Define type.
4536         (Plugin_manager::Plugin_manager): Initialize new fields.
4537         * archive.cc (Archive::defines_symbol): New function.
4538         (Add_archive_symbols::run): Pass archive to plugins if any.
4539         * archive.h (class Archive): Declare defines_symbol.
4540         * readsyms.cc (Input_group::~Input_group): New function.
4541         (Finish_group::run): Pass input_group to plugins if any.
4542         * readsyms.h (class Input_group): Declare destructor.
4543         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4544         any.
4545
4546 2011-01-10  Ian Lance Taylor  <iant@google.com>
4547
4548         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4549         section as relro.
4550         (Layout::set_segment_offsets): Reset increase_relro before calling
4551         set_section_addresses a second time.
4552
4553 2011-01-04  Cary Coutant  <ccoutant@google.com>
4554
4555         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4556         sections before NOBITS sections.
4557
4558 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4559
4560         * version.cc (print_version): Update copyright to 2011.
4561
4562 2010-12-23  Cary Coutant  <ccoutant@google.com>
4563
4564         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4565         of OS to this->add.  Add OD parameter to second form of the function.
4566
4567 2010-12-20  Ian Lance Taylor  <iant@google.com>
4568
4569         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4570         second of two consecutive entries with same offset.
4571
4572 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4573
4574         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4575         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4576         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4577         to avoid unneeded links against $(LDADD).
4578         * testsuite/Makefile.in: Regenerate.
4579
4580 2010-12-15  Ian Lance Taylor  <iant@google.com>
4581
4582         PR gold/12324
4583         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4584         for R_X86_64_32 and R_X86_64_PC32.
4585         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4586         ver_matching_def_pic.o.
4587         (ver_matching_def_pic.o): New target.
4588
4589 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4590
4591         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4592         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4593         Move definition before File_read::View member definitions.
4594         (File_read::View::~View): Initialize and hold lock before
4595         updating current_mapped_bytes.
4596
4597 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4598
4599         * dwarf_reader.cc: Remove outdated comment.
4600         * gold-threads.cc: Fix typo in error message.
4601         * archive.cc: Fix typos in comments.
4602         * archive.h: Likewise.
4603         * arm-reloc-property.cc: Likewise.
4604         * arm-reloc-property.h: Likewise.
4605         * arm-reloc.def: Likewise.
4606         * arm.cc: Likewise.
4607         * attributes.h: Likewise.
4608         * cref.cc: Likewise.
4609         * ehframe.cc: Likewise.
4610         * fileread.h: Likewise.
4611         * gold.h: Likewise.
4612         * i386.cc: Likewise.
4613         * icf.cc: Likewise.
4614         * incremental.h: Likewise.
4615         * int_encoding.cc: Likewise.
4616         * layout.h: Likewise.
4617         * main.cc: Likewise.
4618         * merge.h: Likewise.
4619         * object.cc: Likewise.
4620         * object.h: Likewise.
4621         * options.cc: Likewise.
4622         * readsyms.cc: Likewise.
4623         * reduced_debug_output.cc: Likewise.
4624         * reloc.cc: Likewise.
4625         * script-sections.cc: Likewise.
4626         * sparc.cc: Likewise.
4627         * symtab.h: Likewise.
4628         * target-reloc.h: Likewise.
4629         * target.cc: Likewise.
4630         * target.h: Likewise.
4631         * timer.cc: Likewise.
4632         * timer.h: Likewise.
4633         * x86_64.cc: Likewise.
4634
4635 2010-12-09  Cary Coutant  <ccoutant@google.com>
4636
4637         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4638         stack.
4639         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4640         parameter; change all callers.
4641         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4642         * options.h (warn_execstack): New option.
4643
4644 2010-12-07  Doug Kwan  <dougkwan@google.com>
4645
4646         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4647         like function call relocations.
4648
4649 2010-12-07  Ian Lance Taylor  <iant@google.com>
4650
4651         * archive.cc (Archive::get_elf_object_for_member): Permit
4652         punconfigured to be NULL.
4653         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4654         (Archive::include_member): Pass NULL to get_elf_object_for_member
4655         if we searched for the archive and this is the first included
4656         object.
4657
4658 2010-12-01  Ian Lance Taylor  <iant@google.com>
4659
4660         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4661         track_relocs_type_ field.
4662         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4663         Set track_relocs_type_.
4664         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4665         contents when using RELA relocs.
4666         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4667         reloc_map_.
4668         * reloc.cc (Track_relocs::next_addend): New function.
4669         * reloc.h (class Track_relocs): Declare next_addend.
4670
4671 2010-12-01  Ian Lance Taylor  <iant@google.com>
4672
4673         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4674         virtual destructor.
4675
4676 2010-12-01  Ian Lance Taylor  <iant@google.com>
4677
4678         * README: Update compilers known to work and fail.
4679
4680 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4681
4682         * configure.in: For --enable-gold, handle value `default' instead of
4683         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4684         not the default.
4685         * configure: Regenerate.
4686
4687 2010-11-18  Doug Kwan  <dougkwan@google.com>
4688
4689         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4690         and right_alignment to be zero.  Store result alignment only if it is
4691         greater than existing alignment.
4692
4693 2010-11-16  Cary Coutant  <ccoutant@google.com>
4694
4695         PR gold/12220
4696         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4697         Check for ".zdebug_line".
4698
4699 2010-11-16  Doug Kwan  <dougkwan@google.com>
4700             Cary Coutant  <ccoutant@google.com>
4701
4702         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4703         by reference; adjust all callers.
4704         * output.cc (Output_segment::set_section_addresses): Adjust references
4705         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4706         list is empty.
4707         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4708         end at page boundary.
4709
4710 2010-11-16  Cary Coutant  <ccoutant@google.com>
4711
4712         PR gold/12220
4713         * layout.cc (Layout::choose_output_section): Transform names of
4714         compressed sections even when using a script with a SECTIONS clause.
4715         (Layout::output_section_name): Remove code to transform
4716         compressed debug section names.
4717         * output.cc (Output_section::add_input_section): Use uncompressed
4718         section size when tracking input sections.
4719
4720 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4721
4722         * symtab.h (Symbol::NON_PIC_REF): Remove.
4723         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4724         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4725         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4726         (Symbol::use_plt_offset): Take a flags argument and pass it
4727         directly to needs_dynamic_reloc.  Restrict check for undefined
4728         weak symbols to function calls.
4729         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4730         (Target_arm::Scan::global): Use it.
4731         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4732         (Target_arm::Relocate::relocate): Likewise.
4733         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4734         parameter with an r_type parameter.  Use get_reference_flags
4735         to get the flags.
4736         (Target_arm::Relocate::relocate): Update accordingly.
4737         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4738         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4739         (Target_i386::Scan::global): Likewise.
4740         (Target_i386::Relocate::relocate): Likewise.
4741         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4742         parameter with an r_type parameter.  Use get_reference_flags
4743         to get the flags.
4744         (Target_i386::Relocate::relocate): Update accordingly.
4745         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4746         (Target_powerpc::Scan::global): Use it.
4747         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4748         (Target_powerpc::Relocate::relocate): Likewise.
4749         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4750         (Target_sparc::Scan::global): Use it.
4751         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4752         (Target_sparc::Relocate::relocate): Likewise.
4753         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4754         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4755         (Target_x86_64::Scan::global): Likewise.
4756         (Target_x86_64::Relocate::relocate): Likewise.
4757
4758 2010-11-08  Doug Kwan  <dougkwan@google.com>
4759             Cary Coutant  <ccoutant@google.com>
4760
4761         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4762         (Arm_exidx_merge_section::section_contents_): New data member.
4763         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4764         (Arm_input_section::~Arm_input_section): De-allocate memory.
4765         (Arm_input_section::original_contents_): New data member.
4766         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4767         in parameters instead of calling Object::section_contents without
4768         locking.
4769         (Arm_output_section::group_section): New parameter TASK.  Pass it
4770         to callees that need locking objects.
4771         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4772         to lock EXIDX input sections.  Fix a formatting issue.  Call
4773         Arm_exidx_merged_section::build_contents to create merged section
4774         contents.
4775         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4776         to lock object of stub table owner.
4777         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4778         TEXT_SIZE to initialize data member TEXT_SIZE_.
4779         (Arm_exidx_input_section::addralign): Fix typo in comment.
4780         (Arm_exidx_input_section::text_size): New method.
4781         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4782         that require locking objects.  Lock objects before scanning for stubs
4783         and updating local symbols.
4784         (Arm_input_section<big_endian>::init): Copy contents of original
4785         input section.
4786         (Arm_input_section<big_endian>::do_write): Use saved contents of
4787         original input section instead of calling Object::section_contents
4788         without locking.
4789         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4790         size without calling Object::section_size().
4791         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4792         for size.  Allocate a buffer for merged EXIDX entries.
4793         (Arm_exidx_merged_section::build_contents): New method.
4794         (Arm_exidx_merged_section::do_write): Move merge section contents
4795         building code to Arm_exidx_merged_section::build_contetns.  Write
4796         out contetns in buffer instead of building it on the fly.
4797         (Arm_relobj::make_exidx_input_section): Also pass text section size
4798         to Arm_exidx_input_section constructor.
4799         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4800         (Arm_dynobj::do_read_symbols): Fix memory leak.
4801         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4802         * target.h: (class Task): Add forward declaration.
4803         (Target::relax): Add new parameter TASK and pass it to
4804         Target::do_relax().
4805         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4806
4807 2010-11-05  Cary Coutant  <ccoutant@google.com>
4808
4809         PR gold/10708
4810         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4811         object when reading from the file.
4812         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4813         second layout pass.
4814         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4815         when reading section contents.
4816         (get_section_contents): Likewise.
4817         (icf::find_identical_sections): Likewise.
4818         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4819         object when reading from the file.
4820         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4821         the object when doing deferred section layout.
4822
4823 2010-11-03  Nick Clifton  <nickc@redhat.com>
4824
4825         PR gold/12001
4826         * script.h (class Symbol_assignment: name): New member.  Returns
4827         the name of the symbol.
4828         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4829         Returns true if the given symbol name is on the list of
4830         assignments wating to be processed.
4831         * archive.cc (should_incldue_member): If the symbol is undefined,
4832         check to see if it is on the list of symbols pending assignment.
4833
4834 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4835
4836         * script-sections.cc (Script_sections::find_memory_region): Check
4837         for a NULL output section pointer.
4838
4839 2010-10-29  Doug Kwan  <dougkwan@google.com>
4840
4841         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4842         Output_section::add_relaxed_input_section.
4843         * output.cc (Output_section::add_relaxed_input_section): Add new
4844         arguments LAYOUT and NAME.  Set section order index.
4845         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4846         Copy section order index.
4847         * output.h (Output_section::add_relaxed_input_section): Add new
4848         arguments LAYOUT and NAME.
4849
4850 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4851
4852         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4853         NATIVE_OR_CROSS_LINKER.
4854         * testsuite/Makefile.in: Regenerate.
4855
4856 2010-10-20  Doug Kwan  <dougkwan@google.com>
4857
4858         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4859         without SHF_LINK_ORDER flags.
4860         * layout.cc (Layout::choose_output_section): Do not filter
4861         SHF_LINK_ORDER flag in a relocatable link.
4862
4863 2010-10-17  Cary Coutant  <ccoutant@google.com>
4864
4865         * output.h (Output_segment::set_section_addresses): Change function
4866         signature.  Update all callers.
4867         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4868         sections.
4869         (Output_segment::set_section_addresses): Align after last TLS
4870         section.  Add padding before last relro section instead of after.
4871
4872 2010-10-17  Doug Kwan  <dougkwan@google.com>
4873
4874         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4875         GOT output section to be writable.
4876
4877 2010-10-14  Cary Coutant  <ccoutant@google.com>
4878
4879         * debug.h (DEBUG_INCREMENTAL): New flag.
4880         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4881         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4882         mode.
4883         * incremental.cc (report_command_line): Ignore all forms of
4884         --incremental.
4885         * layout.cc (Layout::Layout): Check parameters for incremental link
4886         mode.
4887         * options.cc (General_options::parse_incremental): New function.
4888         (General_options::parse_no_incremental): New function.
4889         (General_options::parse_incremental_full): New function.
4890         (General_options::parse_incremental_update): New function.
4891         (General_options::incremental_mode_): New data member.
4892         (General_options::finalize): Check incremental_mode_.
4893         * options.h (General_options): Update help text for --incremental.
4894         Add --no-incremental, --incremental-full, --incremental-update.
4895         (General_options::Incremental_mode): New enum type.
4896         (General_options::incremental_mode): New function.
4897         (General_options::incremental_mode_): New data member.
4898         * parameters.cc (Parameters::incremental_mode_): New data member.
4899         (Parameters::set_options): Set incremental_mode_.
4900         (Parameters::set_incremental_full): New function.
4901         (Parameters::incremental): New function.
4902         (Parameters::incremental_update): New function.
4903         (set_parameters_incremental_full): New function.
4904         * parameters.h (Parameters::set_incremental_full): New function.
4905         (Parameters::incremental): New function.
4906         (Parameters::incremental_update): New function.
4907         (Parameters::incremental_mode_): New data member.
4908         (set_parameters_incremental_full): New function.
4909         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4910         incremental link mode.
4911         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4912         (Sized_relobj::do_relocate_sections): Likewise.
4913         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4914         option.
4915         * testsuite/Makefile.in: Regenerate.
4916         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4917
4918 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4919
4920         * script-sections.h (class Script_sections): Make
4921         Sections_elements typedef public.
4922         * script-sections.cc (class Sort_output_sections): Add elements_
4923         field.  Add constructor which sets it; change all callers.
4924         (Sort_output_sections::is_before): New function.
4925         (Sort_output_sections::operator()): Call is_before.
4926         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4927         conditional.
4928         * testsuite/script_test_10.sh: New test. Test script section
4929         order.
4930         * testsuite/script_test_10.t: Likewise.
4931         * testsuite/script_test_10.s: Likewise.
4932         * testsuite/Makefile.am: Wrap the cross linker tests and the
4933         common tests into NATIVE_OR_CROSS_LINKER.
4934         (check_SCRIPTS): Add script_test_10.sh.
4935         (check_DATA): Add script_test_10.stdout.
4936         (script_test_10.o, script_test_10): New targets.
4937         (script_test_10.stdout): New target.
4938         * configure, testsuite/Makefile.in: Regenerate.
4939
4940 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4941
4942         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4943         error for the deprecated relocations.
4944         (Target_arm::Scan::global): Likewise.
4945         (Target_arm::Relocate::relocate): Likewise.
4946
4947 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4948
4949         * fileread.cc (Input_file::find_file): Initialize *found_name
4950         and *namep when using the fallback search for case 4.
4951
4952 2010-10-11  Cary Coutant  <ccoutant@google.com>
4953
4954         * options.h (class General_options): Redefine -z lazy as an alias for
4955         the negation of -z now.
4956
4957 2010-10-11  Ian Lance Taylor  <iant@google.com>
4958
4959         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4960         binding.
4961
4962 2010-10-06  Nick Clifton  <nickc@redhat.com>
4963
4964         * script-sections.cc(class Memory_region): Remove
4965         current_lma_offset_ field.  Rename current_vma_offset_ to
4966         current_offset_.  Add last_section_ field.
4967         (Memory_region::get_current_vma_address): Rename to
4968         get_current_address.
4969         (Memory_region::get_current_lma_address): Delete.
4970         (Memory_region::increment_vma_offset): Rename to
4971         increment_offset.
4972         (Memory_region::increment_lma_offset): Delete.
4973         (Memory_region::attributes_compatible): New method.  Returns
4974         true if the provided section is compatible with the region.
4975         (Memory_region::get_last_section): New method.  Returns the last
4976         section to use the region.
4977         (Memory_region::set_last_section): New method.  Stores the last
4978         section to use the region.
4979         (Script_sections::block_in_region): New method.  Returns true if
4980         a block of memory is contained within a region.
4981         (Script_sections::find_memory_region): New method.  Locates a
4982         memory region to be used to set a VMA or LMA address.
4983         (Output_section_definition::set_section_addresses): Add code to
4984         check for addresses set by memory regions.
4985         (Output_segment::set_section_addresses): Remove memory region
4986         walking code.
4987         (Script_sections::create_segment): Add a warning if a header
4988         segment is created outside of any region.
4989         * script-sections.h (class Script_sections): Add prototypes for
4990         find_memory_region and block_in_region methods.
4991         * testsuite/memory_test.s: Use .long instead of .word.
4992         * testsuite/memory_test.t: Add some more output sections.
4993         * testsuite/memory_test.sh: Update expected output.
4994
4995 2010-10-02  Doug Kwan  <dougkwan@google.com>
4996
4997         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4998         defintion to symtab.h
4999         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5000         declaration to defintion.
5001
5002 2010-10-01  Nick Clifton  <nickc@redhat.com>
5003
5004         * expression.cc (eval): Replace dummy argument with NULL.
5005         (eval_maybe_dot): Check for a NULL result section pointer.
5006         (Symbol_expression::value): Likewise.
5007         (Dot_expression::value): Likewise.
5008         (BINARY_EXPRESSION): Likewise.
5009         (Max_expression::value): Likewise.
5010         (Min_expression::value): Likewise.
5011         (Absolute_expression::value): Likewise.
5012         (Addr_expression::value_from_output_section): Likewise.
5013         (Loaddddr_expression::value_from_output_section): Likewise.
5014         (Segment_start_expression::value): Likewise.
5015         * script-sections.cc
5016         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5017         argument with NULL.
5018         (Sections_elememt_dot_assignment::set_section_addresses):
5019         Likewise.
5020         (Output_data_expression::do_write_to_buffer): Likewise.
5021         (Output_section_definition::finalize_symbols): Likewise.
5022         (Output_section_definition::set_section_addresses): Likewise.
5023
5024 2010-09-30  Doug Kwan  <dougkwan@google.com>
5025
5026         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5027
5028 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5029
5030         * target.h (Target::can_icf_inline_merge_sections): New virtual
5031         function.
5032         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5033         virtual function.
5034         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5035         virtual function.
5036         * icf.cc (get_section_contents): Inline merge sections only when
5037         target allows it.
5038
5039 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5040
5041         * configure: Regenerate.
5042
5043 2010-09-17  Ian Lance Taylor  <iant@google.com>
5044
5045         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5046         * testsuite/Makefile.am (memory_test.o): New target.
5047         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5048         memory_test.t.
5049         * testsuite/Makefile.in: Rebuild.
5050
5051 2010-09-17  Doug Kwan  <dougkwan@google.com>
5052
5053         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5054         defintion if relocation uses GOT entries of the symbol.
5055         * testsuite/icf_safe_test.sh: Fix test.
5056         * testsuite/icf_safe_so_test.sh: Fix test.
5057
5058 2010-09-16  Cary Coutant  <ccoutant@google.com>
5059
5060         * script_sections.cc (class Memory_region): Remove "NULL" from
5061         vector initializations.
5062
5063 2010-09-15  Cary Coutant  <ccoutant@google.com>
5064
5065         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5066         Resolve forwarding symbols.
5067
5068 2010-09-15  Doug Kwan  <dougkwan@google.com>
5069
5070         * gold/testsuite/script_test_3.t: Add ARM special sections.
5071         * gold/testsuite/script_test_4.t: Same.
5072         * gold/testsuite/script_test_5.t: Same.
5073         * gold/testsuite/script_test_6.t: Same.
5074         * gold/testsuite/script_test_7.t: Same.
5075         * gold/testsuite/script_test_7.t: Same.
5076         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5077
5078 2010-09-14  Cary Coutant  <ccoutant@google.com>
5079
5080         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5081         (Target_x86_64::Relocate::relocate_tls): Replace check for
5082         saw_tls_block_reloc_ with test for executable section.
5083
5084 2010-09-12  Cary Coutant  <ccoutant@google.com>
5085
5086         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5087         position-independent executables to shared libraries need dynamic
5088         relocations.
5089         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5090         position-independent executables.
5091         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5092         * testsuite/Makefile.in: Regenerate.
5093
5094 2010-09-10  Nick Clifton  <nickc@redhat.com>
5095
5096         PR gold/11997
5097         * testsuite/memory_test.t: Discard any sections that are not
5098         needed.
5099
5100 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5101
5102         PR gold/11996
5103         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5104         "This::" to work around a bug in gcc 4.2.
5105
5106         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5107
5108 2010-09-09  Rafael Espindola  <espindola@google.com>
5109
5110         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5111         sections with different PF_X flags in the same segment.
5112         (Layout::find_first_load_seg): Search all segments to find the first
5113         one.
5114         * options.h (rosegment): New.
5115
5116 2010-09-08  Rafael Espindola  <espindola@google.com>
5117
5118         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5119
5120 2010-09-08  Doug Kwan  <dougkwan@google.com>
5121
5122         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5123         (Arm_relobj::do_relocate_sections): Add new parameter for output
5124         file to match the parent.
5125         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5126         of local symbols instead of input values.  Update code to track
5127         changes in gold::relocate_section.
5128         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5129         (Sized_relobj::compute_final_local_value_internal): New methods.
5130         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5131         body into private version of Sized_relobj::compute_final_local_value.
5132         Call the inline method.
5133         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5134         merged symbol value if there is one.
5135         (Symbol_value::has_output_value): New method defintiion.
5136         (Sized_relobj::Compute_final_local_value_status): New enum type.
5137         (Sized_relobj::compute_final_local_value): New methods.
5138         (Sized_relobj::compute_final_local_value_internal): New methods.
5139         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5140         and arm_cortex_a8.sh.
5141         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5142         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5143         New tests.
5144         * Makefile.in: Regenerate.
5145         * testsuite/arm_bl_out_of_range.s: Update test.
5146         * testsuite/thumb_bl_out_of_range.s: Ditto.
5147         * testsuite/thumb_blx_out_of_range.s: Ditto.
5148         * testsuite/arm_branch_out_of_range.sh: New file.
5149         * testsuite/arm_cortex_a8.sh: Ditto.
5150         * testsuite/arm_cortex_a8_b.s: Ditto.
5151         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5152         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5153         * testsuite/arm_cortex_a8_bl.s: Ditto.
5154         * testsuite/arm_cortex_a8_blx.s: Ditto.
5155         * testsuite/arm_cortex_a8_local.s: Ditto.
5156         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5157         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5158
5159 2010-09-08  Rafael Espindola  <espindola@google.com>
5160
5161         * Makefile.am (memory_test.stdout): Run readelf with -W.
5162         * Makefile.in: Regenerate.
5163         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5164         64 bit output.
5165
5166 2010-09-08  Rafael Espindola  <espindola@google.com>
5167
5168         * script-sections.cc (Script_sections::add_memory_region): Convert
5169         field precision to int.
5170         * script.cc (script_set_section_region, script_set_section_region):
5171         Convert field precision to int.
5172
5173 2010-09-08  Rafael Espindola  <espindola@google.com>
5174
5175         * arm.cc (do_finalize_sections): Create the __exidx_start and
5176         __exdix_end symbols even when the section is missing.
5177
5178 2010-09-08  Nick Clifton  <nickc@redhat.com>
5179
5180         * README: Remove claim that MEMORY is not supported.
5181         * expression.cc (script_exp_function_origin)
5182         (script_exp_function_length): Move from here to ...
5183         * script.cc: ... here.
5184         (script_set_section_region, script_add_memory)
5185         (script_parse_memory_attr, script_include_directive): New
5186         functions.
5187         * script-sections.cc
5188         (class Memory_region): New class.
5189         (class Output_section_definition): Add set_memory_region,
5190         set_section_vma, set_section_lma and get_section_name methods.
5191         (class Script_Sections): Add add_memory_region,
5192         find_memory_region, find_memory_region_origin,
5193         find_memory_region_length and set_memory_region methods.
5194         Have set_section_addresses method walk the list of set memory
5195         regions.
5196         Extend the print methos to display memory regions.
5197         * script-sections.h: Add prototypes for new methods.
5198         Add enum for MEMORY region attributes.
5199         * yyscript.y: Add support for parsing MEMORY regions.
5200         * script-c.h: Add prototypes for new functions.
5201         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5202         * testsuite/Makefile.in: Regenerate.
5203         * testsuite/memory_test.sh: New script.
5204         * testsuite/memory_test.s: New assembler source file.
5205         * testsuite/memory_test.t: New linker script.
5206
5207 2010-08-27  Doug Kwan  <dougkwan@google.com>
5208
5209         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5210         reference override an existing dynamic weak reference.
5211         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5212         * testsuite/Makefile.in: Regenerate.
5213         * testsuite/dyn_weak_ref.sh: New file.
5214         * testsuite/dyn_weak_ref_1.c: Ditto.
5215         * testsuite/dyn_weak_ref_2.c: Ditto.
5216
5217 2010-08-27  Ian Lance Taylor  <iant@google.com>
5218
5219         * incremental.h (class Incremental_input_entry): Add virtual
5220         destructor.
5221
5222 2010-08-27  Ian Lance Taylor  <iant@google.com>
5223
5224         * testsuite/start_lib_test_3.c: Mark t3 as used.
5225
5226 2010-08-27  Nick Clifton  <nickc@redhat.com>
5227
5228         * options.cc (version_script): Fix small typo in previous
5229         whitespace tidyup.
5230
5231 2010-08-25  Nick Clifton  <nickc@redhat.com>
5232
5233         * archive.cc: Formatting fixes: Remove whitespace between
5234         typename and following asterisk.  Remove whitespace between
5235         function name and opening parenthesis.
5236         * archive.h: Likewise.
5237         * arm.cc: Likewise.
5238         * attributes.cc: Likewise.
5239         * attributes.h: Likewise.
5240         * common.cc: Likewise.
5241         * copy-relocs.cc: Likewise.
5242         * dirsearch.h: Likewise.
5243         * dynobj.cc: Likewise.
5244         * ehframe.cc: Likewise.
5245         * ehframe.h: Likewise.
5246         * expression.cc: Likewise.
5247         * fileread.cc: Likewise.
5248         * fileread.h: Likewise.
5249         * gc.h: Likewise.
5250         * gold-threads.cc: Likewise.
5251         * gold.cc: Likewise.
5252         * i386.cc: Likewise.
5253         * icf.h: Likewise.
5254         * incremental-dump.cc: Likewise.
5255         * incremental.cc: Likewise.
5256         * layout.cc: Likewise.
5257         * layout.h: Likewise.
5258         * main.cc: Likewise.
5259         * merge.cc: Likewise.
5260         * merge.h: Likewise.
5261         * object.cc: Likewise.
5262         * object.h: Likewise.
5263         * options.cc: Likewise.
5264         * options.h: Likewise.
5265         * output.cc: Likewise.
5266         * output.h: Likewise.
5267         * plugin.cc: Likewise.
5268         * plugin.h: Likewise.
5269         * powerpc.cc: Likewise.
5270         * reloc.cc: Likewise.
5271         * script-c.h: Likewise.
5272         * script-sections.cc: Likewise.
5273         * script.cc: Likewise.
5274         * stringpool.cc: Likewise.
5275         * symtab.cc: Likewise.
5276         * symtab.h: Likewise.
5277         * target.cc: Likewise.
5278         * timer.cc: Likewise.
5279         * timer.h: Likewise.
5280         * version.cc: Likewise.
5281         * x86_64.cc: Likewise.
5282
5283 2010-08-24  Nick Clifton  <nickc@redhat.com>
5284
5285         PR 11899
5286         * layout.cc (segment_precedes): Sort segments by their physical
5287         addresses, if they have been set.
5288
5289 2010-08-23  Cary Coutant  <ccoutant@google.com>
5290
5291         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5292         symbols data.
5293         (Lib_group::include_member): Unlock object after deleting its
5294         symbols data.
5295         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5296         the bug fixed here.
5297
5298 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5299             Cary Coutant  <ccoutant@google.com>
5300
5301         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5302         constructor, and set_blocker.
5303         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5304         readsyms_blocker_.
5305         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5306         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5307         * testsuite/Makefile.am (start_lib_test): New test case.
5308         * testsuite/Makefile.in: Regenerate.
5309         * testsuite/start_lib_test_main.c: New file.
5310         * testsuite/start_lib_test_1.c: New file.
5311         * testsuite/start_lib_test_2.c: New file.
5312         * testsuite/start_lib_test_3.c: New file.
5313
5314 2010-08-19  Ian Lance Taylor  <iant@google.com>
5315
5316         * Makefile.in: Rebuild with automake 1.11.1.
5317         * aclocal.m4: Likewise.
5318         * testsuite/Makefile.in: Likewise.
5319
5320 2010-08-19  Ian Lance Taylor  <iant@google.com>
5321
5322         PR 10893
5323         * i386.cc (class Output_data_plt_i386): Update declarations.
5324         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5325         local_ifuncs_ fields.
5326         (Target_i386::do_plt_section_for_global): New function.
5327         (Target_i386::do_plt_section_for_local): New function.
5328         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5329         parameter; change all callers.  Initialize global_ifuncs_ and
5330         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5331         __rel_iplt_end.
5332         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5333         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5334         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5335         symbols.
5336         (Target_i386::make_plt_section): New function, broken out of
5337         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5338         (Target_i386::make_plt_entry): Call make_plt_section.
5339         (Target_i386::make_local_ifunc_plt_entry): New function.
5340         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5341         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5342         R_386_IRELATIVE to switch.
5343         (Target_i386::Scan::global): Likewise.
5344         (Target_i386::Relocate::relocate): Likewise.
5345         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5346         switch.
5347         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5348         (Target_x86_64::do_plt_section_for_global): New function.
5349         (Target_x86_64::do_plt_section_for_local): New function.
5350         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5351         parameter; change all callers.  If doing a static link define
5352         __rela_iplt_start and __rela_iplt_end.
5353         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5354         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5355         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5356         to point to .plt.
5357         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5358         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5359         switch.
5360         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5361         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5362         R_X86_64_IRELATIVE to switch.
5363         (Target_x86_64::Scan::global): Likewise.
5364         (Target_x86_64::Relocate::relocate): Likewise.
5365         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5366         switch.
5367         * target.h (class Target): Add plt_section_for_global and
5368         plt_section_for_local functions.  Add do_plt_section_for_global
5369         and do_plt_section_for_local virtual functions.
5370         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5371         clarifying comments.
5372         (Symbol::use_plt_offset): Handle IFUNC symbol.
5373         * object.cc (Sized_relobj::Sized_relobj): Initialize
5374         local_plt_offsets_.
5375         (Sized_relobj::local_has_plt_offset): New function.
5376         (Sized_relobj::local_plt_offset): New function.
5377         (Sized_relobj::set_local_plt_offset): New function.
5378         (Sized_relobj::do_count): Handle IFUNC symbol.
5379         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5380         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5381         is_ifunc_symbol functions.
5382         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5383         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5384         local_plt_offsets_ field.
5385         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5386         * output.h (class Output_section_data): Add non-const
5387         output_section function.
5388         (class Output_data_got): Update declarations.
5389         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5390         Add use_plt_offset parameter to global and local constructors.
5391         Change all callers.  Change local_sym_index_ field to 31 bits.
5392         Change GSYM_CODE and CONSTANT_CODE accordingly.
5393         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5394         doing a static link don't set sh_link field.
5395         (Output_data_got::Got_entry::write): Use PLT offset if
5396         appropriate.
5397         (Output_data_got::add_global_plt): New function.
5398         (Output_data_got::add_local_plt): New function.
5399         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5400         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5401         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5402         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5403         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5404         IFUNC conditional.
5405         * testsuite/ifunc-sel.h: New file.
5406         * testsuite/ifuncmain1.c: New file.
5407         * testsuite/ifuncmain1vis.c: New file.
5408         * testsuite/ifuncmod1.c: New file.
5409         * testsuite/ifuncdep2.c: New file.
5410         * testsuite/ifuncmain2.c: New file.
5411         * testsuite/ifuncmain3.c: New file.
5412         * testsuite/ifuncmod3.c: New file.
5413         * testsuite/ifuncmain4.c: New file.
5414         * testsuite/ifuncmain5.c: New file.
5415         * testsuite/ifuncmod5.c: New file.
5416         * testsuite/ifuncmain6pie.c: New file.
5417         * testsuite/ifuncmod6.c: New file.
5418         * testsuite/ifuncmain7.c: New file.
5419         * configure, testsuite/Makefile.in: Rebuild.
5420
5421 2010-08-18  Ian Lance Taylor  <iant@google.com>
5422
5423         * incremental.cc
5424         (Output_section_incremental_inputs::write_input_files): Add cast
5425         to avoid signed/unsigned comparison warning.
5426         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5427
5428 2010-08-12  Cary Coutant  <ccoutant@google.com>
5429
5430         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5431
5432 2010-08-13  Ian Lance Taylor  <iant@google.com>
5433
5434         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5435
5436 2010-08-12  Cary Coutant  <ccoutant@google.com>
5437             Doug Kwan  <dougkwan@google.com>
5438
5439         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5440         defintion overrides non-weak undef, remember that the original undef
5441         is not weak.
5442         * symtab.cc (Symbol_table::sized_write_global): For undef without
5443         an original weak binding, set binding to global in output.
5444         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5445         * testsuite/Makefile.in: Regenerate.
5446         * testsuite/strong_ref_weak_def.sh: New file.
5447         * testsuite/strong_ref_weak_def_1.c: Ditto.
5448         * testsuite/strong_ref_weak_def_2.c: Ditto.
5449
5450 2010-08-12  Cary Coutant  <ccoutant@google.com>
5451
5452         * testsuite/incremental_test.sh: Rewrite.
5453         * testsuite/incremental_test_1.c: Rewrite.
5454         * testsuite/incremental_test_2.c: Rewrite.
5455
5456 2010-08-12  Cary Coutant  <ccoutant@google.com>
5457
5458         * arm.cc (Target_arm::got_size): Add const.
5459         (Target_arm::got_entry_count): New function.
5460         (Target_arm::plt_entry_count): New function.
5461         (Target_arm::first_plt_entry_offset): New function.
5462         (Target_arm::plt_entry_size): New function.
5463         (Output_data_plt_arm::entry_count): New function.
5464         (Output_data_plt_arm::first_plt_entry_offset): New function.
5465         (Output_data_plt_arm::get_plt_entry_size): New function.
5466         * i386.cc (Target_i386::got_size): Add const.
5467         (Target_i386::got_entry_count): New function.
5468         (Target_i386::plt_entry_count): New function.
5469         (Target_i386::first_plt_entry_offset): New function.
5470         (Target_i386::plt_entry_size): New function.
5471         (Output_data_plt_i386::entry_count): New function.
5472         (Output_data_plt_i386::first_plt_entry_offset): New function.
5473         (Output_data_plt_i386::get_plt_entry_size): New function.
5474         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5475         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5476         * incremental.cc: Include target.h.
5477         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5478         parameter.  Adjust all callers.  Find incremental_got_plt section.
5479         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5480         section.
5481         (Output_section_incremental_inputs::set_final_data_size): Calculate
5482         size of incremental_got_plt section.
5483         (Output_section_incremental_inputs::do_write): Write the
5484         incremental_got_plt section.
5485         (Got_plt_view_info): New struct.
5486         (Local_got_offset_visitor): New class.
5487         (Global_got_offset_visitor): New class.
5488         (Global_symbol_visitor_got_plt): New class.
5489         (Output_section_incremental_inputs::write_got_plt): New function.
5490         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5491         Add parameter.  Adjust all callers.
5492         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5493         (Incremental_inputs::got_plt_section): New function.
5494         (Incremental_inputs::got_plt_section_): New data member.
5495         (Incremental_got_plt_reader): New class.
5496         * layout.cc (Layout::create_incremental_info_sections): Add the
5497         incremental_got_plt section.
5498         * object.h (Got_offset_list::get_list): New function.
5499         (Got offset_list::for_all_got_offsets): New function.
5500         (Sized_relobj::local_got_offset_list): New function.
5501         * powerpc.cc (Target_powerpc::got_size): Add const.
5502         (Target_powerpc::got_entry_count): New function.
5503         (Target_powerpc::plt_entry_count): New function.
5504         (Target_powerpc::first_plt_entry_offset): New function.
5505         (Target_powerpc::plt_entry_size): New function.
5506         (Output_data_plt_powerpc::entry_count): New function.
5507         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5508         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5509         * sparc.cc (Target_sparc::got_size): Add const.
5510         (Target_sparc::got_entry_count): New function.
5511         (Target_sparc::plt_entry_count): New function.
5512         (Target_sparc::first_plt_entry_offset): New function.
5513         (Target_sparc::plt_entry_size): New function.
5514         (Output_data_plt_sparc::entry_count): New function.
5515         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5516         (Output_data_plt_sparc::get_plt_entry_size): New function.
5517         * symtab.h (Symbol::got_offset_list): New function.
5518         (Symbol_table::for_all_symbols): New function.
5519         * target.h (Sized_target::got_entry_count): New function.
5520         (Sized_target::plt_entry_count): New function.
5521         (Sized_target::plt_entry_size): New function.
5522         * x86_64.cc (Target_x86_64::got_size): Add const.
5523         (Target_x86_64::got_entry_count): New function.
5524         (Target_x86_64::plt_entry_count): New function.
5525         (Target_x86_64::first_plt_entry_offset): New function.
5526         (Target_x86_64::plt_entry_size): New function.
5527         (Output_data_plt_x86_64::entry_count): New function.
5528         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5529         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5530
5531 2010-08-12  Cary Coutant  <ccoutant@google.com>
5532
5533         * archive.cc: Include incremental.h.
5534         (Archive::Archive): Initialize incremental_info_.
5535         (Archive::include_member): Record archive members in incremental info.
5536         (Add_archive_symbols::run): Record begin and end of an archive in
5537         incremental info.
5538         (Lib_group::include_member): Record objects in incremental info.
5539         * archive.h (Incremental_archive_entry): Forward declaration.
5540         (Archive::set_incremental_info): New member function.
5541         (Archive::incremental_info): New member function.
5542         (Archive::Unused_symbol_iterator): New class.
5543         (Archive::unused_symbols_begin): New member function.
5544         (Archive::unused_symbols_end): New member function.
5545         (Archive::incremental_info_): New data member.
5546         * incremental-dump.cc (find_input_containing_global): New function.
5547         (dump_incremental_inputs): Dump new incremental info sections.
5548         * incremental.cc: Include symtab.h.
5549         (Output_section_incremental_inputs): New class.
5550         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5551         new incremental info sections.
5552         (Sized_incremental_binary::do_check_inputs): Likewise.
5553         (Incremental_inputs::report_archive): Remove.
5554         (Incremental_inputs::report_archive_begin): New function.
5555         (Incremental_inputs::report_archive_end): New function.
5556         (Incremental_inputs::report_object): New function.
5557         (Incremental_inputs::finalize_inputs): Remove.
5558         (Incremental_inputs::report_input_section): New function.
5559         (Incremental_inputs::report_script): Rewrite.
5560         (Incremental_inputs::finalize): Do nothing but finalize string table.
5561         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5562         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5563         (Incremental_inputs::create_data_sections): New function.
5564         (Incremental_inputs::relocs_entsize): New function.
5565         (Output_section_incremental_inputs::set_final_data_size): New function.
5566         (Output_section_incremental_inputs::do_write): New function.
5567         (Output_section_incremental_inputs::write_header): New function.
5568         (Output_section_incremental_inputs::write_input_files): New function.
5569         (Output_section_incremental_inputs::write_info_blocks): New function.
5570         (Output_section_incremental_inputs::write_symtab): New function.
5571         * incremental.h (Incremental_script_entry): Forward declaration.
5572         (Incremental_object_entry): Forward declaration.
5573         (Incremental_archive_entry): Forward declaration.
5574         (Incremental_inputs): Forward declaration.
5575         (Incremental_inputs_header_data): Remove.
5576         (Incremental_inputs_header): Remove.
5577         (Incremental_inputs_header_write): Remove.
5578         (Incremental_inputs_entry_data): Remove.
5579         (Incremental_inputs_entry): Remove.
5580         (Incremental_inputs_entry_write): Remove.
5581         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5582         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5583         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5584         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5585         Likewise.
5586         (Incremental_input_entry): New class.
5587         (Incremental_script_entry): New class.
5588         (Incremental_object_entry): New class.
5589         (Incremental_archive_entry): New class.
5590         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5591         (Incremental_inputs::report_inputs): Remove.
5592         (Incremental_inputs::report_archive): Remove.
5593         (Incremental_inputs::report_archive_begin): New function.
5594         (Incremental_inputs::report_archive_end): New function.
5595         (Incremental_inputs::report_object): Change prototype.
5596         (Incremental_inputs::report_input_section): New function.
5597         (Incremental_inputs::report_script): Change prototype.
5598         (Incremental_inputs::get_reloc_count): New function.
5599         (Incremental_inputs::set_reloc_count): New function.
5600         (Incremental_inputs::create_data_sections): New function.
5601         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5602         (Incremental_inputs::inputs_section): New function.
5603         (Incremental_inputs::symtab_section): New function.
5604         (Incremental_inputs::relocs_section): New function.
5605         (Incremental_inputs::get_stringpool): Add const.
5606         (Incremental_inputs::command_line): Add const.
5607         (Incremental_inputs::inputs): Remove.
5608         (Incremental_inputs::command_line_key): New function.
5609         (Incremental_inputs::input_file_count): New function.
5610         (Incremental_inputs::input_files): New function.
5611         (Incremental_inputs::relocs_entsize): New function.
5612         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5613         (Incremental_inputs::finalize_inputs): Remove.
5614         (Incremental_inputs::Input_info): Remove.
5615         (Incremental_inputs::lock_): Remove.
5616         (Incremental_inputs::inputs_): Change type.
5617         (Incremental_inputs::inputs_map_): Remove.
5618         (Incremental_inputs::current_object_entry_): New data member.
5619         (Incremental_inputs::inputs_section_): New data member.
5620         (Incremental_inputs::symtab_section_): New data member.
5621         (Incremental_inputs::relocs_section_): New data member.
5622         (Incremental_inputs::reloc_count_): New data member.
5623         (Incremental_inputs_reader): New class.
5624         (Incremental_symtab_reader): New class.
5625         (Incremental_relocs_reader): New class.
5626         * layout.cc (Layout::finalize): Move finalization of incremental info
5627         and creation of incremental info sections to follow finalization of
5628         symbol table.  Set offsets for postprocessing sections.
5629         (Layout::create_incremental_info_sections): Call
5630         Incremental_inputs::create_data_sections.  Add incremental symtab
5631         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5632         sections to layout after input sections.
5633         * layout.h (struct Timespec): Forward declaration.
5634         (Layout::incremental_inputs): Add const.
5635         (Layout::create_incremental_info_sections): Add parameter.
5636         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5637         * object.cc: Include incremental.h.
5638         (Relobj::finalize_incremental_relocs): New function.
5639         (Sized_relobj::do_layout): Record input sections in incremental info.
5640         * object.h (Object::output_section): New function.
5641         (Object::output_section_offset): Moved from Relobj.
5642         (Object::get_incremental_reloc_base): New function.
5643         (Object::get_incremental_reloc_count): New function.
5644         (Object::do_output_section): New function.
5645         (Object::do_output_section_offset): Moved from Relobj.
5646         (Object::do_get_incremental_reloc_base): New function.
5647         (Object::do_get_incremental_reloc_count): New function.
5648         (Object::Object): Initialize new data members.
5649         (Relobj::output_section): Renamed do_output_section and moved to
5650         protected.
5651         (Relobj::output_section_offset): Moved to Object.
5652         (Relobj::do_get_incremental_reloc_base): New function.
5653         (Relobj::do_get_incremental_reloc_count): New function.
5654         (Relobj::allocate_incremental_reloc_counts): New function.
5655         (Relobj::count_incremental_reloc): New function.
5656         (Relobj::finalize_incremental_relocs): New function.
5657         (Relobj::next_incremental_reloc_index): New function.
5658         (Relobj::reloc_counts_): New data member.
5659         (Relobj::reloc_bases_): New data member.
5660         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5661         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5662         (Sized_relobj::incremental_relocs_scan): New function.
5663         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5664         (Sized_relobj::incremental_relocs_write): New function.
5665         (Sized_relobj::incremental_relocs_write_reltype): New function.
5666         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5667         incremental link.
5668         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5669         archives and object files elsewhere.
5670         (Add_symbols::run): Report object files here.
5671         (Finish_group::run): Report end of archive at end of group.
5672         * reloc.cc: Include layout.h, incremental.h.
5673         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5674         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5675         (Sized_relobj::incremental_relocs_scan): New function.
5676         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5677         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5678         (Sized_relobj::incremental_relocs_write): New function.
5679         (Sized_relobj::incremental_relocs_write_reltype): New function.
5680         * script.cc (read_input_script): Rewrite test for incremental link.
5681         Change call to Incremental_inputs::report_script.
5682         * symtab.h (Symbol_table::first_global_index): New function.
5683         (Symbol_table::output_count): New function.
5684
5685 2010-08-12  Doug Kwan  <dougkwan@google.com>
5686
5687         * arm.cc (Target_arm::merge_object_attributes): Check command line
5688         options --no-wchar-size-warning and --no-enum-size-warning.
5689         * options.h (General_options): Add ld-compatible options
5690         --no-enum-size-warning and --no-wchar-size-warning.
5691
5692 2010-08-04  Ian Lance Taylor  <iant@google.com>
5693
5694         * x86_64.cc (Target_x86_64::Scan::local): Use
5695         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5696         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5697         (Target_x86_64::Scan::global): Likewise.
5698         (Target_x86_64::Relocate::relocate): Likewise.
5699         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5700         Likewise.
5701
5702 2010-08-03  Cary Coutant  <ccoutant@google.com>
5703
5704         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5705         to reserve space in merged_strings vector. Keep total input size
5706         for stats.
5707         (Output_merge_string::do_print_merge_stats): Print total input size.
5708         * merge.h (Output_merge_string): Add input_size_ field.
5709         * stringpool.cc (Stringpool_template::string_length): Move
5710         implementations out of Stringpool_template class and place in
5711         stringpool.h.
5712         * stringpool.h (string_length): Move out of Stringpool_template.
5713
5714 2010-08-03  Ian Lance Taylor  <iant@google.com>
5715
5716         PR 11712
5717         * layout.cc (relaxation_loop_body): If address of load segment is
5718         set, adjust address to include headers if possible.
5719
5720 2010-08-03  Ian Lance Taylor  <iant@google.com>
5721
5722         * version.cc (version_string): Bump to 1.10.
5723
5724 2010-08-03  Ian Lance Taylor  <iant@google.com>
5725
5726         PR 11805
5727         * layout.h (enum Output_section_order): Define.
5728         (class Layout): Update declarations.
5729         * layout.cc (Layout::get_output_section): Add order parameter.
5730         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5731         is_first_non_relro parameters.  Change all callers.
5732         (Layout::choose_output_section): Likewise.
5733         (Layout::add_output_section_data): Likewise.
5734         (Layout::make_output_section): Likewise.  Set order.
5735         (Layout::default_section_order): New function.
5736         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5737         * output.cc (Output_section::Output_section): Initialize order_.
5738         Don't initialize deleted fields.
5739         (Output_segment::Output_segment): Don't initialize deleted
5740         fields.
5741         (Output_segment::add_output_section_to_load): New function
5742         replacing add_output_section.  Change all callers to call this or
5743         add_output_section_to_nonload.
5744         (Output_segment::add_output_section_to_nonload): New function.
5745         (Output_segment::remove_output_section): Rewrite.
5746         (Output_segment::add_initial_output_data): Likewise.
5747         (Output_segment::has_any_data_sections): Likewise.
5748         (Output_segment::is_first_section_relro): Likewise.
5749         (Output_segment::maximum_alignment): Likewise.
5750         (Output_segment::has_dynamic_reloc): New function replacing
5751         dynamic_reloc_count.  Change all callers.
5752         (Output_segment::has_dynamic_reloc_list): New function replacing
5753         dynamic_reloc_count_list.  Change all callers.
5754         (Output_segment::set_section_addresses): Rewrite.
5755         (Output_segment::set_offset): Rewrite.
5756         (Output_segment::find_first_and_last_list): Remove.
5757         (Output_segment::set_tls_offsets): Rewrite.
5758         (Output_segment::first_section_load_address): Likewise.
5759         (Output_segment::output_section_count): Likewise.
5760         (Output_segment::section_with_lowest_load_address): Likewise.
5761         (Output_segment::write_section_headers): Likewise.
5762         (Output_segment::print_sections_to_map): Likewise.
5763         * output.h (class Output_data): Remove dynamic_reloc_count_
5764         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5765         (Output_data::add_dynamic_reloc): Rewrite.
5766         (Output_data::has_dynamic_reloc): New function.
5767         (Output_data::dynamic_reloc_count): Remove.
5768         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5769         is_last_relro_, is_first_non_relro_, is_interp_,
5770         is_dynamic_linker_section_ fields.  Add order and set_order
5771         functions.  Remove is_relro_local, set_is_relro_local,
5772         is_last_relro, set_is_last_relro, is_first_non_relro,
5773         set_is_first_non_relro functions, is_interp, set_is_interp,
5774         is_dynamic_linker_section, and set_is_dynamic_linker_section
5775         functions.
5776         (class Output_segment): Change Output_data_list from std::list to
5777         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5778         output_bss_ fields.  Update declarations.
5779
5780 2010-08-02  Ian Lance Taylor  <iant@google.com>
5781
5782         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5783         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5784         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5785
5786 2010-08-02  Ian Lance Taylor  <iant@google.com>
5787
5788         PR 11855
5789         * script.cc (Script_options::Script_options): Initialize
5790         symbol_definitions_ and symbol_references_.
5791         (Script_options::add_symbol_assignment): Update
5792         symbol_definitions_ and symbol_references_.
5793         (Script_options::add_symbol_reference): New function.
5794         (script_symbol): New function.
5795         * script.h (class Script_options): Add symbol_definitions_ and
5796         symbol_references_ fields.
5797         (Script_options::referenced_const_iterator): New type.
5798         (Script_options::referenced_begin): New function.
5799         (Script_options::referenced_end): New function.
5800         (Script_options::is_referenced): New function.
5801         (Script_options::any_unreferenced): New function.
5802         * script-c.h (script_symbol): Declare.
5803         * yyscript.y (exp): Call script_symbol.
5804         * symtab.cc: Include "script.h".
5805         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5806         Change all callers.  Check symbols referenced by scripts.
5807         (Symbol_table::add_undefined_symbols_from_command_line): Add
5808         layout parameter.  Change all callers.
5809         (Symbol_table::do_add_undefined_symbols_from_command_line):
5810         Likewise.  Break out loop body.  Check symbols referenced by
5811         scripts.
5812         (Symbol_table::add_undefined_symbol_from_command_line): New
5813         function broken out of
5814         do_add_undefined_symbols_from_command_line.
5815         * symtab.h (class Symbol_table): Update declarations.
5816         * archive.cc: Include "layout.h".
5817         (Archive::should_include_member): Add layout parameter.  Change
5818         all callers.  Check for symbol mentioned in expression.
5819         * archive.h (class Archive): Update declaration.
5820         * object.cc (Sized_relobj::do_should_include_member): Add layout
5821         parameter.
5822         * object.h (Object::should_include_member): Add layout parameter.
5823         Change all callers.
5824         (Object::do_should_include_member): Add layout parameter.
5825         (class Sized_relobj): Update declaration.
5826         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5827         parameter.
5828         * dynobj.h (class Sized_dynobj): Update declaration.
5829         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5830         layout parameter.
5831         * plugin.h (class Sized_pluginobj): Update declaration.
5832
5833 2010-08-02  Ian Lance Taylor  <iant@google.com>
5834
5835         PR 11866
5836         * output.cc (Output_segment::set_offset): Search for the first and
5837         last sections rather than assuming that the list is in order.
5838         (Output_segment::find_first_and_last_list): New function.
5839         * output.h (class Output_segment): Update declarations.
5840         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5841         (relro_strip_test_SOURCES): New variable.
5842         (relro_strip_test_DEPENDENCIES): New variable.
5843         (relro_strip_test_LDFLAGS): New variable.
5844         (relro_strip_test_LDADD): New variable.
5845         (relro_strip_test.so): New target.
5846
5847 2010-08-02  Ian Lance Taylor  <iant@google.com>
5848
5849         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5850         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5851         (Target_i386::got_tlsdesc_section): New function.
5852         (Target_i386::got_section): Create space for GOT entries for
5853         TLSDESC relocations.
5854         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5855         R_386_TLS_GOTDESC.
5856         (Target_i386::Scan::global): Likewise.
5857         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5858         using TLSDESC GOT.
5859         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5860         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5861         (Target_x86_64::got_tlsdesc_section): New function.
5862         (Target_x86_64::got_section): Create space for GOT entries for
5863         TLSDESC relocations.
5864         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5865         R_386_TLS_GOTDESC.
5866         (Target_x86_64::Scan::global): Likewise.
5867         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5868         using TLSDESC GOT.
5869
5870 2010-08-02  Ian Lance Taylor  <iant@google.com>
5871
5872         * testsuite/final_layout.sh: Use dc to convert from hex to
5873         decimal.
5874
5875 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5876
5877         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5878         paramter to the call to gold::gc_process_relocs.
5879         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5880         paramter to the call to gold::gc_process_relocs.
5881         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5882         parameter to the call to gold::gc_process_relocs.
5883         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5884         template parameter to the call to gold::gc_process_relocs.
5885         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5886         paramter to the call to gold::gc_process_relocs.
5887         * gc.h (get_embedded_addend_size): New function.
5888         (gc_process_relocs): Save the size of the reloc for use by ICF.
5889         * icf.cc (get_section_contents): Get the addend from the text section
5890         for SHT_REL relocation sections.
5891         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5892         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5893         * int_encoding.h (read_from_pointer): New overloaded function.
5894         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5895         * testsuite/icf_sht_rel_addend_test.sh: New file.
5896         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5897         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5898
5899 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5900
5901         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5902         * Makefile.in: Regenerate.
5903         * testsuite/Makefile.in: Regenerate.
5904
5905 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5906
5907         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5908         * gold/testsuite/debug_msg.cc: Likewise.
5909         * gold/testsuite/odr_violation1.cc
5910         * gold/testsuite/odr_violation2.cc
5911
5912 2010-07-21  Cary Coutant  <ccoutant@google.com>
5913
5914         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5915         string, and length fields.
5916         (Output_merge_string::Merged_strings_list): New type.
5917         (Output_merge_string::Merged_strings_lists): New typedef.
5918         (Output_merge_string): Replace merged_strings_ with
5919         merged_strings_lists_.
5920         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5921         Merged_strings_list per input object and section.  Don't store pointer
5922         to the string.  Don't store length with each merged string entry.
5923         (Output_merge_string::finalize_merged_data): Loop over list of merged
5924         strings lists.  Recompute length of each merged string.
5925
5926 2010-07-15  Cary Coutant  <ccoutant@google.com>
5927
5928         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5929         here.
5930
5931 2010-07-14  Ian Lance Taylor  <iant@google.com>
5932
5933         * descriptors.cc (Descriptors::open): Report correct name in error
5934         message.
5935
5936 2010-07-13  Doug Kwan  <dougkwan@google.com>
5937
5938         * arm.cc (Arm_input_section::Arm_input_section): For a
5939         SHT_ARM_EXIDX section, always keeps the input sections.
5940         (Arm_input_section::set_exidx_section_link): New method.
5941         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5942         has_errors_ to false.
5943         (Arm_exidx_input_section::has_errors,
5944         Arm_exidx_input_section::set_has_errors): New methods.
5945         (Arm_exidx_input_section::has_errors_): New data member.
5946         (Arm_relobj::get_exidx_shndx_list): New method.
5947         (Arm_output_section::append_text_sections_to_list): Do not skip
5948         section without SHF_EXECINSTR.
5949         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5950         errors.
5951         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5952         section header.  Make error messages more verbose.  Check for
5953         a non-executable section linked to an EXIDX section.
5954         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5955         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5956         check that there is no deferred EXIDX section if we exit early.
5957         Instead of not making an EXIDX section in case of an error, make one
5958         and set the has_errors flag of it.
5959         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5960         in a relocatable link.
5961         (Target_arm::do_relax): Look for the EXIDX output section instead of
5962         assuming that it is called .ARM.exidx.
5963         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5964         section list.  Do not check for SHF_EXECINSTR section flags but
5965         skip any input section with errors.
5966         * output.cc (Output_section::Output_section): Initialize
5967         always_keeps_input_sections_ to false.
5968         (Output_section::add_input_section): Check for
5969         always_keeps_input_sections_.
5970         *  output.h (Output_section::always_keeps_input_sections,
5971         Output_section::set_always_keeps_input_sections): New methods.
5972         (Output_section::always_keeps_input_sections): New data member.
5973
5974 2010-07-13  Rafael Espindola  <espindola@google.com>
5975
5976         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5977         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5978
5979 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5980             Ian Lance Taylor  <iant@google.com>
5981
5982         * output.h (Output_section_lookup_maps::add_merge_section):
5983         Correct check of whether value was inserted.
5984         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5985         (Output_section_lookup_maps::add_relaxed_input_section):
5986         Likewise.
5987         * arm.cc (Target_arm::got_section): Remove used local os.
5988         * i386.cc (Target_i386::got_section): Likewise.
5989         * x86_64.cc (Target_x86_64::got_section): Likewise.
5990         * sparc.cc (Target_sparc::got_section): Likewise.
5991         (Target_sparc::relocate): Remove unused local have_got_offset.
5992         * powerpc.cc (Target_powerpc::relocate): Likewise.
5993
5994 2010-07-13  Ian Lance Taylor  <iant@google.com>
5995
5996         * compressed_output.cc (zlib_decompress): Fix signature in
5997         !HAVE_ZLIB_H case.
5998
5999         * archive.cc (Archive::include_member): Unlock an external member
6000         of a thin archive.  Don't bother to delete an object we know is
6001         NULL.
6002
6003 2010-07-12  Cary Coutant  <ccoutant@google.com>
6004
6005         * compressed_output.cc (zlib_decompress): New function.
6006         (get_uncompressed_size): New function.
6007         (decompress_input_section): New function.
6008         * compressed_output.h (get_uncompressed_size): New function.
6009         (decompress_input_section): New function.
6010         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6011         Handle compressed debug sections.
6012         * layout.cc (is_compressed_debug_section): New function.
6013         (Layout::output_section_name): Map compressed section names to
6014         canonical names.
6015         * layout.h (is_compressed_debug_section): New function.
6016         (is_debug_info_section): Recognize compressed debug sections.
6017         * merge.cc: Include compressed_output.h.
6018         (Output_merge_data::do_add_input_section): Handle compressed
6019         debug sections.
6020         (Output_merge_string::do_add_input_section): Handle compressed
6021         debug sections.
6022         * object.cc: Include compressed_output.h.
6023         (Sized_relobj::Sized_relobj): Initialize new data members.
6024         (build_compressed_section_map): New function.
6025         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6026         * object.h (Object::section_is_compressed): New method.
6027         (Object::do_section_is_compressed): New method.
6028         (Sized_relobj::Compressed_section_map): New type.
6029         (Sized_relobj::do_section_is_compressed): New method.
6030         (Sized_relobj::compressed_sections_): New data member.
6031         * output.cc (Output_section::add_input_section): Handle compressed
6032         debug sections.
6033         * reloc.cc: Include compressed_output.h.
6034         (Sized_relobj::write_sections): Handle compressed debug sections.
6035
6036 2010-07-08  Cary Coutant  <ccoutant@google.com>
6037
6038         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6039         weak when resolving to a dynamic def.
6040         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6041         for weak undef/dynamic def cases. Adjust callers.
6042         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6043         undef_binding_weak_.
6044         (Symbol_table::sized_write_globals): Adjust symbol binding.
6045         (Symbol_table::sized_write_symbol): Add binding parameter.
6046         * symtab.h (Symbol::set_undef_binding): New method.
6047         (Symbol::is_undef_binding_weak): New method.
6048         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6049         (Symbol_table::should_override): Add new parameter.
6050         (Symbol_table::sized_write_symbol): Add new parameter.
6051
6052         * testsuite/weak_undef_file1.cc: Add new test case.
6053         * testsuite/weak_undef_file2.cc: Fix header comment.
6054         * testsuite/weak_undef_test.cc: Add new test case.
6055
6056 2010-06-29  Doug Kwan  <dougkwan@google.com>
6057
6058         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6059         Initialize USE_SYMBOL_.
6060         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6061         definition.
6062         (Arm_reloc_property::uses_symbol_): New data member declaration.
6063         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6064         uses symbol value and symbol is undefined but not weakly undefined.
6065
6066 2010-06-28  Rafael Espindola  <espindola@google.com>
6067
6068         * plugin.cc (Plugin::load): Use dlerror.
6069
6070 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6071
6072         * symtab.cc (detect_odr_violations): When reporting an ODR
6073         violation, report an object where the symbol is defined.
6074
6075 2010-06-25  Doug Kwan  <dougkwan@google.com>
6076
6077         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6078         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6079         definition.
6080         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6081         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6082         target hook to detect function points.
6083         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6084         * icf.h (Icf::check_section_for_function_pointers): Change type of
6085         parameter SECTION_NAME to const reference to std::string.  Use
6086         target hook to determine if section may have unsafe pointers.
6087         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6088         method definition.
6089
6090 2010-06-21  Rafael Espindola  <espindola@google.com>
6091
6092         * fileread.cc (Input_file::find_fie): New
6093         (Input_file::open): Use Input_file::find_fie.
6094         * fileread.h (Input_file::find_fie): New
6095         * plugin.cc (set_extra_library_path): New.
6096         (Plugin::load): Add set_extra_library_path to the transfer vector.
6097         (Plugin_manager::set_extra_library_path): New.
6098         (Plugin_manager::add_input_file): Use the extra search path if set.
6099         (set_extra_library_path(): New.
6100         * plugin.h (Plugin_manager): Add set_extra_library_path and
6101         extra_search_path_.
6102
6103 2010-06-19  Cary Coutant  <ccoutant@google.com>
6104
6105         * layout.cc (gdb_sections): Add .debug_types.
6106         (lines_only_debug_sections): Likewise.
6107
6108 2010-06-18  Rafael Espindola  <espindola@google.com>
6109
6110         * plugin.cc (add_input_file,add_input_library)
6111         (Plugin_manager::add_input_file): Make filename arguments const.
6112         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6113         const.
6114
6115 2010-06-16  Doug Kwan  <dougkwan@google.com>
6116
6117         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6118         .ARM.attributes section if we have not merged any input
6119         attributes sections.
6120
6121 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6122
6123         * arm.cc: Allow combining objects with no EABI version
6124         information.
6125
6126 2010-06-15  Rafael Espindola  <espindola@google.com>
6127
6128         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6129
6130 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6131
6132         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6133         (struct iovec): Correct !HAVE_READV definition.
6134
6135 2010-06-10  Cary Coutant  <ccoutant@google.com>
6136
6137         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6138         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6139         reloc sections.
6140         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6141
6142         PR 11683
6143         * symtab.h (Symbol::is_placeholder): New member function.
6144         * target-reloc.h (relocate_section): Check for placeholder symbols.
6145
6146         * testsuite/Makefile.am (plugin_test_8): New test.
6147         (plugin_test_9): New test.
6148         * testsuite/Makefile.in: Regenerate.
6149
6150 2010-06-09  Nick Clifton  <nickc@redhat.com>
6151
6152         * yyscript.y (input_list_element): Allow strings prefixed with
6153         the '-' character.  Treat these as libraries.
6154         * script.cc (script_add_library): New function.  Adds a library
6155         specified by "-l<name>" found in an input script.
6156         * script-c.h: Add prototype for script_add_library.
6157
6158 2010-06-07  Doug Kwan  <dougkwan@google.com>
6159
6160         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6161         Restrict stub-group size to be within long conditional branch
6162         range when working around cortex-A8 erratum.
6163
6164 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6165
6166         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6167         #ifdef typo.
6168
6169 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6170
6171         PR gold/11658
6172         * output.cc
6173         (Output_section::Input_section_sort_entry::compare_section_ordering):
6174         Change to return non-zero correctly.
6175         (Output_section::Input_section_sort_section_order_index_compare
6176         ::operator()): Change to fix ambiguity in comparisons.
6177
6178 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6179
6180         * gold.h (is_wildcard_string): New function.
6181         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6182         (Layout::layout_eh_frame): Ditto.
6183         (Layout::find_section_order_index): New method.
6184         (Layout::read_layout_from_file): New method.
6185         * layout.h (Layout::find_section_order_index): New method.
6186         (Layout::read_layout_from_file): New method.
6187         (Layout::input_section_position_): New private member.
6188         (Layout::input_section_glob_): New private member.
6189         * main.cc (main): Call read_layout_from_file here.
6190         * options.h (--section-ordering-file): New option.
6191         * output.cc (Output_section::input_section_order_specified_): New
6192         member.
6193         (Output_section::Output_section): Initialize new member.
6194         (Output_section::add_input_section): Add new parameter.
6195         Keep input sections when --section-ordering-file is used.
6196         (Output_section::set_final_data_size): Sort input sections when
6197         section ordering file is specified.
6198         (Output_section::Input_section_sort_entry): Add new parameter.
6199         Check sorting type.
6200         (Output_section::Input_section_sort_entry::compare_section_ordering):
6201         New method.
6202         (Output_section::Input_section_sort_compare::operator()): Change to
6203         consider section_order_index.
6204         (Output_section::Input_section_sort_init_fini_compare::operator()):
6205         Change to consider section_order_index.
6206         (Output_section::Input_section_sort_section_order_index_compare
6207         ::operator()): New method.
6208         (Output_section::sort_attached_input_sections): Change to sort
6209         according to section order when specified.
6210         (Output_section::add_input_section<32, true>): Add new parameter.
6211         (Output_section::add_input_section<64, true>): Add new parameter.
6212         (Output_section::add_input_section<32, false>): Add new parameter.
6213         (Output_section::add_input_section<64, false>): Add new parameter.
6214         * output.h (Output_section::add_input_section): Add new parameter.
6215         (Output_section::input_section_order_specified): New
6216         method.
6217         (Output_section::set_input_section_order_specified): New method.
6218         (Input_section::Input_section): Initialize section_order_index_.
6219         (Input_section::section_order_index): New method.
6220         (Input_section::set_section_order_index): New method.
6221         (Input_section::section_order_index_): New member.
6222         (Input_section::Input_section_sort_section_order_index_compare): New
6223         struct.
6224         (Output_section::input_section_order_specified_): New member.
6225         * script-sections.cc (is_wildcard_string): Delete and move modified
6226         method to gold.h.
6227         (Output_section_element_input::Output_section_element_input): Modify
6228         call to is_wildcard_string.
6229         (Output_section_element_input::Input_section_pattern
6230         ::Input_section_pattern): Ditto.
6231         (Output_section_element_input::Output_section_element_input): Ditto.
6232         * testsuite/Makefile.am (final_layout): New test case.
6233         * testsuite/Makefile.in: Regenerate.
6234         * testsuite/final_layout.cc: New file.
6235         * testsuite/final_layout.sh: New file.
6236
6237 2010-06-01  Rafael Espindola  <espindola@google.com>
6238
6239         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6240
6241 2010-06-01  Rafael Espindola  <espindola@google.com>
6242
6243         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6244         visibility of symbols.
6245
6246 2010-05-27  Doug Kwan  <dougkwan@google.com>
6247
6248         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6249         from start of output section instead of address for a local symbol
6250         in a merged or relaxed section when doing a relocatable link.
6251
6252 2010-05-26  Rafael Espindola  <espindola@google.com>
6253
6254         PR 11604
6255         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6256         adding sections the garbage collector removed.
6257         * gold/testsuite/Makefile.am: Add test.
6258         * gold/testsuite/Makefile.in: Regenerate.
6259         * gold/testsuite/plugin_test_7.sh: New.
6260         * gold/testsuite/plugin_test_7_1.c: New.
6261         * gold/testsuite/plugin_test_7_2.c: New.
6262
6263 2010-05-26  Rafael Espindola  <espindola@google.com>
6264
6265         * script-sections.cc (Output_section_definition::set_section_addresses):
6266         Check for --section-start.
6267
6268 2010-05-26  Doug Kwan  <dougkwan@google.com>
6269
6270         * arm.cc (Arm_scan_relocatable_relocs): New class.
6271         (Target_arm::relocate_special_relocatable): New method.
6272         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6273         (Arm_relocate_functions::thumb_branch_common): Same.
6274         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6275         instead of Default_scan_relocatable_relocs.
6276         * target-reloc.h (relocate_for_relocatable): Let target handle
6277         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6278         * target.h (Sized_target::relocate_special_relocatable): New method.
6279
6280 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6281
6282         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6283
6284 2010-05-23  Doug Kwan  <dougkwan@google.com>
6285
6286         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6287         instead of a cast.
6288         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6289         with a direct branch, not a conditional branch, to a stub.
6290         * merge.cc (Output_merge_base::record_input_section): New method
6291         defintion.
6292         (Output_merge_data::do_add_input_section): Record input section if
6293         keeps-input-sections flag is set.
6294         (Output_merge_string::do_add_input_section): Ditto.
6295         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6296         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6297         INPUT_SECTIONS_.
6298         (Output_merge_base::keeps_input_sections,
6299         Output_merge_base::set_keeps_input_sections,
6300         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6301         method definitions.
6302         (Output_merge_base::Input_sections): New type declaration.
6303         (Output_merge_base::input_sections_begin,
6304         Output_merge_base::input_sections_end,
6305         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6306         (Output_merge_base::bool keeps_input_sections_,
6307         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6308         Output_merge_base::input_sections_): New data members.
6309         (Output_merge_data::do_set_keeps_input_sections): New method
6310         defintion.
6311         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6312         * output.cc (Output_section::Input_section::relobj): Move method
6313         defintion from class declaration to here and handle merge sections.
6314         (Output_section::Input_section::shndx): Ditto.
6315         (Output_section::Output_section): Remove initializations of removed
6316         data members and initialize new data member LOOKUP_MAPS_.
6317         (Output_section::add_input_section): Set keeps-input-sections flag
6318         for a newly created merge output section as appropriate.  Adjust code
6319         to use Output_section_lookup_maps class.
6320         (Output_section::add_relaxed_input_section): Adjst code for lookup
6321         maps code refactoring.
6322         (Output_section::add_merge_input_section): Add a new parameter
6323         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6324         class.  If adding input section to a newly created merge output
6325         section fails, remove the new merge section.
6326         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6327         Adjust code for use of the Output_section_lookup_maps class.
6328         (Output_section::find_merge_section): Ditto.
6329         (Output_section::build_lookup_maps): New method defintion.
6330         (Output_section::find_relaxed_input_section): Adjust code to use
6331         Output_section_lookup_maps class.
6332         (Output_section::get_input_sections): Export merge sections.  Adjust
6333         code to use Output_section_lookup_maps class.
6334         (Output_section:::add_script_input_section): Adjust code to use
6335         Output_section_lookup_maps class.  Update lookup maps for merge
6336         sections also.
6337         (Output_section::discard_states): Use Output_section_lookup_maps.
6338         (Output_section::restore_states): Same.
6339         * output.h (Merge_section_properties): Move class defintion out of
6340         Output_section.
6341         (Output_section_lookup_maps): New class.
6342         (Output_section::Input_section::is_merge_section): New method
6343         defintion.
6344         (Output_section::Input_section::relobj): Move defintion out of class
6345         defintion.  Declare method only.
6346         (Output_section::Input_section::shndx): Ditto.
6347         (Output_section::Input_section::output_merge_base): New method defintion.
6348         (Output_section::Input_section::u2_.pomb): New union field.
6349         (Output_section::Merge_section_by_properties_map,
6350         Output_section::Output_section_data_by_input_section_map,
6351         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6352         Remove types.
6353         (Output_section::add_merge_input_section): Add new parameter
6354         KEEPS_INPUT_SECTIONS.
6355         (Output_section::build_lookup_maps): New method declaration.
6356         (Output_section::merge_section_map_,
6357         Output_section::merge_section_by_properties_map_,
6358         Output_section::relaxed_input_section_map_,
6359         Output_section::is_relaxed_input_section_map_valid_): Remove data
6360         members.
6361         (Output_section::lookup_maps_): New data member.
6362
6363 2010-05-21  Doug Kwan  <dougkwan@google.com>
6364
6365         PR gold/11619
6366         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6367         avoid a compilation error.
6368
6369 2010-05-19  Rafael Espindola  <espindola@google.com>
6370
6371         * script-sections.cc (Output_section_definition::allocate_to_segment):
6372         Update the phdrs_list even when the output section is NULL.
6373         * testsuite/Makefile.am: Add test.
6374         * testsuite/Makefile.in: Regenerate.
6375         * testsuite/script_test_9.cc: New.
6376         * testsuite/script_test_9.sh: New.
6377         * testsuite/script_test_9.t: New.
6378
6379 2010-05-19  Doug Kwan  <dougkwan@google.com>
6380
6381         * arm.cc (Arm_input_section::original_size): New method.
6382         (Arm_input_section::do_addralign): Add a cast.
6383         (Arm_input_section::do_output_offset): Remove static cast.
6384         (Arm_input_section::original_addralign,
6385          Arm_input_section::original_size_): Change type to uint32_t.
6386         (Arm_input_section::init): Add safe casts for section alignment
6387         and size.
6388         (Arm_input_section::set_final_data_size): Do not set address and
6389         offset of stub table.
6390         (Arm_output_section::fix_exidx_coverage): Change use of of
6391         Output_section::Simple_input_section to that of
6392         Output_section::Input_section.
6393         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6394         except for the first pass.
6395         * output.cc (Output_section::get_input_sections): Change type of
6396         input_sections to std::list<Input_section>.
6397         (Output_section::add_script_input_section): Rename from
6398         Output_section::add_simple_input_section.  Change type of SIS
6399         parameter from Simple_input_section to Input_section.
6400         * output.h (Output_section::Simple_input_section): Remove class.
6401         (Output_section::Input_section): Change class visibility to public.
6402         (Output_section::Input_section::addralign): Use stored alignments
6403         for special input sections if set.
6404         (Output_section::Input_section::set_addralign): New method.
6405         (Output_section::get_input_sections): Change parameter type from
6406         list of Simple_input_section to list of Input_section.
6407         (Output_section::add_script_input_section): Rename from
6408         Output_section::add_simple_input_section. Change first parameter's
6409         type from Simple_input_section to Input_section and remove the
6410         second and third parameters.
6411         * script-sections.cc (Input_section::Input_section_list): Change
6412         type to list of Output_section::Input_section/
6413         (Input_section_info::Input_section_info): Change parameter type of
6414         INPUT_SECTION to Output_section::Input_section.
6415         (Input_section_info::input_section): Change return type.
6416         (Input_section_info::input_section_): Change type to
6417         Output_section::Input_section.
6418         (Output_section_element_input::set_section_addresses): Adjust code
6419         to use Output_section::Input_section instead of
6420         Output_section::Simple_input_section.  Adjust code for renaming
6421         of Output_section::add_simple_input_section.
6422         (Orphan_output_section::set_section_addresses): Ditto.
6423
6424 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6425
6426         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6427         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6428
6429 2010-05-18  Rafael Espindola  <espindola@google.com>
6430
6431         * options.cc (General_options::finalize): Handle -nostdlib.
6432         * options.h (nostdlib): New option.
6433         * script.cc (script_add_search_dir): Handle -nostdlib.
6434
6435 2010-05-12  Doug Kwan  <dougkwan@google.com>
6436
6437         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6438         attributes section only if there no attributes section after merging.
6439         (Target_arm::merge_object_attributes): Move value of
6440         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6441         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6442         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6443         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6444         and arm_attr_merge_7.stdout.
6445         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6446         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6447         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6448         arm_attr_merge_7b.o): New rules.
6449         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6450         arm_attr_merge_7
6451         * testsuite/Makefile.in: Regenerate.
6452         * testsuite/arm_attr_merge.sh: New file.
6453         * testsuite/arm_attr_merge_[67][ab].s: Same.
6454
6455 2010-05-05  Nick Clifton  <nickc@redhat.com>
6456
6457         * po/es.po: Updated Spanish translation.
6458
6459 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6460
6461         * Makefile.am (install-exec-local): Properly install gold as
6462         default cross linker.
6463         * Makefile.in: Regenerated.
6464
6465 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6466             Nick Clifton  <nickc@redhat.com>
6467
6468         * configure.ac (install_as_default): Define and set to false
6469         unless --enable-gold or --enable-gold=both/gold has been
6470         specified.
6471         * configure: Regenerate.
6472
6473         * Makefile.am (install-exec-local): Install the executable as
6474         'ld.gold'.  If install_as_default is true then also install it as
6475         'ld'.
6476         * Makefile.in: Regenerated.
6477
6478 2010-04-24  Ian Lance Taylor  <iant@google.com>
6479
6480         * layout.cc (Layout::layout_reloc): In relocatable link don't
6481         combine reloc sections for grouped sections.
6482
6483 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6484
6485         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6486         sections that are not ordinary to icf.
6487         * icf.cc (get_section_contents): Handle relocation pointing to section
6488         with no object or shndx information.
6489         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6490         * testsuite/Makefile.in: Regenerate.
6491         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6492         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6493
6494 2010-04-22  Ian Lance Taylor  <iant@google.com>
6495
6496         * expression.cc (Expression::Expression_eval_info): Add
6497         result_alignment_pointer field.
6498         (Expression::eval_with_dot): Add result_alignment_pointer
6499         parameter.  Change all callers.
6500         (Expression::eval_maybe_dot): Likewise.
6501         (class Binary_expression): Add alignment_pointer parameter to
6502         left_value and right_value.  Change all callers.
6503         (BINARY_EXPRESSION): Set result alignment.
6504         (class Trinary_expression): Add alignment_pointer parameter to
6505         arg2_value and arg3_value.  Change all callers.
6506         (Trinary_cond::value): Set result alignment.
6507         (Max_expression::value, Min_expression::value): Likewise.
6508         (Align_expression::value): Likewise.
6509         * script-sections.cc (class Sections_element): Add dot_alignment
6510         parameter to set_section_addresses virtual function.  Update
6511         instantiations.
6512         (class Output_section_element): Likewise.
6513         (Script_sections::create_segments): Add dot_alignment parameter.
6514         Change all callers.
6515         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6516         (Script_sections::set_phdrs_clause_addresses): Likewise.
6517         * script-sections.h: Update declarations.
6518         * script.h: Update declarations.
6519         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6520         min_p_align.
6521         * testsuite/script_test_3.t: Set large alignment.
6522         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6523         segment has expected alignment.
6524
6525 2010-04-22  Nick Clifton  <nickc@redhat.com>
6526
6527         * po/gold.pot: Updated by the Translation project.
6528         * po/vi.po: Updated Vietnamese translation.
6529
6530 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6531
6532         * testsuite/Makefile.am (check_PROGRAMS): Add
6533         icf_virtual_function_folding_test.
6534         * testsuite/Makefile.in: Regenerated.
6535
6536 2010-04-15  Andrew Haley  <aph@redhat.com>
6537
6538         * options.h (merge_exidx_entries): New option.
6539         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6540         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6541         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6542         (Target_arm::merge_exidx_entries): New function.
6543         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6544         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6545         to Arm_exidx_fixup constructor.
6546         Add new arg, merge_exidx_entries.
6547         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6548         Arm_output_section::fix_exidx_coverage.
6549
6550 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6551
6552         * icf.cc (get_section_contents): Check for preemptible functions.
6553         Ignore addend when appropriate.
6554         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6555         section folded.
6556         (add_from_relobj): Check for section folded.
6557         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6558         * symtab.h (should_add_dynsym_entry): Add new parameter.
6559         * target-reloc.h (scan_relocs): Check for section folded.
6560         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6561         Check reloc types for function pointers in shared objects.
6562         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6563         case.
6564         (icf_preemptible_functions_test): New test case.
6565         (icf_string_merge_test): New test case.
6566         * testsuite.Makefile.in: Regenerate.
6567         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6568         bar_glob.  Refactor code.
6569         * testsuite/icf_preemptible_functions_test.cc: New file.
6570         * testsuite/icf_preemptible_functions_test.sh: New file.
6571         * testsuite/icf_string_merge_test.cc: New file.
6572         * testsuite/icf_string_merge_test.sh: New file.
6573         * testsuite/icf_virtual_function_folding_test.cc: New file.
6574         * testsuite/icf_virtual_function_folding_test.sh: New file.
6575
6576 2010-04-14  Doug Kwan  <dougkwan@google.com>
6577
6578         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6579         for local symbol recounting if we remove a section due to ICF.
6580         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6581         there are no regular objects in input.
6582
6583 2010-04-13  Doug Kwan  <dougkwan@google.com>
6584
6585         * arm.cc (Arm_input_section::set_final_data_size): Compute
6586         accurate final data size instead of using current data size.
6587
6588 2010-04-09  Doug Kwan  <dougkwan@google.com>
6589
6590         * layout.cc (Layout::choose_output_section): Handle script section
6591         types.
6592         (Layout::make_output_section_for_script): Add section type parameter.
6593         Handle script section types.
6594         * layout.h (Layout::make_output_section_for_script): Add section
6595         type parameter.
6596         * output.cc (Output_section::Output_section): Initialize data member
6597         is_noload_.
6598         (Output_section::do_reset_address_and_file_offset): Do not set address
6599         to 0 if section is a NOLOAD section.
6600         * output.h (Output_section::is_noload): New method.
6601         (Output_section::set_is_noload): Ditto.
6602         (Output_section::is_noload_): New data member.
6603         * script-c.h (Script_section_type): New enum type.
6604         (struct Parser_output_section_header): Add new file section_type.
6605         * script-sections.cc (Sections_element::output_section_name): Add
6606         parameter for returning script section type.
6607         (Output_section_definition::output_section_name): Ditto.
6608         (Output_section_definition::section_type)P; New method.
6609         (Output_section_definiton::script_section_type_name): Ditto.
6610         (Output_section_definition::script_section_type_): New data member.
6611         (Output_section_definition::Output_section_definition): Initialize
6612         data member Output_section_definition::script_section_type_.
6613         (Output_section_definition::create_sections): Pass script section type
6614         to Layout::make_output_section_for_script.
6615         (Output_section_definition::output_section_name): Return script
6616         section type to caller.
6617         (Output_section_definition::set_section_address): Do not advance
6618         dot value and load address if section type is NOLOAD.  Set address
6619         of NOLOAD sections regardless of section flags.
6620         (Output_section_definition::print): Print section type if it is
6621         not SCRIPT_SECTION_TYPE_NONE.
6622         (Output_section_definition::section_type): New method.
6623         (Output_section_definition::script_section_type_name): Ditto.
6624         (Script_sections::output_section_name): Add new parameter
6625         PSECTION_TYPE for returning script section type.  Pass it to
6626         section elements.  Handle discard sections.
6627         (Sort_output_sections::operator()): Handle NOLOAD sections.
6628         * script-sections.h (Script_sections::Section_type): New enum type.
6629         (Script_sections::output_section_name): Add a new parameter for
6630         returning script section type.
6631         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6632         INFO and NOLOAD.
6633         * yyscript.y (union): Add new field SECTION_TYPE.
6634         (COPY, DSECT, INFO, NOLOAD): New tokens.
6635         (opt_address_and_section_type): Change type to output_section_header.
6636         (section_type): New non-terminal
6637         (section_header): Handle section type.
6638         (opt_address_and_section_type): Return section type value.
6639
6640 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6641
6642         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6643         * testsuite/plugin_common_test_2.c (foo): Likewise.
6644
6645 2010-04-08  Doug Kwan  <dougkwan@google.com>
6646
6647         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6648         Output_merge_data.
6649         * output.cc (Output_section::add_merge_input_section): Simplify
6650         code and return status of Output_merge_base::add_input_section.
6651         Update merge section map only if Output_merge_base::add_input_section
6652         returns true.
6653
6654 2010-04-07  Doug Kwan  <dougkwan@google.com>
6655
6656         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6657         if section is marked as containing instructions but has no mapping
6658         symbols.
6659         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6660         correct section index.
6661         (Arm_relobj::find_linked_text_section): Ditto.
6662
6663 2010-04-07  Cary Coutant  <ccoutant@google.com>
6664
6665         * archive.cc (include_member): Destroy Read_symbols_data object before
6666         releasing file.
6667         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6668         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6669         (Read_symbols_data::~Read_symbols_data) New destructor.
6670         (Section_relocs::Section_relocs) New constructor.
6671         (Section_relocs::~Section_relocs) New destructor.
6672         (Read_relocs_data::Read_relocs_data) New constructor.
6673         (Read_relocs_data::~Read_relocs_data) New destructor.
6674         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6675         pointers to NULL after deleting.
6676
6677 2010-04-07  Doug Kwan  <dougkwan@google.com>
6678
6679         * arm.cc: Replace "endianity" with "endianness" in comments.
6680         (Arm_exidx_cantunwind): Ditto.
6681         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6682         (Arm_relobj::merge_flags_and_attributes): New method.
6683         (Arm_relobj::merge_flags_and_attributes_): New data member.
6684         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6685         (Arm_relobj::scan_sections_for_stubs): Ditto.
6686         (Arm_relobj::do_read_symbols): Check to see if we really want to
6687         merge processor-specific flags and attributes.  Exit early if
6688         an object is empty except for section names and the undefined symbol.
6689         (Target_arm::do_finalize_sections): Move check for ELF format to
6690         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6691         attributes from a regular object only when we have determined that
6692         it is aapropriate.  Do not create an .ARM.attributes section in
6693         output if there is no regular input object.
6694         (Target_arm::merge_processor_specific_flags): Check
6695         --warn-mismatch before printing any error.
6696         (Target_arm::merge_object_attributes): Ditto.
6697         * gold.cc (queue_middle_tasks): Handle the case in which there is
6698         no regular object in input.
6699         * options.cc (General_options::parse_EB): New method.
6700         (General_options::parse_EL): Same.
6701         (General_options::General_options): Initialize endianness_.
6702         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6703         New options.
6704         (General_options::Endianness): New enum.
6705         (General_options::endianness): New method.
6706         (General_options::endianness_): New data member.
6707         * parameters.cc (Parameters::set_options): Check target endianness.
6708         (Parameters::set_target_once): Ditto.
6709         (Parameters::check_target_endianness): New method.
6710         (parameters_force_valid_target): If either -EL or -EB is specified,
6711         use it to define endianness of default target.
6712         * parameters.h (Parameters::check_target_endianness): New method
6713         declaration.
6714         * target.h (class Target): Change "endianity" to "endianness"
6715         in comments.
6716
6717 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6718
6719         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6720         * configure: Regenerate.
6721         * Makefile.in: Regenerate.
6722         * testsuite/Makefile.in: Regenerate.
6723
6724 2010-04-06  Cary Coutant  <ccoutant@google.com>
6725
6726         gcc PR lto/42757
6727         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6728         prevailing definitions of common symbols.
6729         * testsuite/plugin_test_6.sh: New test case.
6730         * testsuite/plugin_common_test_1.c: New test case.
6731         * testsuite/plugin_common_test_2.c: New test case.
6732         * testsuite/Makefile.am (plugin_test_6): New test case.
6733         * testsuite/Makefile.in: Regenerate.
6734
6735 2010-04-06  Nick Clifton  <nickc@redhat.com>
6736
6737         * po/vi.po: New Vietnamese translation.
6738
6739 2010-03-30  Doug Kwan  <dougkwan@google.com>
6740
6741         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6742
6743 2010-03-25  Doug Kwan  <dougkwan@google.com>
6744
6745         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6746         to avoid a conversion warning on a 32-bit host.
6747
6748 2010-03-24  Ian Lance Taylor  <iant@google.com>
6749
6750         * testsuite/script_test_3.t: Add a TLS segment.
6751         * testsuite/Makefile.am (check_PROGRAMS): Add
6752         tls_phdrs_script_test.
6753         (tls_phdrs_script_test_SOURCES): Define.
6754         (tls_phdrs_script_test_DEPENDENCIES): Define.
6755         (tls_phdrs_script_test_LDFLAGS): Define.
6756         (tls_phdrs_script_test_LDADD): Define.
6757         * testsuite/Makefile.in: Rebuild.
6758
6759 2010-03-23  Cary Coutant  <ccoutant@google.com>
6760
6761         * fileread.cc (find_or_make_view): Fix comment.
6762
6763 2010-03-23  Ian Lance Taylor  <iant@google.com>
6764
6765         * script-sections.cc (class Orphan_section_placement): Define
6766         PLACE_TLS and PLACE_TLS_BSS.
6767         (Orphan_section_placement::Orphan_section_placement): Initialize
6768         new places.
6769         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6770         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6771         (tls_script_test_SOURCES): Define.
6772         (tls_script_test_DEPENDENCIES): Define.
6773         (tls_script_test_LDFLAGS): Define.
6774         (tls_script_test_LDADD): Define.
6775         * testsuite/Makefile.in: Rebuild.
6776
6777 2010-03-22  Doug Kwan  <dougkwan@google.com>
6778
6779         * arm.cc (Arm_relocate_functions::abs8,
6780         Arm_relocate_functions::abs16): Use correct check for overflow
6781         specified in the ARM ELF specs.
6782         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6783         target of a BLX instruction specially.
6784         (Reloc_stub::stub_type_for_reloc): Ditto.
6785         (Relocate::relocate): Use symbolic names instead of numeric relocation
6786         codes to report error.
6787         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6788         workaround.
6789         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6790         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6791         thumb2_blx_out_of_range.stdout
6792         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6793         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6794         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6795         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6796         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6797         thumb2_blx_in_range, thumb2_blx_in_range.o,
6798         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6799         thumb2_blx_out_of_range.o): New rules.
6800         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6801         thumb2_blx_in_range and thumb2_blx_out_of_range.
6802         * testsuite/Makefile.in: Regenerate.
6803         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6804         * testsuite/thumb_blx_in_range.s: New file.
6805         * testsuite/thumb_blx_out_of_range.s: New file.
6806
6807 2010-03-22  Rafael Espindola  <espindola@google.com>
6808
6809         * archive.cc (Should_include): Move to archive.h.
6810         (should_include_member): Make it a member of Archive.
6811         (Lib_group): New.
6812         (Add_lib_group_symbols): New.
6813         * archive.h: Include options.h.
6814         (Archive_member): Moved from Archive.
6815         (Should_include): Moved from archive.cc.
6816         (Lib_group): New.
6817         (Add_lib_group_symbols): New.
6818         * dynobj.cc (do_should_include_member): New.
6819         * dynobj.h (do_should_include_member): New.
6820         * gold.cc (queue_initial_tasks): Update call to queue.
6821         * main.cc (main): Print lib group stats.
6822         * object.cc (do_should_include_member): New.
6823         * object.h: Include archive.h.
6824         (Object::should_include_member): New.
6825         (Object::do_should_include_member): New.
6826         (Sized_relobj::do_should_include_member): New.
6827         * options.cc (General_options::parse_start_lib): New.
6828         (General_options::parse_end_lib): New.
6829         (Input_arguments::add_file): Handle lib groups.
6830         (Input_arguments::start_group): Check we are not in a lib.
6831         (Input_arguments::start_lib): New.
6832         (Input_arguments::end_lib): New.
6833         * options.h (General_options): Add start_lib and end_lib.
6834         (Input_argument::lib_): New.
6835         (Input_argument::lib): New.
6836         (Input_argument::is_lib): New.
6837         (Input_file_lib): New.
6838         (Input_arguments::in_lib_): New.
6839         (Input_arguments::in_lib): New.
6840         (Input_arguments::start_lib): New.
6841         (Input_arguments::end_lib_): New.
6842         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6843         in unused members as preempted.
6844         (Sized_pluginobj::do_should_include_member): New.
6845         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6846         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6847         return the blocker.
6848         (Read_symbols::do_whole_lib_group): New.
6849         (Read_symbols::do_lib_group): New.
6850         (Read_symbols::do_read_symbols): Handle lib groups.
6851         (Read_symbols::get_name): Handle lib groups.
6852         * readsyms.h (Read_symbols): Add an archive member pointer.
6853         (Read_symbols::do_whole_lib_group): New.
6854         (Read_symbols::do_lib_group): New.
6855         (Read_symbols::member_): New.
6856         * script.cc (read_input_script): Update call to queue_soon.
6857
6858 2010-03-19  Doug Kwan  <dougkwan@google.com>
6859
6860         * arm.cc (Stub_table::Stub_table): Initialize new data members
6861         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6862         (Stub_table::add_reloc_stub): Assign stub offset and update
6863         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6864         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6865         New data members.
6866         (Stub_table::update_data_size_and_addralign): Use
6867         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6868         instead of going over all reloc stubs.
6869         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6870         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6871         Stringpool_template::offset_ to size of Stringpool_char.
6872         (Stringpool_template::new_key_offset): Remove code to initialize
6873         Stringpool_template::offset_.
6874         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6875         Stringpool_template::offset_ to zero.
6876
6877 2010-03-15  Doug Kwan  <dougkwan@google.com>
6878
6879         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6880         offset_.
6881         (Stringpool_template::new_key_offset): New method.
6882         (Stringpool_template::add_string): Assign offsets when adding new
6883         strings.
6884         (Stringpool_template::set_string_offsets): Do not set string offsets
6885         when not optimizing.
6886         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6887         member size_.
6888         (Chunked_vector::clear): Clear size_.
6889         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6890         (Chunked_vector::size): Return size_.
6891         (Chunked_vector::push_back): Use size_ to find insert position.
6892         (Chunked_vector::size_): New data member.
6893         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6894         (Stringpool_template::new_key_offset): New method declaration.
6895         (Stringpool_template::offset_): New data member.
6896
6897 2010-03-15   Rafael Espindola  <espindola@google.com>
6898
6899         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6900         Add_symbols' constructor.
6901         * readsyms.h (Add_symbols): Remove the input_group member.
6902
6903 2010-03-10  Ian Lance Taylor  <iant@google.com>
6904
6905         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6906         target to ask whether a reference to a symbol requires a stack
6907         split.
6908         * target.h (Target::is_call_to_non_split): New function.
6909         (Target::do_is_call_to_non_split): Declare virtual function.
6910         * target.cc: Include "symtab.h".
6911         (Target::do_is_call_to_non_split): New function.
6912         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6913
6914 2010-03-10  Cary Coutant  <ccoutant@google.com>
6915
6916         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6917         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6918         (File_read::open[2]): Add whole_file_view_ to list of views.
6919         (File_read::make_view): Remove test of whole_file_view_.
6920         (File_read::find_or_make_view): Create whole_file_view_ if
6921         necessary.
6922         (File_read::clear_views): Replace bool parameter with enum;
6923         adjust all callers.  Don't delete views with permanent data;
6924         do delete cached views and views from archives if
6925         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6926         if clearing the corresponding view.
6927         * fileread.h (File_read::Clear_views_mode): New enum.
6928         (File_read::View::is_permanent_view): New method.
6929         (File_read::clear_views): Replace bool parameter
6930         with enum; adjust all callers.
6931         * options.h (General_options): Change keep_files_mapped option;
6932         add map_whole_files.
6933         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6934         releasing the file.
6935         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6936         the file.
6937
6938 2010-03-10  David S. Miller  <davem@davemloft.net>
6939
6940         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6941
6942 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6943
6944         * icf.cc (get_section_contents): Add '@' marker after processing the
6945         merge reloc.
6946
6947 2010-03-08  Doug Kwan  <dougkwan@google.com>
6948
6949         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6950         due to a conversion warning.
6951         (Arm_relobj::update_output_local_symbol_count): Check for local
6952         symbol with unset output index.
6953
6954 2010-03-05  Ian Lance Taylor  <iant@google.com>
6955
6956         * options.h (class General_options): Add --spare-dynamic-tags.
6957         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6958         --spare-dynamic-tags.
6959
6960 2010-03-05  Ian Lance Taylor  <iant@google.com>
6961
6962         * incremental.cc: Include "libiberty.h".
6963
6964 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6965
6966         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6967         function, is_info_ member.
6968         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6969         (Versions::Versions): Update caller.
6970         (Versions::define_base_version): Likewise.
6971         (Versions::add_def): Likewise.
6972
6973 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6974
6975         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6976         (Scan::possible_function_pointer_reloc): New function.
6977         (Scan::local_reloc_may_be_function_pointer): Change to call
6978         possible_function_pointer_reloc.
6979         (Scan::global_reloc_may_be_function_pointer): Ditto.
6980         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6981         relocations in ".data.rel.ro._ZTV" section.
6982         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6983         * testsuite/icf_safe_so_test.cc: Ditto.
6984         * testsuite/icf_safe_test.cc: Ditto.
6985         * testsuite/icf_safe_test.sh: Ditto.
6986
6987 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6988             Ian Lance Taylor  <iant@google.com>
6989
6990         * target-reloc.h (relocate_section): Check the symbol table index
6991         for -1U before setting the local symbol index.
6992         (scan_relocatable_relocs): If copying the relocation, record that
6993         the local symbol is required.
6994         * object.h (Symbol_value::is_output_symtab_index_set): New
6995         function.
6996         (Symbol_value::may_be_discarded_from_output_symtab): New
6997         function.
6998         (Symbol_value::has_output_symtab_entry): New function.
6999         (Symbol_value::needs_output_symtab_entry): Remove.
7000         (Symbol_value::output_symtab_index): Make sure the symbol index is
7001         set.
7002         (Symbol_value::set_output_symtab_index): Make sure the symbol
7003         index is not set.  Make sure the new index is valid.
7004         (Symbol_value::set_must_have_output_symtab_entry): New function.
7005         (Symbol_value::has_output_dynsym_entry): New function.
7006         (Symbol_value::set_output_dynsym_index): Make sure the new index
7007         is valid.
7008         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7009         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7010         local symbol if permitted.
7011         (Sized_relobj::do_finalize_local_symbols): Call
7012         is_output_symtab_index_set rather than needs_output_symtab_entry.
7013         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7014         rather than needs_output_symtab_entry.  Call
7015         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7016         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7017         is_output_symtab_index_set rather than needs_output_symtab_entry.
7018         * testsuite/discard_locals_relocatable_test.c: New file.
7019         * testsuite/discard_locals_test.sh: Test -r.
7020         * testsuite/Makefile.am (check_DATA): Add
7021         discard_locals_relocatable_test1.syms,
7022         discard_local_relocatable_test2.syms.
7023         (MOSTLYCLEANFILES): Likewise.  Also add
7024         discard_locals_relocatable_test1.lout and
7025         discard_locals_relocatable_test2.out.
7026         (discard_locals_relocatable_test1.syms): New target.
7027         (discard_locals_relocatable_test.o): New target.
7028         (discard_locals_relocatable_test1.out): New target.
7029         (discard_locals_relocatable_test2.syms): New target.
7030         (discard_locals_relocatable_test2.out): New target.
7031         (various): Add missing ../ld-new dependencies.
7032         * testsuite/Makefile.in: Rebuild.
7033
7034 2010-03-03  Nick Clifton  <nickc@redhat.com>
7035
7036         * po/fi.po: New Finnish translation.
7037
7038 2010-03-01  Doug Kwan  <dougkwan@google.com>
7039
7040         * layout.cc (Layout::Layout): Force section types of .init_array*,
7041         .preinit_array* and .fini_array* sections.
7042         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7043         Fix check of return value of std::string::find.().
7044         (Output_section::Input_section_sort_compare::operator()): Remove
7045         comment about .init_array.
7046         (Output_section::Input_section_sort_init_fini_compare::operator()):
7047         New method.
7048         (Output_section::sort_attached_input_sections): Handle .init_array
7049         and .fini_array specially.
7050         * output.h (Output_section::Inut_section_sort_compare): Update
7051         comment.
7052         (Output_section::Input_section_sort_init_fini_compare): New struct.
7053
7054 2010-02-26  Doug Kwan  <dougkwan@google.com>
7055
7056         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7057         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7058         * testsuite/debug_msg.sh: Avoid matching source line number for
7059         use of global variable undef_int.
7060
7061 2010-02-26  Doug Kwan  <dougkwan@google.com>
7062
7063         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7064         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7065         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7066         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7067         * options.cc (General_options::General_options): Initialize member
7068         fix_v4bx_.
7069         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7070         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7071         and rm_no_fix_v4bx.stdout
7072         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7073         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7074         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7075         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7076         and arm_no_fix_v4bx.
7077         * Makefile.in: Regenerate.
7078         * testsuite/arm_fix_v4bx.s: New file.
7079         * testsuite/arm_fix_v4bx.sh: Ditto.
7080
7081 2010-02-24  Doug Kwan  <dougkwan@google.com>
7082
7083         * arm.cc (Target_arm::got_section): Make the .got section the first
7084         non RELRO section in the data segment.
7085         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7086         suffixes of section names.
7087
7088 2010-02-24  Doug Kwan  <dougkwan@google.com>
7089
7090         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7091         flags and attributes merging if an input file is a binary file.
7092         * fileread.cc (Input_file::open): Record format of original file.
7093         * fileread.h (Input_file::Format): New enum type.
7094         (Input_file::Input_file): Initialize data member format_.
7095         (Input_file::format): New method definition.
7096         (Input_file::format_):: New data member.
7097
7098 2010-02-24  Doug Kwan  <dougkwan@google.com>
7099
7100         * arm.cc (Arm_output_data_got): New class.
7101         (ARM_TCB_SIZE): New constant
7102         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7103         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7104         If user uses a script with a SECTIONS clause, issue only a warning
7105         for a misplaced EXIDX input section.  Otherwise, issue an error.
7106         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7107         garbage collection.
7108         (Target_arm::got_mode_index_entry): Handle static linking.
7109         (Target_arm::Scan::local): Ditto.
7110         (Target_arm::Scan::global): Ditto.
7111         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7112         all incorrectly implemented relocations.
7113         (Target_arm::fix_exidx_coverage): Pass layout to
7114         Arm_output_section::fix_exidx_coverage.
7115         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7116         from ".ARM.exidx." and ".ARM.extab.".
7117
7118 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7119
7120         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7121         section if it does not already exist.
7122         * attributes.cc (Attributes_section_data::Attributes_section_data):
7123         Don't crash if size is zero.
7124
7125 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7126             Ian Lance Taylor  <iant@google.com>
7127
7128         * gold.cc (queue_middle_tasks): If no input files were opened,
7129         exit.
7130         * workqueue.h (Task_function::Task_function): Assert that there is
7131         a blocker.
7132
7133 2010-02-22  Doug Kwan  <dougkwan@google.com>
7134
7135         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7136         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7137         types to avoid warnings due to different uint64_t implementations
7138         on different hosts.
7139
7140 2010-02-21  Doug Kwan  <dougkwan@google.com>
7141
7142         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7143         handling of the maximum backward branch offset.
7144         (Arm_relocate_functions::thumb_branch_common): Ditto.
7145         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7146         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7147         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7148         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7149         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7150         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7151         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7152         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7153         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7154         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7155         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7156         thumb2_bl_out_of_range.o): New rules.
7157         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7158         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7159         thumb2_bl_out_of_range
7160         * testsuite/Makefile.in: Regenerate.
7161         * testsuite/arm_bl_in_range.s: New file.
7162         * testsuite/arm_bl_out_of_range.s: Ditto.
7163         * testsuite/arm_branch_in_range.sh: Ditto.
7164         * testsuite/arm_branch_range.t: Ditto.
7165         * testsuite/thumb2_branch_range.t: Ditto.
7166         * testsuite/thumb_bl_in_range.s: Ditto.
7167         * testsuite/thumb_bl_out_of_range.s: Ditto.
7168         * testsuite/thumb_branch_range.t: Ditto.
7169
7170 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7171
7172         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7173         Add reloc offset information.
7174         * icf.cc (get_section_contents): Change iterators to point to the new
7175         vectors. Add reloc offset information to the contents.
7176         * icf.h (Icf::Sections_reachable_info): New typedef.
7177         (Icf::Sections_reachable_list): New typedef.
7178         (Icf::Offset_info): New typedef.
7179         (Icf::Reloc_info): New struct typedef.
7180         (Icf::Reloc_info_list): New typedef.
7181         (Icf::symbol_reloc_list): Delete method.
7182         (Icf::addend_reloc_list): Delete method.
7183         (Icf::section_reloc_list): Delete method.
7184         (Icf::reloc_info_list): New method.
7185         (Icf::reloc_info_list_): New member.
7186
7187 2010-02-19  Doug Kwan  <dougkwan@google.com>
7188
7189         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7190         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7191         * arm.cc (Arm_relocation_functions): New forward declaration.
7192         (Target_arm::Target_arm): Initialize new data members
7193         got_mod_index_offset_ and tls_base_symbol_defined_.
7194         (Target_arm::Relocate::relocate_tls): New method.
7195         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7196          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7197         New methods.
7198         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7199         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7200         (Target_arm::got_mod_index_offset_,
7201         Target_arm::tls_base_symbol_defined_): New data members.
7202         (Target_arm::Scan::local, Target::Scan::global,
7203         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7204         relocations.
7205
7206 2010-02-18  Doug Kwan  <dougkwan@google.com>
7207
7208         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7209         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7210         text section as a parameter becuase some broken tools may not set
7211         the link in section header.
7212         (Target_arm::has_got_section): New method.
7213         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7214         without any mapping symbol as data only.  Remove warning.
7215         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7216         link in its section header, try to discover the link by inspecting the
7217         REL31 relocation at the beginning of the section.
7218         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7219         in error message.
7220         (Target_arm::Scan::global): Treat any reference to the symbol
7221         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7222
7223 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7224
7225         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7226         (Scan::global_reloc_may_be_function_pointer): New function.
7227         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7228         (Scan::global_reloc_may_be_function_pointer): New function.
7229         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7230         (Scan::global_reloc_may_be_function_pointer): New function.
7231         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7232         (Scan::global_reloc_may_be_function_pointer): New function.
7233         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7234         (Scan::global_reloc_may_be_function_pointer): New function.
7235         (Scan::possible_function_pointer_reloc): New function.
7236         (Target_x86_64::can_check_for_function_pointers): New function.
7237         * gc.h (gc_process_relocs): Scan relocation types to determine if
7238         function pointers were taken for targets that support it.
7239         * icf.cc (Icf::find_identical_sections): Include functions for
7240         folding in safe ICF whose pointer is not taken.
7241         * icf.h (Secn_fptr_taken_set): New typedef.
7242         (fptr_section_id_): New member.
7243         (section_has_function_pointers): New function.
7244         (set_section_has_function_pointers): New function.
7245         (check_section_for_function_pointers): New function.
7246         * options.h: Fix comment for safe ICF option.
7247         * target.h (can_check_for_function_pointers): New function.
7248         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7249         Modify icf_safe_test for X86-64.
7250         * testsuite/Makefile.in: Regenerate.
7251         * testsuite/icf_safe_so_test.cc: New file.
7252         * testsuite/icf_safe_so_test.sh: New file.
7253         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7254         (main): Change to take pointer to function kept_func_3.
7255         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7256         folding is done correctly for X86-64.
7257
7258 2010-02-12  David S. Miller  <davem@davemloft.net>
7259
7260         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7261         is_symbolless parameter.
7262         (Output_reloc<SHT_REL>::is_symbolless): New.
7263         (Output_reloc<SHT_REL>::is_symbolless_): New.
7264         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7265         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7266         (Output_reloc<SHT_RELA>::is_symbolless): New.
7267         (Output_data_reloc::add_global): Handle is_symbolless.
7268         (Output_data_reloc::add_global_relative): Likewise.
7269         (Output_data_reloc::add_local): Likewise.
7270         (Output_data_reloc::add_local_relative): Likewise.
7271         (Output_data_reloc::add_symbolless_global_addend): New.
7272         (Output_data_reloc::add_symbolless_local_addend): New.
7273         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7274         is_symbolless.
7275         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7276         instead of ->is_relative_
7277         (Output_reloc::write): Likewise.
7278         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7279         (Output_reloc::write_rel): Simplify.
7280
7281         * sparc.cc (Target_sparc::Scan::local): Use
7282         ->add_symbolless_local_addend as needed.
7283         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7284         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7285         based upon relocation offset.
7286
7287 2010-02-11  Doug Kwan  <dougkwan@google.com>
7288
7289         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7290         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7291         beginning of function.
7292         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7293         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7294         parameter is_32bit in calls to should_apply_static_reloc.
7295         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7296         (check_DATA): Add arm_abs_global.stdout.
7297         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7298         arm_abs_global.stdout): New rules.
7299         (MOSTLLYCLEANFILES): Add arm_abs_global
7300         * Makefile.in: Regenerate.
7301         * testsuite/arm_abs_global.s: New file.
7302         * testsuite/arm_abs_global.sh: Ditto.
7303         * testsuite/arm_abs_lib.s: Ditto.
7304
7305 2010-02-11  Ian Lance Taylor  <iant@google.com>
7306
7307         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7308         Read_relocs task.
7309         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7310         Allocate_commons_task first.
7311         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7312         task, rather than symtab_lock_.
7313         (Gc_process_relocs::~Gc_process_relocs): New function.
7314         (Gc_process_relocs::is_runnable): Check this_blocker_.
7315         (Gc_process_relocs::locks): Use next_blocker_ rather than
7316         blocker_.
7317         (Scan_relocs::~Scan_relocs): New function.
7318         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7319         symtab_lock_.
7320         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7321         next_blocker_.
7322         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7323         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7324         constructor accordingly.
7325         (class Gc_process_relocs): Likewise.
7326         (class Scan_relocs): Likewise.
7327         * common.h (class Allocate_commons_task): Remove symtab_lock_
7328         field, and corresponding constructor parameter.
7329         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7330         symtab_lock_.
7331         (Allocate_commons_task::locks): Likewise.
7332
7333 2010-02-11  Ian Lance Taylor  <iant@google.com>
7334
7335         * gold-threads.h (class Once): Define.
7336         (class Initialize_lock): Rewrite as child of Once.
7337         * gold-threads.cc (class Once_initialize): Define.
7338         (once_pointer_control): New static variable.
7339         (once_pointer, once_arg): New static variables.
7340         (c_run_once): New static function.
7341         (Once::Once, Once::run_once, Once::internal_run): New functions.
7342         (class Initialize_lock_once): Remove.
7343         (initialize_lock_control): Remove.
7344         (initialize_lock_pointer): Remove.
7345         (initialize_lock_once): Remove.
7346         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7347         (Initialize_lock::initialize): Rewrite.
7348         (Initialize_lock::do_run_once): New function.
7349         * archive.cc (Archive::interpret_header): Only clear name if it is
7350         not already empty.
7351         * fileread.cc: Include "gold-threads.h"
7352         (file_counts_lock): New static variable.
7353         (file_counts_initialize_lock): Likewise.
7354         (File_read::release): Only increment counts when using --stats.
7355         Use a lock around the increment.
7356         * parameters.cc (class Set_parameters_target_once): Define.
7357         (set_parameters_target_once): New static variable.
7358         (Parameters::Parameters): Move here from parameters.h.
7359         (Parameters::set_target): Rewrite.
7360         (Parameters::set_target_once): New function.
7361         (Parameters::clear_target): Move here and rewrite.
7362         * parameters.h (class Parameters): Update declarations.  Add
7363         set_parameters_target_once_ field.
7364         (Parameters::Parameters): Move to parameters.cc.
7365         (Parameters::clear_target): Likewise.
7366         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7367         task.
7368         (Start_group::~Start_group): New function.
7369         (Start_group::is_runnable): New function.
7370         (Start_group::locks, Start_group::run): New functions.
7371         (Finish_group::run): Change saw_undefined to size_t.
7372         * readsyms.h (class Start_group): Define.
7373         (class Finish_group): Change saw_undefined_ field to size_t.
7374         (Finish_group::Finish_group): Remove saw_undefined and
7375         this_blocker parameters.  Change all callers.
7376         (Finish_group::set_saw_undefined): New function.
7377         (Finish_group::set_blocker): New function.
7378         * symtab.h (class Symbol_table): Change saw_undefined to return
7379         size_t.  Change saw_undefined_ field to size_t.
7380         * target-select.cc (Set_target_once::do_run_once): New function.
7381         (Target_selector::Target_selector): Initialize set_target_once_
7382         field.  Don't initialize lock_ and initialize_lock_ fields.
7383         (Target_selector::instantiate_target): Rewrite.
7384         (Target_selector::set_target): New function.
7385         * target-select.h (class Set_target_once): Define.
7386         (class Target_selector): Update declarations.  Make
7387         Set_target_once a friend.  Remove lock_ and initialize_lock_
7388         fields.  Add set_target_once_ field.
7389
7390 2010-02-10  Ian Lance Taylor  <iant@google.com>
7391
7392         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7393         queueing any tasks.
7394         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7395         (queue_middle_tasks): Add all blockers before queueing any tasks.
7396         (queue_final_tasks): Likewise.
7397         * token.h (Task_token::add_blockers): New function.
7398         * object.h (Input_objects::number_of_relobjs): New function.
7399
7400 2010-02-10  Ian Lance Taylor  <iant@google.com>
7401
7402         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7403         shared, not if not position independent.
7404         * x86_64.cc (Relocate::relocate_tls): Likewise.
7405         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7406         (tls_pie_pic_test): New target.
7407         * testsuite/Makefile.in: Rebuild.
7408
7409         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7410         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7411         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7412         * testsuite/Makefile.in: Rebuild.
7413
7414 2010-02-09  David S. Miller  <davem@davemloft.net>
7415
7416         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7417         R_SPARC_RELATIVE using ->add_local_relative().
7418         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7419
7420         * output.h (Output_data_dynamic::add_section_size): New method
7421         that takes two Output_data objects.
7422         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7423         entry param.  Handle it in initializers.
7424         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7425         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7426         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7427         arg.
7428         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7429         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7430         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7431         for dynrel_includes_plt.
7432         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7433         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7434         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7435         before .rela.plt
7436         (Target_sparc::do_finalize_sections): Update to pass true for
7437         dynrel_includes_plt.
7438         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7439         output before .rela.plt
7440         (Target_powerpc::do_finalize_sections): Update to pass true for
7441         dynrel_includes_plt when 32-bit.
7442
7443 2010-02-08  Doug Kwan  <dougkwan@google.com>
7444
7445         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7446         method.
7447         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7448         Arm_relobj::scan_section_for_cortex_a8_stubs,
7449         Arm_relobj::do_relocation_section): Instead of calling
7450         Output_section::output_address, use faster
7451         Arm_relobj::simple_input_section_output_address.
7452
7453 2010-02-08  David S. Miller  <davem@davemloft.net>
7454
7455         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7456         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7457         relocation helper function.
7458
7459         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7460         just like R_SPARC_GOT{10,13,22}.
7461         (Target_sparc::Scan::local): Likewise.
7462         (Target_sparc::Relocate:relocate): Likewise.
7463
7464 2010-02-06  Ian Lance Taylor  <iant@google.com>
7465
7466         * configure.ac: Rewrite targetobjs duplicate removal code to use
7467         only shell constructs.
7468         * configure: Rebuild.
7469
7470 2010-02-05  Doug Kwan  <dougkwan@google.com>
7471
7472         PR 11247
7473         * arm.cc (Arm_relobj::section_is_scannable): New method.
7474         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7475         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7476
7477 2010-02-04  Doug Kwan  <dougkwan@google.com>
7478
7479         PR 11247
7480         * arm-reloc-property.cc (cstdio): Include.
7481         * configure.ac (targetobjs): Remove duplicates.
7482         * configure: Regenerate.
7483         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7484         big and little endian version for a given address size.
7485
7486 2010-02-03  Doug Kwan  <dougkwan@google.com>
7487
7488         * arm-reloc-property.cc
7489         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7490         definition.
7491         * arm-reloc-property.h
7492         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7493         New method definition.
7494         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7495         declaration.
7496         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7497         overflow to N.
7498         (GOT_PREL): Change implemented to Y.
7499         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7500         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7501         (Arm_relocate_functions::movw_abs_nc): Remove method.
7502         (Arm_relocate_functions::movt_abs): Ditto.
7503         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7504         (Arm_relocate_functions::thm_movt_abs): Ditto.
7505         (Arm_relocate_functions::movw_rel_nc): Ditto.
7506         (Arm_relocate_functions::movw_rel): Ditto.
7507         (Arm_relocate_functions::movt_rel): Ditto.
7508         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7509         (Arm_relocate_functions:thm_movw_rel): Ditto.
7510         (Arm_relocate_functions:thm_movt_rel): Ditto.
7511         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7512         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7513         New method definitions.
7514         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7515         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7516         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7517         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7518         (Target_arm::Relocate::relocate): Check for non-static or
7519         unimplemented relocation code and exit early.  Change calls to
7520         Target_arm::reloc_uses_thumb_bit and
7521         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7522         instead.  Refactor code to handle similar relocations to increase
7523         code sharing.  Remove check for unsupported relocation code in switch
7524         statement.
7525         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7526         relocation property table to find out size.  Change error message to
7527         print out the name of a relocation code instead of the numeric value.
7528         (Target_arm::scan_reloc_for_stub): Use relocation property table
7529         instead of calling Target_arm::reloc_uses_thumb_bit().
7530
7531 2010-02-02  Doug Kwan  <dougkwan@google.com>
7532
7533         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7534         types of relaxed input section.
7535
7536 2010-02-02  Doug Kwan  <dougkwan@google.com>
7537
7538         * Makefile.am (HFILES): Add arm-reloc-property.h.
7539         (DEFFILES): New.
7540         (TARGETSOURCES): Add arm-reloc-property.cc
7541         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7542         (libgold_a_SOURCES): $(DEFFILES)
7543         * Makefile.in: Regenerate.
7544         * arm-reloc-property.cc: New file.
7545         * arm-reloc-property.h: New file.
7546         * arm-reloc.def: New file.
7547         * arm.cc: Update comments.
7548         (arm-reloc-property.h): New included header.
7549         (arm_reloc_property_table): New global variable.
7550         (Target_arm::do_select_as_default_target): New method definition.
7551         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7552         arm-reloc-property to targ_extra_obj.
7553         * parameters.cc (set_parameters_target): Call
7554         Target::select_as_default_target().
7555         * target.h (Target::select_as_default_target): New method definition.
7556         (Target::do_select_as_default_target): Same.
7557
7558 2010-02-01  Doug Kwan  <dougkwan@google.com>
7559
7560         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7561         first_output_text_section_.
7562         (Arm_exidx_fixup::first_output_text_section): New method definition.
7563         (Arm_exidx_fixup::first_output_text_section_): New data member.
7564         (Arm_exidx_fixup::process_exidx_section): Record the first text
7565         output section seen.
7566         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7567         and entsize in output section header.
7568
7569 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7570
7571         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7572         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7573         (Arm_relocate_functions::thm_alu11): New Method.
7574         (Arm_relocate_functions::thm_pc8): New Method.
7575         (Arm_relocate_functions::thm_pc12): New Method.
7576         (Target_arm::Scan::local): Handle the relocations.
7577         (Target_arm::Scan::global): Likewise.
7578         (Target_arm::Relocate::relocate): Likewise.
7579         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7580
7581 2010-01-29  Doug Kwan  <dougkwan@google.com>
7582
7583         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7584         of relocation types as ld.
7585
7586 2010-01-29  Doug Kwan  <dougkwan@google.com>
7587
7588         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7589         to public.
7590         (Arm_relocate_functions::thumb_branch_common): Ditto.
7591         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7592         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7593         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7594         Arm_relocate_functions::jump24): Remove.
7595         (Target_arm::Relocate::relocate): Adjust code to call
7596         Arm_relocation_functions::arm_branch_common and
7597         Arm_relocation_functions::thumb_branch_common instead of their removed
7598         wrappers.  Merge switch-cases together to reduce source code size.
7599
7600 2010-01-29  Doug Kwan  <dougkwan@google.com>
7601
7602         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7603         output_local_symbol_count_needs_update_.
7604         (Arm_relobj::output_local_symbol_count_needs_update,
7605          Arm_relobj::set_output_local_symbol_count_needs_update,
7606          Arm_relobj::update_output_local_symbol_count): New methods.
7607         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7608         member.
7609         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7610         of pointed function as in a R_ARM_PREL31 relocation.
7611         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7612         for output local symbol count updating.
7613         (Target_arm::do_relax): Update output local symbol counts in objects
7614         if necessary.
7615         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7616
7617 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7618
7619         * arm.cc: Added support for the ARM relocations:
7620         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7621         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7622         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7623         movw_prel_nc).
7624         (Arm_relocate_functions::movw_rel): New method.
7625         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7626         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7627         thm_movw_prel_nc).
7628         (Arm_relocate_functions::thm_movw_rel): New method.
7629         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7630         thm_movt_prel).
7631         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7632         relocations.
7633         (Target_arm::Scan::global): Likewise.
7634         (Target_arm::Relocate::relocate): Likewise.
7635         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7636         Likewise.
7637
7638 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7639
7640         * arm.cc: Added support for ARM group relocations.
7641         (Target_arm::reloc_needs_sym_origin): New method.
7642         (Arm_relocate_functions::calc_grp_kn): New method.
7643         (Arm_relocate_functions::calc_grp_residual): New method.
7644         (Arm_relocate_functions::calc_grp_gn): New method.
7645         (Arm_relocate_functions::arm_grp_alu): New Method.
7646         (Arm_relocate_functions::arm_grp_ldr): New Method.
7647         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7648         (Arm_relocate_functions::arm_grp_ldc): New Method.
7649         (Target_arm::Scan::local): Handle the ARM group relocations.
7650         (Target_arm::Scan::global): Likewise.
7651         (Target_arm::Relocate::relocate): Likewise.
7652         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7653         Likewise.
7654
7655 2010-01-26  Doug Kwan  <dougkwan@google.com>
7656
7657         * arm.cc (set): Include.
7658         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7659         pointer type.
7660         (Arm_output_section::Text_section_list): New type.
7661         (Arm_output_section::append_text_sections_to_list): New method.
7662         (Arm_output_section::fix_exidx_coverage): Ditto.
7663         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7664         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7665         Relobj::set_section_offset() instead of
7666         Sized_relobj::invalidate_section_offset().
7667         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7668         parameter for section headers. Ignore relocation sections for
7669         unallocated sections and EXIDX sections.
7670         (Target_arm::fix_exidx_coverage): New method.
7671         (Target_arm::output_section_address_less_than): New type.
7672         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7673         linked text section instead of the EXIDX section.
7674         (Arm_output_section::create_stub_group): Add an assertion to check
7675         that this is not an EXIDX output section.
7676         (Arm_output_section::append_text_sections_to_list): New method.
7677         (Arm_output_section::fix_exidx_coverage): Ditto.
7678         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7679         Arm_relobj::section_needs_reloc_stub_scanning.
7680         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7681         first pass.
7682         (Target_arm::fix_exidx_coverage): New method.
7683         * object.h (Relobj::set_output_section): New method.
7684         (Sized_relobj::invalidate_section_offset): Remove method.
7685         (Sized_relobj::do_invalidate_section_offset): Remove method.
7686         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7687
7688 2010-01-25  Doug Kwan  <dougkwan@google.com>
7689
7690         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7691         Fix warning due to signed and unsigned comparison on a 32-bit host.
7692
7693 2010-01-22  Doug Kwan  <dougkwan@google.com>
7694
7695         * arm.cc (Target_arm::do_relax): Record an output section for section
7696         offset adjustment it contains any stub table that has changed.
7697         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7698         offsets in an output section if necessary.
7699         * output.cc (Output_section::Output_section): Initialize
7700         section_offsets_need_adjustments_.
7701         (Output_section::add_input_section_for_script): Renamed to
7702         Output_section::add_simple_input_section.
7703         (Output_section::save_states): Add a comment.
7704         (Output_section::discard_states): New method defintion.
7705         (Output_section::adjust_section_offsets): Same.
7706         * output.h (Output_section::add_input_section_for_script): Renamed to
7707         Output_section::add_simple_input_section.
7708         (Output_section::discard_states): New method declaration.
7709         (Output_section::adjust_section_offsets): Same.
7710         (Output_section::section_offsets_need_adjustment,
7711         Output_section::set_section_offsets_need_adjustment): New method
7712         definitions.
7713         (Output_section::section_offsets_need_adjustment_): New data member.
7714         * script-sections.cc
7715         (Output_section_element_input::set_section_address): Adjust code for
7716         renaming of Output_section::add_input_section_for_script.
7717         (Orphan_output_section::set_section_address): Same.
7718
7719 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7720
7721         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7722         Fix_v4bx enum values .
7723         * gold/options.h (General_options): New option definitions.
7724         (General_options::fix_v4bx): New method.
7725         (General_options::Fix_v4bx): New enum.
7726         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7727         (General_options::parse_fix_v4bx_interworking): New method.
7728
7729 2010-01-22  Doug Kwan  <dougkwan@google.com>
7730
7731         * arm.cc (Arm_exidx_fixup): New class.
7732
7733 2010-01-21  Doug Kwan  <dougkwan@google.com>
7734
7735         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7736         classes.
7737         (Arm_exidx_section_offset_map): New type.
7738
7739 2010-01-21  Doug Kwan  <dougkwan@google.com>
7740
7741         * arm.cc (Arm_exidx_input_section): New class.
7742         (Arm_relobj::exidx_input_section_by_link,
7743         Arm_relobj::exidx_input_section_by_shndx,
7744         Arm_relobj::make_exidx_input_section): New methods.
7745         (read_arm_attributes_section): Remove.
7746         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7747         information about them.
7748         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7749         to here.
7750
7751 2010-01-20  Doug Kwan  <dougkwan@google.com>
7752
7753         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7754         Input_section_specifier to Section_id.
7755         (Target_arm::new_arm_input_section: Adjust code for change of key
7756         type.
7757         (Target_arm::find_arm_input_section): Ditto.
7758         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7759         (Section_id): Remove.
7760         (Garbage_collection::Section_id_hash): Remove.
7761         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7762         (Section_id): Remove.
7763         (Icf::Section_id_hash): Remove.
7764         * object.h (Section_id, Const_section_id, Section_id_hash,
7765         Const_section_id_hash): New type definitions.
7766         * output.cc (Output_section::add_relaxed_input_section): Change to
7767         use Const_section_id instead of Input_section_specifier as key type.
7768         (Output_section::add_merge_input_section): Ditto.
7769         (Output_section::build_relaxation_map): Change to use Section_id
7770         instead of Input_section_specifier as key type.
7771         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7772         Ditto.
7773         (Output_section::convert_input_sections_to_relaxed_sections): Change
7774         to use Const_section_id instead of Input_section_specifier as key type.
7775         (Output_section::find_merge_section): Ditto.
7776         (Output_section::find_relaxed_input_section): Ditto.
7777         * output.h (Input_section_specifier): Remove class.
7778         (Output_section::Output_section_data_by_input_section_map): Change
7779         key type to Const_section_id.
7780         (Output_section::Output_relaxed_input_section_by_input_section_map):
7781         Ditto.
7782         (Output_section::Relaxation_map): Change key type to Section_id.
7783
7784 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7785
7786         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7787         (class Arm_v4bx_stub): New class.
7788         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7789         (Stub_factory::make_arm_v4bx_stub): New method.
7790         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7791         (Stub_table::empty): Handle v4bx stubs.
7792         (Stub_table::add_arm_v4bx_stub): New method.
7793         (Stub_table::find_arm_v4bx_stub): New method.
7794         (Arm_relocate_functions::v4bx): New method.
7795         (Target_arm::fix_v4bx): New method.
7796         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7797         (Stub_table::relocate_stubs): Likewise.
7798         (Stub_table::do_write): Likewise.
7799         (Stub_table::update_data_size_and_addralign): Likewise.
7800         (Stub_table::finalize_stubs):  Likewise.
7801         (Target_arm::Scan::local): Likewise.
7802         (Target_arm::Scan::global): Likewise.
7803         (Target_arm::do_finalize_sections): Likewise.
7804         (Target_arm::Relocate::relocate): Likewise.
7805         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7806         Likewise.
7807         (Target_arm::scan_reloc_for_stub): Likewise.
7808         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7809
7810 2010-01-19  Ian Lance Taylor  <iant@google.com>
7811
7812         * output.cc (Output_section_headers::do_sized_write): Write large
7813         segment count to sh_info field.
7814         (Output_file_header::do_sized_write): For large segment count,
7815         write PN_XNUM to e_phnum field.
7816
7817 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7818
7819         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7820         (Arm_relocate_functions::thm_jump8): New function.
7821         (Arm_relocate_functions::thm_jump11): New function.
7822         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7823         R_ARM_THM_JUMP11.
7824         (Target_arm::Scan::global): Likewise.
7825         (Target_arm::Relocate::relocate): Likewise.
7826         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7827         Likewise.
7828
7829 2010-01-14  Doug Kwan  <dougkwan@google.com>
7830
7831         * arm.cc (map, utility): Include headers.
7832         (Target_arm::apply_cortex_a8_workaround): New method.
7833         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7834         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7835         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7836         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7837         the --[no-]fix-cortex-a8 command line options.
7838         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7839         (Target_arm::relocate_stub): Use addend in instruction template.
7840         * options.h (DEFINE_bool): Set the user-set flag.
7841         (General_options): Add --[no-]-fix-cortex options.
7842         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7843         : Update fast look-up map after conversion.
7844
7845 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7846
7847         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7848         in the first pass of do_layout.
7849
7850 2010-01-13  Doug Kwan  <dougkwan@google.com>
7851
7852         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7853         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7854         apparent compiler problem of not folding static constant integral
7855         data members of elfcpp::Elf_sizes<32>.
7856
7857 2010-01-13  Doug Kwan  <dougkwan@google.com>
7858
7859         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7860         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7861         Arm_relobj::scan_section_for_cortex_a8_erratum,
7862         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7863         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7864         sections to scan for relocation stubs into a new method
7865         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7866         relocation and Cortex-A8 stub scanning.
7867         (Target_arm::do_relax): Force stubs to be after stubbed sections
7868         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7869         the beginning of a new relaxation pass.  Update a comment.
7870         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7871
7872 2010-01-12  Ian Lance Taylor  <iant@google.com>
7873
7874         * target-reloc.h (visibility_error): New inline function.
7875         (relocate_section): Call visibility_error.
7876         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7877         (MOSTLYCLEANFILES): Likewise.
7878         (protected_4_pic.o, protected_3.err): New targets.
7879         * testsuite/protected_4.cc: New file.
7880
7881 2010-01-12  Doug Kwan  <dougkwan@google.com>
7882
7883         * arm.cc (Cortex_a8_reloc): New class.
7884         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7885         and cortex_a8_relocs_info_.
7886         (Target_arm::fix_cortex_a8): New method definition.
7887         (Target_arm::Cortex_a8_relocs_info): New type.
7888         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7889         New data member declarations.
7890         (Target_arm::scan_reloc_for_stub): Record information about
7891         relocations for THUMB branches that might be exempted from the
7892         Cortex-A8 workaround.
7893         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7894         at the beginning of a relaxation pass.
7895
7896 2010-01-12  Doug Kwan  <dougkwan@google.com>
7897
7898         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7899         (Arm_relobj::Mapping_symbol_position,
7900          Arm_reloj::Mapping_symbol_position_less,
7901          Arm_relobj::Mapping_symbols_info): New types.
7902         (Target_arm::is_mapping_symbol_name): New method definition.
7903         (Arm_relobj::do_count_local_symbols): Save information about mapping
7904         symbols.
7905
7906 2010-01-11  Doug Kwan  <dougkwan@google.com>
7907
7908         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7909         Arm_relocate_functions::thumb32_branch_upper,
7910         Arm_relocate_functions::thumb32_branch_lower,
7911         Arm_relocate_functions::thumb32_cond_branch_offset,
7912         Arm_relocate_functions::thumb32_cond_branch_upper,
7913         Arm_relocate_functions::thumb32_cond_branch_lower,
7914         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7915         branch offset encoding.
7916         (Arm_relocate_functions::thumb_branch_common): Use new branch
7917         offset encoding methods to avoid code duplication.
7918         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7919         (Stub_addend_reader::operator()): Use new branch encoding method
7920         to avoid code duplication.
7921
7922 2010-01-11  Doug Kwan  <dougkwan@google.com>
7923
7924         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7925         (Target_arm::do_finalize_sections): Define special EXIDX section
7926         symbols only if referenced.
7927         * gc.h (Garbage_collection::add_reference): New method.
7928         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7929         code duplication.
7930
7931 2010-01-11  Ian Lance Taylor  <iant@google.com>
7932
7933         * script.cc (Version_script_info::build_expression_list_lookup):
7934         Change complaing about duplicate wildcard match from error to
7935         warning.
7936
7937         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7938         of 2009-12-30.
7939         (Version_script_info::Version_script_info): Initialize globs_,
7940         default_version_, default_is_global_, and exact_.  Don't
7941         initialize globals_ or locals_.
7942         (Version_script_info::build_lookup_tables): Build local symbols
7943         first.
7944         (Version_script_info::unquote): New function.
7945         (Version_script_info::add_exact_match): New function.
7946         (Version_script_info::build_expression_list_lookup): Remove lookup
7947         parameter.  Add is_global parameter.  Change all callers.  Handle
7948         wildcard pattern specially.  Unquote pattern.  Call
7949         add_exact_match.
7950         (Version_script_info::get_name_to_match): New function.
7951         (Version_script_info::get_symbol_version): New function.
7952         (Version_script_info::get_symbol_version_helper): Remove.
7953         (Version_script_info::check_unmatched_names): Call unquote.
7954         * script.h (class Version_script_info): Change get_symbol_version
7955         to be non-inline and add is_global parameter; change all callers.
7956         Rewrite symbol_is_local.  Update declarations.  Define struct
7957         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7958         Remove globals_ and locals_ members.  Add exact_, globs_,
7959         default_version_, is_global_.
7960         (Version_script_info::Glob): Remove pattern, add expression and
7961         is_global.  Update constructor.  Change all callers.
7962         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7963         default version.
7964         (Versions::symbol_section_contents): If a symbol is undefined, or
7965         defined in a dynamic object, set the version index to
7966         VER_NDX_LOCAL.
7967         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7968         symbol_is_local.
7969         (Symbol_table::add_from_pluginobj): Likewise.
7970         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7971
7972 2010-01-11  Doug Kwan  <dougkwan@google.com>
7973
7974         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7975         (incremental_dump_LDADD): Add linking option for libintl.
7976         * Makefile.in: Regenerate.
7977
7978 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7979
7980         PR gold/11144
7981         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7982         instead of -Ds.
7983         * testsuite/Makefile.in: Regenerated.
7984
7985 2010-01-10  Doug Kwan  <dougkwan@google.com>
7986
7987         * options.h (DEFINE_var): Use parentheses around argument varname__
7988         in macro body to avoid any unintended subsequent substitutions.
7989
7990 2010-01-10  Ian Lance Taylor  <iant@google.com>
7991
7992         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7993         candidates before doing symbol resolution.
7994
7995         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7996         ODR candidates if only one is weak.
7997
7998 2010-01-08  Ian Lance Taylor  <iant@google.com>
7999
8000         * script.cc (Version_script_info::build_expression_list_lookup):
8001         Don't warn about ambiguous version, just record the ambiguity.
8002         (Version_script_info::get_symbol_version_helper): Give error if
8003         version is ambiguous.
8004
8005 2010-01-08  Doug Kwan  <dougkwan@google.com>
8006
8007         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8008         prev_data_size_ and prev_addralign_.  Remove initializer for
8009         deleted data member has_been_changed_.
8010         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8011         to determine if the table is empty.
8012         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8013         Remove.
8014         (Stub_table::add_reloc_stub): Define method in class definition
8015         instead of just declaring it there.
8016         (Stub_table::add_cortex_a8_stub): New method definition.
8017         (Stub_table::update_data_size_and_addralign): Ditto.
8018         (Stub_table::finalize_stubs): Ditto.
8019         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8020         (Stub_table::do_addralign_): Return address alignment in the
8021         (Stub_table::do_reset_address_and_file_offset): Define method in
8022         class definition instead of declaring it there.  Set current data
8023         size to be the data size of the previous pass.
8024         (Stub_table::set_final_data_size): Use current data size as the
8025         final data size.
8026         (Stub_table::relocate_stub): Change parameter type of stub from
8027         Reloc_stub pointer to Stub pointer.
8028         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8029         (Stub_table::Cortex_a8_stub_list): New typedef.
8030         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8031          Stub_table::prev_addralign_): New data member.
8032         (Arm_relobj::Arm_relobj): Initialize data member
8033         section_has_cortex_a8_workaround_.
8034         (Arm_relobj::section_has_cortex_a8_workaround,
8035          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8036          definitions.
8037         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8038         declarations.
8039         (Target_arm::relocate_stub): Change parameter type of stub from
8040         Reloc_stub pointer to Stub pointer.
8041         (Insn_template::size, Insn_template::alignment): Handle
8042         THUMB16_SPECIAL_TYPE.
8043         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8044          Stub_table::update_data_size_and_addralign,
8045          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8046         definitions.
8047         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8048         (Stub_table::do_write): Ditto.
8049         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8050
8051 2010-01-08  Ian Lance Taylor  <iant@google.com>
8052
8053         PR 11108
8054         * symtab.h (class Symbol): Remove fields is_target_special_ and
8055         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8056         (Symbol::is_defined_in_discarded_section): New function.
8057         (Symbol::set_is_defined_in_discarded_section): New function.
8058         (Symbol::has_plt_offset): Rewrite.
8059         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8060         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8061         Don't initialize is_target_special_ or has_plt_offset_.
8062         Initialize is_defined_in_discarded_section_.
8063         (Symbol_table::add_from_relobj): If appropriate, set
8064         is_defined_in_discarded_section.
8065         * resolve.cc (Symbol::override_base_with_special): Don't test
8066         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8067         * target-reloc.h (relocate_section): Do special handling for
8068         symbols defined in discarded sections for global symbols as well
8069         as local symbols.
8070
8071 2010-01-08  Ian Lance Taylor  <iant@google.com>
8072
8073         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8074         the SHT_SYMTAB case.
8075
8076 2010-01-08  Ian Lance Taylor  <iant@google.com>
8077
8078         * object.cc (Sized_relobj::do_layout): Don't get confused if
8079         layout_eh_frame returns NULL.
8080
8081 2010-01-08  Ian Lance Taylor  <iant@google.com>
8082
8083         PR 11084
8084         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8085         dynamic symbol table, use the normal symbol table.
8086         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8087         symbol table.
8088
8089 2010-01-08  Ian Lance Taylor  <iant@google.com>
8090
8091         PR 11072
8092         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8093         sections.
8094
8095 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8096
8097         * version.cc (print_version): Change to "Copyright 2010".
8098
8099 2010-01-08  Ian Lance Taylor  <iant@google.com>
8100
8101         PR 10287
8102         PR 11063
8103         * i386.cc (class Target_i386): Change return type of plt_section
8104         to be non-const.
8105         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8106         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8107         tls_desc_rel_ field.
8108         (Output_data_plt_i386::rel_tls_desc): New function.
8109         (Target_i386::rel_tls_desc_section): New function.
8110         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8111         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8112         R_386_TLS_DESC reloc in rel_tls_desc_section.
8113         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8114         Define struct Tlsdesc_info.
8115         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8116         (Target_x86_64::do_reloc_symbol_index): New function.
8117         (Target_x86_64::add_tlsdesc_info): New function.
8118         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8119         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8120         tlsdesc_rel_ field.
8121         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8122         all callers.
8123         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8124         (Target_x86_64::rela_tlsdesc_section): New function.
8125         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8126         handling.
8127         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8128         (Target_x86_64::do_reloc_addend): New function.
8129         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8130         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8131         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8132         (Output_reloc::type): New function.
8133         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8134         (Output_reloc::is_target_specific): New function.
8135         (Output_reloc::target_arg): New function.
8136         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8137         absolute relocs and target specific relocs.
8138         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8139         add_target_specific.
8140         (class Output_data_reloc) [SHT_RELA]: Likewise.
8141         * output.cc (Output_reloc::Output_reloc): Add four new versions
8142         for absolute relocs and target specific relocs.
8143         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8144         (Output_reloc::get_symbol_index): Likewise.
8145         (Output_reloc::local_section_offset): Check that local_sym_index_
8146         is not TARGET_CODE or 0.
8147         (Output_reloc::symbol_value): Likewise.
8148         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8149         reloc.
8150         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8151         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8152         functions.
8153         * layout.cc (add_target_dynamic_tags): Use output section for
8154         DT_PLTRELSZ and DT_JMPREL.
8155
8156 2010-01-07  Ian Lance Taylor  <iant@google.com>
8157
8158         PR 11061
8159         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8160         function.
8161         (class Output_data_reloc_generic): Define.
8162         (class Output_data_reloc_base): Change base class to
8163         Output_data_reloc_generic.  Change add() method to call
8164         bump_relative_reloc_count for a relative reloc.  Remove
8165         sort_relocs_ field.
8166         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8167         to sort_relocs().
8168         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8169         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8170         appropriate.
8171         * layout.h (class Layout): Update declaration.
8172
8173 2010-01-07  Ian Lance Taylor  <iant@google.com>
8174
8175         * output.h (class Output_data): Add const version of
8176         output_section and do_output_section.
8177         (class Output_section_data): Add const version of
8178         do_output_section.
8179         (class Output_section): Likewise.
8180         * layout.cc (Layout::add_target_dynamic_tags): New function.
8181         * layout.h (class Layout): Update declarations.
8182         * arm.cc (Target_arm::do_finalize_sections): Use
8183         add_target_dynamic_tags.
8184         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8185         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8186         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8187         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8188
8189 2010-01-07  Ian Lance Taylor  <iant@google.com>
8190
8191         PR 11042
8192         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8193         object as needed.
8194
8195 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8196             Ian Lance Taylor  <iant@google.com>
8197
8198         PR 11019
8199         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8200         Xindex::read_symtab_xindex.
8201
8202 2010-01-07  Doug Kwan  <dougkwan@google.com>
8203
8204         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8205         (Insn_template::thumb16_bcond_insn): New method declaration.
8206         (Insn_template): Fix spelling.
8207         (Stub::thumb16_special): New method declaration.
8208         (Stub::do_write): Define virtual method which was previously pure
8209         virtual.
8210         (Stub::do_thumb16_special): New method declaration.
8211         (Stub::do_fixed_endian_write): New template member.
8212         (Reloc_stub::do_write): Remove.
8213         (Reloc_stub::do_fixed_endian_write): Remove.
8214         (Cortex_a8_stub): New class definition.
8215         (Stub_factory::make_cortex_a8_stub): New method definition.
8216         (Stub_factory::Stub_factory): Add missing static storage class
8217         qualifier for elf32_arm_stub_a8_veneer_blx.
8218
8219 2010-01-07  Ian Lance Taylor  <iant@google.com>
8220
8221         PR 10980
8222         * options.h (class General_options): Add --warn-unresolved-symbols
8223         and --error-unresolved-symbols.
8224         * errors.cc (Errors::undefined_symbol): Implement
8225         --warn-unresolved-symbols.
8226
8227         * options.h (class General_options): Add -z text and -z textoff.
8228         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8229
8230 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8231
8232         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8233         (Garbage_collection::cident_sections): New function.
8234         (Garbage_collection::add_cident_section): New function.
8235         (Garbage_collection::cident_sections_): New member.
8236         (gc_process_relocs): Add references to sections whose names are C
8237         identifiers.
8238         * gold.h (cident_section_start_prefix): New constant.
8239         (cident_section_stop_prefix): New constant.
8240         (is_cident): New function.
8241         * layout.cc (Layout::define_section_symbols): Replace string constants
8242         with the newly defined constants.
8243         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8244         C identifiers.
8245         * testsuite/Makefile.am: Add gc_orphan_section_test.
8246         * testsuite/Makefile.in: Regenerate.
8247         * testsuite/gc_orphan_section_test.cc: New file.
8248         * testsuite/gc_orphan_section_test.sh: New file.
8249
8250 2010-01-06  Ian Lance Taylor  <iant@google.com>
8251
8252         PR 10980
8253         * options.h (class General_options): Add --warn-shared-textrel.
8254         * layout.cc (Layout::finish_dynamic_section): Implement
8255         --warn-shared-textrel.
8256
8257         PR 10980
8258         * options.h (class General_options): Add --warn-multiple-gp.
8259
8260 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8261
8262         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8263         $(THREADSLIB) and $(LIBDL).
8264         * Makefile.in: Rebuild.
8265
8266 2010-01-06  Ian Lance Taylor  <iant@google.com>
8267
8268         PR 10980
8269         * options.cc (General_options::parse_section_start): New function.
8270         (General_options::section_start): New function.
8271         (General_options::General_options): Initialize all members.
8272         * options.h: Include <map>
8273         (class General_options): Add --section-start.  Add section_starts_
8274         member.
8275         * layout.cc (Layout::attach_allocated_section_to_segment): If
8276         --section-start was used, set the address of the segment.  Remove
8277         local sort_sections.
8278         (Layout::relaxation_loop_body): If the address of the load segment
8279         has been set by --section-start, don't use it.
8280         * output.h (Output_segment::update_flags_for_output_section): New
8281         function.
8282         * output.cc (Output_segment::add_output_section): Call
8283         update_flags_for_output_section.
8284
8285 2010-01-05  Ian Lance Taylor  <iant@google.com>
8286
8287         PR 10980
8288         * options.h (class General_options): Add --undefined-version.
8289         * script.cc (struct Version_expression): Add was_matched_by_symbol
8290         field.
8291         (Version_script_info::matched_symbol): New function.
8292         (Version_script_info::get_symbol_version_helper): Call
8293         matched_symbol.
8294         (Version_script_info::check_unmatched_names): New function.
8295         * script.h (class Version_script_info): Update declarations.
8296         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8297
8298         * options.h (class General_options): Use DEFINE_bool_alias for
8299         allow_multiple_definition.
8300         * resolve.cc (Symbol_table::should_override): Don't test
8301         allow_multiple_definition.
8302
8303         PR 10980
8304         * options.h (class General_options): Add --cref.
8305         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8306         until after printing cref table.
8307         * cref.cc: Include "symtab.h".
8308         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8309         (Cref_table_compare::operator()): New function.
8310         (Cref_inputs::gather_cref): New function.
8311         (filecol): New static const.
8312         (Cref_inputs::print_cref): New function.
8313         (Cref::print_cref): New function.
8314         * cref.h: Include <cstdio>.
8315         (class Cref): Update declarations.
8316         * mapfile.h (Mapfile::file): New function.
8317         * object.h (class Object): Define Symbols.  Declare virtual
8318         do_get_global_symbols.
8319         (Object::get_global_symbols): New function.
8320         * object.cc (Input_objects::add_object): Pass object to cref_ if
8321         --cref.
8322         (Input_objects::archive_start): Likewise.
8323         (Input_objects::archive_stop): Likewise.
8324         (Input_objects::print_cref): New function.
8325         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8326         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8327         --cref.
8328         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8329         function.
8330         * plugin.h (class Sized_pluginobj): Update declarations.
8331
8332 2010-01-05  Ian Lance Taylor  <iant@google.com>
8333
8334         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8335         to is_default_version.  Rename insdef to insdefault.
8336         (Symbol_table::add_from_relobj): Rename def to is_default_version
8337         and local to is_forced_local.
8338         (Symbol_table::add_from_pluginobj): Likewise.
8339         (Symbol_table::add_from_dynobj): Likewise.
8340         (Symbol_table::define_special_symbol): Rename insdef to
8341         insdefault.
8342
8343 2010-01-04  Ian Lance Taylor  <iant@google.com>
8344
8345         PR 10980
8346         * options.h (class General_options): Add
8347         --allow-multiple-definition and -z muldefs.
8348         * resolve.cc (Symbol_table::should_override): Don't warn about a
8349         multiple symbol definition if --allow-multiple-definition or -z
8350         muldefs.
8351
8352         PR 10980
8353         * options.h (class General_options): Add --add-needed and
8354         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8355         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8356         error if --copy-dt-needed-entries aka --add-needed is used and
8357         would cause a change in behaviour.
8358
8359         PR 10980
8360         * options.h (class General_options): Add -G as a short version of
8361         --shared.  Add no-op options -assert, -g, and -i.
8362
8363 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8364
8365         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8366         check for .text or .gnu.linkonce.t sections.
8367         * icf.cc (Icf::find_identical_sections): Ditto.
8368         Change the detection for mangled function name within the section
8369         name.
8370         * icf.h (is_section_foldable_candidate): New function.
8371
8372 2009-12-30  Ian Lance Taylor  <iant@google.com>
8373
8374         PR 10980
8375         * options.h (class General_options): Permit two dashes with
8376         --retain-symbols-file.
8377
8378 2009-12-30  Ian Lance Taylor  <iant@google.com>
8379
8380         PR 10979
8381         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8382         don't put the file header and segment headers in the text
8383         segment.
8384
8385         PR 10979
8386         * common.cc (Sort_commons::operator()): Stabilize sort when both
8387         entries are NULL.
8388         (Symbol_table::do_allocate_commons_list): When allocating common
8389         symbols, skip a symbol which is no longer common.
8390         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8391         an object before checking its type.
8392         * testsuite/common_test_2.c: New file.
8393         * testsuite/common_test_3.c: New file.
8394         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8395         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8396         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8397         (common_test_2_pic.o, common_test_2.so): New targets.
8398         (common_test_3_pic.o, common_test_3.so): New targets.
8399         * testsuite/Makefile.in: Rebuild.
8400
8401         PR 10979
8402         * script.cc (read_input_script): If we see a new SECTIONS clause,
8403         and we have added an input section, give an error.
8404         * layout.h (class Layout): Add have_added_input_section function.
8405         Add have_added_input_section_ field.
8406         * layout.cc (Layout::Layout): Initialize
8407         have_added_input_section_.
8408         (Layout::layout): Set have_added_input_section_.
8409         (Layout::layout_eh_frame): Likewise.
8410
8411 2009-12-30  Ian Lance Taylor  <iant@google.com>
8412
8413         PR 10931
8414         * options.h (class General_options): Add --sort-common option.
8415         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8416         * common.cc (Sort_common): Add sort_order parameter to
8417         constructor.  Add sort_order_ field.
8418         (Sort_commons::operator): Check sort_order_.
8419         (Symbol_table::allocate_commons): Determine the sort order.
8420         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8421         Change all callers.
8422         (Symbol_table::do_allocate_commons_list): Likewise.
8423
8424 2009-12-30  Ian Lance Taylor  <iant@google.com>
8425
8426         PR 10916
8427         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8428         symbols from this object, don't change the visibility of an
8429         undefined symbol.
8430         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8431
8432 2009-12-30  Ian Lance Taylor  <iant@google.com>
8433
8434         PR 10861
8435         * script.h (class Version_script_info): Define Language enum.
8436         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8437         new fields globals_, locals_, and is_finalized_.
8438         * script.cc: Various formatting fixes.
8439         (class Parser_closure): Change language_stack_ from a vector of
8440         std::string to one of Version_script_info::Language.  Adjust all
8441         uses accordingly.
8442         (class Lazy_demangler): Remove.
8443         (struct Version_expression): Change language from std::string to
8444         Version_script_info::Language.
8445         (Version_script_info::Version_script_info): New function.
8446         (Version_script_info::~Version_script_info): Don't call clear.
8447         (Version_script_info::finalize): New function.
8448         (Version_script_info::build_lookup_tables): New function.
8449         (Version_script_info::build_expression_list_lookup): New
8450         function.
8451         (Version_script_info::get_symbol_version_helper): Rewrite to use
8452         lookup tables.
8453         (Version_script_info::print_expression_list): Adjust to use
8454         Version_script_info::Language.
8455         (script_push_lex_into_version_mode): Check that the version script
8456         has not been finalized.
8457         (version_script_push_lang): Change language string to
8458         Version_script_info::Language.
8459         * options.cc (Command_line::version_script): New function.
8460         * options.h (class General_options): Add finalize_dynamic_list
8461         function.  Change version_script from declaration to definition.
8462         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8463         * testsuite/version_script.map: Remove duplicate def of foo.
8464         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8465         version_script.map.
8466         * testsuite/Makefile.in: Rebuild.
8467
8468 2009-12-30  Ian Lance Taylor  <iant@google.com>
8469
8470         PR 10843
8471         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8472         if the input symbol index is 0, make the output symbol index 0.
8473
8474 2009-12-30  Ian Lance Taylor  <iant@google.com>
8475
8476         PR 10670
8477         * options.h (class General_options): Add -x/--discard-all.
8478         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8479         --discard-all.  If the local symbol needs a dynamic entry, check
8480         that before handling --discard-locals.
8481
8482 2009-12-30  Ian Lance Taylor  <iant@google.com>
8483
8484         PR 10450
8485         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8486         flags to PF_R.
8487         (Output_segment::add_output_section): Don't change the flags if
8488         the type is PT_TLS.
8489
8490         PR 10450
8491         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8492         GNU hash table if they need a dynamic value.  Otherwise, don't add
8493         them if they are defined in a dynamic object or are forced local.
8494
8495 2009-12-29  Ian Lance Taylor  <iant@google.com>
8496
8497         PR 10450
8498         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8499         .gnu.hash table for a 32-bit target.
8500
8501         PR 10450
8502         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8503         regular and a dynamic object only needs a dynamic symbol table
8504         entry if it is externally visible.
8505
8506         PR 10450
8507         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8508         constructor.  Add global_offset_table_ field.
8509         (Target_i386::got_section): Set global_offset_table_.
8510         (Target_i386::do_finalize_sections): Set global_offset_table_
8511         size.
8512         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8513         in constructor.  Add global_offset_table_ field.
8514         (Target_x86_64::got_section): Set global_offset_table_.
8515         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8516         size.
8517
8518         * layout.cc (Layout::Layout): Initialize increase_relro_.
8519         (Layout::get_output_section): Add is_relro, is_last_relro, and
8520         is_first_non_relro parameters.  Change all callers.
8521         (Layout::choose_output_section): Likewise.
8522         (Layout::add_output_section_data): Likewise.
8523         (Layout::make_output_section): Likewise.
8524         (Layout::set_segment_offsets): Clear increase_relro when using a
8525         linker script.
8526         * layout.h (class Layout): Add increase_relro method.  Add
8527         increase_relro_ field.  Update declarations.
8528         * output.cc (Output_section::Output_section): Initialize
8529         is_last_relro_ and is_first_non_relro_.
8530         (Output_segment::add_output_section): Group relro sections is
8531         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8532         (Output_segment::maximum_alignment): Remove relro handling.
8533         (Output_segment::set_section_addresses): Add increase_relro
8534         parameter.  Change all callers.  Add initial alignment to align
8535         relro sections on separate page.  Remove old relro handling.
8536         (Output_segment::set_section_list_addresses): Remove in_relro
8537         parameter.  Change all callers.
8538         (Output_segment::set_offset): Add increase parameter.  Change all
8539         callers.  Remove old relro handling.
8540         * output.h (class Output_section): Add new methods: is_last_relro,
8541         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8542         Add is_last_relro_ and is_first_non_relro_ fields.
8543         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8544         Create separate .got.plt section.  Call increase_relro.
8545         * x86_64.cc (Target_x86_64::got_section): Likewise.
8546         * testsuite/relro_script_test.t: Add .got.plt.
8547
8548         PR 10450
8549         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8550         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8551         (Layout::finalize): Call set_dynamic_symbol_size.
8552         (Layout::set_dynamic_symbol_size): New function.
8553         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8554         set_dynamic_symbol_size.
8555
8556         PR 10450
8557         * output.h (class Output_section): Add is_entsize_zero_ field.
8558         * output.cc (Output_section::Output_section): Initialize
8559         is_entsize_zero_.
8560         (Output_section::set_entsize): If two different entsizes are
8561         requested, force it to zero.
8562         (Output_section::add_input_section): Set flags for .debug_str
8563         before updating section flags.  Set entsize.
8564         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8565         and SHF_STRING if all input sections have those flags.
8566
8567 2009-12-29   Rafael Espindola  <espindola@google.com>
8568
8569         * main.cc (main): Fix the sys time reporting.
8570         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8571         reporting.
8572
8573 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8574
8575         * options.cc (General_options::parse_version): Allow -v to exit
8576         without an error if there is nothing to link.
8577
8578 2009-12-29  Ian Lance Taylor  <iant@google.com>
8579
8580         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8581         using a version of gcc before 4.1.
8582         * configure: Rebuild.
8583
8584 2009-12-28  Chris Demetriou  <cgd@google.com>
8585
8586         * attributes.cc (Output_attributes_section_data::do_write): Use
8587         std::vector::front rather than std::vector::data.
8588
8589 2009-12-28  Ian Lance Taylor  <iant@google.com>
8590
8591         * symtab.h (class Symbol_table): Add enum Defined.
8592         * resolve.cc (Symbol_table::should_override): Add defined
8593         parameter.  Change all callers.  Test whether object is NULL
8594         before calling a method on it.
8595         (Symbol_table::report_resolve_problem): Add defined parameter.
8596         Change all callers.
8597         (Symbol_table::should_override_with_special): Likewise.
8598         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8599         parameter.  Change all callers.
8600         (Symbol_table::do_define_in_output_data): Likewise.
8601         (Symbol_table::define_in_output_segment): Likewise.
8602         (Symbol_table::do_define_in_output_segment): Likewise.
8603         (Symbol_table::define_as_constant): Likewise.
8604         (Symbol_table::do_define_as_constant): Likewise.
8605         * script.h (class Symbol_assignment): Add is_defsym parameter to
8606         constructor; change all callers.
8607         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8608         parameter.  Change all callers.  Add is_defsym_ field.
8609         (class Parser_closure): Add parsing_defsym parameter to
8610         constructor; change all callers.  Add parsing_defsym accessor
8611         function.  Add parsing_defsym_ field.
8612
8613 2009-12-28  Ian Lance Taylor  <iant@google.com>
8614
8615         * gold.cc (queue_middle_tasks): Fix formatting.
8616         * object.cc (Relobj::is_section_name_included): Likewise.
8617
8618 2009-12-23  Ian Lance Taylor  <iant@google.com>
8619
8620         * i386.cc (Target_i386::do_calls_non_split): Recognize
8621         -fsplit-stack prologue for a function with a static chain.
8622         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8623         -fsplit-stack prologue when using %r11.
8624
8625 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8626
8627         * options.cc (General_options::parse_version): Make -v continue and do
8628         the link like GNU ld does.
8629
8630 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8631
8632         * Makefile.am (CCFILES): Add timer.cc.
8633         (HFILES): Add timer.h.
8634         * configure.ac: Check for sysconf and times.
8635         * main.cc: include timer.h.
8636         (main): Use Timer instead of get_run_time.
8637         * timer.cc: New.
8638         * timer.h: New.
8639         * workqueue.cc: include timer.h.
8640         (Workqueue::find_and_run_task):
8641         Report user, sys and wall time.
8642         * Makefile.in: Regenerate.
8643         * config.in: Regenerate.
8644         * configure: Regenerate.
8645
8646 2009-12-16  Doug Kwan  <dougkwan@google.com>
8647
8648         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8649         sections.
8650         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8651         relaxed input sections.
8652         * output.cc (Output_section::find_relaxed_input_section): Change
8653         return type to Output_relaxed_input_section pointer.  Adjust code
8654         for new type of relaxed_input_section_map_.
8655         * output.h (Output_section::find_relaxed_input_section): Change
8656         return type to Output_relaxed_input_section pointer.
8657         (Output_section::Output_relaxed_input_section_by_input_section_map):
8658         New type.
8659         (Output_section::relaxed_input_section_map_): Change type to
8660         Output_section::Output_relaxed_input_section_by_input_section_map.
8661         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8662         input section.
8663
8664 2009-12-15  Ian Lance Taylor  <iant@google.com>
8665
8666         * layout.cc (Layout::create_shstrtab): Only write out after input
8667         sections if we are compressing debug sections.
8668
8669 2009-12-15  Ian Lance Taylor  <iant@google.com>
8670
8671         * archive.cc (Archive::add_symbols): Only look up a symbol without
8672         a version if there is, in fact, a version.
8673
8674 2009-12-14  Ian Lance Taylor  <iant@google.com>
8675
8676         Revert -Wshadow changes, all changes from:
8677         2009-12-11  Doug Kwan  <dougkwan@google.com>
8678         2009-12-11  Nick Clifton  <nickc@redhat.com>
8679         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8680
8681 2009-12-11  Doug Kwan  <dougkwan@google.com>
8682
8683         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8684         due to -Wshadow.
8685         * attributes.cc (Object_attribute::size): Ditto.
8686         (Attributes_section_data::size): Ditto.
8687         (Attributes_section_data::Attributes_section_data): Ditto.
8688         (Output_attributes_section_data::do_write): Ditto.
8689         * attributes.h (Object_attribute::set_type): Ditto.
8690         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8691
8692 2009-12-11  Nick Clifton  <nickc@redhat.com>
8693
8694         * archive.cc: Fix shadowed variable warnings.
8695         * arm.cc: Likewise.
8696         * compressed_output.cc: Likewise.
8697         * compressed_output.h: Likewise.
8698         * configure: Likewise.
8699         * dwarf_reader.cc: Likewise.
8700         * dynobj.cc: Likewise.
8701         * dynobj.h: Likewise.
8702         * ehframe.cc: Likewise.
8703         * ehframe.h: Likewise.
8704         * errors.cc: Likewise.
8705         * expression.cc: Likewise.
8706         * fileread.cc: Likewise.
8707         * fileread.h: Likewise.
8708         * freebsd.h: Likewise.
8709         * i386.cc: Likewise.
8710         * icf.cc: Likewise.
8711         * incremental.h: Likewise.
8712         * layout.cc: Likewise.
8713         * layout.h: Likewise.
8714         * mapfile.cc: Likewise.
8715         * merge.cc: Likewise.
8716         * merge.h: Likewise.
8717         * object.cc: Likewise.
8718         * object.h: Likewise.
8719         * options.h: Likewise.
8720         * output.cc: Likewise.
8721         * output.h: Likewise.
8722         * parameters.cc: Likewise.
8723         * plugin.cc: Likewise.
8724         * powerpc.cc: Likewise.
8725         * reduced_debug_output.cc: Likewise.
8726         * reduced_debug_output.h: Likewise.
8727         * reloc.cc: Likewise.
8728         * reloc.h: Likewise.
8729         * resolve.cc: Likewise.
8730         * script-sections.cc: Likewise.
8731         * script.cc: Likewise.
8732         * script.h: Likewise.
8733         * sparc.cc: Likewise.
8734         * symtab.cc: Likewise.
8735         * symtab.h: Likewise.
8736         * target-select.cc: Likewise.
8737         * target-select.h: Likewise.
8738         * token.h: Likewise.
8739         * workqueue.cc: Likewise.
8740         * workqueue.h: Likewise.
8741         * x86_64.cc: Likewise.
8742
8743 2009-12-10  Doug Kwan  <dougkwan@google.com>
8744
8745         * arm.cc (attributes.h): New include.
8746         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8747         (Arm_relobj::~Arm_relobj): Delete object pointed by
8748         attributes_section_data_.
8749         (Arm_relobj::attributes_section_data): New method definition.
8750         (Arm_relobj::attributes_section_data_): New data member declaration.
8751         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8752         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8753         attributes_section_data_.
8754         (Arm_dynobj::attributes_section_data): New method definition.
8755         (Arm_dynobj::attributes_section_data_): New data member declaration.
8756         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8757         initialization value of may_use_blx_ to false.
8758         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8759         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8760         object attributes to compute results instead of hard-coding.
8761         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8762         Target_arm::get_secondary_compatible_arch,
8763         Target_arm::set_secondary_compatible_arch
8764         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8765         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8766         New method declarations.
8767         (Target_arm::get_aeabi_object_attribute): New method definition.
8768         (Target_arm::attributes_section_data_): New data member declaration.
8769         (read_arm_attributes_section): New template definition.
8770         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8771         (Arm_dynobj::do_read_symbols): Ditto.
8772         (Target_arm::do_finalize_sections): Merge attributes sections from
8773         input.  Check for BLX use after attributes section merging.
8774         Fix __exidx_start and __exidx_end visibility.  Create an
8775         .ARM.attributes section if necessary.
8776         (Target_arm::get_secondary_compatible_arch,
8777         Target_arm::set_secondary_compatible_arch,
8778         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8779         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8780         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8781         New method definitions.
8782
8783 2009-12-09  Ian Lance Taylor  <iant@google.com>
8784
8785         * plugin.cc (Plugin::load): Don't cast from void* to a function
8786         pointer.
8787
8788 2009-12-09  Ian Lance Taylor  <iant@google.com>
8789
8790         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8791         information fields.
8792
8793 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8794
8795         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8796         Replace two_file_shared_1.so with two_file_shared_2.so.
8797         * testsuite/Makefile.in: Regenerated.
8798
8799 2009-12-08  Doug Kwan  <dougkwan@google.com>
8800
8801         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8802         (HFILES): Add attributes.h and int_encoding.h.
8803         * Makefile.in: Regenerate.
8804         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8805         function definitions to int_encoding.cc
8806         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8807         prototypes to int_encoding.h
8808         * reduced_debug_output.cc (int_encoding.h): New include.
8809         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8810         function definitions to int_encoding.cc
8811         (insert_into_vector, read_from_pointer): Move template definitions to
8812         int_encoding.h
8813         * attributes.cc: New file.
8814         * attributes.h: New file.
8815         * int_encoding.cc: New file.
8816         * int_encoding.h: New file.
8817
8818 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8819
8820         PR gold/11055
8821         * incremental-dump.cc (dump_incremental_inputs): New.
8822         (main): Use dump_incremental_inputs.
8823
8824 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8825
8826         PR gold/10893
8827         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8828         checking elfcpp::STT_FUNC.
8829         (Target_i386::Relocate::relocate): Likewise.
8830         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8831
8832         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8833         symbols from shared libraries into normal FUNC symbols.
8834
8835         * symtab.h (Symbol): Add is_func and use it.
8836
8837 2009-12-05  Doug Kwan  <dougkwan@google.com>
8838
8839         * arm.cc (Target_arm::arm_info): Initialize new fields
8840         attributes_section and attributes_vendor.
8841         * i386.cc (Target_i386::i386_info): Same.
8842         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8843         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8844         fields attributes_section and attributes_vendor.
8845         * sparc.cc (Target_sparc::sparc_info): Same.
8846         * target.h (Target::attributes_section, Target::attributes_vendor,
8847         Target::is_attributes_section, Target::attribute_arg_type,
8848         Target::attributes_order): New method definitions.
8849         (Target::Target_info::attributes_section,
8850         Target::Target_info::attributes_vendor): New fields.
8851         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8852         virtual method definitions.
8853         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8854         attributes_section and attributes_vendor.
8855         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8856
8857 2009-12-05  Doug Kwan  <dougkwan@google.com>
8858
8859         * arm.cc: Update comments about interworking and stub generation.
8860         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8861         considered as non-PIC.
8862         (Arm_relocate_functions::base_abs): Fix formatting.
8863         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8864         of function to use GOT entry address instead of offset.
8865         (Target_arm::Scan::global): Issue an error if a symbol would need a
8866         PLT does not get one because it is untyped.  Remove code to create
8867         dynamic symbols for relative branches.
8868         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8869         takes unsigned integer instead of boolean.
8870
8871 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8872
8873         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8874         (two_file_test_LDADD): Likewise.
8875         (common_test_1_LDADD): Likewise.
8876         (exception_test_LDADD) Likewise.
8877         (weak_test_LDADD): Likewise.
8878         (many_sections_test_LDADD): Likewise.
8879         (initpri1_LDADD): Likewise.
8880         (script_test_1_LDADD): Likewise.
8881         (script_test_2_LDADD): Likewise.
8882         (justsyms_LDADD): Likewise.
8883         (binary_test_LDADD): Likewise.
8884         (large_LDADD): Likewise.
8885         * testsuite/Makefile.in: Regenerated.
8886
8887 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8888
8889         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8890         (Symbol_table::override_with_special): Likewise.
8891         (Symbol_table::add_from_object): Likewise.
8892
8893 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8894
8895         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8896         Don't set the data_offset twice.
8897
8898 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8899
8900         * testsuite/Makefile.in: Regenerate.
8901
8902 2009-12-03  Doug Kwan  <dougkwan@google.com>
8903
8904         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8905         (Target_arm::do_finalize_sections): Add parameter for symbol table
8906         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8907         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8908         parameter for symbol table pointer.
8909         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8910         an additional parameter for a pointer to symbol table.
8911         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8912         parameter for a symbol table pointer.
8913         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8914         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8915         Ditto.
8916         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8917         parameter for a symbol table pointer.
8918
8919 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8920
8921         * incremental.cc (Incremental_inputs_header)
8922         (Incremental_inputs_header_write, Incremental_inputs_entry)
8923         (Incremental_inputs_entry_write): Move ...
8924         * incremental.h (Incremental_inputs_header)
8925         (Incremental_inputs_header_write, Incremental_inputs_entry)
8926         (Incremental_inputs_entry_write): here.
8927
8928 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8929
8930         * incremental.cc (make_sized_incremental_binary): Set the target.
8931         Error if it is incompatible.
8932         * output.h (Output_file): Add filename method.
8933
8934 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8935
8936         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8937         from the get_* methods.
8938
8939 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8940
8941         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8942         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8943         Write 0 for the data_offset of scripts.
8944
8945 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8946
8947         * testsuite/Makefile.am: Add the incremental_test.sh test.
8948         * testsuite/incremental_test.sh: New.
8949         * testsuite/incremental_test_1.c: New.
8950         * testsuite/incremental_test_2.c: New.
8951
8952 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8953
8954         * incremental-dump.cc (main): Fix typos.
8955
8956 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8957
8958         PR gold/11025
8959         * incremental-dump.cc (main): Use llu to print 64 bit values.
8960
8961 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8962             H.J. Lu  <hongjiu.lu@intel.com>
8963
8964         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8965         $(LIBDL).
8966         (incremental_dump_LDADD): Likewise.
8967         * Makefile.in: Regenerated.
8968
8969 2009-11-25  Doug Kwan  <dougkwan@google.com>
8970
8971         Revert:
8972
8973         2009-11-25  Doug Kwan  <dougkwan@google.com>
8974
8975                 * arm.cc (Target_arm::Target_arm): Move method definition
8976                 outside of class definition.  Add code to handle
8977                 --target1-rel, --target1-abs and --target2= options.
8978                 (Target_arm::get_reloc_reloc_type): Change method to be
8979                 non-static and const.
8980                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8981                 New data member declaration.
8982                 (Target_arm::Scan::local, Target_arm::Scan::global,
8983                 Target_arm::Relocate::relocate,
8984                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8985                 Adjust call to Target_arm::get_real_reloc_type.
8986                 (Target_arm::get_real_reloc_type): Use command line options
8987                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8988                 * options.h (--target1-rel, --target1-abs, --target2): New
8989                 ARM-only options.
8990
8991 2009-11-25  Doug Kwan  <dougkwan@google.com>
8992
8993         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8994         class definition.  Add code to handle --target1-rel, --target1-abs
8995         and --target2= options.
8996         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8997         and const.
8998         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8999         member declaration.
9000         (Target_arm::Scan::local, Target_arm::Scan::global,
9001         Target_arm::Relocate::relocate,
9002         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9003         call to Target_arm::get_real_reloc_type.
9004         (Target_arm::get_real_reloc_type): Use command line options to
9005         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9006         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9007         options.
9008
9009 2009-11-25  Doug Kwan  <dougkwan@google.com>
9010
9011         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9012         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9013         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9014         formatting.
9015         (Arm_relocate_functions::thm_call): Replace body with a call to
9016         Arm_relocate_functions::thumb_branch_common.
9017         (Arm_relocate_functions::thm_jump24,
9018         Arm_relocate_functions::thm_xpc22): New method definitions.
9019         (Arm_relocate_functions::thumb_branch_common): New method definition.
9020         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9021         operator.
9022         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9023         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9024
9025 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9026
9027         * Makefile.am: Build incremental-dump
9028         * Makefile.in: Regenerate.
9029         * incremental-dump.cc: New.
9030         * incremental.cc (Incremental_inputs_header_data,
9031         Incremental_inputs_entry_data): Move to incremental.h
9032         * incremental.h: (Incremental_inputs_header_data,
9033         Incremental_inputs_entry_data): Move from incremental.cc
9034
9035 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9036
9037         * incremental.cc (Incremental_inputs_header,
9038         Incremental_inputs_header_write, Incremental_inputs_entry,
9039         Incremental_inputs_entry_write): Add a typedef with the data type.
9040
9041 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9042
9043         * incremental.cc (Incremental_inputs_header,
9044         Incremental_inputs_header_write, Incremental_inputs_entry,
9045         Incremental_inputs_entry_write): Update comment about which
9046         type has the filed descriptions.
9047
9048 2009-11-15  Doug Kwan  <dougkwan@google.com>
9049
9050         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9051         (Arm_relocate_functions::arm_branch_common): Change method defintion
9052         in class definition to a method declaration and update list of formal
9053         parameters.
9054         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9055         Arm_relocation_functions::jump24): Adjust call to
9056         Arm_relocate_functions::arm_branch_common.  Update list of formal
9057         parameters.
9058         (Arm_relocate_functions::xpc25): New method definition.
9059         (Arm_relocate_functions::arm_branch_common): Move method defintion
9060         out from class definition.  Use stubs for mode-switching and extending
9061         branch ranges.
9062         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9063         specially.  Change code to enable use of stubs in ARM branches.
9064
9065 2009-11-10  Doug Kwan  <dougkwan@google.com>
9066
9067         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9068         in method declaration.
9069         (Target_arm::relocate_stub): New method declaration.
9070         (Target_arm::default_target): Change to return a pointer instead of
9071         a const reference.
9072         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9073         Target_arm::default_target.
9074         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9075         method definition.
9076         (Target_arm::relocate_section): Adjust view.
9077         (Target_arm::relocate_stub): New method definition.
9078
9079 2009-11-10  Doug Kwan  <dougkwan@google.com>
9080
9081         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9082         a format warning.
9083         * incremental.cc (open_incremental_binary): Initialized local
9084         variables to avoid warnings.
9085         * object.cc (make_elf_object): Ditto.
9086         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9087         a format warning.
9088
9089 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9090
9091         PR gold/10930
9092         * testsuite/plugin_test.c: Include "config.h".
9093
9094 2009-11-09  Doug Kwan  <dougkwan@google.com>
9095
9096         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9097         (arm_symbol_value): Remove.
9098         (Arm_relocate_functions::arm_branch_common,
9099         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9100         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9101         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9102         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9103         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9104         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9105         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9106         Arm_relocate_functions::thm_mobw_abs_nc,
9107         Arm_relocate_functions::thm_mov_abs,
9108         Arm_relocate_functions::movw_prel_nc,
9109         Arm_relocate_functions::thm_movt_abs,
9110         Arm_relocate_functions::movt_prel,
9111         Arm_relocate_functions::thm_movw_prel_nc,
9112         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9113         (Target_arm::Relocate::relocate): Only decompose address into two
9114         parts if relocation type uses the thumb-bit and pass the actual
9115         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9116         calls to methods in Arm_relocate_functions for this change.
9117
9118 2009-11-08  Ian Lance Taylor  <iant@google.com>
9119
9120         PR 10925
9121         * reloc.cc: Instantiate
9122         Sized_relobj::initialize_input_to_output_maps and
9123         Sized_relobj:free_input_to_output_maps.
9124
9125 2009-11-06  Ian Lance Taylor  <iant@google.com>
9126
9127         PR 10876
9128         * defstd.cc (in_segment): Set only_if_ref true for "end".
9129
9130 2009-11-06  Doug Kwan  <dougkwan@google.com>
9131
9132         * arm.cc (class Reloc_stub): Correct a comment.
9133         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9134         (Target_arm::scan_section_for_stubs): New method declaration.
9135         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9136         Change methods from private to protected.
9137         (Target_arm::do_may_relax): New method definition.
9138         (Target_arm::do_relax, Target_arm::group_sections,
9139         Target_arm::scan_reloc_for_stub,
9140         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9141         (Target_arm::arm_input_section_map_): New data member declaration.
9142         (Target_arm::scan_reloc_for_stub,
9143         Target_arm::scan_reloc_section_for_stubs,
9144         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9145         Target_arm::do_relax): New method definitions.
9146
9147 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9148
9149         * configure.ac: Check for (struct stat)::st_mtim
9150         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9151         * config.in: Regenerate.
9152         * configure: Regenerate.
9153
9154 2009-11-05  Ian Lance Taylor  <iant@google.com>
9155
9156         PR 10910
9157         * output.cc (Output_segment::add_output_section): Add missing
9158         return statement.
9159
9160 2009-11-04  Ian Lance Taylor  <iant@google.com>
9161
9162         PR 10880
9163         * object.h (class Object): Add is_needed and set_is_needed
9164         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9165         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9166         defined in a dynamic object and referenced by a regular object,
9167         set is_needed for the dynamic object.
9168         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9169         if the file is marked with as_needed and it is not needed.
9170
9171 2009-11-04  Ian Lance Taylor  <iant@google.com>
9172
9173         PR 10887
9174         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9175         tags if data is discarded by linker script.
9176         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9177         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9178         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9179         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9180
9181 2009-11-04  Ian Lance Taylor  <iant@google.com>
9182
9183         * layout.cc (Layout::get_output_section): Add is_interp and
9184         is_dynamic_linker_section parameters.  Change all callers.
9185         (Layout::choose_output_section): Likewise.
9186         (Layout::make_output_section): Likewise.
9187         (Layout::add_output_section_data): Add is_dynamic_linker_section
9188         parameter.  Change all callers.
9189         * layout.h (class Layout): Update declarations.
9190         * output.h (class Output_section): Add is_interp, set_is_interp,
9191         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9192         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9193         generate_code_fills_at_write_ to a bitfield.
9194         * output.cc (Output_section::Output_sections): Initialize new
9195         fields.
9196         (Output_segment::add_output_section): Add do_sort parameter.
9197         Change all callers.
9198
9199 2009-11-03  Ian Lance Taylor  <iant@google.com>
9200
9201         PR 10860
9202         * options.h (class General_options): Add --warn-common.
9203         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9204         merging two common symbols.
9205         (Symbol_table::should_override): Handle --warn-common when merging
9206         a common symbol with a defined symbol.  Use report_resolve_problem
9207         for multiple definitions.
9208         (Symbol_table::report_resolve_problem): New function.
9209         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9210
9211 2009-11-03  Doug Kwan  <dougkwan@google.com>
9212
9213         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9214         stub_factory_.
9215         (Target_arm::stub_factory): New method definition.
9216         (Target_arm::new_arm_input_section,
9217         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9218         Target_arm::reloc_uses_thumb_bit): New method declarations.
9219         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9220         New type definitions.
9221         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9222         member declarations.
9223         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9224         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9225         New method definitions.
9226
9227 2009-11-03  Ian Lance Taylor  <iant@google.com>
9228
9229         * options.h (class General_options): Add --warn_constructors.
9230
9231 2009-11-03  Ian Lance Taylor  <iant@google.com>
9232
9233         PR 10893
9234         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9235         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9236
9237 2009-11-03  Ian Lance Taylor  <iant@google.com>
9238
9239         PR 10895
9240         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9241         --msgid-bugs-address.
9242         (install-pdf): New target.
9243         (install-data_yes): Look up one directory to find mkinstalldirs.
9244
9245 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9246
9247         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9248         tree.
9249
9250 2009-10-30  Doug Kwan  <dougkwan@google.com>
9251
9252         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9253
9254 2009-10-30  Doug Kwan  <dougkwan@google.com>
9255
9256         * arm.cc (Stub_addend_reader): New struct template definition
9257         and partial specializations.
9258         (Stub_addend_reader::operator()): New method definition for a
9259         partially specialized template.
9260
9261 2009-10-30  Doug Kwan  <dougkwan@google.com>
9262
9263         * arm.cc (Arm_relobj::processor_specific_flags): New method
9264         definition.
9265         (Arm_relobj::do_read_symbols): New method declaration.
9266         (Arm_relobj::processor_specific_flags_): New data member declaration.
9267         (Arm_dynobj): New class definition.
9268         (Target_arm::do_finalize_sections): Add input_objects parameter.
9269         (Target_arm::do_adjust_elf_header): New method declaration.
9270         (Target_arm::are_eabi_versions_compatible,
9271         (Target_arm::merge_processor_specific_flags): New method declaration.
9272         (Target_arm::do_make_elf_object): New overloaded method definitions
9273         and declaration.
9274         (Arm_relobj::do_read_symbols): New method definition.
9275         (Arm_dynobj::do_read_symbols): Ditto.
9276         (Target_arm::do_finalize_sections): Add input_objects parameters.
9277         Merge processor-specific flags from all input objects.
9278         (Target_arm::are_eabi_versions_compatible,
9279         Target_arm::merge_processor_specific_flags,
9280         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9281         New method definitions.
9282         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9283         Input_objects pointer type parameter.
9284         * layout.cc (Layout::finalize): Pass input objects to target's.
9285         finalize_sections function.
9286         * output.cc (Output_file_header::do_sized_write): Set ELF file
9287         header's processor-specific flags.
9288         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9289         Input_objects pointer type parameter.
9290         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9291         * target.h (Input_objects): New forward class declaration.
9292         (Target::processor_specific_flags,
9293         Target::are_processor_specific_flags_sect): New method definitions.
9294         (Target::finalize_sections): Add input_objects parameter.
9295         (Target::Target): Initialize processor_specific_flags_ and
9296         are_processor_specific_flags_set_.
9297         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9298         parameter.
9299         (Target::set_processor_specific_flags): New method definition.
9300         (Target::processor_specific_flags_,
9301         Target::are_processor_specific_flags_set_): New data member
9302         declarations.
9303         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9304         Input_objects pointer type parameter.
9305
9306 2009-10-30  Doug Kwan  <dougkwan@google.com>
9307
9308         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9309
9310 2009-10-28  Ian Lance Taylor  <iant@google.com>
9311
9312         * object.h (class Relobj): Drop options parameter from
9313         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9314         do_scan_relocs, do_relocate.  Change all callers.
9315         (class Sized_relobj): Drop options parameters from
9316         do_gc_process_relocs, do_scan_relocs, do_relocate,
9317         do_relocate_sections, relocate_sections, emit_relocs_scan,
9318         emit_relocs_scan_reltype.  Change all callers.
9319         (struct Relocate_info): Remove options field and all references to
9320         it.
9321         * reloc.h (class Read_relocs): Remove options constructor
9322         parameter and options_ field.  Change all callers.
9323         (class Gc_process_relocs, class Scan_relocs): Likewise.
9324         (class Relocate_task): Likewise.
9325         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9326         all callers.
9327         (scan_relocatable_relocs): Likewise.
9328         * target.h (class Sized_target): Remove options parameter from
9329         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9330         all callers.
9331         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9332         callers.
9333         * arm.cc: Update functions to remove options parameters.
9334         * i386.cc: Likewise.
9335         * powerpc.cc: Likewise.
9336         * sparc.cc: Likewise.
9337         * x86_64.cc: Likewise.
9338         * testsuite/testfile.cc: Likewise.
9339
9340 2009-10-28  Doug Kwan  <dougkwan@google.com>
9341
9342         * arm.cc (Arm_relobj): New class definition.
9343         (Arm_relobj::scan_sections_for_stubs,
9344         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9345         New method definitions.
9346
9347 2009-10-28  Cary Coutant  <ccoutant@google.com>
9348
9349         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9350         (Plugin::cleanup_done_): New member.
9351         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9352         (Plugin_manager::cleanup_done_): Remove.
9353         (Plugin_manager::add_input_file): Edit error message.
9354         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9355         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9356
9357 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9358
9359         * fileread.cc: (File_read::View::~View): Use the new
9360         data_ownership_ filed.
9361         (File_read::~File_read): Dispose the new whole_file_view_.
9362         (File_read::open): Mmap the whole file if needed.
9363         (File_read::open): Use whole_file_view_ instead of contents_.
9364         (File_read::find_view): Use whole_file_view_ if applicable.
9365         (File_read::do_read): Use whole_file_view_ instead of contents_.
9366         (File_read::make_view): Use whole_file_view_ instead of contents_,
9367         update File_read::View::View call.
9368         (File_read::find_or_make_view): Update File_read::View::View
9369         call.
9370         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9371         remove contents_
9372         (File_read::View::Data_ownership): New enum.
9373         (File_read::View::View): Replace bool mapped_ with Data_ownership
9374         argument.
9375         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9376         (File_read::View::data_ownership_): New field.
9377         (File_read::contents_): Remove (replaced by whole_file_view_).
9378         (File_read::whole_file_view_): New field.
9379         * options.h (class General_options): Add --keep-files-mapped.
9380
9381 2009-10-27  Cary Coutant  <ccoutant@google.com>
9382
9383         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9384         * testsuite/Makefile.am (plugin_test_5): New test case.
9385         * testsuite/Makefile.in: Regenerate.
9386
9387 2009-10-25  Doug Kwan  <dougkwan@google.com>
9388
9389         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9390         from private to protected to allow access by child class.
9391         (Sized_relobj::do_relocate_sections): New method declaration.
9392         (Sized_relobj::relocate_sections): Virtualize.
9393         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9394         Sized_relobj::relocate_sections.  Instantiate template explicitly
9395         for different target sizes and endianity.
9396
9397 2009-10-24  Doug Kwan  <dougkwan@google.com>
9398
9399         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9400         (Arm_input_section::as_arm_input_section): New method.
9401         (Arm_output_section): New class definition.
9402         (Arm_output_section::create_stub_group,
9403         Arm_output_section::group_sections): New method definitions.
9404
9405 2009-10-22  Doug Kwan  <dougkwan@google.com>
9406
9407         * arm.cc (Arm_input_section): New class definition.
9408         (Arm_input_section::init, Arm_input_section:do_write,
9409         Arm_input_section::set_final_data_size,
9410         Arm_input_section::do_reset_address_and_file_offset): New method
9411         definitions.
9412
9413 2009-10-21  Doug Kwan  <dougkwan@google.com>
9414
9415         * arm.cc (Stub_table, Arm_input_section): New forward class
9416         declarations.
9417         (Stub_table): New class defintion.
9418         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9419         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9420         New method definition.
9421
9422 2009-10-21  Doug Kwan  <dougkwan@google.com>
9423
9424         * arm.cc: Update copyright comments.
9425         (Target_arm): New forward class template declaration.
9426         (Arm_address): New type.
9427         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9428         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9429         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9430         constants.
9431         (Insn_template): Same.
9432         (DEF_STUBS): New macro.
9433         (Stub_type): New enum type.
9434         (Stub_template): New class definition.
9435         (Stub): Same.
9436         (Reloc_stub): Same.
9437         (Stub_factory): Same.
9438         (Target_arm::Target_arm): Initialize may_use_blx_ and
9439         should_force_pic_veneer_.
9440         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9441         Target_arm::should_force_pic_veneer,
9442         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9443         Target_arm::using_thumb_only, Target_arm:;default_target): New
9444         method defintions.
9445         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9446         New data member declarations.
9447         (Insn_template::size, Insn_template::alignment): New method defintions.
9448         (Stub_template::Stub_template): New method definition.
9449         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9450         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9451         (Stub_factory::Stub_factory): New method definition.
9452         * gold.h (string_hash): New template.
9453         * output.h (Input_section_specifier::hash_value): Use
9454         gold::string_hash.
9455         (Input_section_specifier::string_hash): Remove.
9456         * stringpool.cc (Stringpool_template::string_hash): Use
9457         gold::string_hash.
9458
9459 2009-10-20  Doug Kwan  <dougkwan@google.com>
9460
9461         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9462         symbols of relaxed input sections.
9463         * output.h (Output_section::find_relaxed_input_section): Make
9464         method public.
9465
9466 2009-10-16  Doug Kwan  <dougkwan@google.com>
9467
9468         * dynobj.cc (Versions::Versions): Initialize version_script_.
9469         Only insert base version symbol definition for a shared object
9470         if version script defines any version versions.
9471         (Versions::define_base_version): New method definition.
9472         (Versions::add_def): Check that base version is not needed.
9473         (Versions::add_need): Define base version lazily.
9474         * dynobj.h (Versions::define_base_version): New method declaration.
9475         (Versions::needs_base_version_): New data member declaration.
9476         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9477         (check_DATA): Add no_version_test.stdout.
9478         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9479         New make rules.
9480         * testsuite/Makefile.in: Regenerate.
9481         * testsuite/no_version_test.c: New file.
9482         * testsuite/no_version_test.sh: Ditto.
9483
9484 2009-10-16  Doug Kwan  <dougkwan@google.com>
9485
9486         * expression.cc (class Segment_start_expression): New class definition.
9487         (Segment_start_expression::value): New method definition.
9488         (script_exp_function_segment_start): Return a new
9489         Segment_start_expression.
9490         * gold/script-c.h (script_saw_segment_start_expression): New function
9491         prototype.
9492         * script-sections.cc (Script_sections::Script_sections): Initialize
9493         SAW_SEGMENT_START_EXPRESSION_ to false.
9494         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9495         and -Tbbs options to specify section addresses if given in
9496         command line and no SEGMENT_START expression is seen in a script.
9497         * script-sections.h (Script_sections::saw_segment_start_expression,
9498         Script_sections::set_saw_segment_start_expression): New method
9499         definition.
9500         (Script_sections::saw_segment_start_expression_): New data member
9501         declaration.
9502         * script.cc (script_saw_segment_start_expression): New function.
9503         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9504         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9505         script_test_7.sh and script_test_8.sh.
9506         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9507         script_test_8.stdout.
9508         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9509         (script_test_6, script_test_6.stdout, script_test_7,
9510         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9511         * Makefile.in: Regenerate.
9512         * testsuite/script_test_6.sh: New file.
9513         * testsuite/script_test_6.t: Same.
9514         * testsuite/script_test_7.sh: Same.
9515         * testsuite/script_test_7.t: Same.
9516         * testsuite/script_test_8.sh: Same.
9517
9518 2009-10-16  Doug Kwan  <dougkwan@google.com>
9519
9520         * output.cc (Output_segment::set_section_list_address): Cast
9521         expressions to unsigned long long type to avoid format warnings.
9522
9523 2009-10-15  Ian Lance Taylor  <iant@google.com>
9524
9525         * script.cc (Script_options::add_symbol_assignment): Always add a
9526         dot assignment to script_sections_.
9527         * script-sections.cc (Script_sections::add_dot_assignment):
9528         Initialize if necessary.
9529
9530         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9531         program headers with no load segment if there is a linker script.
9532
9533         * layout.cc (Layout::set_segment_offsets): Align the file offset
9534         to the segment aligment for -N or -n with no load segment.
9535         * output.cc (Output_segment::add_output_section): Don't crash if
9536         the first section is a TLS section.
9537         (Output_segment::set_section_list_addresses): Print an error
9538         message if the address moves backward in a linker script.
9539         * script-sections.cc
9540         (Output_section_element_input::set_section_addresses): Don't
9541         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9542         (Orphan_output_section::set_section_addresses): Likewise.
9543
9544 2009-10-15  Doug Kwan  <dougkwan@google.com>
9545
9546         * layout.cc (Layout::finish_dynamic_section): Generate tags
9547         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9548         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9549         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9550
9551 2009-10-14  Ian Lance Taylor  <iant@google.com>
9552
9553         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9554         fields.
9555         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9556         data_shdr fields of relinfo.
9557         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9558         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9559         R_386_TLS_LDO_32, adjust based on section flags.
9560         (Target_i386::Relocate::fix_up_ldo): Remove.
9561
9562 2009-10-13  Ian Lance Taylor  <iant@google.com>
9563
9564         Add support for -pie.
9565         * options.h (class General_options): Add -pie and
9566         --pic-executable.
9567         (General_options::output_is_position_independent): Test -pie.
9568         (General_options::output_is_executable): Return true if not shared
9569         and not relocatable.
9570         (General_options::output_is_pie): Remove.
9571         * options.cc (General_options::finalize): Reject incompatible uses
9572         of -pie.
9573         * gold.cc (queue_middle_tasks): A -pie link is not static.
9574         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9575         * symtab.cc (Symbol::final_value_is_known): Return false if
9576         output_is_position_independent.
9577         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9578         output_is_position_independent.
9579         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9580         output_is_position_independent.
9581         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9582         output_is_position_independent.
9583         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9584         two_file_pie_test.
9585         (basic_pie_test.o, basic_pie_test): New targets.
9586         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9587         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9588         (two_file_pie_test): New target.
9589         * testsuite/Makefile.in: Rebuild.
9590         * README: Remove note saying that -pie is not supported.
9591
9592 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9593
9594         * options.h (class General_options): Add -init and -fini.
9595         * layout.cc (Layout::finish_dynamic_section): Emit
9596         given init and fini functions.
9597
9598 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9599
9600         * gc.h (gc_process_relocs): Check if icf is enabled using new
9601         function.
9602         * gold.cc (queue_initial_tasks): Likewise.
9603         (queue_middle_tasks): Likewise.
9604         * object.cc (do_layout): Likewise.
9605         * symtab.cc (is_section_folded): Likewise.
9606         * main.cc (main): Likewise.
9607         * reloc.cc (Read_relocs::run): Likewise.
9608         (Sized_relobj::do_scan_relocs): Likewise.
9609         * icf.cc (is_function_ctor_or_dtor): New function.
9610         (Icf::find_identical_sections): Check if function is ctor or dtor when
9611         safe icf is chosen.
9612         * options.h (General_options::icf): Change option to be an enum.
9613         (Icf_status): New enum.
9614         (icf_enabled): New method.
9615         (icf_safe_folding): New method.
9616         (set_icf_status): New method.
9617         (icf_status_): New variable.
9618         * (options.cc) (General_options::finalize): Set icf_status_.
9619         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9620         icf_test and icf_keep_unique_test to use the --icf enum flag.
9621         * testsuite/icf_safe_test.sh: New file.
9622         * testsuite/icf_safe_test.cc: New file.
9623
9624 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9625
9626         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9627         includes to gc.h and icf.h.
9628         * arm.cc: Include gc.h.
9629         * gold.cc: Likewise.
9630         * i386.cc: Likewise.
9631         * powerpc.cc: Likewise.
9632         * sparc.cc: Likewise.
9633         * x86_64.cc: Likewise.
9634         * gc.h: Include icf.h.
9635
9636 2009-10-11  Ian Lance Taylor  <iant@google.com>
9637
9638         * plugin.cc: Include "gold.h" before other header files.
9639
9640 2009-10-10  Chris Demetriou  <cgd@google.com>
9641
9642         * options.h (Input_file_argument::Input_file_type): New enum.
9643         (Input_file_argument::is_lib_): Replace with...
9644         (Input_file_argument::type_): New member.
9645         (Input_file_argument::Input_file_argument): Take Input_file_type
9646         'type' rather than boolean 'is_lib' as second argument.
9647         (Input_file_argument::is_lib): Use type_.
9648         (Input_file_argument::is_searched_file): New function.
9649         (Input_file_argument::may_need_search): Handle is_searched_file.
9650         * options.cc (General_options::parse_library): Support -l:filename.
9651         (General_options::parse_just_symbols): Update for Input_file_argument
9652         changes.
9653         (Command_line::process): Likewise.
9654         * archive.cc (Archive::get_file_and_offset): Likewise.
9655         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9656         * script.cc (read_script_file, script_add_file): Likewise.
9657         * fileread.cc (Input_file::Input_file): Likewise.
9658         (Input_file::will_search_for): Handle is_searched_file.
9659         (Input_file::open): Likewise.
9660         * readsyms.cc (Read_symbols::get_name): Likewise.
9661         * testsuite/Makefile.am (searched_file_test): New test.
9662         * testsuite/Makefile.in: Regenerate.
9663         * testsuite/searched_file_test.cc: New file.
9664         * testsuite/searched_file_test_lib.cc: New file.
9665
9666 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9667             Ian Lance Taylor  <iant@google.com>
9668
9669         * descriptor.cc: Include <cstdio> and "binary-io.h".
9670         (Descriptors::open): Open the files in binary mode always.
9671         * script.cc (Lex::get_token): Treat \r as whitespace.
9672
9673 2009-10-09  Ian Lance Taylor  <iant@google.com>
9674
9675         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9676
9677 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9678             Ian Lance Taylor  <iant@google.com>
9679
9680         * configure.ac: Check for readv function also.
9681         * fileread.cc (readv): Define if not HAVE_READV.
9682         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9683         does not exist.
9684         * config.in: Regenerate.
9685         * configure: Regenerate.
9686
9687 2009-10-09  Doug Kwan  <dougkwan@google.com>
9688
9689         * layout.cc (Layout::make_output_section): Call target hook to make
9690         ordinary output section.
9691         (Layout::finalize): Adjust parameter list of call the
9692         Target::may_relax().
9693         * layout.h (class Layout::section_list): New method.
9694         * merge.h (Output_merge_base::entsize): Change visibility to public.
9695         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9696         New methods.
9697         (Output_merge_string::do_is_string): New method.
9698         * object.cc (Sized_relobj::do_setup): renamed from
9699         Sized_relobj::set_up.
9700         * object.h (Sized_relobj::adjust_shndx,
9701         Sized_relobj::initializ_input_to_output_maps,
9702         Sized_relobj::free_input_to_output_maps): Change visibilities to
9703         protected.
9704         (Sized_relobj::setup): Virtualize.
9705         (Sized_relobj::do_setup): New method declaration.
9706         (Sized_relobj::invalidate_section_offset,
9707         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9708         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9709         * options.cc (parse_int): New function.
9710         * options.h (parse_int): New declaration.
9711         (DEFINE_int): New macro.
9712         (stub_group_size): New option.
9713         * output.cc (Output_section::Output_section): Initialize memebers
9714         merge_section_map_, merge_section_by_properties_map_,
9715         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9716         (Output_section::add_input_section): Handled deferred code-fill
9717         generation and remove an old comment.
9718         (Output_section::add_relaxed_input_section): New method definition.
9719         (Output_section::add_merge_input_section): Use merge section by
9720         properties map to speed to search.  Update merge section maps
9721         as appropriate.
9722         (Output_section::build_relaxation_map): New method definition.
9723         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9724         Same.
9725         (Output_section::relax_input_section): Renamed to
9726         Output_section::convert_input_sections_to_relaxed_sections and change
9727         interface to take a vector of pointers to relaxed sections.
9728         (Output_section::find_merge_section,
9729         Output_section::find_relaxed_input_section): New method definitions.
9730         (Output_section::is_input_address_mapped,
9731         Output_section::output_offset, Output_section::output_address):
9732         Use output section data maps to speed up searching.
9733         (Output_section::find_starting_output_address): Add comments.
9734         (Output_section::do_write,
9735         Output_section::write_to_postprocessing_buffer): Do code-fill
9736         generation as appropriate.
9737         (Output_section::get_input_sections): Invalidate relaxed input section
9738         map.
9739         (Output_section::restore_states): Adjust type of checkpoint .
9740         Invalidate relaxed input section map.
9741         * output.h (Output_merge_base): New class declaration.
9742         (Input_section_specifier): New class defintion.
9743         (class Output_relaxed_input_section) Change base class to
9744         Output_section_data_build.
9745         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9746         base class initializer.
9747         (Output_section::add_relaxed_input_section): New method declaration.
9748         (Output_section::Input_section): Change visibility to protected.
9749         (Output_section::Input_section::relobj,
9750         Output_section::Input_section::shndx): Handle relaxed input sections.
9751         Output_section::input_sections) Change visibility to protected.  Also
9752         define overload to return a non-const pointer.
9753         (Output_section::Merge_section_properties): New class defintion.
9754         (Output_section::Merge_section_by_properties_map,
9755         Output_section::Output_section_data_by_input_section_map,
9756         Output_section::Relaxation_map): New types.
9757         (Output_section::relax_input_section): Rename method to
9758         Output_section::convert_input_sections_to_relaxed_sections and change
9759         interface to take a vector of relaxed section pointers.
9760         (Output_section::find_merge_section,
9761         Output_section::find_relaxed_input_section,
9762         Output_section::build_relaxation_map,
9763         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9764         New method declarations.
9765         (Output_section::merge_section_map_
9766         Output_section::merge_section_by_properties_map_,
9767         Output_section::relaxed_input_section_map_,
9768         Output_section::is_relaxed_input_section_map_valid_,
9769         Output_section::generate_code_fills_at_write_): New data members.
9770         * script-sections.cc
9771         (Output_section_element_input::set_section_addresses): Call
9772         current_data_size and addralign methods of relaxed input sections.
9773         (Orphan_output_section::set_section_addresses): Call current_data_size
9774         and addralign methods of relaxed input sections.
9775         * symtab.cc (Symbol_table::compute_final_value): Extract template
9776         from the body of Symbol_table::sized_finalize_symbol.
9777         (Symbol_table::sized_finalized_symbol): Call
9778         Symbol_table::compute_final_value.
9779         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9780         (Symbol_table::compute_final_value): New templated method declaration.
9781         * target.cc (Target::do_make_output_section): New method defintion.
9782         * target.h (Target::make_output_section): New method declaration.
9783         (Target::relax): Add more parameters for input objects, symbol table
9784         and layout.  Adjust call to do_relax.
9785         (Target::do_make_output_section): New method declaration.
9786         (Target::do_relax): Add parameters for input objects, symbol table
9787         and layout.
9788
9789 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9790
9791         * pread.c: Include stdio.h.
9792
9793 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9794
9795         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9796         defined.
9797
9798 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9799
9800         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9801         Change read_shndx type to unsigned int.
9802         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9803         int.
9804         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9805         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9806         Change read_shndx type to unsigned int.
9807         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9808         int.
9809         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9810         * layout.cc (Layout::create_symtab_sections): Cast the result of
9811         local_symcount * symsize to off_t in the gold_assert.
9812
9813 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9814
9815         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9816         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9817         R_ARM_BASE_ABS.
9818         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9819         (Arm_relocate_functions::thm_abs5): New function.
9820         (Arm_relocate_functions::abs12): New function.
9821         (Arm_relocate_functions::abs16): New function.
9822         (Arm_relocate_functions::base_abs): New function.
9823         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9824         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9825         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9826         R_ARM_BASE_ABS.
9827         (Scan::global): Likewise.
9828         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9829         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9830         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9831         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9832         R_ARM_BASE_ABS.
9833
9834 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9835
9836         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9837         (Arm_relocate_functions::movt_prel): New function.
9838         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9839         (Arm_relocate_functions::thm_movt_prel): New function.
9840         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9841         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9842         (Scan::global, Relocate::relocate): Likewise.
9843         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9844
9845 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9846
9847         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9848         Incremental_checker.
9849         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9850         unsigned int.
9851         (class Incremental_inputs_header): New class.
9852         (Incremental_inputs_header_writer): Edit comment.
9853         (Incremental_inputs_entry): New class.
9854         (Incremental_inputs_entry_writer): Edit comment.
9855         (Sized_incremental_binary::do_find_incremental_inputs_section):
9856         Add *strtab_shndx parameter, fill it.
9857         (Sized_incremental_binary::do_check_inputs): New method.
9858         (Incremental_checker::can_incrementally_link_output_file): Use
9859         Sized_incremental_binary::check_inputs.
9860         (Incremental_inputs::report_command_line): Save command line in
9861         command_line_.
9862         * incremental.h:
9863         (Incremental_binary::find_incremental_inputs_section): New
9864         method.
9865         (Incremental_binary::do_find_incremental_inputs_section): Add
9866         strtab_shndx parameter.
9867         (Incremental_binary::do_check_inputs): New pure virtual method.
9868         (Sized_incremental_binary::do_check_inputs): Declare.
9869         (Incremental_checker::Incremental_checker): Add incremental_inputs
9870         parameter, use it to initialize incremental_inputs_.
9871         (Incremental_checker::incremental_inputs_): New field.
9872         (Incremental_checker::command_line): New method.
9873         (Incremental_checker::inputs): New method.
9874         (Incremental_checker::command_line_): New field.
9875
9876 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9877
9878         * incremental.cc: Include <cstdarg> and "target-select.h".
9879         (vexplain_no_incremental): New function.
9880         (explain_no_incremental): New function.
9881         (Incremental_binary::error): New method.
9882         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9883         method.
9884         (make_sized_incremental_binary): New function.
9885         (open_incremental_binary): New function.
9886         (can_incrementally_link_file): Add checks if output is ELF and has
9887         inputs section.
9888         * incremental.h: Include "elfcpp_file.h" and "output.h".
9889         (Incremental_binary): New class.
9890         (Sized_incremental_binary): New class.
9891         (open_incremental_binary): Declare.
9892         * object.cc (is_elf_object): Use
9893         elfcpp::Elf_recognizer::is_elf_file.
9894         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9895         * output.h (Output_file::filesize): New method.
9896
9897 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9898
9899         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9900         New function.
9901         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9902         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9903         function.
9904         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9905         function.
9906         (Arm_relocate_functions::movw_abs_nc): New function.
9907         (Arm_relocate_functions::movt_abs): New function.
9908         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9909         (Arm_relocate_functions::thm_movt_abs): New function.
9910         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9911         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9912         (Scan::global): Likewise.
9913         (Relocate::relocate): Likewise.
9914         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9915
9916 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9917
9918         * arm.cc (Arm_relocate_functions::got_prel) New function.
9919         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9920         (Relocate::relocate): Likewise.
9921         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9922
9923 2009-10-06  Ian Lance Taylor  <iant@google.com>
9924
9925         * options.h (class General_options): Define
9926         split_stack_adjust_size parameter.
9927         * object.h (class Object): Add uses_split_stack_ and
9928         has_no_split_stack_ fields.  Add uses_split_stack and
9929         has_no_split_stack accessor functions.  Declare
9930         handle_split_stack_section.
9931         (class Reloc_symbol_changes): Define.
9932         (class Sized_relobj): Define Function_offsets.  Declare
9933         split_stack_adjust, split_stack_adjust_reltype, and
9934         find_functions.
9935         * object.cc (Object::handle_split_stack_section): New function.
9936         (Sized_relobj::do_layout): Call handle_split_stack_section.
9937         * dynobj.cc (Sized_dynobj::do_layout): Call
9938         handle_split_stack_section.
9939         * reloc.cc (Sized_relobj::relocate_sections): Call
9940         split_stack_adjust for executable sections in split_stack
9941         objects.  Pass reloc_map to relocate_section.
9942         (Sized_relobj::split_stack_adjust): New function.
9943         (Sized_relobj::split_stack_adjust_reltype): New function.
9944         (Sized_relobj::find_functions): New function.
9945         * target-reloc.h: Include "object.h".
9946         (relocate_section): Add reloc_symbol_changes parameter.  Change
9947         all callers.
9948         * target.h (class Target): Add calls_non_split method.  Declare
9949         do_calls_non_split virtual method.  Declare match_view and
9950         set_view_to_nop.
9951         * target.cc: Include "elfcpp.h".
9952         (Target::do_calls_non_split): New function.
9953         (Target::match_view): New function.
9954         (Target::set_view_to_nop): New function.
9955         * gold.cc (queue_middle_tasks): Give an error if mixing
9956         split-stack and non-split-stack objects with -r.
9957         * i386.cc (Target_i386::relocate_section): Add
9958         reloc_symbol_changes parameter.
9959         (Target_i386::do_calls_non_split): New function.
9960         * x86_64.cc (Target_x86_64::relocate_section): Add
9961         reloc_symbol_changes parameter.
9962         (Target_x86_64::do_calls_non_split): New function.
9963         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9964         parameter.
9965         * powerpc.cc (Target_powerpc::relocate_section): Add
9966         reloc_symbol_changes parameter.
9967         * sparc.cc (Target_sparc::relocate_section): Add
9968         reloc_symbol_changes parameter.
9969         * configure.ac: Call AM_CONDITIONAL for the default target.
9970         * configure: Rebuild.
9971         * testsuite/Makefile.am (TEST_AS): New variable.
9972         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9973         (check_DATA): Add split_i386 and split_x86_64 files.
9974         (SPLIT_DEFSYMS): Define.
9975         (split_i386_[1234n].o): New targets.
9976         (split_i386_[124]): New targets.
9977         (split_i386_[1234r].stdout): New targets.
9978         (split_x86_64_[1234n].o): New targets.
9979         (split_x86_64_[124]): New targets.
9980         (split_x86_64_[1234r].stdout): New targets.
9981         (MOSTLYCLEANFILES): Add new executables.
9982         * testsuite/split_i386.sh: New file.
9983         * testsuite/split_x86_64.sh: New file.
9984         * testsuite/split_i386_1.s: New file.
9985         * testsuite/split_i386_2.s: New file.
9986         * testsuite/split_i386_3.s: New file.
9987         * testsuite/split_i386_4.s: New file.
9988         * testsuite/split_i386_n.s: New file.
9989         * testsuite/split_x86_64_1.s: New file.
9990         * testsuite/split_x86_64_2.s: New file.
9991         * testsuite/split_x86_64_3.s: New file.
9992         * testsuite/split_x86_64_4.s: New file.
9993         * testsuite/split_x86_64_n.s: New file.
9994         * testsuite/testfile.cc (Target_test): Update relocation_section
9995         function.
9996         * testsuite/Makefile.in: Rebuild.
9997
9998 2009-10-06  Ian Lance Taylor  <iant@google.com>
9999
10000         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10001         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10002         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10003         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10004         the address on ldo_addrs_.
10005         (Target_i386::Relocate::fix_up_ldo): New function.
10006
10007 2009-10-06   Rafael Espindola  <espindola@google.com>
10008
10009         * plugin.cc (add_input_library): New.
10010         (Plugin::load): Add add_input_library to tv.
10011         (Plugin_manager::add_input_file): Add the is_lib argument.
10012         (add_input_file): Update call to Plugin_manager::add_input_file.
10013         (add_input_library): New.
10014         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10015
10016 2009-09-30  Doug Kwan  <dougkwan@google.com>
10017
10018         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10019         symbol and call Symbol::may_need_copy_reloc to determine if
10020         a copy reloc is needed.
10021         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10022         nocopyreloc is given in command line.
10023         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10024         given in command line.
10025         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10026         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10027         of the removed Target_i386::may_need_copy_reloc.
10028         * options.h (copyreloc): New option with default value false.
10029         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10030         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10031         instead of the removed Target_powerpc::may_need_copy_reloc.
10032         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10033         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10034         instead of the removed Target_sparc::may_need_copy_reloc.
10035         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10036         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10037         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10038         instead of the removed Target_x86_64::may_need_copy_reloc.
10039
10040 2009-09-30  Ian Lance Taylor  <iant@google.com>
10041
10042         * object.h (class Object): Remove target_ field, and target,
10043         sized_target, and set_target methods.
10044         (Object::sized_target): Remove.
10045         (class Sized_relobj): Update declarations.  Remove sized_target.
10046         * object.cc (Sized_relobj::setup): Remove target parameter.
10047         Change all callers.
10048         (Input_objects::add_object): Don't do anything with the target.
10049         (make_elf_sized_object): Add punconfigured parameter.  Change all
10050         callers.  Set or test parameter target.
10051         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10052         Change all callers.
10053         * parameters.cc (Parameters::set_target): Change parameter type to
10054         be non-const.
10055         (Parameters::default_target): Remove.
10056         (set_parameters_target): Change parameter type to be non-const.
10057         (parameters_force_valid_target): New function.
10058         (parameters_clear_target): New function.
10059         * parameters.h (class Parameters): Update declarations.  Remove
10060         default_target method.  Add sized_target and clear_target
10061         methods.  Change target_ to be non-const.
10062         (set_parameters_target): Update declaration.
10063         (parameters_force_valid_target): Declare.
10064         (parameters_clear_target): Declare.
10065         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10066         as NULL if we aren't searching.
10067         (Add_symbols::run): Don't check for compatible target.
10068         * fileread.cc (Input_file::open_binary): Call
10069         parameters_force_valid_target.
10070         * gold.cc (queue_middle_tasks): Likewise.
10071         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10072         set_target on object.
10073         * dynobj.h (class Sized_dynobj): Update declarations.
10074         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10075         make_elf_object returns NULL.
10076         (Archive::include_member): Don't check whether object target is
10077         compatible.
10078         * output.cc (Output_section::add_input_section): Get target from
10079         parameters.
10080         (Output_section::relax_input_section): Likewise.
10081         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10082         parameters.
10083         (Sized_relobj::do_scan_relocs): Likewise.
10084         (Sized_relobj::relocate_sections): Likewise.
10085         * resolve.cc (Symbol_table::resolve): Likewise.
10086         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10087         parameter.  Change all callers.
10088         (Symbol_table::add_from_object): Get target from parameters.
10089         (Symbol_table::add_from_relobj): Don't check object target.
10090         (Symbol_table::add_from_dynobj): Likewise.
10091         (Symbol_table::define_special_symbol): Get target from
10092         parameters.
10093         * symtab.h (class Symbol_table): Update declaration.
10094         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10095         parameter.  Change all callers.  Clear parameter target.
10096         (Binary_test): Test target here.
10097         * testsuite/object_unittest.cc (gold_testsuite): Remove
10098         target_test_pointer parameter.  Change all callers.
10099         (Object_test): Test target here.
10100
10101 2009-09-26  Ian Lance Taylor  <iant@google.com>
10102
10103         * testsuite/initpri1.c: Don't try to use constructor priorities if
10104         compiling with gcc before 4.3.
10105
10106 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10107
10108         * testsuite/retain_symbols_file_test.sh (check_present): Change
10109         output file name to retain_symbols_file_test.stdout.
10110         (check_absent): Likewise.
10111
10112 2009-09-18  Craig Silverstein  <csilvers@google.com>
10113
10114         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10115         * options.cc: Include <cerrno> and <fstream>.
10116         (General_options::finalize): Parse -retain-symbols-file tag.
10117         * options.h: New flag.
10118         (General_options): New method should_retain_symbol, new
10119         variable symbols_to_retain.
10120         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10121         should_retain_symbol map.
10122         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10123         * testsuite/Makefile.in: Regenerate.
10124         * testsuite/retain_symbols_file_test.sh: New file.
10125
10126 2009-09-18  Nick Clifton  <nickc@redhat.com>
10127
10128         * po/es.po: Updated Spanish translation.
10129
10130 2009-09-17  Doug Kwan  <dougkwan@google.com>
10131
10132         * debug.h (DEBUG_RELAXATION): New constant.
10133         (DEBUG_ALL): Add DEBUG_RELAXATION.
10134         (debug_string_to_enum): Add relaxation debug option.
10135         * layout.cc
10136         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10137         Layout::Relaxation_debug_check::read_sections,
10138         Layout::Relaxation_debug_check::read_sections): New method definitions.
10139         (Layout::Layout): Initialize data members
10140         record_output_section_data_from_scrips_,
10141         script_output_section_data_list_ and relaxation_debug_check_.
10142         (Layout::save_segments, Layout::restore_segments,
10143         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10144         Layout::relaxation_loop_body): New method definitions.
10145         (Layout::finalize): Support relaxation.  Move section layout code to
10146         Layout::relaxation_loop_body.
10147         (Layout::set_asection_address_from_script): Move code for orphan
10148         section placement out.
10149         (Layout::place_orphan_sections_in_script): New method definition.
10150         * layout.h (Output_segment_headers, Output_file_header):
10151         New forward class declarations.
10152         (Layout::~Layout): Define.
10153         (Layout::new_output_section_data_from_script): New method definition.
10154         (Layout::place_orphan_sections_in_script): New method declaration.
10155         (Layout::Segment_states): New type declaration.
10156         (Layout::save_segments, Layout::restore_segments,
10157         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10158         Layout::relaxation_loop_body): New method declarations.
10159         (Layout::Output_section_data_list): New type declaration.
10160         (Layout::Relaxation_debug_check): New class definition.
10161         (Layout::record_output_section_data_from_script_,
10162         Layout::script_output_section_data_list_, Layout::segment_states_,
10163         Layout::relaxation_debug_check_): New data members.
10164         * output.cc: (Output_section_headers::do_size): New method definition.
10165         (Output_section_headers::Output_section_headers): Move size
10166         computation to Output_section_headers::do_size.
10167         (Output_segment_headers::do_size): New method definition.
10168         (Output_file_header::Output_file_header): Move size computation to
10169         Output_file_header::do_size and call it.
10170         (Output_file_header::do_size): New method definition.
10171         (Output_data_group::Output_data_group): Adjust call to
10172         Output_section_data.
10173         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10174         (Output_symtab_xindex::do_write): Add array bound check.
10175         (Output_section::Input_section::print_to_mapfile): Handle
10176         RELAXED_INPUT_SECTION_CODE.
10177         (Output_section::Output_section): Initialize data member checkpoint_.
10178         (Output_section::~Output_section): Delete checkpoint object pointed
10179         by checkpoint_.
10180         (Output_section::add_input_section): Always add an Input_section if
10181         relaxing.
10182         (Output_section::add_merge_input_section): Add assert.
10183         (Output_section::relax_input_section): New method definition.
10184         (Output_section::set_final_data_size): Set load address to zero for
10185         an unallocated section.
10186         (Output_section::do_address_and_file_offset_have_reset_values):
10187         New method definition.
10188         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10189         Handle relaxed input section.
10190         (Output_section::sort_attached_input_sections): Checkpoint input
10191         section list lazily.
10192         (Output_section::get_input_sections): Change type of input_sections to
10193         list of Simple_input_section pointers.  Checkpoint input section list
10194         lazily.  Also handle relaxed input sections.
10195         (Output_section::add_input_section_for_script): Take a reference to
10196         a Simple_input_section object instead of Relobj pointer and section
10197         index as parameter.  Handle relaxed input sections.
10198         (Output_section::save_states, Output_section::restore_states): New
10199         method definitions.
10200         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10201         (Output_data::is_data_size_fixed): New method definition.
10202         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10203         if it is fixed.
10204         (Output_data::address_and_file_offset_have_reset_values): New method
10205         definition.
10206         (Output_data::do_address_and_file_offset_have_reset_values): New method
10207         definition.
10208         (Output_data::set_data_size): Check that data size is not fixed.
10209         (Output_data::fix_data_size): New method definition.
10210         (Output_data::is_data_size_fixed_): New data member.
10211         (Output_section_headers::set_final_data_size): New method definition.
10212         (Output_section_headers::do_size): New method declaration.
10213         (Output_segment_headers::set_final_data_size): New method definition.
10214         (Output_segment_headers::do_size): New method declaration.
10215         (Output_file_header::set_final_data_size)::New method definition.
10216         (Output_file_header::do_size)::New method declaration.
10217         (Output_section_data::Output_section_data): Add new parameter
10218         is_data_size_fixed and use it to fix data size.
10219         (Output_data_const::Output_data_const): Adjust call to base class
10220         constructor and fix data size.
10221         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10222         base class constructor and fix data size.
10223         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10224         base class constructor and fix data size.
10225         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10226         class constructor and fix data size.
10227         (Output_data_group::set_final_data_size): New method definition.
10228         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10229         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10230         class constructor and fix data size.
10231         (Output_relaxed_input_section): New class definition.
10232         (Output_section::Simple_input_section): New class definition.
10233         (Output_section::get_input_sections): Adjust parameter list.
10234         (Output_section::add_input_section_for_script): Same.
10235         (Output_section::save_states, Output_section::restore_states,
10236         Output_section::do_address_and_file_offset_have_reset_values,
10237         (Output_section::Input_section::Input_section): Handle
10238         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10239         Output_relaxed_input_section.
10240         (Output_section::Input_section::is_input_section,
10241         Output_section::Input_section::set_output_section): Handle relaxed
10242         input section.
10243         (Output_section::Input_section::is_relaxed_input_section,
10244         Output_section::Input_section::output_section_data,
10245         Output_section::Input_section::relaxed_input_section): New method
10246         definitions.
10247         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10248         value.
10249         (Output_section::Input_section::u1_): Update comments.
10250         (Output_section::Input_section::u2_): Add new union member poris.
10251         (Output_section::Checkpoint_output_section): New classs definition.
10252         (Output_section::relax_input_section): New method declaration.
10253         (Output_section::checkpoint_): New data member.
10254         (Output_segment): Update comments.
10255         (Output_segment::Output_segment): Un-privatize copy constructor.
10256         (Output_segment::operator=): Un-privatize.
10257         * script-sections.cc (Output_section_element::Input_section_list):
10258         Change element type to Output_section::Simple_input_section.
10259         (Output_section_element_dot_assignment::set_section_addresses):
10260         Register output section data for relaxation clean up.
10261         (Output_data_exression::Output_data_expression): Adjust call to base
10262         constructor to fix data size.
10263         (Output_section_element_data::set_section_addresses): Register
10264         Output_data_expression object for relaxation clean up.
10265         (struct Input_section_info): Replace Relobj pointer and section index
10266         pair with Output_section::Simple_input_section and Convert struct to a
10267         class.
10268         (Input_section_sorter::operator()): Adjust access to
10269         Input_section_info data member to use accessors.
10270         (Output_section_element_input::set_section_addresses): Use layout
10271         parameter.  Adjust code to use Output_section::Simple_input_section
10272         and Input_secction_info classes.  Register filler for relaxation
10273         clean up.
10274         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10275         and section index pair with Output_section::Simple_input_section
10276         class.  Adjust code accordingly.
10277         (Phdrs_element::release_segment): New method definition.
10278         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10279         segment list.
10280         (Script_sections::release_segments): New method definition.
10281         * gold/script-sections.h (Script_sections::release_segments): New
10282         method declaration.
10283         * gold/target.h (Target::may_relax, Target::relax,
10284         Target::do_may_relax, Target::do_relax): New method definitions.
10285
10286 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10287
10288         * arm.cc (has_signed_unsigned_overflow): New function.
10289         (Arm_relocate_functions::abs8): New function.
10290         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10291         (Target_arm::Scan::global): Likewise.
10292         (Target_arm::relocate::relocate): Likewise.
10293         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10294         Likewise.
10295
10296 2009-09-16  Cary Coutant  <ccoutant@google.com>
10297
10298         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10299         * testsuite/Makefile.in: Regenerate.
10300
10301 2009-09-11  Nick Clifton  <nickc@redhat.com>
10302
10303         * po/gold.pot: Updated by the Translation project.
10304
10305 2009-09-08  Cary Coutant  <ccoutant@google.com>
10306
10307         * output.cc (Output_file::open): Add execute permission to empty file.
10308         * testsuite/Makefile.am (permission_test): New test.
10309         * testsuite/Makefile.in: Regenerate.
10310
10311 2009-09-02  Ian Lance Taylor  <iant@google.com>
10312
10313         * output.cc (Output_file::resize): Call map_no_anonymous rather
10314         than map.
10315
10316 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10317
10318         * gold.cc: Include "incremental.h".
10319         (queue_initial_tasks): Call Incremental_checker methods.
10320         * incremental.cc: Include "output.h".
10321         (Incremental_checker::can_incrementally_link_output_file): New
10322         method.
10323         * incremental.h (Incremental_checker): New class.
10324
10325         * output.cc (Output_file::open_for_modification): New method.
10326         (Output_file::map_anonymous): Changed return type to bool.  Record
10327         map in base_ field.
10328         (Output_file::map_no_anonymous): New method, broken out of map.
10329         (Output_file::map): Use map_no_anonymous and map_anonymous.
10330         * output.h (class Output_file): Update declarations.
10331
10332 2009-08-24  Cary Coutant  <ccoutant@google.com>
10333
10334         * options.h (Command_line::Pre_options): New class.
10335         (Command_line::pre_options): New member.
10336         * options.cc (gold::options::ready_to_register): New variable.
10337         (One_option::register_option): Do nothing if not registering options.
10338         Assert if same short option registered twice.
10339         (General_options::General_options): Turn off option registration when
10340         done constructing.
10341         (Command_line::Pre_options::Pre_options): New constructor.
10342
10343 2009-08-24  Cary Coutant  <ccoutant@google.com>
10344
10345         * options.h (General_options::no_keep_memory): Remove incorrect
10346         short option.
10347
10348 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10349
10350         * Makefile.am (am__skiplex, am__skipyacc): New.
10351         * Makefile.in: Regenerate.
10352
10353 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10354
10355         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10356         (INCLUDES): ... this.
10357         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10358         (AM_CPPFLAGS): Renamed from ...
10359         (INCLUDE): ... this.
10360         * Makefile.in, testsuite/Makefile.in: Regenerate.
10361
10362         * Makefile.in: Regenerate.
10363         * aclocal.m4: Likewise.
10364         * config.in: Likewise.
10365         * configure: Likewise.
10366         * testsuite/Makefile.in: Likewise.
10367
10368         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10369         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10370         * Makefile.in: Regenerate.
10371         * testsuite/Makefile.in: Regenerate.
10372
10373 2009-08-19  Cary Coutant  <ccoutant@google.com>
10374
10375         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10376         symbols in shared libraries overridden by hidden or internal symbols
10377         in the main program.
10378
10379 2009-08-19  Chris Demetriou  <cgd@google.com>
10380
10381         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10382         checking source file names in error messages.
10383
10384 2009-08-18  Doug Kwan  <dougkwan@google.com>
10385
10386         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10387         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10388         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10389         an elfcpp::Ehdr as parameter.
10390         * object.cc (Object::set_target): Remove the version that looks up
10391         a target and sets it.
10392         (Sized_relobj::setup): Take a Target object instead of
10393         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10394         (make_elf_sized_object): Find target and ask target to
10395         make an ELF object.
10396         * object.h: (Object::set_target): Remove the version that looks up
10397         a target and sets it.
10398         (Sized_relobj::setup): Take a Target object instead of
10399         an elfcpp:Ehdr as parameter.
10400         * target.cc: Include dynobj.h.
10401         (Target::do_make_elf_object_implementation): New.
10402         (Target::do_make_elf_object): New.
10403         * target.h (Target::make_elf_object): New template declaration.
10404         (Target::do_make_elf_object): New method declarations.
10405         (Target::do_make_elf_object_implementation): New template declaration.
10406
10407 2009-08-14  Ian Lance Taylor  <iant@google.com>
10408
10409         * gold.h (FUNCTION_NAME): Define.
10410         (gold_unreachable): Use FUNCTION_NAME.
10411
10412 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10413
10414         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10415         symbol in the --keep-unique list is not found.
10416
10417 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10418
10419         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10420         been maked as --keep-unique.
10421         (Icf::unfold_section): New function.
10422         * icf.h (Icf::unfold_section): New function.
10423         * options.h (General_options::keep_unique): New option.
10424         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10425         * testsuite/Makefile.in: Regenerate.
10426         * testsuite/icf_keep_unique_test.sh: New file.
10427         * testsuite/icf_keep_unique_test.cc: New file.
10428
10429 2009-08-12  Cary Coutant  <ccoutant@google.com>
10430
10431         PR 10471
10432         * resolve.cc (Symbol_table::resolve): Check for references from
10433         dynamic objects to hidden and internal symbols.
10434         * testsuite/Makefile.am (hidden_test.sh): New test.
10435         * testsuite/Makefile.in: Regenerate.
10436         * testsuite/hidden_test.sh: New script.
10437         * testsuite/hidden_test_1.c: New test source.
10438         * testsuite/hidden_test_main.c: New test source.
10439
10440 2009-08-11  Doug Kwan  <dougkwan@google.com>
10441
10442         * arm.cc: Update comments.
10443         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10444         segment to locate the .ARM.exidx section if present.
10445
10446 2009-08-09  Doug Kwan  <dougkwan@google.com>
10447
10448         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10449         patch.
10450
10451 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10452         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10453         compiler warnings.
10454
10455 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10456
10457         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10458         valid tls_segment only for non-debug-section relocations.
10459         * testsuite/Makefile.am: Add gc_tls_test.
10460         * testsuite/Makefile.in: Regenerate.
10461         * testsuite/gc_tls_test.cc: New file.
10462         * testsuite/gc_tls_test.sh: New file.
10463
10464 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10465
10466         * icf.cc: New file.
10467         * icf.h: New file.
10468         * Makefile.am (CCFILES): Add icf.cc.
10469         (HFILES): Add icf.h
10470         * Makefile.in: Regenerate.
10471         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10472         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10473         section, symbol and addend information for the relocs.
10474         * gold.cc (queue_middle_tasks): Call identical code folding.
10475         * gold.h: Add defines for multimap.
10476         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10477         to the call of finalize_local_symbols.
10478         * main.cc (main): Create object of class Icf.
10479         * object.cc (Sized_relobj::do_layout): Allow this function to be
10480         called twice during icf.
10481         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10482         to sections marked as identical by icf.
10483         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10484         when available.
10485         (Sized_relobj::do_section_entsize): New function.
10486         * object.h (Object::section_entsize): New function.
10487         (Object::do_section_entsize): New pure virtual function.
10488         (Relobj::finalize_local_symbols): Add new parameter.
10489         (Relobj::do_section_entsize): New function.
10490         * options.h (General_options::icf): New option.
10491         (General_options::icf_iterations): New option.
10492         (General_options::print_icf_sections): New option.
10493         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10494         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10495         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10496         icf.
10497         * symtab.cc (Symbol_table::is_section_folded): New function.
10498         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10499         to sections marked as identical by icf.
10500         * symtab.h (Symbol_table::set_icf): New function.
10501         (Symbol_table::icf): New function.
10502         (Symbol_table::is_section_folded): New function.
10503         (Symbol_table::icf_): New data member.
10504         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10505         * testsuite/Makefile.am: Add commands to build icf_test.
10506         * testsuite/Makefile.in: Regenerate.
10507         * testsuite/icf_test.sh: New file.
10508         * testsuite/icf_test.cc: New file.
10509
10510 2009-07-24  Chris Demetriou  <cgd@google.com>
10511
10512         * layout.cc (is_compressible_debug_section): Fix incorrect
10513         comment about compressed section names.
10514
10515 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10516
10517         PR 10419
10518         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10519
10520 2009-07-16  Ian Lance Taylor  <iant@google.com>
10521
10522         PR 10400
10523         * layout.h: #include <map>.
10524         (class Kept_section): Change from struct to class.  Add accessors
10525         and setters.  Add section size to Comdat_group mapping.  Change
10526         Comdat_group to std::map.  Add is_comdat_ field.  Add
10527         linkonce_size field in union.
10528         (class Layout): Update declaration of find_or_add_kept_section.
10529         Don't declare find_kept_object.
10530         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10531         parameter.  Add object, shndx, is_comdat, and is_group_name
10532         parameters.  Change all callers.  Adjust for new Kept_section.
10533         (Layout::find_kept_object): Remove.
10534         * object.cc (Sized_relobj::include_section_group): Update use of
10535         Kept_section.  Rename secnum to shndx.  Only record
10536         Kept_comdat_section if sections are the same size.
10537         (Sized_relobj::include_linkonce_section): Update use of
10538         Kept_section.  Only record Kept_comdat_section if sections are the
10539         same size.  Set size of linkonce section.
10540         (Sized_relobj::map_to_kept_section): Update call to
10541         get_kept_comdat_section.
10542         * object.h (class Sized_relobj): Rename fields in
10543         Kept_comdat_section to drop trailing underscores; change object
10544         field to Relobj*.  Change Kept_comdat_section_table to store
10545         struct rather than pointer.
10546         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10547         Add kept_object and kept_shndx parameters.  Change all callers.
10548         (Sized_relobj::get_kept_comdat_section): Change return type to
10549         bool.  Add kept_object and kept_shndx parameters.  Change all
10550         callers.
10551         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10552         Layout::find_or_add_kept_section.
10553
10554 2009-07-09  Ian Lance Taylor  <iant@google.com>
10555
10556         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10557         Reserve space in the hash table.
10558
10559 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10560
10561         * fileread.cc (File_read::get_mtime): New method.
10562         * fileread.h (Timespec): New structure.
10563         (File_read::get_mtime): New method.
10564         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10565         Renamed from timestamp_nsec.
10566         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10567         Elf_Xword.
10568         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10569         timestamp_nsec.
10570         (Incremental_inputs::report_archive): Save mtime; style fix.
10571         (Incremental_inputs::report_obejct): Save mtime; style fix.
10572         (Incremental_inputs::report_script): Save mtime; style fix.
10573         (Incremental_inputs::finalize_inputs): Style fix.
10574         (Incremental_inputs::finalize): Style fix.
10575         (Incremental_inputs::create_input_section_data): Store inputs
10576         mtime.
10577         * incremental.h (Incremental_inputs::report_script): Add mtime
10578         argument.
10579         (Incremental_inputs::Input_info::Input_info): Intialize only one
10580         union member.
10581         (Incremental_inputs::Input_info::archive): Move to nameless
10582         union.
10583         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10584         (Incremental_inputs::Input_info::script): Move to nameless union.
10585         (Incremental_inputs::mtime): New field.
10586         * script.cc (read_input_script): Pass file mtime to
10587         Incremental_input.
10588         * script.h (Script_info::inputs): Style fix.
10589
10590 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10591
10592         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10593         instead of 32.
10594
10595 2009-06-24  Ian Lance Taylor  <iant@google.com>
10596
10597         PR 10156
10598         * layout.cc (Layout::choose_output_section): If we find an
10599         existing section, update the flags.
10600         (Layout::create_notes): New function, broken out of
10601         Layout::finalize.
10602         (Layout::finalize): Don't create note sections.
10603         (Layout::create_note): Don't crash if linker script discards
10604         section.
10605         (Layout::create_gold_note): Likewise.
10606         (Layout::create_build_id): Likewise.  Don't set
10607         after_input_sections on the section.
10608         (Layout::create_executable_stack_info): Remove target parameter.
10609         Change caller.
10610         * layout.h (class Layout): Declare create_notes.  Update
10611         declaration of create_executable_stack_info.
10612         * gold.cc (queue_middle_tasks): Call create_notes.
10613         * output.cc (Output_section::update_flags_for_input_section): Move
10614         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10615         invalid.
10616         * output.h (Output_data::mark_address_invalid): New function.
10617         (class Output_section): Only declare, not define,
10618         update_flags_for_input_section.  Remove set_flags.
10619
10620 2009-06-24  Ian Lance Taylor  <iant@google.com>
10621
10622         * script-sections.cc (Output_section_definition::
10623         set_section_addresses): Rename shadowing local load_address to
10624         laddr.
10625
10626 2009-06-24  Ian Lance Taylor  <iant@google.com>
10627
10628         PR 10244
10629         * reloc.cc (relocate_sections): Skip empty relocation sections.
10630
10631 2009-06-23  Ian Lance Taylor  <iant@google.com>
10632
10633         PR 10156
10634         * layout.cc (Layout::create_note): Use choose_output_section
10635         rather than make_output_section.
10636
10637 2009-06-23  Ian Lance Taylor  <iant@google.com>
10638
10639         PR 10237
10640         * options.cc (General_options::parse_V): Set printed_version_.
10641         (General_options::General_options): Initialize printed_version_.
10642         * options.h (class General_options): Add printed_version_ field.
10643         * gold.cc (queue_initial_tasks): If there are no input files,
10644         don't give a fatal error if we printed the version information.
10645         (queue_middle_tasks): If using -r with a shared object, give a
10646         fatal error rather than an ordinary error.
10647
10648 2009-06-23  Ian Lance Taylor  <iant@google.com>
10649
10650         PR 10219
10651         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10652         (Layout::make_output_section): Set have_stabstr_section_ if we see
10653         a .stab*str section.
10654         (Layout::finalize): Call link_stabs_sections.
10655         (Layout::link_stabs_sections): New file.
10656         * layout.h (class Layout): Add have_stabstr_section_ field.
10657         Declare link_stabs_sections.
10658
10659 2009-06-23  Doug Kwan  <dougkwan@google.com>
10660
10661         * Makefile.am (libgold_a_LIBADD): New.
10662         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10663         * Makefile.in: Regenerate.
10664         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10665         * configure: Regenerate.
10666         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10667         * fileread.cc: Include sys/state.h
10668         * gold.h: Declare memmem and strndup if found missing.
10669         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10670
10671 2009-06-23  Ian Lance Taylor  <iant@google.com>
10672
10673         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10674         * configure: Rebuild.
10675
10676 2009-06-23  Ian Lance Taylor  <iant@google.com>
10677
10678         PR 10147
10679         * object.cc (Object::section_contents): Don't try to get a view if
10680         the section has length zero.
10681         (Object::handle_gnu_warning_section): If the section is empty, use
10682         the name of the section as the warning.
10683
10684 2009-06-23  Ian Lance Taylor  <iant@google.com>
10685
10686         PR 10133
10687         * stringpool.h (class Stringpool_template): Add optimize_ field.
10688         (Stringpool_template::set_optimize): New function.
10689         * stringpool.cc (Stringpool_template::Stringpool_template):
10690         Initialize optimize_ field.
10691         (Stringpool_template::set_string_offsets): Test local optimize
10692         fild rather than parameter.
10693         * layout.cc (Layout::Layout): Call set_optimize on the section
10694         name stringpool.
10695
10696 2009-06-22  Ian Lance Taylor  <iant@google.com>
10697
10698         PR 10030
10699         * yyscript.y: Parse TARGET.
10700         * script.cc (script_set_target): New function.
10701         * script-c.h (script_set_target): Declare.
10702         * options.cc (General_options::string_to_object_format): Rename
10703         from string_to_object_format in anonymous namespace.  Change
10704         callers.
10705         * options.h (class General_options): Declare
10706         string_to_object_format.
10707
10708 2009-06-22  Ian Lance Taylor  <iant@google.com>
10709
10710         * script-sections.cc (Script_sections::create_segments): Don't put
10711         program headers in a PT_LOAD segment if -n or -N.
10712
10713 2009-06-22  Ian Lance Taylor  <iant@google.com>
10714
10715         PR 10141
10716         * options.h (class General_options): Add -z lazy and -z now.  Sort
10717         -z options into alphabetical order.
10718         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10719
10720 2009-06-21  Ian Lance Taylor  <iant@google.com>
10721
10722         * layout.cc (Layout::make_output_section): Call
10723         Target::new_output_section.
10724         (Layout::attach_allocated_section_to_segment): Put large section
10725         sections in a separate load segment with the large segment flag
10726         set.
10727         (Layout::segment_precedes): Sort large data segments after other
10728         load segments.
10729         (align_file_offset): New static function.
10730         (Layout::set_segment_offsets): Use align_file_offset.
10731         * output.h (class Output_section): Add is_small_section_ and
10732         is_large_section_ fields.
10733         (Output_section::is_small_section): New function.
10734         (Output_section::set_is_small_section):  New function.
10735         (Output_section::is_large_section): New function.
10736         (Output_section::set_is_large_section): New function.
10737         (Output_section::is_large_data_section): New function.
10738         (class Output_segment): Add is_large_data_segment_ field.
10739         (Output_segment::is_large_data_segment): New function.
10740         (Output_segment::set_is_large_data_segment): New function.
10741         * output.cc (Output_section::Output_section): Initialize new
10742         fields.
10743         (Output_segment::Output_segment): Likewise.
10744         (Output_segment::add_output_section): Add assertion that large
10745         data sections always go in large data segments.  Force small data
10746         sections to the end of the list of data sections.  Force small BSS
10747         sections to the start of the list of BSS sections.  For large BSS
10748         sections to the end of the list of BSS sections.
10749         * symtab.h (class Symbol): Declare is_common_shndx.
10750         (Symbol::is_defined): Check Symbol::is_common_shndx.
10751         (Symbol::is_common): Likewise.
10752         (class Symbol_table): Define enum Commons_section_type.  Update
10753         declarations.  Add small_commons_ and large_commons_ fields.
10754         * symtab.cc (Symbol::is_common_shndx): New function.
10755         (Symbol_table::Symbol_table): Initialize new fields.
10756         (Symbol_table::add_from_object): Put small and large common
10757         symbols in the right list.
10758         (Symbol_table::sized_finalized_symbol): Check
10759         Symbol::is_common_shndx.
10760         (Symbol_table::sized_write_globals): Likewise.
10761         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10762         common symbol lists.  Don't call do_allocate_commons_list if the
10763         list is empty.
10764         (Symbol_table::do_allocate_commons_list): Remove is_tls
10765         parameter.  Add comons_section_type parameter.  Change all
10766         callers.  Handle small and large common symbols.
10767         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10768         Symbol::is_common_shndx.
10769         * resolve.cc (symbol_to_bits): Likewise.
10770         * target.h (Target::small_common_shndx): New function.
10771         (Target::small_common_section_flags): New function.
10772         (Target::large_common_shndx): New function.
10773         (Target::large_common_section_flags): New function.
10774         (Target::new_output_section): New function.
10775         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10776         small_common_section_flags, and large_common_section_flags
10777         fields.
10778         (Target::do_new_output_section): New virtual function.
10779         * arm.cc (Target_arm::arm_info): Initialize new fields.
10780         * i386.cc (Target_i386::i386_info): Likewise.
10781         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10782         Likewise.
10783         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10784         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10785         (Target_x86_64::do_new_output_section): New function.
10786         * configure.ac: Define conditional MCMODEL_MEDIUM.
10787         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10788         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10789         (large_LDFLAGS): Define.
10790         * testsuite/large.c: New file.
10791         * testsuite/testfile.cc (Target_test::test_target_info):
10792         Initialize new fields.
10793         * configure, testsuite/Makefile.in: Rebuild.
10794
10795 2009-06-05  Doug Kwan  <dougkwan@google.com>
10796
10797         * Makefile.am (CCFILES): Add target.cc.
10798         * Makefile.in: Regenerate.
10799         * i386.cc (class Target_i386): Define new virtual method to
10800         override do_is_local_label_name in parent.
10801         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10802         local symbols if --discard-locals or -X is given.
10803         * options.h (class General_options): Declare new options
10804         '--discard-locals' and '-X' for discarding locals.
10805         * target.h (class Target): Define new methods is_local_label_name.
10806         Declare new virtual method do_is_local_label_name.
10807         * target.cc: New file.
10808         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10809         (check_SCRIPTS): Add discard_locals_test.sh.
10810         (check_DATA): Add discard_local_tests.syms.
10811         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10812         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10813         * testsuite/Makefile.in: Regenerate.
10814         * testsuite/discard_locals_test.c: New file.
10815         * testsuite/discard_locals_test.sh: Same.
10816
10817 2009-06-05  Doug Kwan  <dougkwan@google.com>
10818
10819         * object.cc (Sized_relobj::Sized_relobj): Initialize
10820         discarded_eh_frame_shndx_ to -1U.
10821         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10822         section.
10823         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10824         a discarded .eh_frame section.
10825         (Sized_relobj::do_finalize_local_symbols): Ditto.
10826         * object.h (class Sized_relobj): Declare new member
10827         discarded_eh_frame_shndx_.
10828         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10829         (local_labels_test.o, local_labels_test): New rules.
10830         * testsuite/Makefile.in: Regenerate.
10831
10832 2009-06-04  Doug Kwan  <dougkwan@google.com>
10833
10834         * layout.cc (Layout::section_name_mapping): Add mapping for
10835         special ARM sections.
10836
10837 2009-06-03  Doug Kwan  <dougkwan@google.com>
10838
10839         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10840         (utils::has_overflow): Same.
10841
10842 2009-06-03  Ian Lance Taylor  <iant@google.com>
10843
10844         * layout.cc (Layout::section_name_mapping): New array, replacing
10845         Layout::linkonce_mapping.
10846         (Layout::section_name_mapping_count): New variable, replacing
10847         Layout::linkonce_mapping_count.
10848         (Layout::linkonce_output_name): Remove.
10849         (Layout::output_section_name): Rewrite.
10850         * layout.h (class Layout): Rename Linkonce_mapping to
10851         Section_name_mapping, linkonce_mapping to section_name_mapping,
10852         linkonce_mapping_count to section_name_mapping_count.  Don't
10853         declare linkonce_output_name.
10854
10855 2009-06-03  Doug Kwan  <dougkwan@google.com>
10856
10857         * gold/arm.cc (namespace utils): New.
10858         (Target_arm::reloc_is_non_pic): Define new method.
10859         (class Arm_relocate_functions): New.
10860         (Target_arm::Relocate::relocate): Handle relocation types used by
10861         Android.
10862
10863 2009-06-03  Ian Lance Taylor  <iant@google.com>
10864
10865         * arm.cc (Target_arm::scan::global): Use || instead of |.
10866
10867 2009-06-02  Doug Kwan  <dougkwan@google.com>
10868
10869         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10870         issued_non_pic_error_.
10871         (class Target_arm::Scan): Declare new method check_non_pic.
10872         Define new method symbol_needs_plt_entry.
10873         Declare new data member issued_non_pic_error_.
10874         (class Target_arm::Relocate): Declare new method
10875         should_apply_static_reloc.
10876         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10877         (Target_arm::Scan::check_non_pic): Define new method.
10878         (Target_arm::Scan::local): Handle a small subset of reloc types used
10879         by Android.
10880         (Target_arm::Scan::local): Same.
10881         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10882
10883 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10884
10885         * incremental.cc (Incremental_inputs::report_command_line): Filter
10886         out --incremental-* options.
10887
10888 2009-05-29  Doug Kwan  <dougkwan@google.com>
10889
10890         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10891         template class.
10892         (class Target_arm): Update comment.
10893         (Target_arm::Target_arm): Initialize new data members GOT_,
10894         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10895         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10896         and Target_arm::rel_dyn_section.
10897         Declare new_enum Target_arm::Got_type.
10898         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10899         and DYNBSS_.
10900         Update commments for member do_dynsym_value.
10901         (Target_arm::got_size, Target_arm::plt_section,
10902         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10903         new methods inside class defintion.
10904         (Target_arm::got_section): Define new method.
10905         (Target_arm::rel_dyn_section): Same.
10906         (Output_data_plt_arm): New template class.
10907         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10908         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10909         (Output_data_plt_arm::add_entry): Same.
10910         (Output_data_plt_arm::first_plt_entry): Define new
10911         static data member for PLT instruction template.
10912         (Output_data_plt_arm::plt_entry): Same.
10913         (Output_data_plt_arm::do_write): Define new method.
10914         (Target_arm::make_plt_entry): Same.
10915         (Target_arm::do_finalize_sections): Same.
10916         (Target_arm::do_dynsym_value): Same.
10917
10918 2009-05-28  Doug Kwan  <dougkwan@google.com>
10919
10920         * Makefile.am (TARGETSOURCES): Add arm.cc.
10921         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10922         * Makefile.in: Regenerate.
10923         * arm.cc: New file.
10924         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10925
10926 2009-05-26  Doug Kwan  <dougkwan@google.com>
10927
10928         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10929         (General_options::check_excluded_libs): Strip off directories in
10930         archive name before matching like GNU ld does.
10931         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10932         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10933         (exclude_libs_test_LDFLAGS): Add linker option
10934         -Wl,--exclude-libs,libexclude_libs_test_3
10935         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10936         an explicit archive without using -l.
10937         (alt/libexclude_libs_test_3.a): New make rule.
10938         * testsuite/Makefile.in: Regenerate.
10939         * testsuite/exclude_libs_test.c : Declare lib3_default().
10940         (main): Call it.
10941         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10942         * exclude_libs_test_3.c: New file.
10943
10944 2009-05-26  Nick Clifton  <nickc@redhat.com>
10945
10946         * po/id.po: New Indonesian translation.
10947         * po/gold.pot: Updated template file.
10948
10949 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10950
10951         * testsuite/Makefile.am: Add -ffunction-sections to compile
10952         gc_comdat_test files.  Add -Wl,--gc-sections to build
10953         gc_comdat_test.
10954         * testsuite/Makefile.in: Regenerate.
10955         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10956
10957 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10958
10959         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10960         kept comdat section was garbage collected.
10961         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10962         * testsuite/Makefile.in: Regenerate.
10963         * testsuite/gc_comdat_test.sh: New file.
10964         * testsuite/gc_comdat_test_1.cc: New file.
10965         * testsuite/gc_comdat_test_2.cc: New file.
10966
10967 2009-05-19  Doug Kwan  <dougkwan@google.com>
10968
10969         * archive.cc (Archive::Archive): Move constructor from archive.h
10970         to here.  Initialize no_export_.
10971         (Archive::get_elf_object_for_member): Set no_export flag of object.
10972         * archive.h (Archive::Archive): Move constructor body to
10973         archive.cc.
10974         (Archive::no_export): New method.
10975         (Archive::no_export_): New field.
10976         * object.h (Object::Object): Initialize no_export_ to false.
10977         (Object::no_export, Object::set_no_export): New methods.
10978         (Object::no_export_): New field.
10979         * options.cc (General_options::parse_exclude_libs): New method.
10980         (General_options::check_excluded_libs) Same.
10981         * options.h (exclude_libs): New option.
10982         (General_options::check_excluded_libs): New method declaration.
10983         (General_options::excluded_libs_): New field.
10984         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10985         default or protected visibility if an object has no-export flag set.
10986         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10987         (check_SCRIPTS): Add exclude_libs_test.sh.
10988         (check_DATA): Add exclude_libs_test.syms.
10989         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10990         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10991         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10992         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10993         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10994         libexclude_libs_test_2.a): New rules.
10995         * testsuite/Makefile.in: Regenerate.
10996         * testsuite/exclude_libs_test.c: New file.
10997         * testsuite/exclude_libs_test.sh: Ditto.
10998         * testsuite/exclude_libs_test_1.c: Ditto.
10999         * testsuite/exclude_libs_test_2.c: Ditto.
11000
11001 2009-05-15  Ian Lance Taylor  <iant@google.com>
11002
11003         * configure.ac: Check for declarations for cases where libiberty.h
11004         checks HAVE_DECL_xxx.
11005         * configure, config.in: Rebuild.
11006
11007 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11008
11009         * gold.h (Incremental_argument_list): Remove (invalid) forward
11010         declaration.
11011         * incremental.cc (Incremental_inputs::report_achive): New method.
11012         (Incremental_inputs::report_object): New method.
11013         (Incremental_inputs::report_script): New method.
11014         (Incremental_inputs::finalize_inputs): New method.
11015         (Incremental_inputs::finalize): Call finalize_inputs().
11016         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11017         Create inputs entries.
11018         * incremental.h (Incremental_input_type): New enum.
11019         (Incremental_inputs::Incremental_input): Initialize new fields.
11020         (Incremental_inputs::report_inputs): New method.
11021         (Incremental_inputs::report_achive): New method.
11022         (Incremental_inputs::report_object): New method.
11023         (Incremental_inputs::report_script): New method.
11024         (Incremental_inputs::finalize_inputs): New method.
11025         (Incremental_inputs::Input_info): New struct.
11026         (Incremental_inputs::Input_info_map): New typedef.
11027         (Incremental_inputs::lock_): New field.
11028         (Incremental_inputs::Inputs_): New field.
11029         (Incremental_inputs::Inputs_map): New field.
11030         * main.cc (main): Call Incremental_input::report_inputs.
11031         * options.h (Input_argument_list): Typedef moved from
11032         Input_arguments.
11033         (Input_file_group::Files): Remove, use ::Input_argument_list.
11034         (Input_file_group::Input_argument_list): Remove, use
11035         ::Input_argument_list.
11036         * plugin.cc (Plugin_manager::add_input_file): Add error in
11037         incremental build.
11038         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11039         functions.
11040         * script.cc (read_input_script): Call
11041         Incremental_input::report_script.
11042         * script.h (Script_info): New class.
11043
11044 2009-04-27  Ian Lance Taylor  <iant@google.com>
11045
11046         * x86_64.cc (do_adjust_output_section): Set entsize to
11047         plt_entry_size.
11048
11049 2009-04-23  Elliott Hughes  <enh@google.com>
11050
11051         * output.cc (Output_file::close): After short writes, continue
11052         writing from the correct offset in the buffer being written.
11053
11054 2009-04-23  Chris Demetriou  <cgd@google.com>
11055
11056         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11057         * configure: Regenerate.
11058         * config.in: Regenerate.
11059         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11060         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11061
11062 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11063
11064         * incremental.cc (Incremental_inputs_header_data): Renamed from
11065         Incremental_input_header_data.
11066         (Incremental_inputs_header_data::data_size): New field.
11067         (Incremental_inputs_header_data::put_input_file_count): Renamed
11068         from input_file_count.
11069         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11070         from command_line_offset.
11071         (Incremental_inputs_header_data::put_reserved): Renamed from
11072         put_reserved.
11073         (Incremental_inputs_entry_data): Renamed from
11074         Incremental_input_entry_data.
11075         (Incremental_inputs_entry_data::data_size): New field.
11076         (Incremental_inputs::report_command_line): New method.
11077         (Incremental_inputs::finalize): New method.
11078         (Incremental_inputs::create_incremental_inputs_data): New method.
11079         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11080         * incremental.h: New file.
11081         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11082         (Layout::finalize): Create incremental inputs section in
11083         incremental builds.
11084         (Layout::create_incremental_info_sections): New method.
11085         * layout.h (Layout::incremental_inputs): New method.
11086         (Layout::create_incremental_info_sections): New method.
11087         (Layout::incremental_inputs_): New field.
11088         * main.cc (main): Notify Incremental_input of the command line.
11089
11090 2009-04-01  Ian Lance Taylor  <iant@google.com>
11091             Mikolaj Zalewski  <mikolajz@google.com>
11092
11093         * gold.h (reserve_unordered_map): Define, three versions, one for
11094         each version of Unordered_map.
11095         * layout.cc (Layout::Layout): Remove options parameter.  Add
11096         number_of_input_files parameter.  Don't initialize options_.
11097         Initialize number_of_input_files_ and resized_signatures_.  Move
11098         sections_are_attached_.
11099         (Layout::layout_group): Reserve space for group_signatures_.
11100         (Layout::find_or_add_kept_section): Change name parameter to be a
11101         reference.  Resize signatures_ map when it gets large enough.
11102         (Layout::layout_eh_frame): Use parameters->options() instead of
11103         this->options_.
11104         (Layout::make_output_section): Likewise.
11105         (Layout::attach_allocated_section_to_segment): Likewise.
11106         (Layout::finalize, Layout::create_executable_stack): Likewise.
11107         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11108         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11109         * layout.h (class Layout): Update declarations.  Remove options_
11110         field.  Add number_of_input_files_ and resized_signatures_
11111         fields.  Move sections_are_attached_ field.
11112         * main.cc (main): Pass number of input files to Layout
11113         constructor.  Don't pass options.
11114
11115 2009-03-30  Ian Lance Taylor  <iant@google.com>
11116
11117         * ffsll.c (ffsll): Correct implementation.
11118
11119 2009-03-27  Ian Lance Taylor  <iant@google.com>
11120
11121         * ffsll.c: New file.
11122         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11123         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11124         * ftruncate.c (ftruncate): Declare before definition.
11125         * mremap.c (mremap): Likewise.
11126         * pread.c (pread): Likewise.
11127         * configure, Makefile.in, config.in: Rebuild.
11128
11129         * mremap.c: New file.
11130         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11131         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11132         (mremap): Declare if HAVE_MREMAP is not defined.
11133         * configure, Makefile.in, config.in: Rebuild.
11134
11135 2009-03-27  Cary Coutant  <ccoutant@google.com>
11136
11137         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11138         position independent.
11139         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11140         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11141
11142 2009-03-24  Cary Coutant  <ccoutant@google.com>
11143
11144         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11145         an executable.
11146         (needs_dynamic_reloc): Likewise.
11147
11148 2009-03-24  Ian Lance Taylor  <iant@google.com>
11149
11150         * yyscript.y (file_cmd): Recognize EXTERN.
11151         (extern_name_list, extern_name_list_body): New nonterminals.
11152         * script.cc (script_add_extern): Define.
11153         * script-c.h (script_add_extern): Declare.
11154
11155 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11156
11157         * object.cc (is_elf_object): Define.
11158         * object.h (is_elf_object): Declare.
11159         * archive.cc (Archive::get_elf_object_for_member): Call
11160         is_elf_object.
11161         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11162
11163 2009-03-24  Elliott Hughes  <enh@google.com>
11164
11165         * output.cc (Output_file::map_anonymous): Define.
11166         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11167         try an anonymous one.  Report the size if the mmap fails.
11168         * output.h (class Output_file): Declare map_anonymous.
11169
11170 2009-03-24  Ian Lance Taylor  <iant@google.com>
11171
11172         * target-select.cc (instantiate_target): Don't acquire the lock if
11173         the instantiated_target_ field has already been set.
11174
11175 2009-03-23  Ian Lance Taylor  <iant@google.com>
11176
11177         * gold-threads.h (class Initialize_lock): Define.
11178         * gold-threads.cc (class Initialize_lock_once): Define.
11179         (initialize_lock_control): New static variable.
11180         (initialize_lock_pointer): New static variable.
11181         (initialize_lock_once): New static function.
11182         (Initialize_lock::Initialize_lock): Define.
11183         (Initialize_lock::initialize): Define.
11184         * target-select.h: Include "gold-threads.h".
11185         (class Target_selector): Add lock_ and initialize_lock_ fields.
11186         Don't define instantiate_target, just declare it.
11187         * target-select.cc (Target_selector::Target_selector): Initialize
11188         new fields.
11189         (Target_selector::instantiate_target): Define.
11190         * descriptors.h: Include "gold-threads.h".
11191         (class Descriptors): Add initialize_lock_ field.
11192         * descriptors.cc (Descriptors::Descriptors): Initialize new
11193         field.
11194         (Descriptors::open): Use initialize_lock_ field
11195         * errors.h (class Errors): Add initialize_lock_ field.
11196         * errors.cc (Errors::Errors): Initialize new field.
11197         (Errors::initialize_lock): Use initialize_lock_ field.
11198         * powerpc.cc (class Target_selector_powerpc): Remove
11199         instantiated_target_ field.  In do_recognize call
11200         instantiate_target rather than do_instantiate_target.  In
11201         do_instantiate_target just allocate a new target.
11202         * sparc.cc (class Target_selector_sparc): Likewise.
11203
11204         * freebsd.h: New file.
11205         * i386.cc: Include "freebsd.h".
11206         (Target_i386): Derive from Target_freebsd rather than
11207         Sized_target.
11208         (Target_selector_i386): Derive from Target_selector_freebsd rather
11209         than Target_selector.
11210         * x86_64.cc: Include "freebsd.h".
11211         (Target_x86_64): Derive from Target_freebsd rather than
11212         Sized_target.
11213         (Target_selector_x86_64): Derive from Target_selector_freebsd
11214         rather than Target_selector.
11215         * target.h (class Target): Add adjust_elf_header and
11216         do_adjust_elf_header.
11217         * output.cc (Output_file_header:: do_sized_write): Call target
11218         adjust_elf_header routine.
11219         * configure.tgt: Set targ_osabi.
11220         * configure.ac: Define GOLD_DEFAULT_OSABI.
11221         * parameters.cc (Parameters::default_target): Pass
11222         GOLD_DEFAULT_OSABI to select_target.
11223         * target-select.h (class Target_selector): Make instantiate_target
11224         protected rather than private.
11225         * Makefile.am (HFILES): Add freebsd.h.
11226         * configure, Makefile.in, config.in: Rebuild.
11227
11228         * merge.cc (do_add_input_section): Correct pend value.  Change
11229         message about last entry not being null terminated from error to
11230         warning.
11231
11232 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11233
11234         * incremental.cc: New file.
11235         * Makefile.am (CCFILES): Add incremental.cc.
11236         * Makefile.in: Rebuild.
11237
11238 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11239
11240         * layout.cc (Layout::output_section_name): Preserve names
11241         of '.note.' sections.
11242
11243 2009-03-19  Ian Lance Taylor  <iant@google.com>
11244
11245         * descriptors.cc (Descriptors::open): Check that the options are
11246         valid before using them.
11247
11248 2009-03-18  Ian Lance Taylor  <iant@google.com>
11249
11250         * script-sections.h: Include <list>.
11251         (class Script_sections): Change Sections_elements from std::vector
11252         to std::list.  Typedef public Elements_iterator.  Add
11253         orphan_section_placement_, data_segment_align_start_, and
11254         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11255         field.
11256         * script-sections.cc (class Orphan_section_placement): New class.
11257         (class Sections_element): Add virtual functions is_relro and
11258         orphan_section_init.  Remove virtual function place_orphan_here.
11259         (class Output_section_definition): Add is_relro and
11260         orphan_section_init.  Remove place_orphan_here.
11261         (class Orphan_output_section): Likewise.
11262         (Script_sections::Script_sections): Update for field changes.
11263         (Script_sections::data_segment_align): Set saw_data_segment_align_
11264         and data_segment_align_start_, not data_segment_align_index.
11265         (Script_sections::data_segment_relro_end): Check
11266         saw_data_segment_align_.  Use data_segment_align_start_ rather
11267         than data_segment_align_index_.
11268         (Script_sections::place_orphan): Rewrite to use
11269         Orphan_section_placement.
11270
11271 2009-03-17  Ian Lance Taylor  <iant@google.com>
11272
11273         * archive.cc (Archive::add_symbols): Check for a version attached
11274         to the symbol name in the archive map.
11275         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11276         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11277         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11278         (ver_test_11.a): New target.
11279         * testsuite/Makefile.in: Rebuild.
11280
11281         * configure.ac: Check for chsize and posix_fallocate.  Replace
11282         ftruncate.
11283         * ftruncate.c: New file, from gnulib.
11284         * output.cc (posix_fallocate): Define dummy version if not
11285         HAVE_POSIX_FALLOCATE.
11286         (Output_file::map): Call posix_fallocate rather than lseek and
11287         write.
11288         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11289         * configure, Makefile.in, config.in: Rebuild.
11290
11291 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11292
11293         * layout.h (Layout::create_note): Add section_name parameter.
11294         * layout.cc (Layout::create_note): Likewise.
11295         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11296
11297 2009-03-17  Ian Lance Taylor  <iant@google.com>
11298
11299         * descriptors.cc: Include "options.h".
11300         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11301         (Descriptors::open): Always use O_CLOEXEC when opening a new
11302         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11303         then set FD_CLOEXEC.
11304
11305         * sparc.cc (class Target_sparc): Add has_got_section.
11306         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11307         make sure we have a GOT section.
11308
11309         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11310         (Target_sparc::Scan::local): Likewise.
11311         (Target_sparc::Scan::global): Likewise.
11312         (Target_sparc::Relocate::relocate): Likewise.
11313         (Target_sparc::Relocate::relocate_tls): Likewise.
11314
11315         * symtab.cc (Symbol_table::define_default_version): New function,
11316         broken out of add_from_object.
11317         (Symbol_table::add_from_object): Call define_default_version.
11318         (Symbol_table::define_special_symbol): Add resolve_oldsym
11319         parameter.  Change all callers.  If the version for a symbol comes
11320         from a version script, resolve it with the symbol with the same
11321         name with no version.  Also add the symbol without a version if
11322         appropriate.
11323         (do_define_in_output_data): If resolving with oldsym, don't delete
11324         sym.
11325         (do_define_in_output_segment): Likewise.
11326         (do_define_as_constant): Likewise.
11327         * symtab.h (class Symbol_table): Update declarations.
11328
11329 2009-03-13  Ian Lance Taylor  <iant@google.com>
11330
11331         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11332         (Read_symbols::requeue): New function.
11333         (Read_symbols::do_read_symbols): If make_elf_object fails because
11334         the target type is not configured, and the file was searched for,
11335         issue a warning and retry with the next directory.
11336         (Add_symbols::run): If the file has an incompatible format, and
11337         it was searched for, requeue the Read_symbols task.  On error,
11338         release the object.
11339         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11340         dirindex parameter to constructor.  Change all callers.  Declare
11341         incompatible_warning and requeue.
11342         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11343         input_argument_ and input_group_ fields.  Add them to
11344         constructor.  Change all callers.
11345         (class Read_script): Add dirindex_ field.  Add it to constructor.
11346         Change all callers.
11347         * archive.cc (Archive::setup): Remove input_objects parameter.
11348         Change all callers.
11349         (Archive::get_file_and_offset): Likewise.
11350         (Archive::read_all_symbols): Likewise.
11351         (Archive::read_symbols): Likewise.
11352         (Archive::get_elf_object_for_member): Remove input_objects
11353         parameter.  Add punconfigured parameter.  Change all callers.
11354         (Archive::add_symbols): Change return type to bool.  Check return
11355         value of include_member.
11356         (Archive::include_all_members): Likewise.
11357         (Archive::include_member): Change return type to bool.  Return
11358         false if first included object has incompatible target.  Set
11359         included_member_ field.
11360         (Add_archive_symbols::run): If add_symbols returns false, requeue
11361         Read_symbols task.
11362         * archive.h (class Archive): Add included_member_ field.
11363         Initialize it in constructor.  Add input_file and searched_for
11364         methods.  Update declarations.
11365         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11366         input_argument_ fields.  Add them to constructor.  Change all
11367         callers.
11368         * script.cc: Include "target-select.h".
11369         (class Parser_closure): Add skip_on_incompatible_target_ and
11370         found_incompatible_target_ fields.  Add
11371         skip_on_incompatible_target parameter to constructor.  Change all
11372         callers.  Add methods skip_on_incompatible_target,
11373         clear_skip_on_incompatible_target, found_incompatible_target, and
11374         set_found_incompatible_target.
11375         (read_input_script): Add dirindex parameter.  Change all callers.
11376         If parser finds an incompatible target, requeue Read_symbols
11377         task.
11378         (script_set_symbol): Clear skip_on_incompatible_target in
11379         closure.
11380         (script_add_assertion, script_parse_option): Likewise.
11381         (script_start_sections, script_add_phdr): Likewise.
11382         (script_check_output_format): New function.
11383         * script.h (read_input_script): Update declaration.
11384         * script-c.h (script_check_output_format): Declare.
11385         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11386         (ignore_cmd): Remove OUTPUT_FORMAT.
11387         * fileread.cc (Input_file::Input_file): Add explicit this.
11388         (Input_file::will_search_for): New function.
11389         (Input_file::open): Add pindex parameter.  Change all callers.
11390         * fileread.h (class Input_file): Add input_file_argument method.
11391         Declare will_search_for.  Update declarations.
11392         * object.cc (make_elf_object): Add punconfigured parameter.
11393         Change all callers.
11394         * object.h (class Object): Make input_file public.  Add
11395         searched_for method.
11396         (make_elf_object): Update declaration.
11397         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11398         restart search.
11399         * dirsearch.h (class Dirsearch): Update declaration.
11400         * options.h (class General_options): Add --warn-search-mismatch.
11401         * parameters.cc (Parameters::is_compatible_target): New function.
11402         * parameters.h (class Parameters): Declare is_compatible_target.
11403         * workqueue.cc (Workqueue::add_blocker): New function.
11404         * workqueue.h (class Workqueue): Declare add_blocker.
11405
11406         * fileread.cc (Input_file::open): Remove options parameter.
11407         Change all callers.
11408         (Input_file::open_binary): Likewise.
11409         * script.cc (read_input_script): Likewise.
11410         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11411         options parameter from constructor.  Change all callers.
11412         (class Read_script): Likewise.
11413         * fileread.h (class Input_file): Update declarations.
11414         * script.h (read_input_script): Update declaration.
11415
11416 2009-03-10  Nick Clifton  <nickc@redhat.com>
11417
11418         * po/es.po: New Spanish translation.
11419
11420 2009-03-06  Cary Coutant  <ccoutant@google.com>
11421
11422         * options.cc (parse_short_option): Keep dash_z from registering itself.
11423
11424 2009-03-03  Ian Lance Taylor  <iant@google.com>
11425
11426         PR 9918
11427         * target-reloc.h (relocate_section): Pass output_section to
11428         relocate.
11429         * i386.cc (Target_i386::should_apply_static_reloc): Add
11430         output_section parameter.  Change all callers.
11431         (Target_i386::Relocate::relocate): Add output_section parameter.
11432         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11433         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11434         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11435         * testsuite/two_file_shared.sh: New script.
11436         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11437         (check_DATA): Add two_file_shared.dbg.
11438         (two_file_shared.dbg): New target.
11439         * testsuite/Makefile.in: Rebuild.
11440
11441 2009-03-01  Ian Lance Taylor  <iant@google.com>
11442
11443         * configure.ac: Check for byteswap.h.
11444         * configure: Rebuild.
11445         * config.in: Rebuild.
11446
11447 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11448
11449         * layout.cc (Layout::find_or_add_kept_section): New function.
11450         (Layout::add_comdat): Removed.
11451         * layout.h (struct Kept_section): Move out of class Layout.
11452         Remove trailing underscores from field names.  Add group_sections
11453         field.  Rename group_ field to is_group.  Change all uses.
11454         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11455         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11456         comdat_groups_ field.
11457         (Sized_relobj::include_section_group): Use
11458         find_or_add_kept_section and Kept_section::group_sections.
11459         (Sized_relobj::include_linkonce_section): Likewise.
11460         * object.cc (class Sized_relobj): Don't define Comdat_group or
11461         Comdat_group_table.  Remove find_comdat_group and
11462         add_comdat_group.  Remove comdat_groups_ field.
11463         * plugin.cc (include_comdat_group): Use
11464         Layout::find_or_add_kept_section.
11465
11466 2009-02-28  Ian Lance Taylor  <iant@google.com>
11467
11468         * README: --gc-sections and map files are now supported.  Document
11469         some build requirements.
11470
11471         PR 6992
11472         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11473         relocatable link set the value of the section symbol to zero.
11474         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11475         relocatable link don't include the section address in the local
11476         symbol value.
11477
11478 2009-02-27  Ian Lance Taylor  <iant@google.com>
11479
11480         PR 6811
11481         * options.h (class Search_directory): Add is_system_directory.
11482         (class General_options): Declare is_in_system_directory.
11483         * options.cc (get_relative_sysroot): Make static.
11484         (get_default_sysroot): Make static.
11485         (General_optoins::is_in_system_directory): New function.
11486         * fileread.cc (Input_file::is_in_system_directory): New function.
11487         * fileread.h (class Input_file): Declare is_in_system_directory.
11488         * object.h (class Object): Add is_in_system_directory.
11489         (class Input_objects): Remove system_library_directory_ field.
11490         * object.cc (Input_objects::add_object): Don't set
11491         system_library_directory_.
11492         (input_objects::found_in_system_library_directory): Remove.
11493         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11494         parameter.  Change all callers.
11495         (Symbol_table::sized_write_globals): Likewise.
11496         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11497         Call Object::is_in_system_directory.
11498         * symtab.h (class Symbol_table): Update declarations.
11499
11500         PR 5990
11501         * descriptors.h (Open_descriptor): Add is_on_stack field.
11502         * descriptors.cc (Descriptors::open): If the descriptor is on the
11503         top of the stack, remove it.  Initialize is_on_stack field.
11504         (Descriptors::release): Only add pod to stack if it is not on the
11505         stack already.
11506         (Descriptors::close_some_descriptor): Clear stack_next and
11507         is_on_stack fields.
11508
11509         PR 7091
11510         * output.cc (Output_section::find_starting_output_address): Rename
11511         from starting_output_address; add PADDR parameter; change return
11512         type.
11513         * output.h (class Output_section): Declare
11514         find_starting_output_address instead of starting_output_address.
11515         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11516         section symbol for which we can't find a merge section.
11517
11518         PR 9836
11519         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11520         hidden or internal, force the symbol to be local.
11521         * resolve.cc (Symbol::override_visibility): Define.
11522         (Symbol::override_base): Use override_visibility.
11523         (Symbol_table::resolve): Likewise.
11524         (Symbol::override_base_with_special): Likewise.
11525         (Symbol_table::override_with_special): If the visibility is hidden
11526         or internal, force the symbol to be local.
11527         * symtab.h (class Symbol): Add set_visibility and
11528         override_visibility.
11529         * testsuite/ver_test_1.sh: New file.
11530         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11531         (check_DATA): Add ver_test_1.syms.
11532         (ver_test_1.syms): New target.
11533         * testsuite/Makefile.in: Rebuild.
11534
11535 2009-02-25  Cary Coutant  <ccoutant@google.com>
11536
11537         * layout.cc (Layout::choose_output_section): Don't rename sections
11538         when using a linker script that has a SECTIONS clause.
11539         * Makefile.in: Regenerate.
11540
11541         * testsuite/Makefile.am (script_test_5.sh): New test case.
11542         * testsuite/Makefile.in: Regenerate.
11543         * testsuite/script_test_5.cc: New file.
11544         * testsuite/script_test_5.sh: New file.
11545         * testsuite/script_test_5.t: New file.
11546
11547 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11548
11549         * archive.cc (Archive::include_member): Update calls to add_symbols.
11550         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11551         the Layout argument.
11552         * dynobj.h (do_add_symbols): Add the Layout argument.
11553         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11554         Layout argument.
11555         * object.h (Object::add_symbols): Add the Layout argument.
11556         (Object::do_add_symbols): Add the Layout argument.
11557         (Sized_relobj::do_add_symbols): Add the Layout argument.
11558         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11559         Unify the two versions.
11560         (Add_plugin_symbols): Remove.
11561         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11562         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11563         (Add_plugin_symbols): Remove.
11564         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11565         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11566         (Add_symbols::run): Make it work with Pulginobj.
11567
11568 2009-02-06  Ian Lance Taylor  <iant@google.com>
11569
11570         * object.cc (Sized_relobj::do_layout): Make info message start
11571         with lower case letter.
11572
11573 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11574
11575         * binary.cc: Fix file comment.
11576
11577         * options.h (enum Incremental_disposition): Define.
11578         (class General_options): Add new options: --incremental,
11579         --incremental_changed, --incremental_unchanged,
11580         --incremental_unknown.  Add incremental_disposition_ and
11581         implicit_incremental_ fields.
11582         (General_options::incremental_disposition): New function.
11583         (class Position_dependent_options): Add incremental_disposition
11584         option.
11585         (Position_dependent_options::copy_from_options): Set incremental
11586         dispositions.
11587         * options.cc (General_options::parse_incremental_changed): New
11588         function.
11589         (General_options::parse_incremental_unchanged): New function.
11590         (General_options::parse_incremental_unknown): New function.
11591         (General_options::General_options): Initialize new fields
11592         incremental_disposition_ and implicit_incremental_.
11593         (General_options::finalize): Check for uasge of --incremental-*
11594         without --incremental.
11595
11596 2009-02-06  Chris Demetriou  <cgd@google.com>
11597
11598         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11599         pointer and to report location as the file name associated with
11600         the symbol.
11601         (gold_undefined_symbol_at_location): New function to replace the
11602         old gold_undefined_symbol functionality.
11603         * target-reloc.h (relocate_section): Update to use
11604         gold_undefined_symbol_at_location.
11605         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11606         Call gold_undefined_symbol function rather than gold_error.
11607         * errors.h (Errors::undefined_symbol): Take location as a
11608         string, rather than calculating it from a relocation.
11609         * errors.cc (Errors::fatal): Print "fatal error:" before the
11610         formatted message.
11611         (Errors::error, Errors::error_at_location): Print "error: "
11612         before the formatted message.
11613         (Errors::undefined_symbol): Take location as a string, rather
11614         than calculating it from a relocation.
11615         (gold_undefined_symbol_at_location): New function akin to
11616         old gold_undefined_symbol, calculates location from relocation.
11617         (gold_undefined_symbol): Change to take only a Symbol pointer
11618         and to report location as the file name associated with the symbol.
11619         * testsuite/debug_msg.sh: Update for changed error messages.
11620         * testsuite/undef_symbol.sh: Likewise.
11621
11622 2009-02-04  Duncan Sands  <baldrick@free.fr>
11623
11624         PR 9812
11625         * reduced_debug_output.h
11626         (Output_reduced_debug_abbrev_section::failed): Use format for
11627         gold_warning.
11628         (Output_reduced_debug_info_section::faild): Likewise.
11629
11630 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11631
11632         * script.cc (Lazy_demangler): New class.
11633         (Version_script_info::get_symbol_version_helper): Demangle a
11634         symbol only once.
11635
11636 2009-01-29  Cary Coutant  <ccoutant@google.com>
11637
11638         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11639         to __tls_get_addr.
11640         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11641
11642 2009-01-28  Ian Lance Taylor  <iant@google.com>
11643
11644         * version.cc (version_string): Bump to 1.9.
11645
11646         * gold.h: Include <cstring> and <stdint.h>.
11647         * version.cc: Include <cstdio>.
11648         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11649         warning.
11650         * reduced_debug_output.cc (insert_into_vector): Rename from
11651         Insert_into_vector; change all callers.  Use Swap_unaligned to
11652         avoid aliasing issue; remove union since it is unnecessary.
11653
11654 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11655
11656         * Makefile.am (CCFILES): Add gc.cc.
11657         (HFILES): Add gc.h.
11658         * Makefile.in: Regenerate.
11659         * gold.cc (Gc_runner): New class.
11660         (queue_initial_tasks): Call garbage collection related tasks
11661         when corresponding options are invoked.
11662         (queue_middle_gc_tasks): New function.
11663         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11664         processed early before laying out sections during garbage collection.
11665         * gold.h (queue_middle_gc_tasks): New function.
11666         (is_prefix_of): Move from "layout.cc".
11667         * i386.cc (Target_i386::gc_process_relocs): New function.
11668         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11669         * main.cc (main): Create object of class "Garbage_collection".
11670         * object.cc (Relobj::copy_symbols_data): New function.
11671         (Relobj::is_section_name_included): New function.
11672         (Sized_relobj::do_layout): Allow this function to be called twice
11673         during garbage collection and defer layout of section during the
11674         first call.
11675         * object.h (Relobj::get_symbols_data): New function.
11676         (Relobj::is_section_name_included): New function.
11677         (Relobj::copy_symbols_data): New function.
11678         (Relobj::set_symbols_data): New function.
11679         (Relobj::get_relocs_data): New function.
11680         (Relobj::set_relocs_data): New function.
11681         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11682         (Relobj::gc_process_relocs): New function.
11683         (Relobj::do_gc_process_relocs): New pure virtual function.
11684         (Relobj::sd_): New data member.
11685         (Sized_relobj::is_output_section_offset_invalid): New function.
11686         (Sized_relobj::do_gc_process_relocs): New function.
11687         * options.h (General_options::gc_sections): Modify to not be a no-op.
11688         (General_options::print_gc_sections): New option.
11689         * plugin.cc (Plugin_finish::run): Remove function call to
11690         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11691         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11692         * reloc.cc (Read_relocs::run): Add task to process relocs and
11693         determine unreferenced sections when doing garbage collection.
11694         (Gc_process_relocs): New class.
11695         (Sized_relobj::do_gc_process_relocs): New function.
11696         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11697         sections that are garbage collected.
11698         * reloc.h (Gc_process_relocs): New class.
11699         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11700         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11701         symbols whose corresponding sections are garbage collected.
11702         (Symbol_table::Symbol_table): Add new parameter for the garbage
11703         collection object.
11704         (Symbol_table::gc_mark_undef_symbols): New function.
11705         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11706         (Symbol_table::gc_mark_dyn_syms): New function.
11707         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11708         as garbage.
11709         (Symbol_table::add_from_object): Likewise.
11710         (Symbol_table::add_from_relobj): When building shared objects, do not
11711         treat externally visible symbols as garbage.
11712         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11713         table information for static and relocatable links.
11714         * symtab.h (Symbol_table::set_gc): New function.
11715         (Symbol_table::gc): New function.
11716         (Symbol_table::gc_mark_undef_symbols): New function.
11717         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11718         (Symbol_table::gc_mark_dyn_syms): New function.
11719         (Symbol_table::gc_): New data member.
11720         * target.h (Sized_target::gc_process_relocs): New pure virtual
11721         function.
11722         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11723         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11724
11725 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11726
11727         * options.h (General_options::gc_sections): Define as a no-op for now.
11728         (General_options::no_keep_memory): Ditto.
11729         (General_options::Bshareable): Define.
11730         * options.cc (General_options::finalize): Honor -Bshareable.
11731
11732 2009-01-20  Andreas Schwab  <schwab@suse.de>
11733
11734         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11735         read the value in the contents, since we don't use it.  Use the
11736         template endianness when writing.
11737         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11738
11739 2009-01-19  Andreas Schwab  <schwab@suse.de>
11740
11741         * configure.tgt (powerpc64-*): Fix targ_obj.
11742
11743 2009-01-15  Ian Lance Taylor  <iant@google.com>
11744
11745         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11746         local symbols when stripping all symbols.
11747
11748 2009-01-14  Cary Coutant  <ccoutant@google.com>
11749
11750         * output.cc (Output_reloc): Add explicit instantiations.
11751
11752 2009-01-14  Cary Coutant  <ccoutant@google.com>
11753
11754         * archive.cc (Archive::get_elf_object_for_member): Remove call
11755         to File_read::claim_for_plugin.
11756         * descriptors.cc (Descriptors::open): Remove reference to
11757         is_claimed.
11758         (Descriptors::claim_for_plugin): Remove.
11759         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11760         (Descriptors::is_claimed): Remove.
11761         (claim_descriptor_for_plugin): Remove.
11762         * fileread.cc (File_read::claim_for_plugin): Remove.
11763         * fileread.h (File_read::claim_for_plugin): Remove.
11764         (File_read::descriptor): Reopen descriptor if necessary.
11765         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11766         (Plugin_manager::all_symbols_read): Add task parameter. Change
11767         all callers.
11768         (Plugin_manager::get_input_file): New function.
11769         (Plugin_manager::release_input_file): New function.
11770         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11771         corresponding data member.
11772         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11773         and pass to base constructor. Change all callers.
11774         (get_input_file, release_input_file): New functions.
11775         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11776         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11777         (Plugin_manager::all_symbols_read): Add task parameter.
11778         (Plugin_manager::get_input_file): New function.
11779         (Plugin_manager::release_input_file): New function.
11780         (Plugin_manager::task_): New data member.
11781         (Pluginobj::Pluginobj): Add filesize parameter.
11782         (Pluginobj::filename): New function.
11783         (Pluginobj::descriptor): New function.
11784         (Pluginobj::filesize): New function.
11785         (Pluginobj::filesize_): New data member.
11786         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11787         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11788         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11789
11790         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11791         with archive libraries.
11792         * testsuite/Makefile.in: Regenerate.
11793         * testsuite/plugin_test.c (struct sym_info): New type.
11794         (get_input_file, release_input_file): New static variables.
11795         (onload): Capture new transfer vector entries.
11796         (claim_file_hook): Stop reading at end of file according to filesize.
11797         Factor out parsing of readelf output into separate function.
11798         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11799         APIs and get the source file name from the symbol table.  Convert
11800         source file name to corresponding object file name.  Print info
11801         message when adding new input files.
11802         (parse_readelf_line): New function.
11803         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11804         * testsuite/plugin_test_2.sh: Likewise.
11805         * testsuite/plugin_test_3.sh: Likewise.
11806         * testsuite/plugin_test_4.sh: New test case.
11807
11808 2009-01-07  Ian Lance Taylor  <iant@google.com>
11809
11810         * version.cc (version_string): Bump to 1.8.
11811
11812 2008-12-23  Cary Coutant  <ccoutant@google.com>
11813
11814         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11815         * plugin.cc (Plugin_manager::finish): Rename as
11816         layout_deferred_objects.  Move cleanup to separate function.
11817         (Plugin_manager::cleanup): New function.
11818         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11819         separately.
11820         * plugin.h (Plugin_manager::finish): Rename as
11821         layout_deferred_objects.
11822         (Plugin_manager::cleanup): New function.
11823         (Plugin_manager::cleanup_done): New field.
11824
11825 2008-12-23  Cary Coutant  <ccoutant@google.com>
11826
11827         * plugin.cc (is_visible_from_outside): New function.
11828         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11829         so we don't return "IR only" status for exported symbols or -r links.
11830
11831         * testsuite/Makefile.am (plugin_test_3): New test case.
11832         * testsuite/Makefile.in: Regenerate.
11833         * testsuite/plugin_test_3.sh: New file.
11834
11835 2008-12-22  Cary Coutant  <ccoutant@google.com>
11836
11837         * object.cc (Sized_relobj::layout_section): New function.
11838         (Sized_relobj::do_layout): Defer layout of input sections until after
11839         plugin has provided replacement files.
11840         (Sized_relobj::do_layout_deferred_sections): New function.
11841         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11842         (Relobj::layout_deferred_sections): New function.
11843         (Relobj::do_layout_deferred_sections): New function.
11844         (Sized_relobj::do_layout_deferred_sections): New function.
11845         (Sized_relobj::layout_section): New function.
11846         (Sized_relobj::Deferred_layout): New structure.
11847         (Sized_relobj::deferred_layout_): New field.
11848         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11849         Change all callers.  Layout deferred sections.
11850         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11851         references.
11852         (Plugin_hook::run): Move code from do_plugin_hook inline.
11853         (Plugin_hook::do_plugin_hook): Remove.
11854         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11855         (Plugin_manager::finish): Renamed, was cleanup.
11856         (Plugin_manager::should_defer_layout): New function.
11857         (Plugin_manager::add_deferred_layout_object): New function.
11858         (Plugin_manager::Deferred_layout_list): New type.
11859         (Plugin_manager::deferred_layout_objects_): New field.
11860         (Plugin_hook::do_plugin_hook): Remove.
11861
11862 2008-12-17  Ian Lance Taylor  <iant@google.com>
11863
11864         * options.h (class General_options): Add --no case for
11865         --export-dynamic.
11866
11867 2008-12-16  Cary Coutant  <ccoutant@google.com>
11868
11869         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11870         vector.
11871         (Plugin_manager::claim_file): Create plugin object even if
11872         plugin did not call the add_symbols callback.
11873         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11874         asking for more symbols than were added.
11875         * testsuite/Makefile.am (plugin_test_1): Add test case with
11876         no global symbols.
11877         (empty.syms): New target.
11878         * testsuite/Makefile.in: Regenerate.
11879         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11880         message. Don't call add_symbols if no globals.
11881         (all_symbols_read_hook): Don't provide replacement for empty
11882         claimed file.
11883
11884 2008-12-12  Ian Lance Taylor  <iant@google.com>
11885
11886         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11887         r_type == 0 for a local symbol with r_sym == 0.
11888         (scan_relocatable_relocs): Pass r_sym to
11889         local_non_section_strategy.
11890         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11891         r_sym parameter.
11892
11893         * configure.ac: Update test for TLS descriptors: they are
11894         supported as of glibc 2.9.
11895         * configure: Rebuild.
11896
11897 2008-12-11  Ian Lance Taylor  <iant@google.com>
11898
11899         PR 7091
11900         * target-reloc.h (Default_scan_relocatable_relocs): For each
11901         function, map r_type == 0 to RELOC_DISCARD.
11902
11903 2008-12-10  Cary Coutant  <ccoutant@google.com>
11904
11905         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11906         object to override a kept COMDAT group from a plugin object.
11907
11908 2008-12-09  Ian Lance Taylor  <iant@google.com>
11909
11910         PR 7088
11911         * yyscript.y (file_cmd): Handle INPUT.
11912
11913         * testsuite/initpri1.c: Change all declarations to be full
11914         prototypes by adding void, to avoid compiler warnings.
11915
11916 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11917
11918         * options.cc (General_options::parse_plugin_opt): New.
11919         (General_options::add_plugin): The argument now is just the filename.
11920         (General_options::add_plugin_option): New.
11921         * options.h (plugin_opt): New.
11922         (add_plugin): Change argument name.
11923         (add_plugin_option): New.
11924         * plugin.cc (Plugin::load): Don't parse the plugin option.
11925         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11926         (Plugin::add_option): New.
11927         (Plugin::args_): Change type.
11928         (Plugin::filename_): New.
11929         (Plugin_manager::add_plugin_option): New.
11930         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11931         * testsuite/Makefile.in: Regenerate.
11932
11933 2008-12-05  Cary Coutant  <ccoutant@google.com>
11934
11935         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11936         Handle --strip-lto-sections option.
11937         * options.h (strip_lto_sections): New option.
11938
11939 2008-12-01  Cary Coutant  <ccoutant@google.com>
11940
11941         * plugin.cc (ld_plugin_message): Change format parameter to const.
11942         Fix mismatch between new[] and delete.
11943
11944 2008-11-14  Cary Coutant  <ccoutant@google.com>
11945
11946         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11947         instead of -1U.
11948
11949 2008-11-05  Craig Silverstein  <csilvers@google.com>
11950
11951         * options.cc (General_options::parse_dynamic_list): New function.
11952         * options.h (General_options): New flags dynamic_list,
11953         dynamic_list_data, dynamic_list_cpp_new, and
11954         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11955         (General_options::in_dynamic_list): New function.
11956         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11957         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11958         (Lex::can_continue_name): Likewise.
11959         (yylex): Likewise.
11960         (read_script_file): New parameter script_options.
11961         (read_dynamic_list): New function.
11962         (Script_options::define_dynamic_list): New function.
11963         (dynamic_list_keyword_parsecodes): New variable.
11964         (dynamic_list_keywords): New variable.
11965         * script.h (Script_options::define_dynamic_list): New function
11966         prototype.
11967         (read_dynamic_list): New function prototype.
11968         * symtab.cc (strprefix): New macro.
11969         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11970         dynamic_list_data, dynamic_list_cpp_new, and
11971         dynamic_list_cpp_typeinfo.
11972         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11973         (dynamic_list_expr): New rule.
11974         (dynamic_list_nodes): Likewise.
11975         (dynamic_list_node): Likewise.
11976         * testsuite/Makefile.am (dynamic_list): New test.
11977         * testsuite/Makefile.in: Regenerated.
11978         * testsuite/dynamic_list.t: New file.
11979         * testsuite/dynamic_list.sh: New file.
11980
11981 2008-11-05  Craig Silverstein  <csilvers@google.com>
11982
11983         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11984         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11985         (t11_last): Likewise.
11986         * testsuite/ver_test_6.c (main): Likewise.
11987
11988 2008-10-07  Cary Coutant  <ccoutant@google.com>
11989
11990         * options.c (General_options::finalize): Add check for -static and
11991         -shared.
11992         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11993         is not empty.
11994
11995 2008-10-02  Cary Coutant  <ccoutant@google.com>
11996
11997         * plugin.cc (make_sized_plugin_object): Fix conditional
11998         compilation to work when not all targets are enabled.
11999
12000 2008-09-29  Cary Coutant  <ccoutant@google.com>
12001
12002         * archive.cc (Archive::get_file_and_offset): Use filename instead
12003         of name to get library path.
12004         (Archive::include_member): Unlock external member of a thin archive.
12005
12006         * testsuite/Makefile.am (TEST_AR): New variable.
12007         (thin_archive_test_1): New test.
12008         (thin_archive_test_2): New test.
12009         * testsuite/Makefile.in: Regenerate.
12010         * testsuite/thin_archive_main.cc: New file.
12011         * testsuite/thin_archive_test_1.cc: New file.
12012         * testsuite/thin_archive_test_2.cc: New file.
12013         * testsuite/thin_archive_test_3.cc: New file.
12014         * testsuite/thin_archive_test_4.cc: New file.
12015
12016 2008-09-29  Cary Coutant  <ccoutant@google.com>
12017
12018         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12019         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12020         instead of -1U.
12021         (Sized_relobj::do_finalize_local_symbols): Likewise.
12022         (Sized_relobj::map_to_kept_section): Likewise.
12023         * object.h (Sized_relobj::invalid_address): New constant.
12024         (Sized_relobj::do_output_section_offset): Check for invalid_address
12025         and return -1ULL.
12026         * output.cc (Output_reloc::local_section_offset): Use constant
12027         invalid_address instead of -1U.
12028         (Output_reloc::get_address): Likewise.
12029         (Output_section::output_address): Change -1U to -1ULL.
12030         * output.h (Output_reloc::invalid_address): New constant.
12031         * reloc.cc (Sized_relobj::write_sections): Use constant
12032         invalid_address instead of -1U.
12033         (Sized_relobj::relocate_sections): Likewise.
12034         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12035         values for merge sections.
12036         * target-reloc.h (relocate_for_relocatable): Use constant
12037         invalid_address instead of -1U.
12038
12039 2008-09-19  Cary Coutant  <ccoutant@google.com>
12040
12041         Add plugin functionality for link-time optimization (LTO).
12042         * configure.ac (plugins): Add --enable-plugins option.
12043         * configure: Regenerate.
12044         * config.in: Regenerate.
12045         * Makefile.am (LIBDL): New variable.
12046         (CCFILES): Add plugin.cc.
12047         (HFILES): Add plugin.h.
12048         (ldadd_var): Add LIBDL.
12049         * Makefile.in: Regenerate.
12050
12051         * archive.cc: Include "plugin.h".
12052         (Archive::setup): Don't preread archive symbols when using a plugin.
12053         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12054         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12055         files.
12056         (Archive::include_member): Add symbols from plugin objects.
12057         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12058         * descriptors.cc (Descriptors::open): Check for file descriptors
12059         abandoned by plugins.
12060         (Descriptors::claim_for_plugin): New function.
12061         * descriptors.h (Descriptors::claim_for_plugin): New function.
12062         (Open_descriptor::is_claimed): New field.
12063         (claim_descriptor_for_plugin): New function.
12064         * fileread.cc (File_read::claim_for_plugin): New function.
12065         * fileread.h (File_read::claim_for_plugin): New function.
12066         (File_read::descriptor): New function.
12067         * gold.cc: Include "plugin.h".
12068         (queue_initial_tasks): Add task to call plugin hooks for generating
12069         new object files.
12070         * main.cc: Include "plugin.h".
12071         (main): Load plugin libraries.
12072         * object.h (Pluginobj): Declare.
12073         (Object::pluginobj): New function.
12074         (Object::do_pluginobj): New function.
12075         (Object::set_target): New function.
12076         * options.cc: Include "plugin.h".
12077         (General_options::parse_plugin): New function.
12078         (General_options::General_options): Initialize plugins_ field.
12079         (General_options::add_plugin): New function.
12080         * options.h (Plugin_manager): Declare.
12081         (General_options): Add --plugin option.
12082         (General_options::has_plugins): New function.
12083         (General_options::plugins): New function.
12084         (General_options::add_plugin): New function.
12085         (General_options::plugins_): New field.
12086         * plugin.cc: New file.
12087         * plugin.h: New file.
12088         * readsyms.cc: Include "plugin.h".
12089         (Read_symbols::do_read_symbols): Check for archive before checking
12090         for ELF file.  Call plugin hooks to claim files.
12091         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12092         from a real object file; force override when processing replacement
12093         files.
12094         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12095         (Symbol::init_base_object): Likewise.
12096         (Symbol::init_base_output_data): Likewise.
12097         (Symbol::init_base_output_segment): Likewise.
12098         (Symbol::init_base_constant): Likewise.
12099         (Symbol::init_base_undefined): Likewise.
12100         (Symbol::output_section): Assert that object is not a plugin.
12101         (Symbol_table::add_from_pluginobj): New function.
12102         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12103         undefined.
12104         (Symbol_table::sized_write_globals): Likewise.
12105         (Symbol_table::add_from_pluginobj): Instantiate template.
12106         * symtab.h (Sized_pluginobj): Declare.
12107         (Symbol::in_real_elf): New function.
12108         (Symbol::set_in_real_elf): New function.
12109         (Symbol::in_real_elf_): New field.
12110         (Symbol_table::add_from_pluginobj): New function.
12111
12112         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12113         (LIBDL): New variable.
12114         (LDADD): Add LIBDL.
12115         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12116         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12117         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12118         (MOSTLYCLEANFILES): Likewise.
12119         * testsuite/Makefile.in: Regenerate.
12120         * testsuite/plugin_test.c: New file.
12121         * testsuite/plugin_test_1.sh: New file.
12122         * testsuite/plugin_test_2.sh: New file.
12123
12124 2008-09-16  Ian Lance Taylor  <iant@google.com>
12125
12126         * target-reloc.h (relocate_section): Check whether a symbol is
12127         defined by the ABI before reporting an undefined symbol error.
12128         * target.h (Target::is_defined_by_abi): Make parameter const.
12129         (Target::do_is_defined_by_abi): Likewise.
12130         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12131         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12132         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12133         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12134         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12135         * testsuite/Makefile.in: Rebuild.
12136
12137         * fileread.cc (make_view): Add casts to avoid warning.
12138
12139 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12140
12141         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12142         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12143
12144 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12145
12146         * options.h (General_options::output_is_executable): New.
12147         (General_options::output_is_pie): New.
12148         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12149         for shared libraries.
12150         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12151
12152 2008-09-11  Chris Demetriou  <cgd@google.com>
12153
12154         * options.h (origin): New -z option.
12155         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12156         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12157         in DT_FLAGS_1.
12158
12159 2008-09-05  Cary Coutant  <ccoutant@google.com>
12160
12161         * fileread.cc (File_read::make_view): Add check for attempt to map
12162         beyond end of file.
12163
12164 2008-09-05  Cary Coutant  <ccoutant@google.com>
12165
12166         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12167         explicit instantiations.
12168
12169 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12170
12171         PR gold/6858
12172         * options.cc (General_options::finalize): Allow undefined symbols
12173         in shlibs if linking -shared.
12174
12175         PR gold/6859
12176         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12177         symbols as not needing a dynsym entry.
12178
12179 2008-08-20  Craig Silverstein  <csilvers@google.com>
12180
12181         * fileread.cc (File_read::open): Do not lock the file unless it
12182         was successfully opened.
12183
12184 2008-08-14  Cary Coutant  <ccoutant@google.com>
12185
12186         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12187         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12188         * testsuite/tls_test.cc (struct int128): 128-bit struct
12189         for testing TLS relocs with non-zero addend.
12190         (v12): New TLS variable.
12191         (t12): New test.
12192         (t_last): Add check for v12.
12193         * testsuite/tls_test.h (t12): New function.
12194         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12195
12196 2008-08-13  Ian Lance Taylor  <iant@google.com>
12197
12198         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12199         set tls_segment_ or relro_segment_.
12200         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12201         when appropriate.
12202         * output.h (Output_section::clear_is_relro): New function.
12203         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12204         sections specially even when output_data_ is empty.
12205         (Output_segment::maximum_alignment): When first section is relro,
12206         only force alignment for PT_LOAD segments.
12207         * script.cc (script_data_segment_align): New function.
12208         (script_data_segment_relro_end): New function.
12209         * script-c.h (script_data_segment_align): Declare.
12210         (script_data_segment_relro_end): Declare.
12211         * script-sections.h (class Script_sections): Declare
12212         data_segment_align and data_segment_relro_end.  Add fields
12213         segment_align_index_ and saw_relro_end_.
12214         * script-sections.cc (class Sections_element): Add set_is_relro
12215         virtual function.  Add new bool* parameter to place_orphan_here.
12216         Add get_output_section virtual function.
12217         (class Output_section_definition): Add set_is_relro.  Add new
12218         bool* parameter to place_orphan_here.  Add get_output_section.
12219         Add is_relro_ field.
12220         (Output_section_definition::Output_section_definition): Initialize
12221         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12222         and is_relro_ fields.
12223         (Output_section_definition::place_orphan_here): Add is_relro
12224         parameter.
12225         (Output_section_definition::set_section_addresses): Set relro for
12226         output section.
12227         (Output_section_definition::alternate_constraint): Likewise.
12228         (class Orphan_output_section): Add new bool* parameter to
12229         place_orphan_here.  Add get_output_section.
12230         (Orphan_output_section::place_orphan_here): Add is_relro
12231         parameter.
12232         (Script_sections::Script_sections): Initialize
12233         data_segment_align_index_ and saw_relro_end_.
12234         (Script_sections::data_segment_align): New function.
12235         (Script_sections::data_segment_relro_end): New function.
12236         (Script_sections::place_orphan): Set or clear is_relro.
12237         (Script_sections::set_section_addresses): Force alignment of first
12238         TLS section.
12239         * yyscript.y (exp): Call script_data_segment_align and
12240         script_data_segment_relro_end.
12241         * testsuite/relro_script_test.t: New file.
12242         * testsuite/relro_test.cc (using_script): Declare.
12243         (t1, t2): Test using_script.
12244         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12245         (relro_script_test_SOURCES): Define.
12246         (relro_script_test_DEPENDENCIES): Define.
12247         (relro_script_test_LDFLAGS): Define.
12248         (relro_script_test_LDADD): Define.
12249         (relro_script_test.so): New target.
12250         * testsuite/Makefile.in: Rebuild.
12251
12252 2008-08-06  Cary Coutant <ccoutant@google.com>
12253
12254         * archive.cc (Archive::total_archives, Archive::total_members)
12255         (Archive::total_members_loaded): New variables.
12256         (Archive::setup): Add parameter.  Add option to preread
12257         archive symbols.
12258         (Archive::read_armap): Add counter.
12259         (Archive::get_file_and_offset): New function.
12260         (Archive::get_elf_object_for_member): New function.
12261         (Archive::read_all_symbols): New function.
12262         (Archive::read_symbols): New function.
12263         (Archive::add_symbols): Add counters.
12264         (Archive::include_all_members): Use armap to find members if it's
12265         already built.
12266         (Archive::include_member): Skip reading symbols if already read.
12267         Factored code into Archive::get_file_and_offset and
12268         Archive::get_elf_object_for_member.  Changed call to
12269         Mapfile::report_include_archive_member.
12270         (Archive::print_stats): New function.
12271         * archive.h: Declare Object and Read_symbols_data classes.
12272         (Archive::Archive): Add initializers for new members.
12273         (Archive::setup): Add parameter.
12274         (Archive::print_stats): New function.
12275         (Archive::total_archives, Archive::total_members)
12276         (Archive::total_members_loaded): New variables.
12277         (Archive::get_file_and_offset): New function.
12278         (Archive::get_elf_object_for_member): New function.
12279         (Archive::read_all_symbols): New function.
12280         (Archive::read_symbols): New function.
12281         (Archive::Archive_member): New class.
12282         (Archive::members_): New member.
12283         (Archive::num_members_): New member.
12284         * main.cc: Include archive.h.
12285         (main): Call Archive::print_stats.
12286         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12287         archive parameter; member_name is now the fully-decorated name.
12288         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12289         * options.h: (General_options): Add --preread-archive-symbols option.
12290         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12291         Archive::setup.
12292
12293 2008-08-04  Ian Lance Taylor  <iant@google.com>
12294
12295         * symtab.h (Symbol::use_plt_offset): New function.
12296         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12297         * powerpc.cc (Relocate::relocate): Likewise.
12298         * sparc.cc (Relocate::relocate): Likewise.
12299         * x86_64.cc (Relocate::relocate): Likewise.
12300         * testsuite/weak_plt.sh: New test.
12301         * testsuite/weak_plt_main.cc: New test.
12302         * testsuite/weak_plt_shared.cc: New test.
12303         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12304         (check_PROGRAMS): Add weak_plt.
12305         (check_DATA): Add weak_plt_shared.so.
12306         (weak_plt_main_pic.o, weak_plt): New targets.
12307         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12308         * testsuite/Makefile.in: Rebuild.
12309
12310         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12311         gcctestdir/ld.
12312         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12313         * testsuite/Makefile.in: Rebuild.
12314
12315 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12316
12317         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12318         * Makefile.in: Regenerate.
12319         * po/POTFILES.in: Regenerate.
12320
12321 2008-07-29  Ian Lance Taylor  <iant@google.com>
12322
12323         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12324         symbols before other symbols.
12325         * testsuite/script_test_2.cc (test_addr): Declare.
12326         (test_addr_alias): Declare.
12327         (main): Check that test_addr and test_addr_alias have the right
12328         values.
12329         * testsuite/script_test_2.t: Define test_addr_alias and
12330         test_addr.
12331
12332 2008-07-24  Ian Lance Taylor  <iant@google.com>
12333
12334         PR 5990
12335         * descriptors.cc: New file.
12336         * descriptors.h: New file.
12337         * gold-threads.h (class Hold_optional_lock): New class.
12338         * fileread.cc: Include "descriptors.h".
12339         (File_read::~File_read): Release descriptor rather than closing
12340         it.
12341         (File_read::open) [file]: Call open_descriptor rather than open.
12342         Set is_descriptor_opened_.
12343         (File_read::open) [memory]: Assert that descriptor is not open.
12344         (File_read::reopen_descriptor): New function.
12345         (File_read::release): Release descriptor.
12346         (File_read::do_read): Make non-const.  Reopen descriptor.
12347         (File_read::read): Make non-const.
12348         (File_read::make_view): Reopen descriptor.
12349         (File_read::do_readv): Likewise.
12350         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12351         Update declarations.
12352         * layout.cc: Include "descriptors.h".
12353         (Layout::create_build_id): Use open_descriptor rather than open.
12354         * output.cc: Include "descriptors.h".
12355         (Output_file::open): Use open_descriptor rather than open.
12356         * archive.cc (Archive::const_iterator): Change Archive to be
12357         non-const.
12358         (Archive::begin, Archive::end): Make non-const.
12359         (Archive::count_members): Likewise.
12360         * archive.h (class Archive): Update declarations.
12361         * object.h (Object::read): Make non-const.
12362         * Makefile.am (CCFILES): Add descriptors.cc.
12363         (HFILES): Add descriptors.h.
12364         * Makefile.in: Rebuild.
12365
12366         PR 6716
12367         * gold.h: Always include <clocale>.  Add Solaris workarounds
12368         following code in binutils/sysdep.h.
12369
12370         PR 6048
12371         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12372         this->eh_frame_hdr_ is NULL before using it.
12373
12374         * dynobj.cc (Versions::Versions): Update comment.
12375
12376         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12377         the base version name.
12378
12379         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12380         array size plus one.
12381         (Stringpool_template::set_string_offsets): Subtract one from key
12382         before using it as an array index.
12383         (Stringpool_template::get_offset_with_length): Likewise.
12384         (Stringpool_template::write_to_buffer): Likewise.
12385         * stringpool.h (Stringpool_template::get_offset_from_key):
12386         Likewise.
12387
12388 2008-07-23  Ian Lance Taylor  <iant@google.com>
12389
12390         PR 6658
12391         * object.h (Merged_symbol_value::value): Do our best to handle a
12392         negative addend.
12393
12394         PR 6647
12395         * script.cc (Version_script_info::get_versions): Don't add empty
12396         version tag to return value.
12397         (Version_script_info::get_symbol_version_helper): Change return
12398         type to bool.  Add pversion parameter.  Change all callers.
12399         (script_register_vers_node): Don't require a non-NULL tag.
12400         * script.h (class Version_script_info): Update declarations.
12401         (Version_script_info::get_symbol_version): Change return type to
12402         bool.  Add version parameter.  Change all callers.
12403         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12404         handling.  Handle an empty version from a version script.
12405         (Symbol_table::define_special_symbol): Likewise.
12406         * testsuite/ver_test_10.script: New file.
12407         * testsuite/ver_test_10.sh: New file.
12408         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12409         (check_DATA): Add ver_test_10.syms.
12410         (ver_test_10.syms, ver_test_10.so): New target.
12411         * testsuite/Makefile.in: Rebuild.
12412
12413 2008-07-23  Simon Baldwin  <simonb@google.com>
12414
12415         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12416         to zero for undefined symbols from dynamic libraries.
12417
12418 2008-07-23  Ian Lance Taylor  <iant@google.com>
12419
12420         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12421         Change all callers.
12422         * symtab.h (class Symbol_table): Update declaration.
12423         * testsuite/ver_test_9.cc: New file.
12424         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12425         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12426         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12427         (ver_test_9.so, ver_test_9.o): New targets.
12428         * testsuite/Makefile.in: Rebuild.
12429
12430 2008-07-22  Ian Lance Taylor  <iant@google.com>
12431
12432         * options.h (class General_options): Define --check-sections.
12433         * layout.cc (Layout::set_segment_offsets): Handle
12434         --check-sections.
12435
12436         * options.h (class General_options): Define -n/--nmagic and
12437         -N/--omagic.
12438         * options.cc (General_options::finalize): For -n/--nmagic or
12439         -N/--omagic, set -static.
12440         * layout.cc (Layout::attach_allocated_section_to_segment): If
12441         -N/--omagic, don't put read-only and read-write sections in
12442         different segments.
12443         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12444         finding a read-only segment.
12445         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12446         don't set the minimum segment alignment to the common page size,
12447         and don't set the file offset to the address modulo the page size.
12448         * script-sections.cc (Script_sections::create_segments): If
12449         -n/--omagic, don't put read-only and read-write sections in
12450         different segments.
12451
12452         * cref.cc: New file.
12453         * cref.h: New file.
12454         * options.h (class General_options): Add --print-symbol-counts.
12455         * main.cc (main): Issue defined symbol report if requested.
12456         * archive.cc (Archive::interpret_header): Make into a const member
12457         function.
12458         (Archive::add_symbols): Call Input_objects::archive_start and
12459         archive_stop.
12460         (Archive::const_iterator): Define new class.
12461         (Archive::begin, Archive::end): New functions.
12462         (Archive::include_all_members): Rewrite to use iterator.
12463         (Archive::count_members): New function.
12464         * archive.h (class Archive): Update declarations.
12465         (Archive::filename): New function.
12466         * object.cc: Include "cref.h".
12467         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12468         (Sized_relobj::do_get_global_symbol_counts): New function.
12469         (Input_objects::add_object): Add object to cross-referencer.
12470         (Input_objects::archive_start): New function.
12471         (Input_objects::archive_stop): New function.
12472         (Input_objects::print_symbol_counts): New function.
12473         * object.h: Declare Cref and Archive.
12474         (Object::get_global_symbol_counts): New function.
12475         (Object::do_get_global_symbol_counts): New pure virtual function.
12476         (class Sized_relobj): Add defined_count_ field.  Update
12477         declarations.
12478         (class Input_objects): Add cref_ field.  Update constructor.
12479         Update declarations.
12480         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12481         defined_count_.
12482         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12483         symbol counts.
12484         (Sized_dynobj::do_get_global_symbol_counts): New function.
12485         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12486         defined_count_.  Update declarations.  Define Symbols typedef.
12487         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12488         parameter.  Change all callers.
12489         (Symbol_table::add_from_dynobj): Add sympointers and defined
12490         parameters.  Change all callers.
12491         * symtab.h (class Symbol_table): Update declarations.
12492         * Makefile.am (CCFILES): Add cref.cc.
12493         (HFILES): Add cref.h.
12494         * Makefile.in: Rebuild.
12495
12496 2008-07-22  Simon Baldwin  <simonb@google.com>
12497
12498         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12499         to zero when writing undefined symbols.
12500
12501 2008-07-22  Ian Lance Taylor  <iant@google.com>
12502
12503         * output.cc (Output_section::add_input_section): Don't try to
12504         merge empty merge sections.
12505
12506 2008-07-21  Craig Silverstein  <csilvers@google.com>
12507
12508         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12509         Include symbol version in error message.
12510
12511 2008-07-20  Chris Demetriou  <cgd@google.com>
12512
12513         * configure.ac (gold_cv_c_random_seed): New configured variable.
12514         (RANDOM_SEED_CFLAGS): New substituted variable.
12515         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12516         * configure: Rebuild.
12517         * Makefile.in: Likewise.
12518         * testsuite/Makefile.in: Likewise.
12519
12520 2008-07-18  Ian Lance Taylor  <iant@google.com>
12521
12522         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12523         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12524         * testsuite/ver_test_main.cc (main): Call t4.
12525         (t4, t4_2a): Define.
12526         * testsuite/ver_test_2.cc (t4_2): Define.
12527         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12528         * testsuite/ver_test_4.cc (t4_2a): Define.
12529         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12530         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12531
12532 2008-07-17  Ian Lance Taylor  <iant@google.com>
12533
12534         * dynobj.cc (Versions::add_def): If we give an error about a
12535         missing version, go ahead and create the version anyhow.
12536
12537 2008-07-10  Ian Lance Taylor  <iant@google.com>
12538
12539         Handle output sections with more than 0x7fffffff bytes.
12540         * object.h (class Relobj): Change map_to_output_ to
12541         output_sections_, and just keep a section pointer.  Change all
12542         uses.  Move comdat group support to Sized_relobj.
12543         (Relobj::is_section_specially_mapped): Remove.
12544         (Relobj::output_section): Remove poff parameter.  Change all
12545         callers.
12546         (Relobj::output_section_offset): New function.
12547         (Relobj::set_section_offset): Rewrite.
12548         (Relobj::map_to_output): Remove.
12549         (Relobj::output_sections): New function.
12550         (Relobj::do_output_section_offset): New pure virtual function.
12551         (Relobj::do_set_section_offset): Likewise.
12552         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12553         group support from Relobj.  Update declarations.
12554         (Sized_relobj::get_output_section_offset): New function.
12555         (Sized_relobj::do_output_section_offset): New function.
12556         (Sized_relobj::do_set_section_offset): New function.
12557         * object.cc (Relobj::output_section_address): Remove.
12558         (Sized_relobj::Sized_relobj): Initialize new fields.
12559         (Sized_relobj::include_section_group): Cast find_kept_object to
12560         Sized_relobj.
12561         (Sized_relobj::include_linkonce_section): Likewise.
12562         (Sized_relobj::do_layout): Use separate arrays for output section
12563         and output offset.
12564         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12565         output_sections.
12566         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12567         output_sections and section_offsets.
12568         (Sized_relobj::write_local_symbols): Likewise.
12569         (map_to_kept_section): Compute output address directly.
12570         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12571         output_sections and section_offsets.
12572         (Sized_relobj::write_sections): Likewise.
12573         (Sized_relobj::relocate_sections): Likewise.
12574         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12575         * output.h (class Output_reloc): Update declarations.  Change
12576         u2_.relobj to Sized_relobj*.
12577         (class Output_data_reloc): Change add functions to use
12578         Sized_relobj*.
12579         * output.cc (Output_reloc::Output_reloc): Change relobj to
12580         Sized_relobj*.
12581         (Output_reloc::local_section_offset): Change return type to
12582         Elf_Addr.  Use get_output_section_offset.
12583         (Output_reloc::get_address): Likewise.
12584         (Output_section::is_input_address_mapped): Don't call
12585         is_section_specially_mapped.
12586         (Output_section::output_offset): Likewise.
12587         (Output_section::output_address): Likewise.
12588         (Output_section::starting_output_address): Likewise.
12589         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12590         parameter to Sized_relobj*.
12591         (Copy_relocs::need_copy_reloc): Likewise.
12592         (Copy_relocs::save): Likewise.
12593         * copy-relocs.h (class Copy_relocs): Update declarations.
12594         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12595         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12596         * target-reloc.h (relocate_for_relocatable): Change
12597         offset_in_output_section type to Elf_Addr.  Change code that uses
12598         it as well.
12599         * layout.cc (Layout::layout): Always set *off.
12600         * mapfile.cc (Mapfile::print_input_section): Use
12601         output_section_offset.
12602         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12603         Sized_relobj*.
12604         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12605         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12606         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12607
12608 2008-07-03  Ian Lance Taylor  <iant@google.com>
12609
12610         * layout.cc (Layout::include_section): Do not discard unrecognized
12611         SHT_STRTAB sections.
12612
12613 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12614
12615         * script.cc (Lex::can_continue_name): Make '?' allowable in
12616         version-script names.
12617         * testsuite/version_script.map: Change glob pattern to use '?'
12618
12619 2008-06-30  Manish Singh  <yosh@gimp.org>
12620
12621         PR 6585
12622         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12623         Correct typo.
12624
12625 2008-06-30  Ian Lance Taylor  <iant@google.com>
12626
12627         PR 6660
12628         PR 6682
12629         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12630         versions]: Don't try to read the value in the contents, since we
12631         don't use it.  Use the template endianness when writing.
12632
12633 2008-06-25  Cary Coutant  <ccoutant@google.com>
12634
12635         * fileread.cc (File_read::make_view): Assert on zero-length view.
12636         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12637         symbol table when there are no symbols to read.
12638
12639 2008-06-23  Craig Silverstein  <csilvers@google.com>
12640
12641         * version.cc (version_string): Bump to 1.7
12642
12643 2008-06-18  Craig Silverstein  <csilvers@google.com>
12644
12645         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12646         constant 0xFFFF to type Valtype.
12647         (Powerpc_relocate_functions::rel16_ha): Likewise.
12648
12649 2008-06-17  Ian Lance Taylor  <iant@google.com>
12650
12651         * output.h (Output_section::Input_section): Initialize p2align_ to
12652         zero for Output_section_data constructors.
12653         (Output_section::Input_section::addralign): If not an input
12654         section, return the alignment of the Output_section_data.
12655         * testsuite/copy_test.cc: New file.
12656         * testsuite/copy_test_1.cc: New file.
12657         * testsuite/copy_test_2.cc: New file.
12658         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12659         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12660         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12661         (copy_test_1_pic.o, copy_test_1.so): New targets.
12662         (copy_test_2_pic.o, copy_test_2.so): New targets.
12663         * testsuite/Makefile.in: Rebuild.
12664
12665         * script-sections.cc (Script_sections::place_orphan): Initialize
12666         local variable exact.
12667
12668 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12669
12670         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12671
12672 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12673             David S. Miller  <davem@davemloft.net>
12674
12675         * powerpc.cc: New file.
12676         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12677         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12678         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12679         * Makefile.in: Rebuild.
12680
12681 2008-06-09  Ian Lance Taylor  <iant@google.com>
12682
12683         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12684         <exception>.
12685         (throwing, orig_terminate): New static variables.
12686         (terminate_handler): New static function.
12687         (t2): Set terminate handler.
12688
12689 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12690
12691         PR 6584
12692         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12693         alignment.
12694
12695 2008-05-30  Cary Coutant  <ccoutant@google.com>
12696
12697         * archive.cc (Archive::include_all_members) Correct to step
12698         over symbol table and extended name table in thin archives.
12699
12700 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12701
12702         PR 6407
12703         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12704         calculation.
12705
12706 2008-05-28  Caleb Howe  <cshowe@google.com>
12707
12708         * reduced_debug_output.cc: New file.
12709         * reduced_debug_output.h: New file.
12710         * options.h (class General_options): Add --strip-debug-non-line.
12711         * options.cc (General_options::finalize): Add strip_debug_non_line
12712         to the strip heirarchy.
12713         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12714         fields.
12715         * layout.cc: Include "reduced_debug_output.h".
12716         (Layout::Layout): Initialize new fields.
12717         (line_only_debug_sections): New static array.
12718         (is_lines_only_debug_sections): New static inline function.
12719         (Layout::include_section): Handle --strip-debug-non-line.
12720         (Layout::make_output_section): If --strip-debug-non-line, build
12721         new output sections for .debug_abbrev and .debug_info.
12722         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12723         gold.  Warn about possible overflow.
12724         (read_signed_LEB_128): Likewise.
12725         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12726         (read_signed_LEB_128): Declare.
12727         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12728         (HFILES): Add reduced_debug_output.h.
12729         * Makefile.in: Rebuild.
12730
12731 2008-05-21  Ian Lance Taylor  <iant@google.com>
12732
12733         * mapfile.cc: New file.
12734         * mapfile.h: New file.
12735         * options.h (class General_options): Add -M/--print-map and -Map.
12736         * options.cc (General_options::finalize): Make -M equivalent to
12737         -Map -.
12738         * main.cc: Include <cstdio> and "mapfile.h".
12739         (main): Open mapfile if requested.
12740         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12741         constructor.  Change caller.
12742         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12743         (queue_middle_tasks): Likewise.
12744         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12745         declarations.
12746         * archive.cc: Include "mapfile.h".
12747         (Archive::add_symbols): Add mapfile parameter.  Change all
12748         callers.  Pass mapfile, symbol, and reason to include_member.
12749         (Archive::include_all_members): Add mapfile parameter.  Change all
12750         callers.
12751         (Archive::include_member): Add mapfile, sym, and why parameters.
12752         Change all callers.  Report inclusion to map file.
12753         * archive.h: Include "fileread.h".
12754         (class Archive): Update declarations.
12755         (Archive::file): New const method.
12756         (class Add_archive_symbols): Add mapfile_ field.  Update
12757         constructor.  Change all callers.
12758         * readsyms.h (class Read_symbols): Likewise.
12759         (class Finish_group): Likewise.
12760         (class Read_script): Likewise.
12761         * common.cc: Include "mapfile.h".
12762         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12763         all callers.
12764         (Symbol_table::do_allocate_commons): Likewise.
12765         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12766         symbol allocation to mapfile.
12767         * common.h (class Allocate_commons_task): Add mapfile_ field.
12768         Update constructor.  Change all callers.
12769         * symtab.h (class Symbol_table): Update declarations.
12770         * layout.cc: Include "mapfile.h".
12771         (Layout_task_runner::run): Print information to mapfile.
12772         (Layout::create_gold_note): Change Output_data_fixed_space to
12773         Output_data_zero_fill.
12774         (Layout::create_build_id): Likewise.
12775         (Layout::print_to_mapfile): New function.
12776         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12777         constructor.  Change caller.
12778         (class Layout): Declare print_to_mapfile.
12779         * output.cc (Output_section::Input_section::print_to_mapfile): New
12780         function.
12781         (Output_section::add_input_section): If producing a map, always
12782         add to input_sections_ list.
12783         (Output_section::do_print_to_mapfile): New function.
12784         (Output_segment::print_sections_to_mapfile): New function.
12785         (Output_segment::print_section_list_to_mapfile): New function.
12786         * output.h: Include "mapfile.h".
12787         (Output_data::print_to_mapfile): New function.
12788         (Output_data::do_print_to_mapfile): New virtual function.
12789         (Output_segment_headers::do_print_to_mapfile): New function.
12790         (Output_file_header::do_print_to_mapfile): New function.
12791         (Output_data_const::do_print_to_mapfile): New function.
12792         (class Output_data_const_buffer): Add map_name_ field.  Update
12793         constructor.  Change all callers.  Add do_print_to_mapfile
12794         function.
12795         (class Output_data_fixed_space): Likewise.
12796         (class Output_data_space): Likewise.
12797         (class Output_data_zero_fill): New class.
12798         (Output_data_strtab::do_print_to_mapfile): New function.
12799         (Output_data_reloc_base::do_print_to_mapfile): New function.
12800         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12801         (Output_data_group::do_print_to_mapfile): New function.
12802         (Output_data_got::do_print_to_mapfile): New function.
12803         (Output_data_dynamic::do_print_to_mapfile): New function.
12804         (Output_symtab_xindex::do_print_to_mapfile): New function.
12805         (class Output_section): Declare do_print_to_mapflie.  Declare
12806         print_to_mapfile in Input_section.
12807         (class Output_segment): Declare new functions.
12808         * object.h (Sized_relobj::symbol_count): New function.
12809         * script-sections.cc
12810         (Output_section_element_dot_assignment::set_section_addresses):
12811         Change Output_data_fixed_space to Output_data_zero_fill.
12812         (Output_data_expression::do_print_to_mapfile): New function.
12813         * script.cc (read_input_script): Add mapfile parameter.  Change
12814         all callers.
12815         * script.h (read_input_script): Update declaration.
12816         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12817         (Eh_frame::do_print_to_mapfile): New function.
12818         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12819         (Output_merge_string::do_print_to_mapfile): New function.
12820         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12821         function.
12822         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12823         function.
12824         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12825         function.
12826         * Makefile.am (CCFILES): Add mapfile.cc.
12827         (HFILES): Add mapfile.h.
12828         * Makefile.in: Rebuild.
12829
12830 2008-05-19  Ian Lance Taylor  <iant@google.com>
12831
12832         * options.h (class General_options): Add -z relro.
12833         * layout.cc (Layout::Layout): Initialize relro_segment_.
12834         (Layout::add_output_section_data): Return the output section.
12835         (Layout::make_output_section): Rcognize relro sections and mark
12836         them appropriately.
12837         (Layout::attach_allocated_section_to_segment): Put relro sections
12838         in a PT_GNU_RELRO segment.
12839         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12840         section as relro.
12841         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12842         PT_TLS segments.
12843         (Layout::linkonce_mapping): Map d.rel.ro.local to
12844         .data.rel.ro.local.
12845         (Layout::output_section_name): Us .data.rel.ro.local for any
12846         section which begins with that.
12847         * layout.h (class Layout): Update add_output_section_data
12848         declaration.  Add relro_segment_ field.
12849         * output.cc (Output_section::Output_section): Initialize is_relro_
12850         and is_relro_local_ fields.
12851         (Output_segment::add_output_section): Group relro sections.
12852         (Output_segment::is_first_section_relro): New function.
12853         (Output_segment::maximum_alignment): If there is a relro section,
12854         align the segment to the common page size.
12855         (Output_segment::set_section_addresses): Track whether we are
12856         looking at relro sections.  If the last section is a relro
12857         section, align to the common page size.
12858         (Output_segment::set_section_list_addresses): Add in_relro
12859         parameter.  Change all callers.  Align to the page size when
12860         moving from relro to non-relro section.
12861         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12862         segment.
12863         * output.h (class Output_section): Add is_relro_ and
12864         is_relro_local_ fields.
12865         (Output_section::is_relro): New function.
12866         (Output_section::set_is_relro): New function.
12867         (Output_section::is_relro_local): New function.
12868         (Output_section::set_is_relro_local): New function.
12869         (class Output_segment): Update declarations.
12870         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12871         * sparc.cc (Target_sparc::got_section): Likewise.
12872         * x86_64.cc (Target_x86_64::got_section): Likewise.
12873         * testsuite/relro_test_main.cc: New file.
12874         * testsuite/relro_test.cc: New file.
12875         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12876         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12877         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12878         (relro_test.so, relro_test_pic.o): New targets.
12879         * testsuite/Makefile.in: Rebuild.
12880
12881 2008-05-16  Ian Lance Taylor  <iant@google.com>
12882
12883         * output.cc (Output_segment::add_output_section): Remove front
12884         parameter.
12885         * output.h (class Output_segment): Remove
12886         add_initial_output_section and overloaded add_output_section.
12887         Update declaration of remaining add_output_section.
12888         * layout.cc (Layout::create_interp): Call add_output_section
12889         rather than add_initial_output_section.
12890         (Layout::finish_dynamic_section): Likewise.
12891
12892         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12893         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12894         know the dynamic type.
12895         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12896         field.  Initialize it in constructor.
12897         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12898         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12899         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12900         reloc.
12901
12902         * output.cc (Output_reloc::get_address): Change return type to
12903         Elf_Addr.
12904         * output.h (class Output_reloc): Update get_address declaration.
12905         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12906         for section addresses.
12907
12908 2008-05-09  Ian Lance Taylor  <iant@google.com>
12909
12910         PR 6493
12911         * gold.cc (gold_nomem): Use return value of write.
12912
12913 2008-05-08  Ian Lance Taylor  <iant@google.com>
12914
12915         * symtab.c (Symbol::init_base_output_data): Add version
12916         parameter.  Change all callers.
12917         (Symbol::init_base_output_segment): Likewise.
12918         (Symbol::init_base_constant): Likewise.
12919         (Symbol::init_base_undefined): Likewise.
12920         (Sized_symbol::init_output_data): Likewise.
12921         (Sized_symbol::init_output_segment): Likewise.
12922         (Sized_symbol::init_constant): Likewise.
12923         (Sized_symbol::init_undefined): Likewise.
12924         (Symbol_table::do_define_in_output_data): If the new symbol has a
12925         version, mark it as the default.
12926         (Symbol_table::do_define_in_output_segment): Likewise.
12927         (Symbol_table::do_define_as_constant): Likewise.
12928         * symtab.h (class Symbol): Update declarations.
12929         (class Sized_symbol): Likewise.
12930         * resolve.cc (Symbol::override_version): New function.
12931         (Symbol::override_base): Call override_version.
12932         (Symbol::override_base_with_special): Likewise.
12933         * testsuite/ver_script_8.script: New file.
12934         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12935         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12936         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12937         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12938
12939 2008-05-06  Ian Lance Taylor  <iant@google.com>
12940
12941         PR 6049
12942         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12943         functions.
12944         (class General_options): Remove existing --undefined, and add
12945         --no-undefined instead.  Add new --undefined as synonym for -u.
12946         * archive.cc (Archive::add_symbols): Check whether symbol was
12947         named with -u.
12948         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12949         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12950         all uses.  Add IS_UNDEFINED.  Update declarations to split
12951         different versions of init_base.  Declare init_base_undefined.
12952         (Symbol::is_defined): Handle IS_UNDEFINED.
12953         (Symbol::is_undefined): Likewise.
12954         (Symbol::is_weak_undefined): Call is_undefined.
12955         (Symbol::is_absolute): Handle IS_CONSTANT.
12956         (class Sized_symbol): Update declarations to split different
12957         versions of init.  Declare init_undefined.
12958         (class Symbol_table): Declare new functions.
12959         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12960         Change all callers.
12961         (Symbol::init_base_output_data): Likewise.
12962         (Symbol::init_base_output_segment): Likewise.
12963         (Symbol::init_base_constant): Likewise.
12964         (Symbol::init_base_undefined): New function.
12965         (Sized_symbol::init_object): Rename from init.  Change all
12966         callers.
12967         (Sized_symbol::init_output_data): Likewise.
12968         (Sized_symbol::init_output_segment): Likewise.
12969         (Sized_symbol::init_constant): Likewise.
12970         (Sized_symbol::init_undefined): New function.
12971         (Symbol_table::add_undefined_symbols_from_command_line): New
12972         function.
12973         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12974         function.
12975         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12976         (Symbol::output_section): Likewise.
12977         (Symbol::set_output_section): Likewise.
12978         (Symbol_table::sized_finalize_symbol): Likewise.
12979         (Symbol_table::sized_write_globals): Likewise.
12980         * resolve.cc (Symbol_table::should_override): Likewise.
12981         (Symbol::override_base_with_special): Likewise.
12982
12983         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12984         symbol, change it to have default visibility.
12985         * testsuite/protected_1.cc: New file.
12986         * testsuite/protected_2.cc: New file.
12987         * testsuite/protected_3.cc: New file.
12988         * testsuite/protected_main_1.cc: New file.
12989         * testsuite/protected_main_2.cc: New file.
12990         * testsuite/protected_main_3.cc: New file.
12991         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12992         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12993         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12994         (protected_1.so): New target.
12995         (protected_1_pic.o, protected_2_pic.o): New targets.
12996         (protected_3_pic.o): New target.
12997         (check_PROGRAMS): Add protected_2.
12998         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12999         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13000         * testsuite/Makefile.in: Rebuild.
13001
13002         * options.h (DEFINE_var): Add set_user_set_##varname__.
13003         (DEFINE_bool_alias): New macro.
13004         (class General_options): Define -Bstatic using DEFINE_bool_alias
13005         rather than DEFINE_special.  Add --undefined as an alias for -z
13006         defs.
13007         * options.cc (General_options::parse_Bstatic): Remove.
13008
13009         * options.h (class General_options): Add --fatal-warnings.
13010         * main.cc (main): Implement --fatal-warnings.
13011         * errors.h (Errors::warning_count): New function.
13012
13013         * options.h (class General_options): Add -Bsymbolic-functions.
13014         * symtab.h (Symbol::is_preemptible): Check for
13015         -Bsymbolic-functions.
13016
13017 2008-05-05  Ian Lance Taylor  <iant@google.com>
13018
13019         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13020         as noVARNAME rather than no-VARNAME.
13021         (class General_options): Add option -z combreloc.
13022         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13023         get_address.
13024         (Output_reloc::sort_before) [SHT_REL]: New function.
13025         (Output_reloc::sort_before) [SHT_RELA]: New function.
13026         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13027         Sort_relocs_comparison.
13028         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13029         parameter.  Change all callers.
13030         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13031         sort_relocs parameter.  Change all callers.
13032         * output.cc (Output_reloc::get_address): New function, broken out
13033         of write_rel.
13034         (Output_reloc::write_rel): Call it.
13035         (Output_reloc::compare): New function.
13036         (Output_data_reloc_base::do_write): Optionally sort relocs.
13037
13038         * configure.ac: If targ_extra_obj is set, link it in.
13039         * configure.tgt: Initialize all variables.
13040         (x86_64*): Set targ_extra_obj and targ_extra_size.
13041         * configure: Rebuild.
13042
13043         * object.cc (Sized_relobj::include_section_group): Adjust section
13044         indexes read from group data.  Build vector to pass to
13045         layout_group.
13046         * layout.cc (Layout::layout_group): Add flags and shndxes
13047         parameters.  Remove contents parameter.  Change caller.  Update
13048         explicit instantiations.
13049         * layout.h (class Layout): Update layout_group declaration.
13050         * output.cc (Output_data_group::Output_data_group): Add flags and
13051         input_shndxes parameters.  Remove contents parameter.  Change
13052         caller.
13053         (Output_data_group::do_write): Change input_sections_ to
13054         input_shndxes_.
13055         * output.h (class Output_data_group): Update constructor
13056         declaration.  Rename input_sections_ to input_shndxes_.
13057         * testsuite/many_sections_test.cc: Add template.
13058
13059 2008-04-30  Cary Coutant  <ccoutant@google.com>
13060
13061         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13062
13063         * layout.cc (Layout::include_section): Refactored check for debug
13064         info section.
13065         (Layout::add_comdat): Add new parameters.  Change type
13066         of signature parameter.  Add object and shndx to signatures table.
13067         (Layout::find_kept_object): New function.
13068         * layout.h: Include <cstring>.
13069         (Layout::is_debug_info_section): New function.
13070         (Layout::add_comdat): Add new parameters.
13071         (Layout::find_kept_object): New function.
13072         (Layout::Kept_section): New struct.
13073         (Layout::Signatures): Change type of map range.
13074         * object.cc (Relobj::output_section_address): New function.
13075         (Sized_relobj::include_section_group): Add new parameters.  Change
13076         calls to Layout::add_comdat.  Change to build table of kept comdat
13077         groups and table mapping discarded sections to kept sections.
13078         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13079         (Sized_relobj::do_layout): Change calls to include_section_group and
13080         include_linkonce_section.
13081         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13082         value to zero when section is discarded.
13083         (Sized_relobj::map_to_kept_section): New function.
13084         * object.h (Relobj::output_section_address): New function.
13085         (Relobj::Comdat_group): New type.
13086         (Relobj::find_comdat_group): New function.
13087         (Relobj::Comdat_group_table): New type.
13088         (Relobj::Kept_comdat_section): New type.
13089         (Relobj::Kept_comdat_section_table): New type.
13090         (Relobj::add_comdat_group): New function.
13091         (Relobj::set_kept_comdat_section): New function.
13092         (Relobj::get_kept_comdat_section): New function.
13093         (Relobj::comdat_groups_): New field.
13094         (Relobj::kept_comdat_sections_): New field.
13095         (Symbol_value::input_value): Update comment.
13096         (Sized_relobj::map_to_kept_section) New function.
13097         (Sized_relobj::include_linkonce_section): Add new parameter.
13098         * target-reloc.h (Comdat_behavior): New type.
13099         (get_comdat_behavior): New function.
13100         (relocate_section): Add code to map a discarded section to the
13101         corresponding kept section when applying a relocation.
13102
13103 2008-04-30  Craig Silverstein  <csilvers@google.com>
13104
13105         * dwarf_reader.cc (next_generation_count): New static var.
13106         (Addr2line_cache_entry): New struct.
13107         (addr2line_cache): New static var.
13108         (Dwarf_line_info::one_addr2line): Added caching.
13109         (Dwarf_line_info::clear_addr2line_cache): New function.
13110         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13111         cache-size parameter.
13112         (Dwarf_line_info::one_addr2line_cache): New function.
13113         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13114         new cache-size argument to one_addr2line(), and clear cache.
13115
13116 2008-04-28  Cary Coutant  <ccoutant@google.com>
13117
13118         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13119         R_386_PC8 relocations.
13120
13121 2008-04-23  Ian Lance Taylor  <iant@google.com>
13122
13123         * object.cc (Sized_relobj::include_section_group): Check for
13124         invalid section group.
13125
13126         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13127         header size.
13128
13129         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13130         than read for file header.
13131         * archive.cc (Archive::include_member): Likewise.
13132
13133 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13134
13135         * aclocal.m4: Regenerate.
13136         * configure: Regenerate.
13137
13138 2008-04-19  Ian Lance Taylor  <iant@google.com>
13139
13140         * version.cc (version_string): Bump to 1.6.
13141
13142         * testsuite/Makefile.am (many_sections_r_test): New target.
13143         (many_sections_r_test_SOURCES): Remove.
13144         (many_sections_r_test_DEPENDENCIES): Remove.
13145         (many_sections_r_test_LDFLAGS): Remove.
13146         (many_sections_r_test_LDADD): Remove.
13147
13148         * object.cc (Sized_relobj::do_add_symbols): Always pass
13149         local_symbol_count_ to add_from_relobj.
13150
13151         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13152         every thousand variables.
13153         * testsuite/Makefile.in: Rebuild.
13154
13155         * object.cc (Xindex::initialize_symtab_xindex): New function.
13156         (Xindex::read_symtab_xindex): New function.
13157         (Xindex::sym_xindex_to_shndx): New function.
13158         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13159         available.
13160         (Sized_relobj::do_initialize_xindex): New function.
13161         (Sized_relobj::do_read_symbols): Adjust section links.
13162         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13163         parameter.  Change all callers.
13164         (Sized_relobj::include_section_group): Adjust section links and
13165         symbol section indexes.
13166         (Sized_relobj::do_layout): Adjust section links.
13167         (Sized_relobj::do_count_local_symbols): Adjust section links and
13168         symbol section indexes.
13169         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13170         ordinary and special symbols.
13171         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13172         dynsym_xindex parameters.  Change all callers.  Adjust section
13173         links.  Use SHN_XINDEX when needed.
13174         (Sized_relobj::get_symbol_location_info): Adjust section links.
13175         Don't get fooled by special symbols.
13176         * object.h (class Xindex): Define.
13177         (class Object): Add xindex_ parameter.  Declare virtual functoin
13178         do_initialize_xindex.
13179         (Object::adjust_sym_shndx): New function.
13180         (Object::set_xindex): New protected function.
13181         (class Symbol_value): Add is_ordinary_shndx_ field.
13182         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13183         (Symbol_value::value): Assert ordinary section.
13184         (Symbol_value::initialize_input_to_output_map): Likewise.
13185         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13186         Change all callers.
13187         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13188         all callers.
13189         (class Sized_relobj): Update declarations.
13190         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13191         parameter.  Change all callers.
13192         (Sized_relobj::adjust_shndx): New function.
13193         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13194         field.
13195         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13196         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13197         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13198         (Sized_dynobj::read_dynsym_section): Adjust section links.
13199         (Sized_dynobj::read_dynamic): Likewise.
13200         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13201         section links.
13202         (Sized_dynobj::do_initialize_xindex): New function.
13203         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13204         do_initialize_xindex.
13205         (Sized_dynobj::adjust_shndx): New function.
13206         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13207         dynsym_xindex_ fields.
13208         (Layout::finalize): Add a call to set_section_indexes before
13209         creating the symtab sections.
13210         (Layout::set_section_indexes): Don't do anything if the section
13211         already has a section index.
13212         (Layout::create_symtab_sections): Add shnum parameter.  Change
13213         caller.  Create .symtab_shndx section if needed.
13214         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13215         caller.
13216         (Layout::allocated_output_section_count): New function.
13217         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13218         needed.
13219         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13220         fields.  Update declarations.
13221         (Layout::symtab_xindex): New function.
13222         (Layout::dynsym_xindex): New function.
13223         (class Write_symbols_task): Add layout_ field.
13224         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13225         Change caller.
13226         * output.cc (Output_section_headers::Output_section_headers): Add
13227         shstrtab_section parameter.  Change all callers.
13228         (Output_section_headers::do_sized_write): Store overflow values
13229         for section count and section string table section index in
13230         section header zero.
13231         (Output_file_header::do_sized_write): Check for overflow of
13232         section count and section string table section index.
13233         (Output_symtab_xindex::do_write): New function.
13234         (Output_symtab_xindex::endian_do_write): New function.
13235         * output.h (class Output_section_headers): Add shstrtab_section_.
13236         Update declarations.
13237         (class Output_symtab_xindex): Define.
13238         (Output_section::has_out_shndx): New function.
13239         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13240         field.
13241         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13242         Change all callers.
13243         (Sized_symbol::init): Likewise.
13244         (Symbol::output_section): Check for ordinary symbol.
13245         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13246         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13247         callers.
13248         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13249         Change all callers.  Simplify handling of symbols from sections
13250         not included in the link.
13251         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13252         distinction.
13253         (Weak_alias_sorter::operator()): Assert that symbols are
13254         ordinary.
13255         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13256         distinction.
13257         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13258         parameters.  Change all callers.
13259         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13260         symbol distinction.  Use SHN_XINDEX when needed.
13261         (Symbol_table::write_section_symbol): Add symtab_xindex
13262         parameter.  Change all callers.
13263         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13264         SHN_XINDEX when needed.
13265         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13266         declarations.
13267         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13268         (Symbol::is_defined): Check is_ordinary.
13269         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13270         (Symbol::is_absolute, Symbol::is_common): Likewise.
13271         (class Sized_symbol): Update declarations.
13272         (class Symbol_table): Update declarations.
13273         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13274         parameters.  Change all callers.
13275         (Sized_symbol::override): Likewise.
13276         (Symbol_table::override): Likewise.
13277         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13278         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13279         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13280         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13281         to be in an ordinary section.
13282         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13283         object and is_ordinary parameters.  Change all callers.
13284         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13285         Change all callers.  Don't add undefined or non-ordinary symbols
13286         to reloc_map_.
13287         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13288         Change all callers.
13289         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13290         declarations.
13291         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13292         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13293         (Sized_relobj::relocate_sections): Likewise.
13294         * target-reloc.h (scan_relocs): Adjust section symbol index.
13295         (scan_relocatable_relocs): Likewise.
13296         * i386.cc (Scan::local): Check for ordinary symbols.
13297         * sparc.cc (Scan::local): Likewise.
13298         * x86_64.cc (Scan::local): Likewise.
13299         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13300         to symbol_section_and_value.
13301         * testsuite/many_sections_test.cc: New file.
13302         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13303         (check_PROGRAMS): Add many_sections_test.
13304         (many_sections_test_SOURCES): Define.
13305         (many_sections_test_DEPENDENCIES): Define.
13306         (many_sections_test_LDFLAGS): Define.
13307         (BUILT_SOURCES): Add many_sections_define.h.
13308         (many_sections_define.h): New target.
13309         (BUILT_SOURCES): Add many_sections_check.h.
13310         (many_sections_check.h): New target.
13311         (check_PROGRAMS): Add many_sections_r_test.
13312         (many_sections_r_test_SOURCES): Define.
13313         (many_sections_r_test_DEPENDENCIES): Define.
13314         (many_sections_r_test_LDFLAGS): Define.
13315         (many_sections_r_test_LDADD): Define.
13316         (many_sections_r_test.o): New target.
13317         * testsuite/Makefile.in: Rebuild.
13318
13319 2008-04-17  Cary Coutant  <ccoutant@google.com>
13320
13321         * errors.cc (Errors::info): New function.
13322         (gold_info): New function.
13323         * errors.h (Errors::info): New function.
13324         * gold.h (gold_info): New function.
13325         * object.cc (Input_objects::add_object): Print trace output.
13326         * options.cc (options::parse_set): New function.
13327         (General_options::parse_wrap): Deleted.
13328         (General_options::General_options): Deleted initializer.
13329         * options.h (options::String_set): New typedef.
13330         (options::parse_set): New function.
13331         (DEFINE_set): New macro.
13332         (General_options::wrap): Changed to use DEFINE_set. Changed
13333         callers of any_wrap_symbols and is_wrap_symbol.
13334         (General_options::trace, General_options::trace_symbol):
13335         New options.
13336         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13337         (General_options::wrap_symbols_): Deleted.
13338         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13339
13340 2008-04-17  David S. Miller  <davem@davemloft.net>
13341
13342         * options.cc (General_options::parse_V): New function.
13343         * options.h: Add entries for -V and -Qy.
13344
13345 2008-04-17  Ian Lance Taylor  <iant@google.com>
13346
13347         * common.cc (Symbol_table::allocate_commons): Remove options
13348         parameter.  Change caller.
13349         (Symbol_table::do_allocate_commons): Remove options parameter.
13350         Change caller.  Just call do_allocate_commons_list twice.
13351         (Symbol_table::do_allocate_commons_list): New function, broken out
13352         of do_allocate_commons.
13353         * common.h (class Allocate_commons_task): Remove options_ field.
13354         Update constructor.
13355         * symtab.cc (Symbol_table::Symbol_table): Initialize
13356         tls_commons_.
13357         (Symbol_table::add_from_object): Put TLS common symbols on
13358         tls_commons_ list.
13359         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13360         which are IN_OUTPUT_DATA.
13361         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13362         allocate_commons and do_allocate_commons declarations.  Declare
13363         do_allocate_commons_list.
13364         * gold.cc (queue_middle_tasks): Update creation of
13365         Allocate_commons_task to not pass options.
13366         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13367         (TLS_TEST_C_FLAGS): New variable.
13368         (tls_test_c_pic.o): New target.
13369         (tls_test_shared.so): Link in tls_test_c_pic.o.
13370         (tls_test_c_pic_ie.o): New target.
13371         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13372         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13373         (tls_test_c.o): New target.
13374         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13375         (tls_pic_test_LDADD): Likewise.
13376         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13377         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13378         (tls_test_c_gnu2.o): New target.
13379         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13380         tls_test_c_gnu2.o.
13381         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13382         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13383         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13384         * testsuite/tls_test.cc: Include "config.h".
13385         (t_last): Call t11_last.
13386         * testsuite/tls_test.h (t11, t11_last): Declare.
13387         * testsuite/tls_test_c.c: New file.
13388         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13389         * configure.ac: Check for OpenMP support.
13390         * configure, config.in, Makefile.in: Rebuild.
13391         * testsuite/Makefile.in: Rebuild.
13392
13393 2008-04-16  Cary Coutant  <ccoutant@google.com>
13394
13395         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13396         (Target_i386::tls_base_symbol_defined_): New field.
13397         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13398         (Target_i386::Scan::global): Likewise.
13399         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13400         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13401         (Target_x86_64::tls_base_symbol_defined_): New field.
13402         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13403         (Target_x86_64::Scan::global): Likewise.
13404
13405 2008-04-16  Cary Coutant  <ccoutant@google.com>
13406
13407         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13408         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13409         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13410         building shared libraries.
13411         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13412         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13413         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13414         * testsuite/Makefile.in: Rebuild.
13415         * testsuite/weak_undef.h: New file.
13416         * testsuite/weak_undef_file1.cc: Add extra test cases.
13417         * testsuite/weak_undef_file2.cc: Likewise.
13418         * testsuite/weak_undef_test.cc: Likewise.
13419
13420 2008-04-16  David S. Miller  <davem@davemloft.net>
13421
13422         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13423         Add issued_non_pic_error_ field.  Declare check_non_pic.
13424         (Target_sparc::Scan::check_non_pic): New function.
13425         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13426         (Target_sparc::Scan::global): Likewise.
13427
13428         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13429         * configure: Rebuild.
13430
13431         * options.h (DEFINE_enable): New macro.
13432         (new_dtags): New enable option.
13433         (initfirst, interpose, loadfltr, nodefaultlib,
13434         nodelete, nodlopen, nodump): New -z options.
13435         * layout.cc (Layout:finish_dynamic_section): If new
13436         dtags enabled, emit DT_RUNPATH.  Also, emit a
13437         DT_FLAGS_1 containing any specified -z flags.
13438
13439 2008-04-16  Ian Lance Taylor  <iant@google.com>
13440
13441         * copy-relocs.cc: New file.
13442         * copy-relocs.h: New file.
13443         * reloc.cc: Remove Copy_relocs code.
13444         * reloc.h: Likewise.
13445         * reloc-types.h (struct Reloc_types) [both versions]: Add
13446         get_reloc_addend_noerror.
13447         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13448         variants of add_global which take an addend which must be zero.
13449         * i386.cc: Include "copy-relocs.h".
13450         (class Target_i386): Change type of copy_relocs_ to variable,
13451         update initializer.
13452         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13453         Change all callers.
13454         (Target_i386::do_finalize_sections): Change handling of
13455         copy_relocs_.
13456         * sparc.cc: Include "copy-relocs.h".
13457         (class Target_sparc): Change type of copy_relocs_ to variable,
13458         update initializer.
13459         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13460         Change all callers.
13461         (Target_sparc::do_finalize_sections): Change handling of
13462         copy_relocs_.
13463         * x86_64.cc: Include "copy-relocs.h".
13464         (class Target_x86_64): Change type of copy_relocs_ to variable,
13465         update initializer.
13466         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13467         class.  Change all callers.
13468         (Target_x86_64::do_finalize_sections): Change handling of
13469         copy_relocs_.
13470         * Makefile.am (CCFILES): Add copy-relocs.cc.
13471         (HFILES): Add copy-relocs.h.
13472
13473         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13474
13475         * testsuite/script_test_4.sh: Permit leading zeroes.
13476
13477 2008-04-15  Ian Lance Taylor  <iant@google.com>
13478
13479         * script-sections.cc (Script_sections::create_segments): Use
13480         header_size_adjustment even when there is enough room for the
13481         headers.
13482         * testsuite/script_test_4.sh: New file.
13483         * testsuite/script_test_4.t: New file.
13484         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13485         (check_DATA): Add script_test_4.stdout.
13486         (MOSTLYCLEANFILES): Likewise.
13487         (script_test_4): New target.
13488         (script_test_4.stdout): New target.
13489         * testsuite/Makefile.in: Rebuild.
13490
13491         * sparc.cc: Add definitions for Output_data_plt_sparc class
13492         constants.
13493
13494 2008-04-14  David S. Miller  <davem@davemloft.net>
13495
13496         * sparc.cc: New file.
13497         * Makefile.am (TARGETSOURCES): Add sparc.cc
13498         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13499         * configure.tgt: Document targ_extra_size and
13500         targ_extra_big_endian.  Add entries for sparc-* and
13501         sparc64-*.
13502         * configure.ac: Handle targ_extra_size and
13503         targ_extra_big_endian.
13504         * Makefile.in: Rebuild.
13505         * configure: Likewise.
13506         * po/POTFILES.in: Likewise.
13507         * po/gold.pot: Likewise.
13508
13509 2008-04-14  Ian Lance Taylor  <iant@google.com>
13510
13511         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13512         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13513         in the name/type/flags to section mapping.  Don't call
13514         allocate_output_section.
13515         (Layout::choose_output_section): Change parameter from adjust_name
13516         to is_input_section.  Don't permit input sections after sections
13517         are attached to segments.  Don't call allocate_output_section.
13518         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13519         not write_enable_output_section.
13520         (Layout::make_output_section): Don't push to
13521         unattached_section_list_ nor call attach_to_segment.  Call
13522         attach_section_to_segment if sections are attached.
13523         (Layout::attach_sections_to_segments): New function.
13524         (Layout::attach_section_to_segment): New function.
13525         (Layout::attach_allocated_section_to_segment): Rename from
13526         attach_to_segment.  Remove flags parameter.
13527         (Layout::allocate_output_section): Remove function.
13528         (Layout::write_enable_output_section): Remove function.
13529         * layout.h (class Layout): Update for above changes.  Add new
13530         field sections_are_attached_.
13531         * output.h (Output_section::update_flags_for_input_section): New
13532         function.
13533         * output.cc (Output_section::add_input_section): Call
13534         update_flags_for_input_section.
13535         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13536
13537 2008-04-11  Cary Coutant  <ccoutant@google.com>
13538
13539         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13540         thought unnecessary.
13541         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13542
13543 2008-04-11  Ian Lance Taylor  <iant@google.com>
13544
13545         * output.h (class Output_section_data): Remove inline definition
13546         of set_addralign.
13547         * output.cc (Output_section_data::set_addralign): New function.
13548
13549 2008-04-11  Cary Coutant  <ccoutant@google.com>
13550
13551         Add support for TLS descriptors for i386 and x86_64.
13552         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13553         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13554         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13555         GOT_TYPE_TLS_DESC.
13556         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13557         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13558         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13559         relocations.
13560         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13561         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13562         Fix problem with initial-exec relocations.
13563         (Target_i386::Relocate::relocate_tls): Likewise.
13564         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13565         relaxation.
13566         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13567         support for section-plus-offset dynamic table entries.
13568         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13569         (Output_data_dynamic::Dynamic_entry): Add support for
13570         section-plus-offset dynamic table entries.
13571         (Output_data_dynamic::Classification): Likewise.
13572         (Output_data_dynamic::classification_): Renamed offset_.
13573         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13574         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13575         (Target_x86_64::make_plt_section): New function.
13576         (Target_x86_64::reserve_tlsdesc_entries): New function.
13577         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13578         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13579         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13580         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13581         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13582         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13583         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13584         add extra PLT entry for TLS descriptors.
13585         (Output_data_plt_x86_64::got_): New field.
13586         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13587         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13588         fields.
13589         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13590         descriptors.
13591         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13592         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13593         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13594         R_386_TLS_DESC_CALL relocations.
13595         (Target_x86_64::Scan::global): Likewise.
13596         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13597         for TLS descriptors.
13598         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13599         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13600         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13601         GD-to-IE relaxation.
13602         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13603         and TLS_DESCRIPTORS.
13604         * Makefile.in: Rebuild.
13605         * configure: Rebuild.
13606         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13607         (tls_test_shared2.so): New target.
13608         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13609         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13610         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13611         (tls_shared_gd_to_ie_test_LDADD): New variable.
13612         (tls_shared_gnu2_gd_to_ie_test): New target.
13613         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13614         New targets.
13615         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13616         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13617         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13618         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13619         (tls_shared_gnu2_test): New target.
13620         (tls_test_gnu2_shared.so): New target.
13621         (tls_shared_gnu2_test_SOURCES): New variable.
13622         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13623         (tls_shared_gnu2_test_LDFLAGS): New variable.
13624         (tls_shared_gnu2_test_LDADD): New variable.
13625         * testsuite/Makefile.in: Rebuild.
13626         * testsuite/Makefile.
13627
13628 2008-04-11  Ian Lance Taylor  <iant@google.com>
13629
13630         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13631         justsyms.t.
13632         * testsuite/Makefile.in: Rebuild.
13633
13634         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13635         long.
13636         * testsuite/script_test_2.cc (main): Adjust test.
13637
13638 2008-04-11  David S. Miller  <davem@davemloft.net>
13639             Ian Lance Taylor  <iant@google.com>
13640
13641         * options.h (General_options): Add entries for '-Y' and
13642         '-relax'.
13643         * options.cc (General_options:finalize): If -Y was used, add those
13644         entries to the library path instead of the default "/lib" and
13645         "/usr/lib".
13646
13647 2008-04-11  David S. Miller  <davem@davemloft.net>
13648
13649         * testsuite/justsyms.t: Start at 0x100.
13650         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13651         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13652         long.
13653         * testsuite/script_test_2.cc: Adjust string and section length
13654         checks.
13655
13656 2008-04-09  Ian Lance Taylor  <iant@google.com>
13657
13658         PR gold/5996
13659         * script-sections.cc (Sections_element::allocate_to_segment): Add
13660         orphan parameter.
13661         (Output_section_definition::allocate_to_segment): Likewise.
13662         (Orphan_output_section::allocate_to_segment): Likewise.
13663         (Script_sections::attach_sections_using_phdrs_clause): Don't
13664         propagate non-PT_LOAD segments to orphan sections.
13665         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13666         readelf rather than objdump.
13667         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13668         .interp section and PT_INTERP segment are the same size.
13669         * testsuite/Makefile.in: Rebuild.
13670
13671         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13672         aliases for symbols defined in the same object.
13673         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13674         (weak_alias_test_SOURCES): New variable.
13675         (weak_alias_test_DEPENDENCIES): New variable.
13676         (weak_alias_test_LDFLAGS): New variable.
13677         (weak_alias_test_LDADD): New variable.
13678         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13679         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13680         (weak_alias_test_3.o): New target.
13681         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13682         * testsuite/weak_alias_test_main.cc: New file.
13683         * testsuite/weak_alias_test_1.cc: New file.
13684         * testsuite/weak_alias_test_2.cc: New file.
13685         * testsuite/weak_alias_test_3.cc: New file.
13686
13687 2008-04-08  Ian Lance Taylor  <iant@google.com>
13688
13689         * options.h (class General_options): Add --noinhibit-exec option.
13690         * main.cc (main): Check --noinhibit-exec.
13691
13692         * options.h (class General_options): Define --wrap as a special
13693         option.  Add wrap_symbols_ field.
13694         (General_options::any_wrap_symbols): New function.
13695         (General_options::is_wrap_symbol): New function.
13696         * options.cc (General_options::parse_wrap): New function.
13697         (General_options::General_options): Initialize wrap_symbols_.
13698         * symtab.cc (Symbol_table::wrap_symbol): New function.
13699         (Symbol_table::add_from_object): Handle --wrap.
13700         * symtab.h (class Symbol_table): Declare wrap_symbol.
13701         * target.h (Target::wrap_char): New function.
13702         (Target::Target_info): Add wrap_char field.
13703         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13704         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13705         * testsuite/testfile.cc (Target_test::test_target_info):
13706         Likewise.
13707
13708         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13709         there is one.
13710
13711         * layout.h (class Layout): Add added_eh_frame_data_ field.
13712         * layout.cc (Layout::Layout): Initialize new field.
13713         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13714         output section until we find a section we merged successfully.
13715         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13716         that the size be non-zero.
13717
13718         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13719         qualifier.
13720
13721 2008-04-08  Craig Silverstein  <csilvers@google.com>
13722
13723         * configure.ac: Export new conditional variable HAVE_ZLIB.
13724         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13725         on HAVE_ZLIB.
13726         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13727         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13728
13729 2008-04-07  Ian Lance Taylor  <iant@google.com>
13730
13731         * version.cc (version_string): Set to "1.5".
13732
13733         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13734         Add issued_non_pic_error_ field.  Declare check_non_pic.
13735         (Target_x86_64::Scan::check_non_pic): New function.
13736         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13737         (Target_x86_64::Scan::global): Likewise.
13738
13739         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13740         addend parameter.  Change caller.  Handle merge sections.
13741         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13742         Address to Addend.  Don't add in the result of
13743         local_section_offset, pass down the addend and use the returned
13744         value.
13745         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13746         Update declarations of local_section_offset and symbol_value.
13747         * testsuite/two_file_test_1.cc (t18): New function.
13748         * testsuite/two_file_test_2.cc (f18): New function.
13749         * testsuite/two_file_test_main.cc (main): Call t18.
13750         * testsuite/two_file_test.h (t18, f18): Declare.
13751
13752         * configure.ac: Don't test for objdump, c++filt, or readelf.
13753         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13754         conditionals.
13755         (TEST_READELF): New variable.
13756         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13757         (check_PROGRAMS): Add two_file_strip_test.
13758         (two_file_strip_test): New target.
13759         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13760         (two_file_same_shared_strip_test_SOURCES): New variable.
13761         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13762         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13763         (two_file_same_shared_strip_test_LDADD): New variable.
13764         (two_file_shared_strip.so): New target.
13765         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13766         (ver_test_5.syms, ver_test_7.syms): Likewise.
13767         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13768         (strip_test_3.stdout): Use TEST_OBJDUMP.
13769         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13770
13771 2008-04-04  Cary Coutant  <ccoutant@google.com>
13772
13773         * symtab.h (Symbol::is_weak_undefined): New function.
13774         (Symbol::is_strong_undefined): New function.
13775         (Symbol::is_absolute): New function.
13776         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13777         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13778         absolute symbols.
13779         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13780         (weak_undef_test): New target.
13781         * testsuite/Makefile.in: Rebuild.
13782         * testsuite/weak_undef_file1.cc: New file.
13783         * testsuite/weak_undef_file2.cc: New file.
13784         * testsuite/weak_undef_test.cc: New file.
13785
13786 2008-04-03  Craig Silverstein  <csilvers@google.com>
13787
13788         * compressed_output.h (class Output_compressed_section): Use
13789         unsigned buffer.
13790         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13791         add zlib header.
13792         (zlib_compressed_suffix): Removed.
13793         (Output_compressed_section::set_final_data_size): Use unsigned
13794         buffers.
13795         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13796         Fix linker invocation.
13797         (flagstest_o_specialfile_and_compress_debug_sections):
13798         Likewise.
13799         * testsuite/Makefile.in: Regenerated.
13800
13801 2008-04-02  David S. Miller  <davem@davemloft.net>
13802
13803         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13804         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13805
13806 2008-04-02  Craig Silverstein  <csilvers@google.com>
13807
13808         * TODO: New file.
13809
13810 2008-04-02  Ian Lance Taylor  <iant@google.com>
13811
13812         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13813         parameters.  Update for new key type to views_.  Change all
13814         callers.
13815         (File_read::read): Adjust for byteshift in returned view.
13816         (File_read::add_view): New function, broken out of
13817         find_and_make_view.
13818         (File_read::make_view): New function, broken out of
13819         find_and_make_view.
13820         (File_read::find_or_make_view): Add offset and aligned
13821         parameters.  Rewrite accordingly.  Change all callers.
13822         (File_read::get_view): Add offset and aligned parameters.  Adjust
13823         for byteshift in return value.
13824         (File_read::get_lasting_view): Likewise.
13825         * fileread.h (class File_read): Update declarations.
13826         (class File_read::View): Add byteshift_ field.  Add byteshift to
13827         constructor.  Add byteshift method.
13828         * archive.h (Archive::clear_uncached_views): New function.
13829         (Archive::get_view): Add aligned parameter.  Change all callers.
13830         * object.h (Object::get_view): Add aligned parameter.  Change all
13831         callers.
13832         (Object::get_lasting_view): Likewise.
13833
13834         * fileread.cc (File_read::release): Don't call clear_views if
13835         there are multiple objects.
13836         * fileread.h (File_read::clear_uncached_views): New function.
13837         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13838         on the archive.
13839
13840 2008-03-31  Cary Coutant  <ccoutant@google.com>
13841
13842         Add thin archive support.
13843         * archive.cc (Archive::armagt): New const.
13844         (Archive::setup): Remove task parameter and calls to unlock.
13845         (Archive::unlock_nested_archives): New function.
13846         (Archive::read_header): Add nested_off parameter. Change
13847         all callers.
13848         (Archive::interpret_header): Likewise.
13849         (Archive::include_all_members): Change to handle thin
13850         archives.
13851         (Archive::include_member): Likewise.
13852         * archive.h (Archive::Archive): Add new parameters and
13853         initializers.
13854         (Archive::armagt): New const.
13855         (Archive::setup): Remove task parameter.
13856         (Archive::unlock_nested_archives): New function.
13857         (Archive::read_header): Add nested_off parameter.
13858         (Archive::interpret_header): Likewise.
13859         (Archive::Nested_archive_table): New typedef.
13860         (Archive::is_thin_archive_): New field.
13861         (Archive::nested_archives_): New field.
13862         (Archive::options_): New field.
13863         (Archive::dirpath_): New field.
13864         (Archive::task_): New field.
13865         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13866         for thin archives.  Pass additional parameters to
13867         Archive::Archive.  Unlock the archive file after calling
13868         Archive::setup.
13869
13870 2008-03-29  Ian Lance Taylor  <iant@google.com>
13871
13872         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13873         version symbol to be local.
13874         * testsuite/ver_test_4.sh: New file.
13875         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13876         (check_DATA): Add ver_test_4.syms.
13877         (ver_test_4.syms): New target.
13878         * testsuite/Makefile.in: Rebuild.
13879
13880         * output.cc
13881         (Output_section::Input_section_sort_entry::has_priority): New
13882         function.
13883         (Output_section::Input_section_sort_entry::match_file_name): New
13884         function.
13885         (Output_section::Input_section_sort_entry::match_section_name):
13886         Remove.
13887         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13888         Remove.
13889         (Output_section::Input_section_sort_entry::match_section_file):
13890         Remove.
13891         (Output_section::Input_section_sort_compare::operator()): Rewrite
13892         using new Input_section_sort_entry functions.  Sort crtbegin and
13893         crtend first.  Sort sections with no priority before sections with
13894         a priority.
13895         * testsuite/initpri1.c (d3): Check j != 4.
13896         (cd5): New constructor/destructor function.
13897         (main): Check j != 2.
13898
13899         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13900         new symbol when resolving, don't call set_is_default.
13901         * testsuite/ver_test_7.cc: New file.
13902         * testsuite/ver_test_7.sh: New file.
13903         * testsuite/Makefile.am (ver_test_7.so): New target.
13904         (ver_test_7.o): New target.
13905         (check_SCRIPTS): Add ver_test_7.sh.
13906         (check_DATA): Add ver_test_7.syms.
13907         (ver_test_7.syms): New target.
13908
13909 2008-03-28  Ian Lance Taylor  <iant@google.com>
13910
13911         * layout.cc (Layout::layout): If we see an input section with a
13912         name that needs sorting, set the must_sort flag for the output
13913         section.
13914         (Layout::make_output_section): If the name of the output section
13915         indicates that it might require sorting, set the may_sort flag.
13916         * output.h (Output_section::may_sort_attached_input_sections): New
13917         function.
13918         (Output_section::set_may_sort_attached_input_sections): New
13919         function.
13920         (Output_section::must_sort_attached_input_sections): New
13921         function.
13922         (Output_section::set_must_sort_attached_input_sections): New
13923         function.
13924         (class Output_section): Declare Input_section_sort_entry.  Define
13925         Input_section_sort_compare.  Declare
13926         sort_attached_input_sections.  Add new fields:
13927         may_sort_attached_input_sections_,
13928         must_sort_attached_input_sections_,
13929         attached_input_sections_are_sorted_.
13930         * output.cc (Output_section::Output_section): Initialize new
13931         fields.
13932         (Output_section::add_input_section): Add an entry to
13933         input_sections_ if may_sort or must_sort are true.
13934         (Output_section::set_final_data_size): Call
13935         sort_attached_input_sections if necessary.
13936         (Output_section::Input_section_sort_entry): Define new class.
13937         (Output_section::Input_section_sort_compare::operator()): New
13938         function.
13939         (Output_section::sort_attached_input_sections): New function.
13940         * configure.ac: Check whether the compiler supports constructor
13941         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13942         * testsuite/initpri1.c: New file.
13943         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13944         CONSTRUCTOR_PRIORITY.
13945         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13946         (initpri1_LDFLAGS): New variable.
13947         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13948
13949 2008-03-27  Ian Lance Taylor  <iant@google.com>
13950
13951         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13952         * testsuite/common_test_1.c: New file.
13953         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13954         (common_test_1_SOURCES): New variable.
13955         (common_test_1_DEPENDENCIES): New variable.
13956         (common_test_1_LDFLAGS): New variable.
13957
13958         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13959         and commons_ correctly when NAME/VERSION does not override
13960         NAME/NULL.
13961         * testsuite/ver_test_6.c: New file.
13962         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13963         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13964         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13965
13966 2008-03-26  Ian Lance Taylor  <iant@google.com>
13967
13968         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13969         of an undefined symbol from a version script.
13970         * testsuite/Makefile.am (ver_test_5.so): New target.
13971         (ver_test_5.o): New target.
13972         (check_SCRIPTS): Add ver_test_5.sh.
13973         (check_DATA): Add ver_test_5.syms.
13974         (ver_test_5.syms): New target.
13975         * testsuite/ver_test_5.cc: New file.
13976         * testsuite/ver_test_5.script: New file.
13977         * testsuite/ver_test_5.sh: New file.
13978         * Makefile.in, testsuite/Makefile.in: Rebuild.
13979
13980         PR gold/5986
13981         Fix problems building gold with gcc 4.3.0.
13982         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13983         (gold_error_at_location, gold_warning_at_location): Use it.
13984         * configure.ac: Check whether we can compile and use a template
13985         function with a printf attribute.
13986         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13987         when jumping over bytes.
13988         * object.cc: Instantiate Object::read_section_data.
13989         * debug.h: Include <cstring>
13990         * dwarf_reader.cc: Include <algorithm>
13991         * main.cc: Include <cstring>.
13992         * options.cc: Include <cstring>.
13993         * output.cc: Include <cstring>.
13994         * script.cc: Include <cstring>.
13995         * script.h: Include <string>.
13996         * symtab.cc: Include <cstring> and <algorithm>.
13997         * target-select.cc: Include <cstring>.
13998         * version.cc: Include <string>.
13999         * testsuite/testmain.cc: Include <cstdlib>.
14000         * configure, config.in: Rebuild.
14001
14002 2008-03-25  Ian Lance Taylor  <iant@google.com>
14003
14004         * options.cc: Include "../bfd/bfdver.h".
14005         (options::help): Print bug reporting address.
14006
14007         * version.cc (print_version): Adjust output for current value of
14008         BFD_VERSION_STRING.
14009
14010         * NEWS: New file.
14011
14012         * options.cc (options::help): Print list of supported targets.
14013         * target-select.h: Include <vector>.
14014         (class Target_selector): Make machine_, size_, and is_big_endian_
14015         fields const.  Add bfd_name_ and instantiated_target_ fields.
14016         (Target_selector::Target_selector): Add bfd_name parameter.
14017         (Target_selector::recognize): Make non-virtual, call
14018         do_recognize.
14019         (Target_selector::recognize_by_name): Make non-virtual, call
14020         do_recognize_by_name.
14021         (Target_selector::supported_names): New function.
14022         (Target_selector::bfd_name): New function.
14023         (Target_selector::do_instantiate_target): New pure virtual
14024         function.
14025         (Target_selector::do_recognize): New virtual function.
14026         (Target_selector::do_recognize_by_name): New virtual function.
14027         (Target_selector::instantiate_target): New private function.
14028         (supported_target_names): Declare.
14029         * target-select.cc (Target_selector::Target_selector): Update for
14030         new parameter and fields.
14031         (select_target_by_name): Check that the name matches before
14032         calling recognize_by_name.
14033         (supported_target_names): New function.
14034         * i386.cc (class Target_selector_i386): Update Target_selector
14035         constructor call.  Remove recognize and recognize_by_name.  Add
14036         do_instantiate_target.
14037         * x86_64.cc (class Target_selector_x86_64): Likewise.
14038         * testsuite/testfile.cc (class Target_selector_test): Update for
14039         changes to Target_selector.
14040
14041         * README: Rewrite, with some notes on unsupported features.
14042
14043 2008-03-24  Cary Coutant  <ccoutant@google.com>
14044
14045         * i386.cc (Target_i386::Got_type): New enum declaration.
14046         (Target_i386::Scan::local): Updated callers of Output_data_got
14047         member functions.
14048         (Target_i386::Scan::global): Likewise.
14049         (Target_i386::Relocate::relocate): Likewise.
14050         (Target_i386::Relocate::relocate_tls): Likewise.
14051         * object.h (Got_offset_list): New class.
14052         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14053         (Sized_relobj::local_got_offset): Likewise.
14054         (Sized_relobj::set_local_got_offset): Likewise.
14055         (Sized_relobj::local_has_tls_got_offset): Removed.
14056         (Sized_relobj::local_tls_got_offset): Removed.
14057         (Sized_relobj::set_local_tls_got_offset): Removed.
14058         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14059         * output.cc (Output_data_got::add_global): Added got_type parameter.
14060         (Output_data_got::add_global_with_rel): Likewise.
14061         (Output_data_got::add_global_with_rela): Likewise.
14062         (Output_data_got::add_global_pair_with_rel): New function.
14063         (Output_data_got::add_global_pair_with_rela): New function.
14064         (Output_data_got::add_local): Added got_type parameter.
14065         (Output_data_got::add_local_with_rel): Likewise.
14066         (Output_data_got::add_local_with_rela): Likewise.
14067         (Output_data_got::add_local_pair_with_rel): New function.
14068         (Output_data_got::add_local_pair_with_rela): New function.
14069         (Output_data_got::add_global_tls): Removed.
14070         (Output_data_got::add_global_tls_with_rel): Removed.
14071         (Output_data_got::add_global_tls_with_rela): Removed.
14072         (Output_data_got::add_local_tls): Removed.
14073         (Output_data_got::add_local_tls_with_rel): Removed.
14074         (Output_data_got::add_local_tls_with_rela): Removed.
14075         * output.h (Output_data_got::add_global): Added got_type parameter.
14076         (Output_data_got::add_global_with_rel): Likewise.
14077         (Output_data_got::add_global_with_rela): Likewise.
14078         (Output_data_got::add_global_pair_with_rel): New function.
14079         (Output_data_got::add_global_pair_with_rela): New function.
14080         (Output_data_got::add_local): Added got_type parameter.
14081         (Output_data_got::add_local_with_rel): Likewise.
14082         (Output_data_got::add_local_with_rela): Likewise.
14083         (Output_data_got::add_local_pair_with_rel): New function.
14084         (Output_data_got::add_local_pair_with_rela): New function.
14085         (Output_data_got::add_global_tls): Removed.
14086         (Output_data_got::add_global_tls_with_rel): Removed.
14087         (Output_data_got::add_global_tls_with_rela): Removed.
14088         (Output_data_got::add_local_tls): Removed.
14089         (Output_data_got::add_local_tls_with_rel): Removed.
14090         (Output_data_got::add_local_tls_with_rela): Removed.
14091         * resolve.cc (Symbol::override_base_with_special): Removed
14092         reference to has_got_offset_ field.
14093         * symtab.cc (Symbol::init_fields): Replaced initialization
14094         of got_offset_ with got_offsets_.  Removed initialization
14095         of has_got_offset_
14096         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14097         (Symbol::got_offset): Likewise.
14098         (Symbol::set_got_offset): Likewise.
14099         (Symbol::has_tls_got_offset): Removed.
14100         (Symbol::tls_got_offset): Removed.
14101         (Symbol::set_tls_got_offset): Removed.
14102         (Symbol::got_offset_): Removed.
14103         (Symbol::tls_mod_got_offset_): Removed.
14104         (Symbol::tls_pair_got_offset_): Removed.
14105         (Symbol::got_offsets_): New field.
14106         (Symbol::has_got_offset): Removed.
14107         (Symbol::has_tls_mod_got_offset): Removed.
14108         (Symbol::has_tls_pair_got_offset): Removed.
14109         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14110         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14111         member functions.
14112         (Target_x86_64::Scan::global): Likewise.
14113         (Target_x86_64::Relocate::relocate): Likewise.
14114         (Target_x86_64::Relocate::relocate_tls): Likewise.
14115
14116 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14117
14118         * yyscript.y: Fix spelling error in comment.
14119
14120 2008-03-24  Ian Lance Taylor  <iant@google.com>
14121
14122         * options.h (class General_options): Define build_id option.
14123         * layout.h (class Layout): Declare write_build_id, create_note,
14124         create_build_id.  Add build_id_note_ member.
14125         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14126         "libiberty.h", "md5.h", "sha1.h".
14127         (Layout::Layout): Initialize eh_frame_data_,
14128         eh_frame_hdr_section_, and build_id_note_.
14129         (Layout::finalize): Call create_build_id.
14130         (Layout::create_note): New function, broken out of
14131         Layout::create_gold_note.
14132         (Layout::create_gold_note): Call create_note.
14133         (Layout::create_build_id): New function.
14134         (Layout::write_build_id): New function.
14135         (Close_task_runner::run): Call write_build_id.
14136
14137         * x86_64.cc: Correct license to GPLv3.
14138
14139 2008-03-23  Ian Lance Taylor  <iant@google.com>
14140
14141         * options.cc: Include "demangle.h".
14142         (parse_optional_string): New function.
14143         (parse_long_option): Handle takes_optional_argument.
14144         (parse_short_option): Update dash_z initializer.  Handle
14145         takes_optional_argument.
14146         (General_options::General_options): Initialize do_demangle_.
14147         (General_options::finalize): Set do_demangle_.  Handle demangling
14148         style.
14149         * options.h (parse_optional_string): Declare.
14150         (struct One_option): Add optional_arg field.  Update constructor.
14151         Update call constructor calls.  Add takes_optional_argument
14152         function.
14153         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14154         (DEFINE_optional_string): Define.
14155         (General_options::demangle): Change from DEFINE_bool to
14156         DEFINE_optional_string.
14157         (General_options::no_demangle): New function.
14158         (General_options::do_demangle): New function.
14159         (General_options::set_do_demangle): New function.
14160         (General_options::execstack_status_): Move definition to end of
14161         class definition.
14162         (General_options::static_): Likewise.
14163         (General_options::do_demangle_): New field.
14164         * object.cc (big_endian>::get_symbol_location_info): Call
14165         Options::do_demangle, not Options::demangle.
14166         * symtab.cc (demangle): Likewise.
14167
14168 2008-03-22  Ian Lance Taylor  <iant@google.com>
14169
14170         * gold.h: Include <cstddef> and <sys/types.h>
14171         * options.h: Include <cstring>.
14172
14173 2008-03-21  Ian Lance Taylor  <iant@google.com>
14174
14175         * Added source code to GNU binutils.