Define bfd_elf32_get_synthetic_symtab for x32
[external/binutils.git] / gold / ChangeLog
1 2014-12-04  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
4         addend of PLTREL24 reloc when not generating a plt stub.  Make
5         max_branch_offset an "Address".
6         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
7         (Target_powerpc::Relocate::relocate): Likewise.
8
9 2014-12-04  Alan Modra  <amodra@gmail.com>
10
11         PR 17670
12         * symtab.cc (Symbol::set_undefined): Remove assertion.
13         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
14         on symbols defined in discarded sections, instead return false.
15         Rearrange params, update all callers.
16         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
17         branches to syms in discarded sections.
18         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
19         undefined and flag as discarded.
20         (Target_powerpc::Relocate::relocate): Localize variable.
21
22 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
23
24         PR gold/17675
25         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
26         * testsuite/Makefile.in: Regenerated.
27
28 2014-12-03  Alan Modra  <amodra@gmail.com>
29
30         PR 17566
31         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
32         when adding dynamic relocations against section symbols.
33
34 2014-12-01  Dimitry Ivanov <dimitry@google.com>
35
36         * layout.cc (Layout::finish_dynamic_section): When '-z global'
37         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
38         * options.h (General_options): New -z option (global).
39
40 2014-12-01  Cary Coutant  <ccoutant@google.com>
41
42         PR gold/17578
43         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
44         is given.
45         (Layout::create_executable_stack_info): Warn when -z noexecstack is
46         given but some inputs require executable stack.
47
48 2014-11-26  Cary Coutant  <ccoutant@google.com>
49
50         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
51         .debug_str_offsets; strip .debug_gnu_pubnames and
52         .debug_gnu_pubtypes.
53         (lines_only_debug_sections): Strip all four new sections.
54
55 2014-11-26  Jing Yu  <jingyu@google.com>
56
57         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
58         register to be x0 when to relax TLSDESC_LD64_LO12.
59
60 2014-11-26  Alan Modra  <amodra@gmail.com>
61
62         * powerpc.cc (struct Stub_table_owner): New.
63         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
64         unsigned int vector.  Update all references.
65         (powerpc_relobj::set_stub_table): Take an unsigned int param
66         rather than a Stub_table.  Update callers.
67         (Powerpc_relobj::clear_stub_table): New function.
68         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
69         stub_group_size_ vars.
70         (Target_powerpc::new_stub_table): Delete.
71         (max_branch_delta): New function, extracted from..
72         (Target_powerpc::Relocate::relocate): ..here..
73         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
74         status on whether stub created successfully.
75         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
76         default sizing to..
77         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
78         reduce on relax failure.
79         (Target_powerpc::group_sections): Add "no_size_errors" param.
80         Use stub_group_size_.  Set up group info in a temp vector,
81         before building Stub_table vector.  Account for input sections
82         possibly already converted to relaxed sections.
83         (Stub_table::init): Delete.  Merge into..
84         (Stub_table::Stub_table): ..here.
85         (Stub_table::can_reach_stub): New function.
86         (Stub_table::add_plt_call_entry): Add "from" parameter and
87         return true iff stub could be reached.
88         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
89         param too.
90         (Stub_table::clear_stubs): Add "all" param.
91
92 2014-11-26  Alan Modra  <amodra@gmail.com>
93
94         * powerpc.cc (Stub_control::set_output_and_owner): New function.
95         (Target_powerpc::group_sections): Use it.
96
97 2014-11-25  Cary Coutant  <ccoutant@google.com>
98
99         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
100         (Binary_to_elf::write_symbol): Add st_size parameter.
101         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
102
103 2014-11-25  Cary Coutant  <ccoutant@google.com>
104
105         PR gold/17639
106         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
107         (Sized_relobj_file::do_layout): Handle deferred sections properly
108         during GC pass 1. Don't add reloc sections to deferred list twice.
109         * object.h (Sized_relobj_file::is_deferred_layout): New function.
110         (Sized_relobj_file::is_deferred_layout_): New data member.
111
112 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
113
114         PR gold/17619
115         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
116         Check PC-relative offset overflow in PLT entry.
117
118 2014-11-21  Alan Modra  <amodra@gmail.com>
119
120         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
121         for undefined weaks.
122
123 2014-11-20  Alan Modra  <amodra@gmail.com>
124
125         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
126         from --stub-group-size parameter divided by 1024.
127         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
128         template parameter.  Update all uses.
129         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
130         has_stub_value.  Set for long branches.  Don't report overflow for
131         branch to undefined weak symbols.  Print info message on
132         overflowing branch to stub.
133
134 2014-11-20  Alan Modra  <amodra@gmail.com>
135
136         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
137
138 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
139
140         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
141         entry for R_X86_64_GOTPLT64.
142         (Target_x86_64<size>::Relocate::relocate): Update comments for
143         R_X86_64_GOTPLT64.
144
145 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
146
147         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
148         * plugin.h: add lock definition
149
150 2014-10-29  Han Shen  <shenhan@google.com>
151             Jing Yu   <jingyu@google.com>
152
153         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
154         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
155         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
156         Symbol::TLS_REF.
157         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
158         method.
159         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
160         (Target_aarch64::tls_ld_to_le): New method.
161         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
162         for 64bit targets.
163         (Output_data_plt_aarch64::irelative_rel_): New data member.
164         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
165         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
166         (Output_data_plt_aarch64::add_relocation): New method.
167         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
168         offset. Add got_irelative size to got size.
169         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
170         type string with the new typename.
171         (AArch64_relocate_functions::update_adr): Replace parameter x with
172         immed.
173         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
174         (AArch64_relocate_functions::reloc_common): New method.
175         (AArch64_relocate_funcsions::rela_general): Extract common part out
176         into reloc_common method.
177         (AArch64_relocate_functions::rela_general): Likewise.
178         (AArch64_relocate_functions::pcrela_general): Likewise.
179         (AArch64_relocate_functions::adr): New method.
180         (AArch64_relocate_functions::adrp): Calculate immed before calling
181         update_adr.
182         (AArch64_relocate_functions::adrp): Likewise.
183         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
184         comparing x to 0. Calculate immed from ~x when x < 0.
185         (Target_aarch64::optimize_tls_reloc): Add new cases for
186         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
187         TLSLD_MOVW_DTPREL_G0_NC.
188         (Target_aarch64::possible_function_pointer_reloc): Implement this
189         method.
190         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
191         comment.
192         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
193         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
194         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
195         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
196         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
197         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
198         (Target_aarch64::make_plt_entry): Call add_entry with two more
199         parameters.
200         (Target_aarch64::make_local_ifunc_plt_entry): New method.
201         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
202         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
203         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
204         (Target_aarch64::Relocate::relocate_tls): Add cases for
205         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
206         TLSLD_MOVW_DTPREL_G0_NC.
207         * testsuite/icf_safe_so_test.cc: Correct test comment.
208         * testsuite/icf_safe_test.sh: Add AArch64 arch.
209
210 2014-10-22  Alan Modra  <amodra@gmail.com>
211
212         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
213         thread_starter.
214
215 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
216
217         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
218
219 2014-10-17  Cary Coutant  <ccoutant@google.com>
220
221         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
222         Add "typename" keyword.
223
224 2014-10-15  Han Shen  <shenhan@google.com>
225             Jing Yu   <jingyu@google.com>
226
227         Patch for gold aarch64 backend to support relaxation.
228         * aarch64-reloc.def: Change format.
229         * aarch64.cc (class Reloc_stub): New class.
230         (class Stub_table): New class.
231         (class AArch64_relobj): New class.
232         (class AArch64_input_section): New class.
233         (class AArch64_output_section): New class.
234         (Target_aarch64::new_stub_table): New method.
235         (Target_aarch64::new_aarch64_input_section): New method.
236         (Target_aarch64::find_aarch64_input_section): New method.
237         (Target_aarch64::scan_section_for_stubs): New method.
238         (Target_aarch64::scan_reloc_section_for_stubs): New method.
239         (Target_aarch64::relocate_stub): New method.
240         (Target_aarch64::current_target): New method.
241         (Target_aarch64::do_make_elf_object): New method.
242         (Target_aarch64::do_may_relax): New method.
243         (Target_aarch64::do_relax): New method.
244         (Target_aarch64::group_sections): New method.
245         (Target_aarch64::scan_reloc_for_stub): New method.
246         (Target_aarch64::do_make_output_section): New method.
247         (Target_aarch64::stub_tables_): New data member.
248         (Target_aarch64::aarch64_input_section_map_): New data member.
249         (AArch64_relocate_functions::maybe_apply_stub): New method.
250
251 2014-09-30  Cary Coutant  <ccoutant@google.com>
252
253         PR gold/17432
254         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
255
256 2014-09-30  Kito Cheng  <kito@0xlab.org>
257
258         PR gold/13597
259         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
260         hash table before sysv-style hash table.
261
262 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
263
264         * options.h (--pic-executable): Add negative to alias to -no-pie.
265
266 2014-09-26  Cary Coutant  <ccoutant@google.com>
267
268         PR gold/16773
269         * object.cc (Sized_relobj_file): Compute value of section symbols
270         for TLS sections the same as TLS symbols.
271
272 2014-09-25  Cary Coutant  <ccoutant@google.com>
273
274         PR gold/17432
275         * resolve.cc (Symbol_table::resolve): Override common placeholder
276         symbols, but adjust sizes.
277         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
278         symbols to common lists.
279
280 2014-09-24  Alan Modra  <amodra@gmail.com>
281
282         * po/POTFILES.in: Regenerate.
283
284 2014-09-23  Taiju Tsuiki  <tzik@google.com>
285             Cary Coutant  <ccoutant@google.com>
286
287         PR gold/14860
288         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
289         on input_sections_blocker.
290         * layout.cc (Write_sections_task::locks): Unblock
291         input_sections_blocker_.
292         * layout.h (Write_sections_task::Write_sections_task): Add
293         input_sections_blocker.
294         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
295         to DEPENDENCIES.
296         * testsuite/Makefile.in: Regenerate.
297
298 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
299
300         * testsuite/Makefile.am (plugin_test_10): New test.
301         * testsuite/Makefile.in: Regenerate
302         * testsuite/plugin_common_test_2.c (c1): Align to 8.
303         * testsuite/plugin_test_10.sh: New file.
304
305 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
306
307         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
308         * resolve.cc (Symbol_table::resolve): Don't override common symbols
309         during the replacement phase.
310
311 2014-09-17  Han Shen  <shenhan@google.com>
312             Jing Yu  <jingyu@google.com>
313
314         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
315         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
316         * aarch64.cc (Target_aarch64): Add data members
317         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
318         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
319         constructor.
320         (Target_aarch64::do_reloc_symbol_index): New method.
321         (Target_aarch64::do_reloc_addend): New method.
322         (Target_aarch64::add_tlsdesc_info): New method.
323         (Target_aarch64::do_dynsym_value): New method.
324         (Target_aarch64::do_make_data_plt): Add new parameters: got,
325         got_irelative. Pass them to Output_data_plt_aarch64_standard.
326         (Target_aarch64::make_data_plt): Add new parameters: got,
327         got_irelative. Pass them to do_make_data_plt.
328         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
329         (Target_aarch64::Relocate:tls_gd_to_le): New method.
330         (Target_aarch64::Relocate:tls_ie_to_le): New method.
331         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
332         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
333         (Target_aarch64::got_tlsdesc_section): New method.
334         (Target_aarch64::make_local_ifunc_plt_entry): New method.
335         (Target_aarch64::define_tls_base_symbol): New method.
336         (Target_aarch64::reserve_tlsdesc_entries): New method.
337         (Target_aarch64::got_mod_index_entry): New method.
338         (Target_aarch64::rela_tlsdesc_section): New method.
339         (Target_aarch64::rela_irelative_section): New method.
340         (Target_aarch64::Tlsdesc_info): New struct.
341         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
342         relocations and tlsdesc relocations.
343         (Target_aarch64::optimize_tls_reloc): Implement method.
344         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
345         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
346         in constructor.
347         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
348         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
349         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
350         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
351         (Output_data_plt_aarch64::rela_tlsdesc): New method.
352         (Output_data_plt_aarch64::rela_irelative): New method.
353         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
354         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
355         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
356         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
357         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
358         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
359         (Output_data_plt_aarch64_standard): New member variables:
360         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
361         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
362         New parameter: got, got_irelative.
363         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
364         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
365         (Output_data_plt_aarch64::do_write): Replace got_address with
366         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
367         (AArch64_relocate_functions::update_movnz): New method.
368         (AArch64_relocate_functions): Correct format.
369         (AArch64_relocate_functions::movnz): New method.
370         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
371         before the switch. Add new cases to switch.
372         Check ie_to_le relaxation on tlsie relocations. Add code handling
373         tlsgd tlsdesc cases.
374         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
375         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
376         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
377         Call reloc_name_in_error_message to print unsupported reloc.
378         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
379         make_data_plt.
380         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
381         relocs. Fill in some more dynamic tags.
382         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
383         Skip call tls_get_addr when tlsgd is relaxed.
384         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
385         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
386         tlsdesc->ie relaxation.
387
388 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
389
390         * mips.cc (Target_mips_nacl): New class.
391         (Target_selector_mips_nacl): New class.
392         (target_selector_mips32): Rename from target_selector_mips32be and use
393         Target_selector_mips_nacl instead of Target_selector_mips.
394         (target_selector_mips32el): Rename from target_selector_mips32 and use
395         Target_selector_mips_nacl instead of Target_selector_mips.
396         (target_selector_mips64): Rename from target_selector_mips64be and use
397         Target_selector_mips_nacl instead of Target_selector_mips.
398         (target_selector_mips64el): Rename from target_selector_mips64 and use
399         Target_selector_mips_nacl instead of Target_selector_mips.
400         (Target_mips::mips_info): Add const attribute.
401
402 2014-09-02  Cary Coutant  <ccoutant@google.com>
403
404         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
405         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
406         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
407         (Sized_incr_dynobj::do_section_name): Likewise.
408         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
409         (Sized_incr_dynobj::do_section_name): Likewise.
410         * object.h (Object::section_name): Likewise.
411         (Object::do_section_name): Likewise.
412         (Sized_relobj_file::do_section_name): Likewise.
413         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
414         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
415
416 2014-09-02  Cary Coutant  <ccoutant@google.com>
417
418         PR gold/17005
419         * ehframe.cc (Fde::write): Add output_offset parameter.
420         (Cie::write): Likewise.
421         (Eh_frame::set_final_data_size): Account for offset within output
422         section.
423         (Eh_frame::do_sized_write): Likewise.
424         * ehframe.h (Fde::write): Add output_offset parameter.
425         (Cie::write): Likewise.
426         * output.cc (Output_section::Input_section_sort_entry): Remove
427         section_has_name_; add output_section_name parameter. Use
428         output section name for non-input sections.
429         (Output_section::Input_section_sort_entry::section_has_name): Remove.
430         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
431         (Output_section::Input_section_sort_compare): Remove logic for
432         sections without names.
433         (Output_section::Input_section_sort_init_fini_compare): Likewise.
434         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
435         Likewise.
436         (Output_section::Input_section_sort_section_name_compare): Likewise.
437
438 2014-08-29 Han Shen <shenhan@google.com>
439            Jing Yu <jingyu@google.com>
440
441         * aarch64-reloc-property.cc
442         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
443         reference reloc property in the table.
444         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
445         3 other entries.
446         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
447         2 new overloaded methods.
448         (Output_data_got_aarch64::do_write): Add code to write out
449         static relocs.
450         (class Output_data_got_aarch64::Static_reloc): New class to wrap
451         static relocs.
452         (Output_data_got_aarch64::static_relocs): New vector to
453         hold static relocs.
454         (Target_aarch64::TCB_SIZE): New const static memeber.
455         (Target_aarch64::tcb_size): New method.
456         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
457         (Target_aarch64::Relocate::relocate_tls): New method.
458         (Target_aarch64::Scan::local): Add code handling new reloc types.
459         (Target_aarch64::Scan::global): Add code handling new reloc types.
460
461 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
462
463         * options.h (-no-pie): Add option.
464
465 2014-08-08  Jing Yu  <jingyu@google.com>
466             Han Shen  <shenhan@google.com>
467
468         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
469         (DEFFILES): add aarch64-reloc.def.
470         (TARGETSOURCES): Add aarch64-reloc-property.cc.
471         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
472         * Makefile.in: Regenerate.
473         * aarch64-reloc-property.cc: New file.
474         * aarch64-reloc-property.h: New file.
475         * aarch64-reloc.def: New file.
476         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
477         with tab to make the format consistent.
478         (Output_data_got_aarch64::symbol_table_): New method.
479         (Target_aarch64::do_plt_address_for_global): New method.
480         (Target_aarch64::do_plt_address_for_local): New method.
481         (Target_aarch64::do_select_as_default_target): New method.
482         (Target_aarch64::do_make_data_plt): New method.
483         (Target_aarch64::make_data_plt): New method.
484         (Output_data_plt_aarch64::has_irelative_section): New method.
485         (Output_data_plt_aarch64::address_for_global): New method.
486         (Output_data_plt_aarch64::address_for_local): New method.
487         (Output_data_plt_aarch64::irelative_rel_): New parameter.
488         (Output_data_plt_aarch64::add_entry): Implement contents.
489         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
490         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
491         the got_pov entry to plt0.
492         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
493         Implement contents.
494         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
495         (AArch64_howto): New struct.
496         (aarch64_howto[]): New static const array.
497         (AArch64_relocate_functions): New class.
498         (Target_aarch64::Scan::get_reference_flags): Remove method.
499         (Target_aarch64::Scan::local): Implement to support a few relocations.
500         (Target_aarch64::Scan::global): Implement to support a few relocations.
501         (Target_aarch64::make_plt_section): Implement contents.
502         (Target_aarch64::make_plt_entry): Implement contents.
503         (Target_aarch64::do_finalize_sections): Implement contents.
504         (Target_aarch64::Relocate::relocate): Implement a few relocations.
505         (Target_aarch64::relocate_section): Implement contents.
506
507 2014-08-06  Alan Modra  <amodra@gmail.com>
508
509         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
510
511 2014-08-06  Alan Modra  <amodra@gmail.com>
512
513         PR 13227
514         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
515
516 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
517
518         * object.cc (Relobj::is_section_name_included): Add
519         ".rodata.nptl_version" to not garbage collect this section.
520
521 2014-07-08  Cary Coutant  <ccoutant@google.com>
522
523         * expression.cc (struct Expression::Expression_eval_info): Add
524         new fields type_pointer, vis_pointer, and nonvis_pointer.
525         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
526         nonvis_pointer parameters. Adjust all calls.
527         (Symbol_expression::value): Update type, visibility, and nonvis bits
528         in caller.
529         * script.cc (Symbol_assignment::sized_finalize): Update type,
530         visibility, and remaining st_other bits for new symbol.
531         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
532         vis_pointer, and nonvis_pointer parameters.
533         * symtab.h (Symbol::set_type): New method.
534
535         * testsuite/Makefile.am (defsym_test): New test.
536         * testsuite/Makefile.in: Regenerate.
537         * testsuite/defsym_test.c: New file.
538         * testsuite/defsym_test.sh: New file.
539
540 2014-07-08  Cary Coutant  <ccoutant@google.com>
541
542         PR gold/15639
543         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
544         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
545         (Sized_dynobj::base_read_symbols): ...new method.
546         * object.h (Sized_relobj_file::base_read_symbols): New method.
547         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
548         (Sized_relobj_file::base_read_symbols): ...new method.
549         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
550         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
551         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
552
553 2014-07-04  Alan Modra  <amodra@gmail.com>
554
555         * po/POTFILES.in: Regenerate.
556
557 2014-07-02  Jing Yu  <jingyu@google.com>
558
559         * aarch64.cc: New file
560         * Makefile.am (TARGETSOURCES): Add aarch64.cc
561         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
562         * Makefile.in: Regenerate.
563         * configure.tgt: Add entries for aarch64*.
564         * configure.ac:  Likewise.
565         * configure: Likewise.
566
567 2014-06-27  Alan Modra  <amodra@gmail.com>
568
569         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
570
571 2014-06-24  Cary Coutant  <ccoutant@google.com>
572
573         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
574         sections.
575         (Dwo_file::sized_read_unit_index): Likewise.
576
577 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
578
579         * mips.cc: New file.
580         * Makefile.am (TARGETSOURCES): Add mips.cc
581         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
582         * configure.tgt: Add entries for mips*.
583         * configure.ac: Likewise.
584         * Makefile.in: Regenerate.
585         * configure: Likewise.
586
587 2014-06-09  Cary Coutant  <ccoutant@google.com>
588
589         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
590         unit_length is within section bounds.
591
592 2014-06-09  Cary Coutant  <ccoutant@google.com>
593
594         PR gold/16980
595         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
596         map.
597
598 2014-06-07  Alan Modra  <amodra@gmail.com>
599
600         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
601
602 2014-06-06  Cary Coutant  <ccoutant@google.com>
603
604         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
605         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
606         (Dwarf_pubnames_table::read_header): Likewise.
607         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
608         .debug_gnu_pubtypes.
609
610 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
611
612         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
613         * Makefile.in, configure: Regenerate.
614
615 2014-06-03  Alan Modra  <amodra@gmail.com>
616
617         * powerpc.cc (addis_12_2): Define.
618         (Stub_table::do_write): Support fusion on ELFv2 stubs.
619
620 2014-06-03  Alan Modra  <amodra@gmail.com>
621
622         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
623         st_other output.
624
625 2014-06-02  Alan Modra  <amodra@gmail.com>
626
627         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
628         Only ignore relocs on ELFv1.
629         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
630
631 2014-05-30  Cary Coutant  <ccoutant@google.com>
632
633         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
634         * testsuite/Makefile.in: Regenerate.
635         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
636
637 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
638
639         PR gold/16945
640         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
641         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
642
643 2014-05-15  Alan Modra  <amodra@gmail.com>
644
645         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
646         Compare FDE contents with DW_CFA_nop rather than 0.
647
648 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
649
650         * symtab.h (may_need_copy_reloc): Remove check for position independent
651         code.
652         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
653         position independence before pc absolute may_need_copy_reloc call.
654         Add check for executable output befor pc relative may_need_copy_reloc
655         call.
656         * i386.cc: Ditto.
657         * arm.cc: Ditto.
658         * sparc.cc: Ditto.
659         * tilegx.cc: Ditto.
660         * powerpc.cc: Add check for no position independence before
661         may_need_copy_reloc calls.
662         * testsuite/pie_copyrelocs_test.cc: New file.
663         * testsuite/pie_copyrelocs_shared_test.cc: New file.
664         * Makefile.am (pie_copyrelocs_test): New test.
665         * Makefile.in: Regenerate.
666
667 2014-05-08  Martin Liška  <mliska@suse.cz>
668
669         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
670
671 2014-05-06  Cary Coutant  <ccoutant@google.com>
672
673         PR gold/16900
674         * i386.cc (Output_data_got_plt_i386): New class.
675         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
676         parameter. Change all callers.
677         (Output_data_plt_i386::layout_): Remove.
678         (Output_data_plt_i386::got_plt_): Change type.
679         (Target_i386::got_plt_): Change type. Change all references.
680         (Target_i386::got_section): Create instance of new class.
681         (Output_data_got_plt_i386::do_write): New function.
682         * x86_64.cc (Output_data_got_plt_x86_64): New class.
683         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
684         parameter. Change all callers.
685         (Output_data_plt_x86_64::layout_): Remove.
686         (Output_data_plt_x86_64::got_plt_): Change type.
687         (Target_x86_64::got_plt_): Change type. Change all references.
688         (Target_x86_64::got_section): Create instance of new class.
689         (Output_data_got_plt_x86_64::do_write): New function.
690         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
691         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
692         class.
693
694 2014-05-05  Cary Coutant  <ccoutant@google.com>
695
696         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
697         if we have pubnames/pubtypes.
698
699 2014-05-02  Cary Coutant  <ccoutant@google.com>
700
701         * defstd.cc (in_segment): Define __ehdr_start here...
702         * layout.cc (Layout::finalize): ...Instead of here.  Set the
703         output segment when known.
704         * resolve.cc (Symbol::override_base_with_special): Remember
705         the original binding.
706         * symtab.cc (Symbol::set_output_segment): New function.
707         (Symbol::set_undefined): New function.
708         * symtab.h (Symbol::is_weak_undefined): Check original undef
709         binding.
710         (Symbol::is_strong_undefined): New function.
711         (Symbol::set_output_segment): New function.
712         (Symbol::set_undefined): New function.
713         * target-reloc.h (is_strong_undefined): Remove.
714         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
715         Check for hidden undefs.
716         (relocate_section): Call Symbol::is_strong_undefined.
717
718         * testsuite/Makefile.am (ehdr_start_test_1)
719         (ehdr_start_test_2, ehdr_start_test_3)
720         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
721         * testsuite/Makefile.in: Regenerate.
722         * testsuite/ehdr_start_def.cc: New source file.
723         * testsuite/ehdr_start_test.cc: New source file.
724         * testsuite/ehdr_start_test.t: New linker script.
725         * testsuite/ehdr_start_test_4.sh: New shell script.
726
727 2014-04-23  Cary Coutant  <ccoutant@google.com>
728
729         PR gold/16870
730         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
731
732 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
733
734         * layout.cc (Layout::include_section): Allow a target to decide
735         whether to include a section.
736         * target.h (Target::should_include_section): New function.
737         (Target::do_should_include_section): New function.
738
739 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
740
741         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
742         inline into ...
743         (Copy_relocs::emit): ... here.
744         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
745         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
746         (Copy_reloc_entry::entries_): Change from private to protected.
747
748 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
749
750         * icf.cc (get_section_contents): Replace copies of reloc
751         vectors with const references.
752
753 2014-04-02  Cary Coutant  <ccoutant@google.com>
754
755         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
756         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
757         * configure: Regenerate.
758         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
759         -fno-use-linker-plugin.
760         (LINK1, CXXLINK1): Add it to the link command.
761         * testsuite/Makefile.in: Regenerate.
762
763 2014-03-12  Alan Modra  <amodra@gmail.com>
764
765         * Makefile.in: Regenerate.
766
767 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
768
769         * symtab.h (Symbol::set_nonvis): New function.
770
771 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
772
773         * symtab.cc (Sized_symbol<32>::init_output_data):
774         Instantiate the template.
775         (Sized_symbol<64>::init_output_data): Likewise.
776
777 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
778
779         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
780         adjust dynamic symbol value.
781         * target.h (Target::adjust_dyn_symbol): New function.
782         (Target::do_adjust_dyn_symbol): New function.
783
784 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
785
786         * output.cc (Output_data_dynamic::Dynamic_entry::write):
787         Get the value of DYNAMIC_CUSTOM dynamic entry.
788         * output.h (Output_data_dynamic::add_custom): New function.
789         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
790         dynamic entry.
791         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
792         * target.h (Target::dynamic_tag_custom_value): New function.
793         (Target::do_dynamic_tag_custom_value): New function.
794
795 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
796
797         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
798         dynsym indexes.
799         * target.h (Target::has_custom_set_dynsym_indexes): New function.
800         (Target::do_has_custom_set_dynsym_indexes): New function.
801         (Target::set_dynsym_indexes): New function.
802         (Target::do_set_dynsym_indexes): New function.
803
804 2014-03-07  Alan Modra  <amodra@gmail.com>
805
806         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
807         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
808         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
809         (Powerpc_relocate_functions::has_overflow_bitfield,
810         overflowed): Use the above.
811         (Target_powerpc::Relocate::relocate): Correct overflow checking
812         for a number of relocations.  Modify overflow test for 16-bit
813         fields in instructions to signed/unsigned according to whether
814         the field takes a signed or unsigned value.
815
816 2014-03-05  Alan Modra  <amodra@gmail.com>
817
818         Update copyright years.
819
820 2014-03-05  Alan Modra  <amodra@gmail.com>
821
822         * powerpc.cc (Target_powerpc::Scan::local, global): Support
823         R_PPC64_ADDR64_LOCAL.
824         (Target_powerpc::Relocate::relocate): Likewise.
825
826 2014-03-03  Alan Modra  <amodra@gmail.com>
827
828         * dwp.cc (print_version): Update copyright year to current.
829
830 2014-02-10  Alan Modra  <amodra@gmail.com>
831
832         * po/gold.pot: Regenerate.
833
834 2014-02-06  Cary Coutant  <ccoutant@google.com>
835
836         Fix problem where -u is ignored when a weak undef is seen.
837
838         * archive.cc (Library_base::should_include_member): Reorder
839         code to check for -u option if a weak undef has already been seen.
840         * testsuite/Makefile.am (weak_undef_test_2): New test case.
841         * testsuite/Makefile.in: Regenerate.
842         * testsuite/weak_undef_file3.cc: New file.
843         * testsuite/weak_undef_file4.cc: New file.
844         * testsuite/weak_undef_test_2.cc: New file.
845
846 2014-02-05  Cary Coutant  <ccoutant@google.com>
847
848         Fix issues with gold undefined symbol diagnostics.
849
850         PR binutils/15435
851         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
852         check to here.
853         * target-reloc.h (is_strong_undefined): New function.
854         (relocate_section): Move undef vtable symbol check from here.
855         Check for is_strong_undefined.
856
857 2014-02-05  Cary Coutant  <ccoutant@google.com>
858
859         Fix problems with the --dynamic-list option.
860
861         PR gold/13577
862         * options.cc (General_options::parse_dynamic_list):
863         Set have_dynamic_list_.
864         (General_options::General_options): Initialize have_dynamic_list_.
865         (General_options::finalize): Turn off -Bsymbolic and
866         -Bsymbolic-functions if --dynamic-list provided.
867         * options.h (General_options::have_dynamic_list): New function.
868         (General_options::have_dynamic_list_): New data member.
869         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
870         correctly.
871
872         PR gold/16530
873         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
874         in --dynamic-list, mark it.
875
876         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
877         (dynamic_list_2): New test case.
878         * testsuite/Makefile.in: Regenerate.
879         * testsuite/dynamic_list_2.cc: New file.
880         * testsuite/dynamic_list_2.t: New file.
881         * testsuite/dynamic_list_lib1.cc: New file.
882         * testsuite/dynamic_list_lib2.cc: New file.
883         * testsuite/gc_dynamic_list_test.c: New file.
884         * testsuite/gc_dynamic_list_test.sh: New file.
885         * testsuite/gc_dynamic_list_test.t: New file.
886
887 2014-01-28  Cary Coutant  <ccoutant@google.com>
888
889         Add .gdb_index version 7 support.
890
891         * gold/dwarf_reader.cc: include <utility> (for make_pair).
892         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
893         debug sections.
894         (Dwarf_ranges_table::read_ranges_table): Likewise.
895         (Dwarf_pubnames_table::read_section): Check for GNU-style
896         sections, and for compressed debug sections.
897         (Dwarf_pubnames_table::read_header): Compute end address of table.
898         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
899         for end of list by offset, not by offset == 0.
900         (Dwarf_info_reader::do_read_string_table): Check for compressed
901         debug sections.
902         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
903         Initialize new data members.
904         (Dwarf_pubnames_table::next_name): return flag_byte.
905         (Dwarf_pubnames_table::end_of_table_): New data member.
906         (Dwarf_pubnames_table::is_gnu_style_): New data member.
907         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
908         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
909         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
910         read skeleton type unit DIEs.
911         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
912         (Gdb_index::do_write): Write flag_byte.
913         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
914         (Gdb_index::Cu_vector): Store flags along with cu indexes.
915         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
916         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
917
918 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
919
920         * version.cc (print_version): Update copyright year to 2014.
921
922 2013-12-19  Dimitry Andric  <dimitry@andric.com>
923
924         * stringpool.cc (Stringpool_template::reserve): Add
925         HAVE_UNORDERED_MAP case.
926         * stringpool.cc (Stringpool_template::print_stats): Likewise.
927
928 2013-12-18  Cary Coutant  <ccoutant@google.com>
929
930         * configure.ac: Check for <unordered_set> and <unordered_map>.
931         * config.in: Regenerate.
932         * configure: Regenerate.
933         * system.h: Use <unordered_set> and <unordered_map> if available.
934
935 2013-12-10  Roland McGrath  <mcgrathr@google.com>
936
937         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
938         with $(INSTALL_PROGRAM_ENV).
939         * Makefile.in: Regenerate.
940
941 2013-11-22  Cary Coutant  <ccoutant@google.com>
942
943         * configure.ac: Add check for which library is needed for
944         dlopen.
945         * configure: Regenerate.
946
947 2013-11-22  Cary Coutant  <ccoutant@google.com>
948
949         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
950         assembler.
951         * testsuite/Makefile.in: Regenerate.
952
953 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
954
955         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
956         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
957         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
958         (Target_x86_64<size>::Scan::local): Likewise.
959         (Target_x86_64<size>::Scan::global): Likewise.
960         (Target_x86_64<size>::Relocate::relocate): Likewise.
961         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
962         Likewise.
963         (Target_x86_64<size>::Scan::check_non_pic(): Handle
964         R_X86_64_PC32_BND.
965
966         * testsuite/Makefile.am (check_PROGRAMS): Add
967         exception_x86_64_bnd_test.
968         (exception_x86_64_bnd_test_SOURCES): New macro.
969         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
970         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
971         (exception_x86_64_bnd_test_LDADD): Likewise.
972         (exception_x86_64_bnd_1.o): New rule.
973         (exception_x86_64_bnd_2.o): Likewise.
974         * testsuite/Makefile.in: Regenerated.
975
976 2013-11-15  Alan Modra  <amodra@gmail.com>
977
978         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
979         accessor.
980         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
981         Only call ppc64_local_entry_offset for 64-bit.  Restrict
982         symval_for_branch lookup to ELFv1.
983         (Stub_table::add_plt_call_entry): Use unsigned int off.
984         (Output_data_glink::Address, invalid_address): New.
985         (Output_data_glink::add_eh_frame): Move out of line.  Add
986         support for ELFv2.
987         (Output_data_glink::add_global_entry, find_global_entry,
988         global_entry_address): New functions.
989         (Output_data_glink::global_entry_stubs_, end_branch_table_,
990         ge_size): New variables.
991         (Output_data_glink::set_final_data_size): Add global entry
992         stub sizing.
993         (Output_data_glink::do_write): Write global entry stubs.
994         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
995         parameter.  Return true for ELFv2.  Adjust callers.
996         (Target_powerpc::Scan::local, global): Restrict opd lookup to
997         ELFv1.  Similarly for ifunc and dynamic relocation processing
998         specific to ELFv1.  Recognize that symbols are defined on
999         their plt entries for ELFv2.
1000         (Target_powerpc::symval_for_branch): Assert if called for
1001         ELFv2 or ppc32.
1002         (Target_powerpc::Relocate::relocate): Use global entry plt
1003         stub for symbol value if such exists on ELFv2.
1004         (Target_powerpc::Relocate::relocate): Don't call
1005         symval_for_branch when ELFv2.  Do adjust for local entry
1006         offset when ELFv2.
1007         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1008         plt stub for ELFv2.
1009         (Target_powerpc::do_plt_address_for_global): Similarly.
1010
1011 2013-11-14  Cary Coutant  <ccoutant@google.com>
1012
1013         Revert patch -- this did not fix the problem, and there is
1014         no race there.
1015
1016         2013-11-14  Cary Coutant  <ccoutant@google.com>
1017
1018             PR gold/14860
1019             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1020             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1021             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1022             updating fde_offsets_.
1023             (Eh_frame_hdr::lock_): New data member.
1024
1025 2013-11-14  Cary Coutant  <ccoutant@google.com>
1026
1027         * dwp.cc (Dwo_file_entry): New type.
1028         (File_list): Use Dwo_file_entry.
1029         (Dwo_file::verify): New function.
1030         (Dwo_file::verify_dwo_list): New function.
1031         (Dwo_file::sized_verify_dwo_list): New function.
1032         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1033         list.
1034         (Dwp_options): New enum type.
1035         (dwp_options): Add --verify-only.
1036         (usage): Likewise.
1037         (main): Likewise.
1038         * dwp.h (gold_info): Add declaration.
1039
1040 2013-11-14  Cary Coutant  <ccoutant@google.com>
1041
1042         PR gold/14860
1043         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1044         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1045         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1046         updating fde_offsets_.
1047         (Eh_frame_hdr::lock_): New data member.
1048
1049 2013-11-06  Cary Coutant  <ccoutant@google.com>
1050
1051         PR gold/15758
1052         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1053         before reloc sections.
1054
1055 2013-11-04  Alan Modra  <amodra@gmail.com>
1056
1057         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1058         (Symbol::needs_dynamic_reloc): Test new flag.
1059         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1060         (Target_powerpc::Scan::get_reference_flags): Add target param.
1061         Return FUNC_DESC_ABI for 64-bit ELFv1.
1062         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1063         call.
1064         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1065         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1066
1067 2013-10-31  Cary Coutant  <ccoutant@google.com>
1068
1069         Restore support for dwp v2 DWARF package file format.
1070
1071         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1072         tu_length parameter.  Adjust all callers.
1073         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1074         * dwp.cc: Include dwarf.h.
1075         (Section_bounds): New struct type.
1076         (Unit_set): New struct type.
1077         (Dwo_file::Dwo_file): Initialize new data member.
1078         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1079         Combine and rename to...
1080         (Dwo_file::read_unit_index): ...this.
1081         (Dwo_file::sized_read_compunit_index)
1082         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1083         (Dwo_file::sized_read_unit_index): ...this.
1084         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1085         parameters; add section_id parameter.
1086         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1087         (Dwo_file::add_unit_set): ...this.
1088         (Dwo_file::shndx_map_): Remove.
1089         (Dwo_file::sect_offsets_): New data member.
1090         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1091         (Dwp_output_file::add_section): Rename to...
1092         (Dwp_output_file::add_contribution): ...this.
1093         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1094         (Dwp_output_file::add_tu_set): Likewise.
1095         (Dwp_output_file::Contribution): New type.
1096         (Dwp_output_file::Section::contributions): New data member.
1097         (Dwp_output_file::Cu_or_tu_set): Remove.
1098         (Dwp_output_file::Section::Section): New ctor.
1099         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1100         (Dwp_output_file::Dwp_index::Section_table): New type.
1101         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1102         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1103         parameter.
1104         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1105         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1106         (Dwp_output_file::Dwp_index::section_table): New member function.
1107         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1108         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1109         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1110         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1111         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1112         (Dwp_output_file::Dwp_index::section_table_): New data member.
1113         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1114         (Dwp_output_file::add_output_section): New member function.
1115         (Dwp_output_file::write_new_section): New member function.
1116         (Dwp_output_file::write_contributions): New member function.
1117         (Dwp_output_file::section_id_map_): New data member.
1118         (class Dwo_id_info_reader): Remove.
1119         (class Unit_reader): New class.
1120         (get_dwarf_section_name): New function.
1121         (Dwo_file::read_executable): Adjust initializations of class data.
1122         (Dwo_file::read): Add support for v2 package file format.
1123         (Dwo_file::read_unit_index): Likewise.
1124         (Dwo_file::sized_read_unit_index): Likewise.
1125         (Dwo_file::copy_section): Likewise.
1126         (Dwo_file::add_unit_set): Likewise.
1127         (Dwp_output_file::add_output_section): Likewise.
1128         (Dwp_output_file::add_contribution): Likewise.
1129         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1130         for empty slot.
1131         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1132         file format.
1133         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1134         slot.
1135         (Dwp_output_file::initialize): Remove unused function.
1136         (Dwp_output_file::finalize): Add support for v2 package file format.
1137         (Dwp_output_file::write_index): Likewise.
1138         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1139         function prototype.
1140
1141 2013-10-31  Cary Coutant  <ccoutant@google.com>
1142
1143         * configure.ac: Fix check for -fmerge-constants.
1144         * configure.ac: Regenerate.
1145
1146 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1147
1148         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1149         Correct 9-byte nop sequence to match what the assembler generates.
1150
1151 2013-10-30  Alan Modra  <amodra@gmail.com>
1152
1153         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1154         ppc64_local_entry_offset, ppc64_local_entry_offset,
1155         do_read_symbols): New functions.
1156         (Powerpc_relobj::e_flags_, st_other_): New vars.
1157         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1158         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1159         (Powerpc_relobj::e_flags_): New var.
1160         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1161         and adjust for ELFv2.
1162         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1163         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1164         (Powerpc_dynobj::do_find_special_sections): Likewise.
1165         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1166         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1167         to ELFv2 local entry.
1168         (Target_powerpc::do_relax): No thread safe barriers needed for
1169         ELFv2.
1170         (Output_data_plt_powerpc::initial_plt_entry_size_,
1171         plt_entry_size): Delete.  Replace all uses with
1172         first_plt_entry_offset() and plt_entry_size().
1173         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1174         reserved_size parm.  Update callers.
1175         (Output_data_plt_powerpc::entry_count): Update.
1176         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1177         and use Target_powerpc::first_plt_entry_offset().
1178         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1179         rename to plt_entry_size.
1180         (Output_data_plt_powerpc::add_ifunc_entry,
1181         add_local_ifunc_entry): Adjust reloc for ELFv2.
1182         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1183         (glink_eh_frame_fde_64v2): New.
1184         (Stub_table::plt_call_size): Support ELFv2 sizing.
1185         (Output_data_glink::add_eh_frame): Use the new FDE.
1186         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1187         (Stub_table::do_write): Write ELFv2 stubs and glink.
1188         (Target_powerpc::Relocate::relocate): Replaces nop after call
1189         with ld 2,24(1) and adjust local offset destination for ELFv2.
1190
1191 2013-10-30  Alan Modra  <amodra@gmail.com>
1192
1193         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1194         (Target_powerpc::Scan::global, local): Likewise.
1195         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1196         on all ppc64 @h and @ha relocs.
1197
1198 2013-10-14  Alan Modra  <amodra@gmail.com>
1199
1200         * output.h (Output_data_got::add_constant): Tidy.
1201         (Output_data_got::add_constant_pair): New function.
1202         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1203         methods used so as to first call reserve_ent().
1204
1205 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1206
1207         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1208         add_got_entry and add_got_entry_pair.
1209
1210         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1211         (HAVE_PUBNAMES): Likewise.
1212         * configure: Regenerate.
1213
1214         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1215         * testsuite/Makefile.in: Regenerate.
1216
1217         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1218         Remove const from declaration.
1219         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1220         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1221         * output.h (Output_file_header): Remove const from member target_
1222         and corresponding constructor argument.
1223         * output.cc (Output_file_header::Output_file_header): Update prototype.
1224         (Output_file_header::do_sized_write): Use this->target_ in place
1225         of parameters()->target().
1226
1227         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1228
1229         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1230         * configure: Regenerate.
1231         * Makefile.in: Regenerate.
1232         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1233         * testsuite/merge_string_literals_2.c: Likewise.
1234         * testsuite/Makefile.am
1235         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1236         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1237         literal -fmerge-constants.
1238         * testsuite/Makefile.in: Regenerate.
1239
1240         * i386.cc (Target_i386): Remove unused member dynbss_.
1241         * arm.cc (Target_arm): Likewise.
1242         * powerpc.cc (Target_powerpc): Likewise.
1243         * sparc.cc (Target_sparc): Likewise.
1244         * tilegx.cc (Target_tilegx): Likewise.
1245         * x86_64.cc (Target_x86_64): Likewise.
1246         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1247         type_signature_, type_offset_.
1248         * plugin.h (Plugin_hook): Remove unused member layout_.
1249         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1250         mapfile_.
1251         (Read_member): Remove unused members input_objects_, symtab_,
1252         mapfile_, layout_.
1253         (Check_library): Remove unused member symtab_.
1254         * archive.h (Lib_group): Remove unused member lib_.
1255         * archive.cc (Lib_group::Lib_group): Update initializer.
1256         * incremental.h (Incremental_binary): Remove unused member target_.
1257         (Incremental_script_entry): Removed unused member script_.
1258         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1259         * icf.h (Icf): Remove unused member num_tracked_relocs.
1260
1261         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1262         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1263         its only use.
1264         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1265
1266         * archive.h: Use struct rather than class for forward declaration
1267         of Read_symbols_data.
1268
1269 2013-10-07  Cary Coutant  <ccoutant@google.com>
1270
1271         PR gold/16010
1272         * testsuite/Makefile.am (icf_test): Fix dependencies.
1273         (icf_safe_test): Likewise.
1274         (icf_safe_so_test): Likewise.
1275         (large_symbol_alignment): Add empty _LDADD rule.
1276         * testsuite/Makefile.in: Regenerate.
1277
1278 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1279
1280         PR gold/15927
1281         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1282         relocation for R_X86_64_32 on x32.
1283
1284 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1285
1286         * output.cc (Output_segment::set_section_addresses): Take new
1287         Target* argument.  If target->isolate_execinstr() and the segment
1288         is executable and starts at a target->abi_pagesize() boundary,
1289         pad its end out to a target->abi_pagesize() boundary with code fill.
1290         * output.h (Output_segment::set_section_addresses): Update decl.
1291         * layout.h (Layout::check_output_data_for_reset_values): Take new
1292         argument RELAX_OUTPUTS.
1293         (Layout): New member relax_output_list_.
1294         (Layout::add_relax_output): New method.
1295         * layout.cc (Layout::Layout): Update constructor.
1296         (Layout::reset_relax_output): New method.
1297         (Layout::clean_up_after_relaxation): Call it.
1298         (Layout::prepare_for_relaxation): Update caller.
1299         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1300         Call reset_relax_output before re-processing segments for
1301         isolate_execinstr case.
1302         (Layout::write_data): Handle relax_output_list_.
1303         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1304         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1305
1306 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1307
1308         PR binutils/15834
1309         * object.h: Fix typos.
1310
1311 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1312
1313         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1314         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1315
1316 2013-08-07  Cary Coutant  <ccoutant@google.com>
1317
1318         Revert support for v2 DWP files:
1319
1320         2013-03-01  Cary Coutant  <ccoutant@google.com>
1321
1322             Add dwp support for v2 DWARF package file format.
1323             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1324             tu_length parameter.  Adjust all callers.
1325             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1326             * dwp.cc: Include dwarf.h.
1327             (Section_bounds): New struct type.
1328             (Unit_set): New struct type.
1329             (Dwo_file::Dwo_file): Initialize new data member.
1330             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1331             Combine and rename to...
1332             (Dwo_file::read_unit_index): ...this.
1333             (Dwo_file::sized_read_compunit_index)
1334             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1335             (Dwo_file::sized_read_unit_index): ...this.
1336             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1337             parameters; add section_id parameter.
1338             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1339             (Dwo_file::add_unit_set): ...this.
1340             (Dwo_file::shndx_map_): Remove.
1341             (Dwo_file::sect_offsets_): New data member.
1342             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1343             (Dwp_output_file::add_section): Rename to...
1344             (Dwp_output_file::add_contribution): ...this.
1345             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1346             (Dwp_output_file::add_tu_set): Likewise.
1347             (Dwp_output_file::Contribution): New type.
1348             (Dwp_output_file::Section::contributions): New data member.
1349             (Dwp_output_file::Cu_or_tu_set): Remove.
1350             (Dwp_output_file::Section::Section): New ctor.
1351             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1352             (Dwp_output_file::Dwp_index::Section_table): New type.
1353             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1354             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1355             parameter.
1356             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1357             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1358             (Dwp_output_file::Dwp_index::section_table): New member function.
1359             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1360             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1361             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1362             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1363             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1364             (Dwp_output_file::Dwp_index::section_table_): New data member.
1365             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1366             (Dwp_output_file::add_output_section): New member function.
1367             (Dwp_output_file::write_new_section): New member function.
1368             (Dwp_output_file::write_contributions): New member function.
1369             (Dwp_output_file::section_id_map_): New data member.
1370             (class Dwo_id_info_reader): Remove.
1371             (class Unit_reader): New class.
1372             (get_dwarf_section_name): New function.
1373             (Dwo_file::read_executable): Adjust initializations of class data.
1374             (Dwo_file::read): Add support for v2 package file format.
1375             (Dwo_file::read_unit_index): Likewise.
1376             (Dwo_file::sized_read_unit_index): Likewise.
1377             (Dwo_file::copy_section): Likewise.
1378             (Dwo_file::add_unit_set): Likewise.
1379             (Dwp_output_file::add_output_section): Likewise.
1380             (Dwp_output_file::add_contribution): Likewise.
1381             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1382             for empty slot.
1383             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1384             file format.
1385             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1386             slot.
1387             (Dwp_output_file::initialize): Remove unused function.
1388             (Dwp_output_file::finalize): Add support for v2 package file format.
1389             (Dwp_output_file::write_index): Likewise.
1390             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1391             function prototype.
1392
1393 2013-07-31  Cary Coutant  <ccoutant@google.com>
1394
1395         * object.cc (Sized_relobj::do_output_section_address): New function.
1396         (Sized_relobj): Instantiate explicitly.
1397         * object.h (Object::output_section_address): New function.
1398         (Object::do_output_section_address): New function.
1399         (Sized_relobj::do_output_section_address): New function.
1400         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1401
1402 2013-07-30  Cary Coutant  <ccoutant@google.com>
1403             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1404
1405         * parameters.cc (Parameters::entry): Return target-specific entry
1406         symbol name.
1407         * target.h (Target::entry_symbol_name): New function.
1408         (Target_info::entry_symbol_name): New data member.
1409
1410         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1411         * i386.cc (Target_i386::i386_info): Likewise.
1412         (Target_i386_nacl::i386_nacl_info): Likewise.
1413         * sparc.cc (Target_sparc::sparc_info): Likewise.
1414         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1415         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1416         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1417         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1418
1419 2013-07-22  Sterling Augustine  <saugustine@google.com>
1420
1421         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1422         Convert parameter shndx to local variable. Add parameters symtab
1423         and symtab_size.  Scan over section names.  Find relocation
1424         section corresponding to current section.  Create and initialize
1425         reloc_mapper_ and reloc_type_.
1426         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1427         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1428         cu_offset_.
1429         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1430         Initialize new fields unit_length_ and cu_offset_.
1431         (Dwarf_pubnames_table::read_section): Update prototype.
1432         (Dwarf_pubnames_table::cu_offset): New member function.
1433         (Dwarf_pubnames_table::subsection_size): Likewise.
1434         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1435         New fields.
1436         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1437         member functions public.
1438         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1439         Update comment.  Rework logic.  Move repeated parts to...
1440         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1441         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1442         pubtypes_table_, and stmt_list_offset.
1443         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1444         Gdb_index::find_pubtype_offset,
1445         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1446         (Gdb_index::pubnames_read): Update prototype and rework logic.
1447         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1448         Forward declare.
1449         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1450         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1451         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1452         Gdb_index::map_pubtable_to_dies):
1453         Declare functions.
1454         (Gdb_index::pubnames_read): Update declaration.
1455         (Gdb_index::Pubname_offset_map): New type.
1456         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1457         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1458         Gdb_index::stmt_list_offset): Declare.
1459         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1460         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1461         Gdb_index::pubtypes_offset_): Remove.
1462
1463 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1464
1465         * options.h (General_options): Add -Trodata-segment option.
1466         * parameters.cc (Parameters::check_rodata_segment): New function.
1467         (Parameters::set_target_once): Call it.
1468         * parameters.h (Parameters): Declare it (private member function).
1469         * layout.cc (load_seg_unusable_for_headers): New function, broken
1470         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1471         then validate rodata segment rather than text segment.
1472         (relaxation_loop_body): Call that.
1473         (is_text_segment): New function.  Don't admit a non-executable
1474         segment if TARGET->isolate_execinstr().
1475         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1476
1477 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1478
1479         PR gold/15070
1480         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1481         * nacl.h (Sniff_file::View::View): Request aligned view.
1482
1483 2013-07-11  Cary Coutant  <ccoutant@google.com>
1484
1485         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1486         correct BRLT entry size.
1487
1488 2013-07-03  Alan Modra  <amodra@gmail.com>
1489
1490         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1491         comment.
1492
1493 2013-07-01  Cary Coutant  <ccoutant@google.com>
1494
1495         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1496         reloc_type_.
1497         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1498         (Dwarf_ranges_table::lookup_reloc): New function.
1499         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1500         reloc_type_.
1501         (Dwarf_ranges_table::lookup_reloc): New function.
1502         (Dwarf_ranges_table::reloc_type_): New data member.
1503
1504 2013-06-27  Jing Yu  <jingyu@google.com>
1505
1506         PR gold/15662
1507         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1508         function.
1509         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1510         (Target_powerpc::do_relax): Call the above.
1511
1512 2013-06-27  Cary Coutant  <ccoutant@google.com>
1513
1514         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1515         on garbage collected .opd section.
1516
1517 2013-06-27  Alan Modra  <amodra@gmail.com>
1518
1519         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1520         is non-zero.
1521         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1522         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1523
1524 2013-06-14  Cary Coutant  <ccoutant@google.com>
1525
1526         * resolve.cc (Symbol::override_base): Don't override st_type
1527         from plugin placeholder symbols.
1528         (Symbol_table::resolve): Likewise.
1529         (Symbol_table::should_override): Don't complain about TLS mismatch
1530         if the TO symbol is a plugin placeholder.
1531         * testsuite/Makefile.am (plugin_test_tls): New test.
1532         * testsuite/Makefile.in: Regenerate.
1533         * testsuite/plugin_test_tls.sh: New test script.
1534         * testsuite/two_file_test_2_tls.cc: New test source.
1535         * testsuite/two_file_test_tls.cc: New test source.
1536
1537 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1538
1539         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1540         the maximum segment alignment is larger than the page size.
1541         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1542         correctly aligns the symbols with large alignemnt.
1543         * testsuite/Makefile.in: Regenerate.
1544         * testsuite/large_symbol_alignment.cc: New file.
1545
1546 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1547             Sriraman Tallam  <tmsriram@google.com>
1548
1549         * options.h (sort_section): New option.
1550         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1551         Rename from Input_section_sort_section_name_special_ordering_compare.
1552         (Input_section_sort_section_name_compare): New struct.
1553         * output.cc (Output_section::Input_section_sort_section_name_compare::
1554         operator()): New function.
1555         (Output_section::sort_attached_input_sections): Use new sort function
1556         for .text if --sort-section=name is specified.
1557         * layout.cc (Layout::make_output_section):
1558         Add sorting by name when --sort-section=name is specified.
1559         * testsuite/Makefile.am (text_section_grouping): Test option
1560         --sort-section=name.
1561         * testsuite/Makefile.in: Regenerate.
1562         * testsuite/section_sorting_name.cc: New file.
1563         * testsuite/section_sorting_name.sh: New file.
1564
1565 2013-05-21  Cary Coutant  <ccoutant@google.com>
1566
1567         * symtab.h (Symbol::is_cxx_vtable): New function.
1568         * target-reloc.h (relocate_section): Check for vtable symbol.
1569         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1570         * testsuite/Makefile.in: Regenerate.
1571         * testsuite/missing_key_func.cc: New test source.
1572         * testsuite/missing_key_func.sh: New test script.
1573
1574 2013-05-21  Cary Coutant  <ccoutant@google.com>
1575
1576         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1577         type of enclosing symbol.
1578         (Relocate_info::location): Check symbol type when describing symbol.
1579         * object.h (Symbol_location_info): Remove unused line_number;
1580         add enclosing_symbol_type.
1581         * testsuite/debug_msg.sh: Adjust expected output.
1582
1583 2013-05-13  Cary Coutant  <ccoutant@google.com>
1584
1585         * configure.ac: Export DEFAULT_TARGET.
1586         * configure: Regenerate.
1587         * Makefile.in: Regenerate.
1588         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1589         * testsuite/Makefile.in: Regenerate.
1590         * testsuite/debug_msg.sh: Delete duplicate tests.
1591         Don't check undef_int error message match for powerpc where the
1592         source file and line number aren't available.
1593
1594 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1595
1596         * options.h (General_options): Add --rosegment-gap option.
1597         * options.cc (finalize): --rosegment-gap implies --rosegment.
1598         * layout.cc (set_segment_offsets): Let user option override
1599         target->rosegment_gap().
1600
1601 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1602
1603         * options.h (General_options): Remove leading space from help
1604         messages for -nostdlib and --rosegment.
1605
1606 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1607
1608         PR ld/15365
1609         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1610
1611 2013-05-03  Alan Modra  <amodra@gmail.com>
1612
1613         * merge.cc (Output_merge_string::do_add_input_section): Correct
1614         scan for number of strings.  Rename vars to avoid shadowing.
1615         Include missing terminator in input_size_.
1616
1617 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1618
1619         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1620         Restore empty string handling.
1621
1622 2013-05-01  Cary Coutant  <ccoutant@google.com>
1623
1624         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1625         uninitialized warning.
1626
1627 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1628
1629         * output.cc (Output_section::add_merge_input_section): Allow
1630         to merge sections if the alignment is more than character size.
1631         * merge.h (Output_merge_string::Output_merge_string): Remove
1632         assert.
1633         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1634         only not-null strings. Check the alignment of strings.
1635         * stringpool.h
1636         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1637         alignment as the argument.
1638         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1639         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1640         Align non-zero length strings according to the addralign_.
1641         (Stringpool_template<Stringpool_char>::set_string_offsets):
1642         Updating offsets according to the given alignment.
1643         * testsuite/Makefile.am (text_section_grouping): Test if string
1644         literals are getting merged.
1645         * testsuite/Makefile.in: Regenerate.
1646         * testsuite/merge_string_literals_1.c: New file.
1647         * testsuite/merge_string_literals_2.c: Ditto.
1648         * testsuite/merge_string_literals.sh: Ditto.
1649
1650 2013-04-26  Ian Lance Taylor  <iant@google.com>
1651
1652         * target-reloc.h (relocate_section): If the reloc offset is out of
1653         range, pass VIEW as NULL to relocate.relocate.
1654         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1655         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1656         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1657         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1658         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1659         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1660
1661 2013-04-26  Geoff Pike  <gpike@chromium.org>
1662
1663         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1664         * layout.cc (Hash_task): New class.
1665         (Layout::queue_build_id_tasks): New function.
1666         (Layout::write_build_id): Handle single-thread portion of build ID
1667         computation.  (In some cases, all of it is single-threaded.)  Replace
1668         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1669         functionality in fewer lines of code.
1670         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1671         * options.h (General_options): make "--build-id" default to tree
1672         rather than sha1.  Add two new options related to --build-id=tree:
1673         --build-id-chunk-size-for-treehash and
1674         --build-id-min-file-size-for-treehash.
1675         * Makefile.am: add testing of --build-id=tree and related new options
1676         (these tests will be invoked by "make check").
1677         * Makefile.in: Regenerate.
1678
1679 2013-04-25  Alan Modra  <amodra@gmail.com>
1680
1681         * configure.tgt: Add powerpcle and powerpc64le.
1682
1683 2013-04-22  Alan Modra  <amodra@gmail.com>
1684
1685         PR gold/15355
1686         * layout.cc (Layout::segment_precedes): Allow more than one
1687         segment with the same type and flags.
1688
1689 2013-04-15  Cary Coutant  <ccoutant@google.com>
1690
1691         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1692         allocate space in file for BSS sections.
1693
1694 2013-04-15  Cary Coutant  <ccoutant@google.com>
1695
1696         * script-sections.cc (Orphan_output_section): Reset address
1697         to zero after each orphaned section for relocatable links.
1698
1699 2013-04-15  Cary Coutant  <ccoutant@google.com>
1700
1701         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1702         section starting address for relocatable link.
1703         * testsuite/Makefile.am (script_test_11): New test.
1704         * testsuite/Makefile.in: Regenerate.
1705         * testsuite/script_test_11.c: New source file.
1706         * testsuite/script_test_11.t: New linker script.
1707
1708 2013-04-13  Alan Modra  <amodra@gmail.com>
1709
1710         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1711         owner when sections are not adjacent and exceed group size.
1712         (Target_powerpc::group_sections): Handle corner case.
1713         (Target_powerpc::Branch_info::make_stub): Handle case where
1714         stub table doesn't exist due to branches in non-exec sections.
1715         (Target_powerpc::Relocate::relocate): Likewise.
1716
1717 2013-04-11  Alan Modra  <amodra@gmail.com>
1718
1719         PR gold/15354
1720         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1721         .branch_lt to match bfd ld.  Adjust comments throughout file.
1722
1723 2013-04-04  Ian Lance Taylor  <iant@google.com>
1724
1725         GCC PR c++/56840
1726         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1727         sections before checking whether they are included in the link.
1728
1729 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1730
1731         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1732         object before calling the plugin claim_file handler.  Pass the elf
1733         object of the archive to the plugin. Delete the elf object if the
1734         plugin claims the file.
1735
1736 2013-03-21  Alan Modra  <amodra@gmail.com>
1737
1738         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1739         segment when omagic.
1740
1741 2013-03-21  Alan Modra  <amodra@gmail.com>
1742
1743         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1744         comparison warning.
1745         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1746         uninitialized" warning.
1747
1748 2013-03-20  Alan Modra  <amodra@gmail.com>
1749
1750         * symtab.h (Symbol::clear_version): New function.
1751         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1752         is_needed by weak references.  Clear version for symbols defined
1753         in as-needed objects that are not needed.
1754
1755 2013-03-15  Alan Modra  <amodra@gmail.com>
1756
1757         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1758         static and public.  Add report_err param.  Return false for data refs.
1759         (Target_powerpc::rela_dyn_section): New overloaded function.
1760         (Target_powerpc::plt_, iplt_): Elucidate.
1761         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1762         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1763         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1764         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1765         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1766         push_branch and make_plt_entry for ifunc syms when
1767         reloc_needs_plt_for_ifunc.
1768         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1769         for ifunc unless reloc_needs_plt_for_ifunc.
1770
1771 2013-03-15  Alan Modra  <amodra@gmail.com>
1772
1773         * gc.h (gc_process_relocs): Don't look through function descriptors.
1774         * icf.cc (get_section_contents): Do so here instead.
1775
1776 2013-03-13  Alan Modra  <amodra@gmail.com>
1777
1778         * powerpc.cc (is_branch_reloc): Forward declare.
1779         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1780         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1781         false for 64-bit, true for 32-bit non-branch relocs.
1782         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1783         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1784         nm output.
1785         (icf_safe_test): Generate linker map file as well as nm output.
1786         (icf_safe_so_test): Likewise.
1787         * testsuite/Makefile.in: Regenerate.
1788         * testsuite/icf_test.sh: Parse linker map file to determine
1789         section folding.
1790         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1791         * testsuite/icf_safe_so_test.sh: Likewise.
1792         (X86_32_or_ARM_specific_safe_fold): Merge into..
1793         (arch_specific_safe_fold): ..this.
1794         (X86_64_specific_safe_fold): Delete unused function.
1795
1796 2013-03-12  Alan Modra  <amodra@gmail.com>
1797
1798         * gc.h (gc_process_relocs): Look through function descriptors
1799         to determine shndx, symvalue and addend used by ICF.  Tidy
1800         variable duplication.
1801
1802 2013-03-11  Alan Modra  <amodra@gmail.com>
1803
1804         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1805         * layout.cc (Layout_task_runner::run): ..to here.
1806         * symtab.h (struct Symbol_location): Extract from..
1807         (class Symbol_table): ..here.
1808         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1809         * target.h (class Target): Add function_location and
1810         do_function_location functions.
1811         (class Sized_target): Add do_function_location.
1812         * object.h (class Sized_relobj_file): Move find_shdr..
1813         (class Object): ..to here.
1814         * object.cc: Likewise.  Update to suit.  Instantiate.
1815         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1816         * powerpc.cc (class Powerpc_dynobj): New.
1817         (Target_powerpc::do_function_location): New function.
1818         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1819         (Powerpc_dynobj::do_read_symbols): New function.
1820         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1821
1822 2013-03-08  Ian Lance Taylor  <iant@google.com>
1823
1824         * options.cc (General_options::string_to_object_format): Accept
1825         "default".
1826
1827 2013-03-08  Alan Modra  <amodra@gmail.com>
1828
1829         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1830         pointer to Post_fde.
1831         (struct Post_fde): Move definition to here..
1832         * ehframe.cc (struct Post_fde): ..from here.
1833         (Cie::write): Don't alloc Post_fde.
1834         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1835
1836 2013-03-07  Alan Modra  <amodra@gmail.com>
1837
1838         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1839         relocation referencing .LC0.
1840         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1841
1842 2013-03-07  Alan Modra  <amodra@gmail.com>
1843
1844         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1845         always_inline.  Add assembly for powerpc to avoid GOT.
1846
1847 2013-03-07  Alan Modra  <amodra@gmail.com>
1848
1849         * testsuite/script_test_10.sh: Don't test .bss section
1850         header number.
1851
1852 2013-03-06  Alan Modra  <amodra@gmail.com>
1853
1854         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1855         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1856         all callers.  Handle folded sections.
1857         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1858         to Powerpc_relobj.
1859         (Global_symbol_visitor_opd::operator()): Likewise.
1860
1861 2013-03-04  Alan Modra  <amodra@gmail.com>
1862
1863         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1864         * testsuite/Makefile.in: Regenerate.
1865
1866 2013-03-01  Cary Coutant  <ccoutant@google.com>
1867
1868         Add dwp support for v2 DWARF package file format.
1869         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1870         tu_length parameter.  Adjust all callers.
1871         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1872         * dwp.cc: Include dwarf.h.
1873         (Section_bounds): New struct type.
1874         (Unit_set): New struct type.
1875         (Dwo_file::Dwo_file): Initialize new data member.
1876         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1877         Combine and rename to...
1878         (Dwo_file::read_unit_index): ...this.
1879         (Dwo_file::sized_read_compunit_index)
1880         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1881         (Dwo_file::sized_read_unit_index): ...this.
1882         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1883         parameters; add section_id parameter.
1884         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1885         (Dwo_file::add_unit_set): ...this.
1886         (Dwo_file::shndx_map_): Remove.
1887         (Dwo_file::sect_offsets_): New data member.
1888         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1889         (Dwp_output_file::add_section): Rename to...
1890         (Dwp_output_file::add_contribution): ...this.
1891         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1892         (Dwp_output_file::add_tu_set): Likewise.
1893         (Dwp_output_file::Contribution): New type.
1894         (Dwp_output_file::Section::contributions): New data member.
1895         (Dwp_output_file::Cu_or_tu_set): Remove.
1896         (Dwp_output_file::Section::Section): New ctor.
1897         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1898         (Dwp_output_file::Dwp_index::Section_table): New type.
1899         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1900         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1901         parameter.
1902         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1903         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1904         (Dwp_output_file::Dwp_index::section_table): New member function.
1905         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1906         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1907         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1908         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1909         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1910         (Dwp_output_file::Dwp_index::section_table_): New data member.
1911         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1912         (Dwp_output_file::add_output_section): New member function.
1913         (Dwp_output_file::write_new_section): New member function.
1914         (Dwp_output_file::write_contributions): New member function.
1915         (Dwp_output_file::section_id_map_): New data member.
1916         (class Dwo_id_info_reader): Remove.
1917         (class Unit_reader): New class.
1918         (get_dwarf_section_name): New function.
1919         (Dwo_file::read_executable): Adjust initializations of class data.
1920         (Dwo_file::read): Add support for v2 package file format.
1921         (Dwo_file::read_unit_index): Likewise.
1922         (Dwo_file::sized_read_unit_index): Likewise.
1923         (Dwo_file::copy_section): Likewise.
1924         (Dwo_file::add_unit_set): Likewise.
1925         (Dwp_output_file::add_output_section): Likewise.
1926         (Dwp_output_file::add_contribution): Likewise.
1927         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1928         for empty slot.
1929         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1930         file format.
1931         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1932         slot.
1933         (Dwp_output_file::initialize): Remove unused function.
1934         (Dwp_output_file::finalize): Add support for v2 package file format.
1935         (Dwp_output_file::write_index): Likewise.
1936         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1937         function prototype.
1938
1939 2013-03-01  Cary Coutant  <ccoutant@google.com>
1940
1941         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1942         function into class definition in header file.
1943         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1944         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1945         New function.
1946         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1947
1948 2013-02-28  Alan Modra  <amodra@gmail.com>
1949
1950         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1951         * target.cc (Target::do_plt_fde_location): New function.
1952         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1953         accessor function, and constructor param.
1954         (struct Post_fde, Post_fdes): Declare.
1955         (Cie::write): Add post_fdes param.
1956         * ehframe.cc (Fde::write): Use plt_fde_location.
1957         (struct Post_fde): Define.
1958         (Cie::write): Stash FDEs added post merge mapping.
1959         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1960         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1961         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1962         other FDEs.
1963         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1964         (Target_powerpc::has_glink): New function.
1965         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1966         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1967         glink_eh_frame_fde_32, default_fde): New data.
1968         (Stub_table::eh_frame_added_): New var.
1969         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1970         Make const.
1971         (Stub_table::add_eh_frame): New function.
1972         (Output_data_glink::add_eh_frame): New function.
1973         (Target_powerpc::make_glink_section): Call add_eh_frame.
1974
1975 2013-02-15  Ian Lance Taylor  <iant@google.com>
1976
1977         * options.h (DEFINE_uint64_alias): Define.
1978         (class General_options): Add -Ttext-segment as an alias for
1979         -Ttext.
1980
1981 2013-02-15  Alan Modra  <amodra@gmail.com>
1982
1983         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1984         (Stub_table::do_write): ..here, two places.
1985         (Stub_table::plt_call_size): Use it here too.
1986
1987 2013-02-11  Ian Lance Taylor  <iant@google.com>
1988
1989         * descriptors.cc (Descriptors::close_all): New function.
1990         * descriptors.h (class Descriptors): Declare close_all.
1991         (close_all_descriptors): New inline function.
1992         * plugin.cc: Include "descriptors.h".
1993         (Plugin_manager::cleanup): Call close_all_descriptors.
1994
1995 2013-02-06  Alan Modra  <amodra@gmail.com>
1996
1997         * README: Update coding style link.
1998
1999 2013-01-28  Cary Coutant  <ccoutant@google.com>
2000
2001         * dwp.cc (File_list): New typedef.
2002         (Dwo_name_info_reader): New class.
2003         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2004         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2005         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2006         (Dwo_file::read_executable): New function.
2007         (Dwo_file::read): Move common setup code to ...
2008         (Dwo_file::make_object): ... here.
2009         (dwp_options): Add --exec/-e.
2010         (usage): Likewise.
2011         (main): Likewise.
2012
2013 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2014
2015         * layout.cc (Layout::layout): Check for option text_reorder.
2016         (Layout::make_output_section): Ditto.
2017         * options.h (text_reorder): New option.
2018         * output.cc (Input_section_sort_compare): Remove special ordering
2019         of section names.
2020         (Output_section::
2021          Input_section_sort_section_name_special_ordering_compare::
2022          operator()): New function.
2023         (Output_section::sort_attached_input_sections): Use new sort function
2024         for .text.
2025         * output.h (Input_section_sort_section_name_special_ordering_compare):
2026         New struct.
2027         * testsuite/Makefile.am (text_section_grouping): Test option
2028         --no-text-reorder
2029         * testsuite/Makefile.in: Regenerate.
2030         * testsuite/text_section_grouping.sh: Check order of functions without
2031         default text reordering.
2032
2033 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2034
2035         * options.h (General_options): Change default to true for new_dtags.
2036
2037 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2038
2039         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2040         when enable_new_dtags is false.  Only add DT_RUNPATH when
2041         enable_new_dtags is true.
2042
2043 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2044
2045         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2046         used in declaration and definition consistent.
2047         (Target_powerpc::symval_for_branch): Ditto.
2048
2049 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2050
2051         * testsuite/plugin_final_layout.cc: Fix comment.
2052
2053 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2054
2055         * layout.cc (Layout::layout): Do not do default sorting for
2056         text sections when section ordering is specified.
2057         (make_output_section): Ditto.
2058         * testsuite/plugin_final_layout.cc: Name the function sections
2059         to catch reordering issues.
2060
2061 2013-01-15  Alan Modra  <amodra@gmail.com>
2062
2063         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2064         plt-thread-safe.
2065
2066 2013-01-15  Alan Modra  <amodra@gmail.com>
2067
2068         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2069         * testsuite/Makefile.in: Regenerate.
2070
2071 2013-01-14  Alan Modra  <amodra@gmail.com>
2072
2073         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2074         * testsuite/Makefile.in: Regenerate.
2075
2076 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2077
2078         PR bfd/14430
2079         Fix mingw gold build with plugins enabled
2080         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2081         * configure.ac: Export DLOPEN_LIBS and add headers check.
2082         * plugin.cc: Handle non-dlfcn case.
2083         * Makefile.in: Regenerate.
2084         * config.in: Regenerate.
2085         * configure: Regenerate.
2086         * testsuite/Makefile.in: Regenerate.
2087
2088 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2089
2090         * output.h (sort_attached_input_sections): Change to be public.
2091         * script-sections.cc
2092         (Output_section_definition::set_section_addresses): Sort
2093         attached input sections according to section order before linker
2094         script assigns section addresses.
2095         (Orphan_output_section::set_section_addresses): Sort
2096         attached input sections according to section order before linker
2097         script assigns section addresses.
2098         * Makefile.am (final_layout.sh): Use a simple linker script to
2099         check if section ordering still works.
2100         * Makefile.in: Regenerate.
2101
2102 2013-01-09  Ben Cheng  <bccheng@google.com>
2103
2104         * arm.cc (Target_arm::attributes_accept_div): New function.
2105         (Target_arm::attributes_forbid_div): New function.
2106         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2107         attribute using the same new functions as what bfd/elf32_arm.c
2108         does.
2109
2110 2013-01-07  Cary Coutant  <ccoutant@google.com>
2111
2112         PR gold/14993
2113         * output.cc (Output_section::add_input_section): For incremental
2114         updates, don't track input sections that are allocated from patch
2115         space.
2116
2117 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2118             Ian Lance Taylor  <iant@google.com>
2119
2120         PR gold/14897
2121         * configure.ac (--enable-ld): Removed.
2122         (install_as_default): Set to yes only for --enable-gold=default
2123         or --disable-ld.
2124         * configure: Regenerated.
2125
2126 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2127
2128         * options.h (General_options): Add -fuse-ld= for GCC linker
2129         option compatibility.
2130
2131 2013-01-04  Cary Coutant  <ccoutant@google.com>
2132
2133         * configure.ac: Fix typo restoring CXXFLAGS.
2134         * configure: Regenerate.
2135
2136 2013-01-04  Cary Coutant  <ccoutant@google.com>
2137
2138         * testsuite/Makefile.am (CXXLINK_S): New macro.
2139         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2140         * testsuite/Makefile.in: Regenerate.
2141
2142 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2143
2144         * version.cc (print_version): Update copyright year to 2013.
2145
2146 2012-12-20  Ian Lance Taylor  <iant@google.com>
2147
2148         * layout.cc (Layout::special_ordering_of_input_section): New
2149         function.
2150         (Layout::layout): If input section requires special ordering, must
2151         sort input sections.
2152         (Layout::make_output_section): May sort .text input sections.
2153         (Layout::is_section_name_prefix_grouped): Remove.
2154         * layout.h (class Layout): Declare
2155         special_ordering_of_input_section.  Don't declare
2156         is_section_name_prefix_grouped.
2157         * output.cc (Output_section::add_input_section): Revert last
2158         change.
2159         (Output_section::Input_section_sort::match_file_name): Don't crash
2160         if called on output section data.
2161         (Output_section::Input_section_sort_compare): Sort based on
2162         special ordering.
2163         (Output_section::Input_section_sort_section_order_index_compare):
2164         Revert last patch.
2165         (Output_section::sort_attached_input_sections): Likewise.
2166
2167 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2168
2169         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2170         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2171         * output.cc (Output_section::add_input_section): Check if section
2172         name contains special prefix.  Keep input sections to sort such
2173         sections.
2174         (Output_section::Input_section_sort_section_order_index_compare
2175          ::operator()): Group sections according to prefixes.
2176         (Output_section::sort_attached_input_sections): Add condition to
2177         Input_section_entry constructor call.
2178         * testsuite/Makefile.am (text_section_grouping): New test.
2179         * testsuite/Makefile.in: Regenerate.
2180         * testsuite/text_section_grouping.cc: New file.
2181         * testsuite/text_section_grouping.sh: New file.
2182
2183 2012-12-17  Nick Clifton  <nickc@redhat.com>
2184
2185         * Makefile.am: Add copyright notice.
2186         * NEWS: Likewise.
2187         * README: Likewise.
2188         * configure.ac: Likewise.
2189         * ftruncate.c: Likewise.
2190         * Makefile.in: Regenerate.
2191
2192 2012-12-14  Cary Coutant  <ccoutant@google.com>
2193
2194         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2195         --no-as-needed flag.
2196         (exception_separate_shared_12_test): Likewise.
2197         (incremental_copy_test): Likewise.
2198         * testsuite/Makefile.in: Regenerate.
2199
2200 2012-12-14  Cary Coutant  <ccoutant@google.com>
2201
2202         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2203         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2204
2205 2012-12-12  Alan Modra  <amodra@gmail.com>
2206
2207         * powerpc.cc (class Track_tls): New.
2208         (class Relocate, class Scan): Inherit Track_tls.
2209         (Target_powerpc::Scan::local, global): Track tls optimization
2210         and avoid creating plt entry for __tls_get_addr if all uses
2211         are optimized away.
2212         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2213
2214 2012-12-12  Alan Modra  <amodra@gmail.com>
2215
2216         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2217         Replace no_toc_optimize with toc_optimize.
2218         * output.h (Output_section::input_sections): Provide non-const variant.
2219         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2220         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2221         accessors.
2222         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2223         (class Sort_toc_sections): New.
2224         (Target_powerpc::do_finalize_sections): Sort toc sections.
2225         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2226
2227 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2228
2229         * testsuite/binary_unittest.cc (read_all): New function.
2230         (Sized_binary_test): Use it instead of ::read.
2231         * fileread.cc (do_read): Don't assume pread always reads the whole
2232         amount in a single call.
2233
2234 2012-12-10  Alan Modra  <amodra@gmail.com>
2235
2236         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2237         Set EM_PPC64 or EM_PPC here.
2238         (Target_selector_powerpc::do_recognize): Delete.
2239
2240 2012-12-10  Alan Modra  <amodra@gmail.com>
2241
2242         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2243         stub_table_.
2244         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2245
2246 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2247
2248         * testsuite/binary_unittest.cc (Sized_binary_test):
2249         Use open_descriptor rather than ::open.
2250
2251 2012-12-07  Alan Modra  <amodra@gmail.com>
2252
2253         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2254         typedef and invalid_address constant.
2255         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2256         instantiate constants.
2257
2258 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2259
2260         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2261         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2262         * aclocal.m4: Regenerate.
2263         * configure: Regenerate.
2264         * Makefile.in: Regenerate.
2265         * testsuite/Makefile.in: Regenerate.
2266
2267 2012-12-07  Alan Modra  <amodra@gmail.com>
2268
2269         * options.h (General_options): Add no_toc_optimize.
2270         * powerpc.cc (ok_lo_toc_insn): New function.
2271         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2272
2273 2012-12-06  Alan Modra  <amodra@gmail.com>
2274
2275         * options.h (General_options): Add plt_align, plt_static_chain,
2276         plt_thread_safe.  Update stub_group_size help text.
2277         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2278         for new plt_thread_safe_ var.
2279         (use_plt_offset): Correct comments.
2280         (Target_powerpc::do_relax): Look for thread creation symbols to
2281         determine default plt_thread_safe value.  Clear plt call stubs
2282         as well as branch stubs each iteration.
2283         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2284         insn constants.
2285         (l, hi, ha, write_insn): Move earlier.
2286         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2287         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2288         plt stubs too.
2289         (Stub_table::update_size): Adjust.
2290         (Stub_table::prev_size, set_prev_size): Delete.
2291         (Stub_table::stub_align): Let --plt-align affect result.
2292         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2293         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2294         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2295         (Stub_table::do_write): Support more stub variants.
2296
2297 2012-12-04  Alan Modra  <amodra@gmail.com>
2298
2299         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2300         (Target_powerpc::do_define_standard_symbols): New function.
2301
2302 2012-12-03  Alan Modra  <amodra@gmail.com>
2303
2304         * output.h: Formatting, whitespace.
2305
2306 2012-12-03  Alan Modra  <amodra@gmail.com>
2307
2308         * layout.h (Layout::get_executable_sections): Declare.
2309         * layout.cc (Layout::get_executable_sections): New function.
2310         * arm.cc (Target_arm::group_sections): Use it.
2311         (Arm_output_section::group_sections): Delete now redundant test.
2312         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2313         param to handle relative relocs.
2314         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2315         (Output_data_reloc::add_absolute): Adjust.
2316         (Output_data_reloc::add_relative): New function.
2317         (Output_data::reset_data_size): New function.
2318         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2319         (Output_section::set_addralign): New function.
2320         (Output_section::checkpoint_set_addralign): New function.
2321         (Output_section::clear_section_offsets_need_adjustment): New function.
2322         (Output_section::input_sections): Make public.
2323         * powerpc.cc (class Output_data_brlt_powerpc): New.
2324         (class Stub_table, class Stub_control): New.
2325         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2326         stub_table_, set_stub_table, stub_table): New vectors and accessor
2327         functions.
2328         (Target_powerpc::do_may_relax, do_relax, push_branch,
2329         new_stub_table, stub_tables, brlt_section, group_sections,
2330         add_branch_lookup_table, find_branch_lookup_table,
2331         write_branch_lookup_table, make_brlt_section): New functions.
2332         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2333         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2334         branch_info_): New vars.
2335         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2336         make call stubs here.
2337         (Output_data_glink): Remove all call stub handling from this class.
2338         (Target_powerpc::Scan::local, global): Save interesting branch
2339         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2340         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2341         functions on final link.
2342         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2343         Handle long branch destinations too.
2344         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2345         do_plt_address_for_local): Adjust lookup of plt call stubs.
2346
2347 2012-11-30  Alan Modra  <amodra@gmail.com>
2348
2349         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2350         relocs against protected symbols when building 32-bit shared libs.
2351
2352 2012-11-30  Alan Modra  <amodra@gmail.com>
2353
2354         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2355         param.  Call got_section() to make .got.  Update all callers
2356         and their callers and so on.
2357
2358 2012-11-30  Alan Modra  <amodra@gmail.com>
2359
2360         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2361         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2362         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2363         value if it already exists.
2364
2365 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2366
2367         PR gold/14858
2368         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2369
2370 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2371
2372         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2373         than bfc instruction for data sandboxing.
2374
2375 2012-11-08  Alan Modra  <amodra@gmail.com>
2376
2377         * po/POTFILES.in: Regenerate.
2378
2379 2012-11-05  Alan Modra  <amodra@gmail.com>
2380
2381         * configure.ac: Apply 2012-09-10 change to config.in here.
2382         * configure: Regenerate.
2383
2384 2012-11-05  Alan Modra  <amodra@gmail.com>
2385
2386         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2387         (struct Opd_ent): Use "Address" rather than "Offset".
2388         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2389         (Target_powerpc::got_section): Make public.
2390         (Target_powerpc::scan_relocs): Move code setting symbols..
2391         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2392         Create _SDA_BASE_ only when referenced.
2393
2394 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2395
2396         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2397         from last change.
2398
2399 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2400
2401         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2402         for offset_in_output_section parameter.
2403         (Sized_target::relocate_special_relocatable): Likewise.
2404         * arm.cc (Target_arm::relocate_relocs): Likewise.
2405         (Target_arm::relocate_special_relocatable): Likewise.
2406         * i386.cc (Target_i386::relocate_relocs): Likewise.
2407         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2408         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2409         * target-reloc.h (relocate_relocs): Likewise.
2410         * testsuite/testfile.cc (Target_test): Likewise.
2411         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2412         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2413
2414         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2415         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2416
2417         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2418         parameter, which is unused in the [!F_SETFD] case.
2419
2420         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2421         SYMNDX to off_t before comparing it to this->data_size().
2422         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2423         * incremental.cc (Output_section_incremental_inputs::do_write):
2424         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2425
2426         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2427
2428 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2429
2430         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2431         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2432         in EABI_VER5.
2433
2434 2012-10-29  Cary Coutant  <ccoutant@google.com>
2435
2436         * dwp.cc (usage): Add file and exit status parameters;
2437         add --help and --version options.
2438         (print_version): New function.
2439         (main): Add --help and --version options.
2440
2441 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2442
2443         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2444         final_layout_sequence.txt.
2445         * testsuite/Makefile.in: Regenerated.
2446
2447 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2448
2449         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2450         COMPILE generated by automake.
2451         (LINK1): Likewise.
2452         (CXXCOMPILE1): Likewise.
2453         (CXXLINK1): Likewise.
2454         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2455         (LINK): Likewise.
2456         (CXXCOMPILE): Likewise.
2457         (CXXLINK): Likewise.
2458         * testsuite/Makefile.in: Regenerated.
2459
2460 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2461
2462         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2463         on bad fwrite return.
2464
2465 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2466
2467         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2468         on val.
2469
2470 2012-10-23  Cary Coutant  <ccoutant@google.com>
2471
2472         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2473         * testsuite/Makefile.in: Regenerate.
2474         * testsuite/dwp_test.h: New source file.
2475         * testsuite/dwp_test_1.cc: New source file.
2476         * testsuite/dwp_test_1.s: New source file.
2477         * testsuite/dwp_test_1.sh: New source file.
2478         * testsuite/dwp_test_1b.cc: New source file.
2479         * testsuite/dwp_test_1b.s: New source file.
2480         * testsuite/dwp_test_2.cc: New source file.
2481         * testsuite/dwp_test_2.s: New source file.
2482         * testsuite/dwp_test_2.sh: New source file.
2483         * testsuite/dwp_test_main.cc: New source file.
2484         * testsuite/dwp_test_main.s: New source file.
2485
2486 2012-10-23  Cary Coutant  <ccoutant@google.com>
2487
2488         * dwp.h: New header file.
2489         * dwp.cc: New source file.
2490         * gold.h: Move shared declarations to system.h.
2491         * system.h: New header file.
2492         * Makefile.am: Add dwp.
2493         * Makefile.in: Regenerate.
2494
2495 2012-10-23  Cary Coutant  <ccoutant@google.com>
2496
2497         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2498         Dwarf_info_reader::read_from_pointer.
2499         (Dwarf_pubnames_table::read_header): Likewise.
2500         (Dwarf_pubnames_table::next_name): Likewise.
2501         (Dwarf_die::read_attributes): Likewise.
2502         (Dwarf_die::skip_attributes): Likewise.
2503         (Dwarf_info_reader::read_from_pointer): New function template.
2504         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2505         (Dwarf_pubnames_table): Likewise.
2506         (Dwarf_info_reader::read_from_pointer): New function template.
2507         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2508         Dwarf_pubnames_table ctor.
2509
2510 2012-10-23  Cary Coutant  <ccoutant@google.com>
2511
2512         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2513         abbrev_shndx.
2514         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2515         abbrev_shndx_.
2516         (Dwarf_info_reader::set_abbrev_shndx): New method.
2517         (Dwarf_info_reader::abbrev_shndx_): New data member.
2518
2519 2012-10-23  Cary Coutant  <ccoutant@google.com>
2520
2521         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2522         from object, not parameters.
2523         (Dwarf_info_reader::parse): Likewise.
2524         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2525         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2526         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2527         methods.
2528
2529 2012-10-23  Cary Coutant  <ccoutant@google.com>
2530
2531         * fileread.cc (Input_file::Input_file): New constructor.
2532         * fileread.h (class Input_file): Add new constructor.
2533
2534 2012-10-18  Alan Modra  <amodra@gmail.com>
2535
2536         PR gold/14727
2537         * object.cc (Relobj::is_section_name_included): Also match
2538         .sdata personality section.
2539
2540 2012-10-18  Alan Modra  <amodra@gmail.com>
2541
2542         * target-reloc.h (class Default_comdat_behavior): New, package up..
2543         (get_comdat_behaviour): ..this.
2544         (relocate_section): Add Relocate_comdat_behavior template arg,
2545         adjust code to suit.
2546         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2547         (Target_arm::scan_reloc_section): Likewise.
2548         * i386.cc (Target_i386::relocate_section): Likewise.
2549         * sparc.cc (Target_sparc::relocate_section): Likewise.
2550         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2551         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2552         * powerpc.cc (class Relocate_comdat_behavior): New.
2553         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2554         gold::relocate_section with new template arg.
2555
2556 2012-10-18  Alan Modra  <amodra@gmail.com>
2557
2558         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2559         dynamic relocs for GOT_TPREL got entries, without symbol if
2560         resolving locally.
2561         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2562         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2563         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2564
2565 2012-10-17  Alan Modra  <amodra@gmail.com>
2566
2567         PR gold/14726
2568         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2569
2570 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2571
2572         * layout.cc (Layout::include_section): Keep sections marked
2573         SHF_EXCLUDE when doing relocatable links.
2574
2575 2012-10-16  Alan Modra  <amodra@gmail.com>
2576
2577         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2578         (Target_powerpc::do_finalize_sections): Call it.
2579         (Output_data_save_res): New class and supporting functions.
2580         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2581         normal symbols defined in object files.
2582
2583 2012-10-12  Alan Modra  <amodra@gmail.com>
2584
2585         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2586         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2587         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2588         section if scan_opd_relocs not yet called.
2589         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2590
2591 2012-10-12  Alan Modra  <amodra@gmail.com>
2592
2593         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2594         add_local_ifunc_entry): Revert last change.
2595         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2596
2597 2012-10-05  Alan Modra  <amodra@gmail.com>
2598
2599         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2600         do_plt_address_for_global): New functions.
2601         (Output_data_got_powerpc::do_write): Don't segfault when linking
2602         statically.
2603         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2604         add_local_ifunc_entry): Return true on adding entry..
2605         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2606         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2607         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2608         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2609         set up symbols here.
2610         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2611         syms here.  Do so even when no .iplt.  Don't segfault when linking
2612         statically.
2613         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2614         new variants without reloc param.
2615         (Glink_sym_ent::Glink_sym_ent): Likewise.
2616         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2617         reloc when refs will resolve to plt call stub.
2618         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2619         R_PPC_PLTREL24 to resolve locally.
2620         (Target_powerpc::Scan::global): Correct ifunc handling.
2621         (Target_powerpc::Relocate::relocate): Correct local sym glink
2622         lookup.  Don't destroy "value" when we have a plt call stub,
2623         and when checking plt call validity.
2624         (Target_powerpc::do_dynsym_value): Simplify.
2625
2626 2012-10-05  Alan Modra  <amodra@gmail.com>
2627
2628         * i386.cc (Output_data_plt_i386::address_for_global,
2629         address_for_local): Add plt offset to returned value.  Adjust uses.
2630         * sparc.cc (Output_data_plt_sparc::address_for_global,
2631         address_for_local): Likewise.
2632         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2633         address_for_local): Likewise.
2634         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2635         address_for_local): Likewise.
2636         * target.h (Target::plt_address_for_global, plt_address_for_local):
2637         Update comment.
2638         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2639         (Output_data_got::Got_entry::write): Nor here.
2640         * output.h: Comment fix.
2641
2642 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2643
2644         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2645         global_offset_table_ value for larget got.
2646         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2647
2648 2012-09-29  Alan Modra  <amodra@gmail.com>
2649
2650         * powerpc.cc (Target_powerpc::iplt_): New output section.
2651         (Target_powerpc::iplt_section, make_iplt_section,
2652         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2653         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2654         Target_powerpc::plt_entry_count): Count iplt entries too.
2655         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2656         reloc section in constructor.  New params.
2657         (Target_powerpc::make_plt_section): Create reloc section here instead.
2658         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2659         functions.
2660         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2661         (Output_data_glink::add_entry, find_entry): New functions to
2662         deal with local syms.
2663         (Glink_sym_ent): Add support for local syms.
2664         (Output_data_glink::do_write): Handle ifunc plt entries.
2665         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2666         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2667         (Target_powerpc::Relocate::relocate): Likewise.
2668         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2669
2670 2012-09-25  Alan Modra  <amodra@gmail.com>
2671
2672         * object.h (Sized_relobj_file::adjust_local_symbol,
2673         do_adjust_local_symbol): New functions.
2674         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2675         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2676         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2677         and irregular opd entry spacing.
2678         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2679         (Global_symbol_visitor_opd): New functor.
2680         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2681         on deleted opd entries.
2682
2683 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2684
2685         * tilegx.cc: New file.
2686         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2687         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2688         * configure.tgt: Add entries for tilegx*.
2689         * configure.ac: Likewise.
2690         * Makefile.in: Rebuild.
2691         * configure: Likewise.
2692         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2693         tilegx.
2694
2695 2012-09-13  Alan Modra  <amodra@gmail.com>
2696
2697         * target-reloc.h (scan_relocs): Call scan.local for relocs
2698         against symbols in discarded sections.  Pass is_discarded
2699         param.
2700         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2701         Add is_discarded param.
2702         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2703         is_discarded to flag opd entry as discarded.  Don't emit dyn
2704         relocs on such entries.
2705         (Target_powerpc::Scan::global): Similarly detect and handle
2706         such opd entries.
2707         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2708         opd_ent_.  Update all uses.
2709         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2710         (Target_powerpc::relocate_section): Zero out discarded opd
2711         entry relocs.
2712
2713 2012-09-12  Ian Lance Taylor  <iant@google.com>
2714
2715         PR gold/14570
2716         * output.cc: Rename Output_data_got template parameter from size
2717         to got_size for all functions.  Compile all variants of
2718         Output_data_got.
2719         (Output_data_got::Got_entry::write): Correct use of size for
2720         symbol value.  Use local_is_tls rather than casting to
2721         Sized_relobj_file.
2722         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2723         (class Sized_relobj_file): Add do_local_is_tls.
2724         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2725
2726 2012-09-11  Alan Modra  <amodra@gmail.com>
2727
2728         PR gold/14566
2729         * layout.cc (Layout::set_segment_offsets): When using
2730         common-page-size alignment, ensure we are on a new max-page-size
2731         page.
2732         * output.cc (Output_segment::set_section_addresses): Use
2733         abi_pagesize, not common_pagesize for relro boundary.
2734         (Output_segment::set_offset): Likewise.
2735
2736 2012-09-11  Alan Modra  <amodra@gmail.com>
2737
2738         * output.h (Output_data_got::add_global_tls, add_local_tls,
2739         add_local_tls_pair): New functions.
2740         (Output_data_got::add_local_pair_with_rel): Remove second
2741         reloc param.  Expand comment.
2742         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2743         use_plt_or_tls_offset_, similarly for constructor param.
2744         (Output_data_got::Got_entry::write): Add got_index param.
2745         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2746         add_local_tls_pair): New functions.
2747         (Output_data_got::Got_entry::write): Handle tls symbols
2748         with use_plt_or_tls_offset_ set specially.
2749         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2750         (Output_data_got::do_write): Replace iterator with index, pass
2751         index to entry write function.
2752         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2753         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2754         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2755         call.
2756         * i386.cc (Target_i386::Scan::local): Likewise.
2757         * sparc.cc (Target_sparc::Scan::local): Likewise.
2758         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2759         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2760         do_tls_offset_for_global): New functions.
2761         (Target_powerpc::Scan::local): Correct TLS relocations and got
2762         entry values.
2763         (Target_powerpc::Scan::global): Don't emit unnecessary
2764         dynamic relocations on TLS GOT entries.
2765
2766 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2767
2768         * config.in: Disable sanity check for kfreebsd.
2769
2770 2012-09-10  Sterling Augustine  <saugustine@google.com>
2771
2772         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2773         (Gdb_index::pubtypes_read): New parameter.
2774         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2775         to calls.
2776         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2777         pubtypes_object_.
2778
2779 2012-09-09  Alan Modra  <amodra@gmail.com>
2780
2781         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2782         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2783         * gc.h (gc_process_relocs): Call target gc_add_reference.
2784         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2785         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2786         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2787         unnecessary cast.
2788         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2789         to cater for when we don't need code offset.  Update use.
2790         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2791         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2792         set_opd_valid): New functions.
2793         (Target_powerpc::do_gc_add_reference): New function.
2794         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2795         stashed refs.
2796         (Target_powerpc::do_gc_mark_symbol): New function.
2797
2798 2012-09-06  Cary Coutant  <ccoutant@google.com>
2799
2800         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2801         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2802         (Dwarf_die::skip_attributes): Likewise.
2803         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2804         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2805         (main): Call it.
2806         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2807
2808 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2809
2810         * testsuite/script_test_3.t: Add .got.plt output section
2811         statement.
2812         * testsuite/script_test_4.t: Likewise.
2813
2814 2012-09-05  Alan Modra  <amodra@gmail.com>
2815
2816         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2817         update all uses and lose "enum" when using type.
2818
2819 2012-09-05  Alan Modra  <amodra@gmail.com>
2820
2821         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2822         * configure: Regenerate.
2823         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2824         (plugin_final_layout.stdout): Likewise.
2825         (memory_test): Set page sizes to 0x1000.
2826         * testsuite/Makefile.in: Regenerate.
2827         * testsuite/discard_locals_test.sh: Add FIXME comment.
2828         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2829         * testsuite/pr14265.t: Add .got output section statement.
2830         * testsuite/script_test_2.t: Likewise.
2831         * testsuite/script_test_3.t: Likewise.
2832         * testsuite/script_test_4.t: Likewise.
2833         * testsuite/script_test_5.t: Likewise.
2834         * testsuite/script_test_6.t: Likewise.
2835         * testsuite/script_test_7.t: Likewise.
2836         * testsuite/script_test_9.t: Likewise.
2837
2838 2012-09-05  Alan Modra  <amodra@gmail.com>
2839
2840         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2841         (Powerpc_relocate_functions::Status): New typedef.
2842         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2843         (Target_powerpc::Scan::local): Handle REL64.
2844         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2845         for REL32 and REL64.
2846         (Target_powerpc::symval_for_branch): New function, extracted from..
2847         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2848         checks.  Report overflow errors.
2849
2850 2012-09-05  Alan Modra  <amodra@gmail.com>
2851
2852         * object.h (Sized_relobj_file::emit_relocs): Delete.
2853         (Sized_relobj_file::emit_relocs_reltype): Delete.
2854         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2855         relocate_relocs for --emit-relocs.
2856         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2857         * output.h: Update comment.
2858         (Output_segment::first_section): New function.
2859         (Output_segment::first_section_load_address): Use first_section.
2860         * output.cc (Output_segment::first_section): New function extracted..
2861         (Output_segment::first_section_load_address): ..from here.  Delete.
2862         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2863         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2864         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2865         adjust call to target.h function.
2866         * i386.cc (Target_i386): Likewise.
2867         * sparc.cc (Target_sparc): Likewise.
2868         * x86_64.cc (Target_x86_64): Likewise.
2869         * powerpc.cc (Target_powerpc): Likewise.
2870         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2871         first tls section has section symbol for optimised local dynamic
2872         output relocs.
2873         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2874         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2875         optimised tls code.
2876         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2877         Rename to relocate_relocs.  Update error message.
2878
2879 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2880
2881         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2882         --just-symbols.
2883
2884 2012-08-31  Alan Modra  <amodra@gmail.com>
2885
2886         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2887         (Powerpc_relobj::toc_base_offset): New stub function.
2888         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2889         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2890         (Target_powerpc::Relocate::enum skip_tls): New.
2891         (Target_powerpc::call_tls_get_addr_): New var.
2892         (Target_powerpc::is_branch_reloc): Move to file scope.
2893         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2894         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2895         New functions.
2896         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2897         (powerpc_info): Correct common_pagesize for ppc64.
2898         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2899         (Powerpc_relocate_functions): Add overflow check enums and functions.
2900         Add non-shift version of rela, rela_ua.  Delete all rel public
2901         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2902         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2903         addr16_ha3, addr14 functions.
2904         (Output_data_got_powerpc::add_constant_pair): New function.
2905         (Output_data_got_powerpc::got_base_offset): Likewise.
2906         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2907         (instruction constants): Sort, add some more.
2908         (Output_data_glink::do_write): Add and use Address typedef.  Use
2909         object->toc_base_offset() stub for 64-bit.
2910         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2911         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2912         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2913         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2914         Always treat .opd relocs as against locally defined symbol.
2915         Correct condition for RELATIVE relocs.
2916         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2917         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2918         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2919         calculations.  Handle TLS relocs, and more.  Add overflow
2920         checking and adjust for Powerpc_relocate_functions changes.
2921         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2922         Reinstate --emit-relocs code with FIXME.
2923
2924 2012-08-30  Alan Modra  <amodra@gmail.com>
2925
2926         * layout.cc (Layout::set_segment_offsets): Set p_align to
2927         abi_pagesize, not common_pagesize.
2928         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2929         to determine whether file header can go in segment.
2930
2931 2012-08-30  Alan Modra  <amodra@gmail.com>
2932
2933         * output.h (Output_reloc::Output_reloc <output section>): Add
2934         is_relative param.  Adjust calls.
2935         (Output_reloc::add_output_section_relative): New functions.
2936         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2937         is_relative.
2938         (Output_reloc::symbol_value): Handle SECTION_CODE.
2939
2940 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2941
2942         * gold.cc (queue_middle_tasks): Call layout again when unique
2943         segments for sections is desired.
2944         * layout.cc (Layout::Layout): Initialize new members.
2945         (Layout::get_output_section_flags): New function.
2946         (Layout::choose_output_section): Call get_output_section_flags.
2947         (Layout::layout): Make output section for mapping to a unique segment.
2948         (Layout::insert_section_segment_map): New function.
2949         (Layout::attach_allocated_section_to_segment): Make unique segment for
2950         output sections marked so.
2951         (Layout::segment_precedes): Check for unique segments when sorting.
2952         * layout.h (Layout::Unique_segment_info): New struct.
2953         (Layout::Section_segment_map): New typedef.
2954         (Layout::insert_section_segment_map): New function.
2955         (Layout::get_output_section_flags): New function.
2956         (Layout::is_unique_segment_for_sections_specified): New function.
2957         (Layout::set_unique_segment_for_sections_specified): New function.
2958         (Layout::unique_segment_for_sections_specified_): New member.
2959         (Layout::section_segment_map_): New member.
2960         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2961         Rename is_gc_pass_one to is_pass_one.
2962         Rename is_gc_pass_two to is_pass_two.
2963         Rename is_gc_or_icf to is_two_pass.
2964         Check for which pass based on whether symbols data is present.
2965         Make it two pass when unique segments for sections is desired.
2966         * output.cc (Output_section::Output_section): Initialize new
2967         members.
2968         * output.h (Output_section::is_unique_segment): New function.
2969         (Output_section::set_is_unique_segment): New function.
2970         (Output_section::is_unique_segment_): New member.
2971         (Output_section::extra_segment_flags): New function.
2972         (Output_section::set_extra_segment_flags): New function.
2973         (Output_section::extra_segment_flags_): New member.
2974         (Output_section::segment_alignment): New function.
2975         (Output_section::set_segment_alignment): New function.
2976         (Output_section::segment_alignment_): New member.
2977         (Output_segment::Output_segment): Initialize is_unique_segment_.
2978         (Output_segment::is_unique_segment): New function.
2979         (Output_segment::set_is_unique_segment): New function.
2980         (Output_segment::is_unique_segment_): New member.
2981         * plugin.cc (allow_unique_segment_for_sections): New function.
2982         (unique_segment_for_sections): New function.
2983         (Plugin::load): Add new functions to transfer vector.
2984         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2985         * Makefile.in: Regenerate.
2986         * testsuite/plugin_final_layout.sh: Check if unique segment
2987         functionality works.
2988         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2989         are available.
2990         (allow_unique_segment_for_sections): New global.
2991         (unique_segment_for_sections): New global.
2992         (claim_file_hook): Call allow_unique_segment_for_sections.
2993         (all_symbols_read_hook): Call unique_segment_for_sections.
2994
2995 2012-08-22  Cary Coutant  <ccoutant@google.com>
2996
2997         * layout.cc (Layout::include_section): Don't assert on GROUP
2998         sections with --emit-relocs.
2999
3000 2012-08-21  Cary Coutant  <ccoutant@google.com>
3001
3002         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3003         if --export-dynamic-symbol names an undef symbol.
3004
3005 2012-08-18  Alan Modra  <amodra@gmail.com>
3006
3007         * powerpc.cc: Formatting and white space.
3008         (Powerpc_relobj): Rename got2_section_ to special_.
3009         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3010         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3011         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3012         (Target_powerpc): Add Address typedef and invalid_address.  Use
3013         throughout.
3014         (Target_powerpc::is_branch_reloc): New function.
3015         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3016         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3017         for dst_mask, value and addend.
3018         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3019         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3020         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3021         uint16_t for 24-bit offset.  Use get_output_section_offset and
3022         check return.
3023         (Target_powerpc::Scan::local): Handle more relocs.
3024         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3025         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3026         Plug in toc restoring insn after plt calls.  Translate branches
3027         to function descriptor symbols to corresponding entry point.
3028         (Target_powerpc::relocate_for_relocatable): Check return from
3029         get_output_section_offset.
3030         * symtab.h: Comment typo.
3031
3032 2012-08-14  Ian Lance Taylor  <iant@google.com>
3033
3034         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3035         unsupported_relocal_local to call unsupported_reloc_global.
3036
3037 2012-08-14  Nick Clifton  <nickc@redhat.com>
3038
3039         PR ld/14265
3040         * script-sections.cc (Sections_element::output_section_name): Add
3041         keep return parameter.
3042         (Output_section_element::match_name): Add keep return parameter.
3043         Return the value of the keep_ member.
3044         * script-sections.h (class Output_section): Update
3045         output_section_name prototype.
3046         * layout.cc (Layout::keep_input_section): New public member
3047         function.
3048         (Layout::choose_output_section): Pass keep parameter to
3049         output_section_name.
3050         * layout.h (class Layout): Add keep_input_section.
3051         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3052         sections.
3053         * testsuite/Makefile.am: Add a test.
3054         * testsuite/Makefile.in: Regenerate.
3055         * testsuite/pr14265.c: Source file for the test.
3056         * testsuite/pr14265.t: Linker script for the test.
3057         * testsuite/pr14265.sh: Shell script for the test.
3058
3059 2012-08-14  Alan Modra  <amodra@gmail.com>
3060
3061         * target.h (Target::output_section_name): New function.
3062         (Target::do_output_section_name): New function.
3063         * layout.cc (Layout::choose_output_section): Call the above.
3064         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3065
3066 2012-08-14  Alan Modra  <amodra@gmail.com>
3067
3068         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3069         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3070         for replace_constant call.
3071         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3072         (Output_data_glink::do_print_to_mapfile): New function.
3073         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3074         (Target_powerpc::Relocate::relocate): Likewise.
3075
3076 2012-08-14  Alan Modra  <amodra@gmail.com>
3077
3078         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3079         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3080         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3081         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3082         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3083         here.
3084         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3085         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3086         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3087         here.
3088         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3089         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3090
3091 2012-08-12  Alan Modra  <amodra@gmail.com>
3092
3093         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3094         (glink insn constants): Use uint32_t.
3095         (Output_data_glink::add_entry): Use insert, not [] operator.
3096
3097 2012-08-11  Alan Modra  <amodra@gmail.com>
3098
3099         * object.h (Sized_relobj_file::find_shdr): New function.
3100         (Sized_relobj_file::find_special_sections): New function.
3101         * object.cc (Sized_relobj_file::find_shdr): New function.
3102         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3103         (Sized_relobj_file::find_special_sections): New function, split out..
3104         (Sized_relobj_file::do_read_symbols): ..from here.
3105         * output.h (Output_data_got::replace_constant): New function.
3106         (Output_data_got::num_entries): New function.
3107         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3108         (Output_data_got::got_offset): Protected rather than private.
3109         (Output_data_got::replace_got_entry): New function.
3110         * output.cc (Output_data_got::replace_got_entry): New function.
3111         * powerpc.cc (class Powerpc_relobj): New.
3112         (class Powerpc_relocate_functions): Delete all psymval variants or
3113         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3114         Implement _ha functions using corresponding _hi function.
3115         (Powerpc_relobj::find_special_sections): New function.
3116         (Target_powerpc::do_make_elf_object): New function.
3117         (class Output_data_got_powerpc): New.
3118         (class Output_data_glink): New.
3119         (class Powerpc_scan_relocatable_reloc): New.
3120         Many more changes througout file.
3121
3122 2012-08-09  Nick Clifton  <nickc@redhat.com>
3123
3124         * po/vi.po: Updated Vietnamese translation.
3125
3126 2012-08-07  Ian Lance Taylor  <iant@google.com>
3127
3128         * layout.cc (Layout::add_target_dynamic_tags): If
3129         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3130         plt_rel.
3131
3132 2012-07-30  Nick Clifton  <nickc@redhat.com>
3133
3134         * po/gold.pot: Updated template.
3135         * po/es.po: Updated Spanish translation.
3136
3137 2012-07-18  Cary Coutant  <ccoutant@google.com>
3138
3139         PR gold/14344
3140         * configure.ac: Add check for -gpubnames support.
3141         * configure: Regenerate.
3142         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3143         support; force -gno-pubnames.
3144         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3145         support.
3146         (gdb_index_test_4): New test.
3147         * testsuite/Makefile.in: Regenerate.
3148         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3149         * testsuite/gdb_index_test_2.sh: Likewise.
3150         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3151         * testsuite/gdb_index_test_4.sh: New script.
3152         * testsuite/gdb_index_test_comm.sh: New script with common code;
3153         don't look for space after colon.
3154
3155 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3156
3157         * gold.cc (queue_middle_tasks): Update function order only after
3158         deferred objects due to plugins are processed.
3159
3160 2012-07-11  Ian Lance Taylor  <iant@google.com>
3161
3162         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3163         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3164         (Target_arm::scan_reloc_for_stub): Likewise.
3165         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3166         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3167         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3168         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3169         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3170
3171 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3172             Ian Lance Taylor  <iant@google.com>
3173
3174         PR gold/14309
3175         * configure.ac: Test whether std::tr1::hash<off_t> works.
3176         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3177         needed.
3178         * output.h (class Output_fill): Add virtual destructor.
3179         * configure, config.in: Rebuild.
3180
3181 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3182
3183         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3184
3185 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3186
3187         * plugin.cc (Plugin::load): Handle position independent executables.
3188
3189 2012-06-06  Cary Coutant  <ccoutant@google.com>
3190
3191         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3192         add .debug_macro.
3193         (lines_only_debug_sections): Likewise.
3194         (gdb_fast_lookup_sections): New static array.
3195         (is_gdb_debug_section): Rename formal parameter.
3196         (is_lines_only_debug_section): Likewise.
3197         (is_gdb_fast_lookup_section): New function.
3198         (Layout::include_section): Check for ".zdebug_" prefix; pass
3199         section name suffix to is_gdb_debug_section, et al.; check for
3200         fast-lookup sections when building .gdb_index.
3201         * options.h (--strip-debug-gdb): Update GDB version number.
3202
3203 2012-06-06  Cary Coutant  <ccoutant@google.com>
3204
3205         * configure.ac: Add check for fallocate.
3206         * configure: Regenerate.
3207         * config.in: Regenerate.
3208
3209         * options.h (class General_options): Add --mmap-output-file and
3210         --posix-fallocate options.
3211         * output.cc: (posix_fallocate): Remove; replace with...
3212         (gold_fallocate): New function.
3213         (Output_file::map_no_anonymous): Call gold_fallocate.
3214         (Output_file::map): Check --mmap-output-file option.
3215
3216 2012-06-05  Jing Yu  <jingyu@google.com>
3217
3218         * gold.h (textdomain): Add do {} to empty while(0).
3219         (bindtextdomain): Likewise.
3220
3221 2012-06-04  Cary Coutant  <ccoutant@google.com>
3222
3223         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3224         has_dynsym_index.
3225
3226 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3227
3228         * symtab.cc (Symbol_table::define_special_symbol):
3229         Initialize *poldsym to prevent uninitialized variable errors.
3230
3231 2012-05-23  Cary Coutant  <ccoutant@google.com>
3232
3233         * layout.cc (Layout::section_name_mapping): Add rules to handle
3234         exact match on .data.rel.ro.local or .data.rel.ro.
3235         (Layout::output_section_name): Check for exact matches.
3236
3237 2012-05-23  Cary Coutant  <ccoutant@google.com>
3238
3239         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3240         more carefully.
3241
3242 2012-05-22  Cary Coutant  <ccoutant@google.com>
3243
3244         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3245         object before exporting symbol.
3246
3247 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3248
3249         * testsuite/tls_test.cc: Include "config.h" first.
3250         * testsuite/tls_test_c.c: Likewise.
3251
3252 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3253             Nick Clifton  <nickc@redhat.com>
3254
3255         PR 14072
3256         * configure.in: Add check that sysdep.h has been included before
3257         any system header files.
3258         * configure: Regenerate.
3259         * config.in: Regenerate.
3260
3261 2012-05-14  Cary Coutant  <ccoutant@google.com>
3262
3263         * layout.cc (Layout::make_output_section): Mark .tdata section
3264         as RELRO.
3265         * testsuite/relro_test.cc: Add a TLS variable.
3266
3267 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3268
3269         PR gold/14091
3270         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3271         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3272         R_X86_64_64.
3273
3274 2012-05-08  Cary Coutant  <ccoutant@google.com>
3275
3276         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3277         (lines_only_debug_sections): Likewise.
3278
3279 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3280
3281         * nacl.cc: New file.
3282         * nacl.h: New file.
3283         * Makefile.am (CCFILES, HFILES): Add them.
3284         * Makefile.in: Regenerate.
3285         * i386.cc (Output_data_plt_i386_nacl): New class.
3286         (Output_data_plt_i386_nacl_exec): New class.
3287         (Output_data_plt_i386_nacl_dyn): New class.
3288         (Target_i386_nacl): New class.
3289         (Target_selector_i386_nacl): New class.
3290         (target_selector_i386): Use it instead of Target_selector_i386.
3291         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3292         (Target_x86_64_nacl): New class.
3293         (Target_selector_x86_64_nacl): New class.
3294         (target_selector_x86_64, target_selector_x32): Use it instead of
3295         Target_selector_x86_64.
3296         * arm.cc (Output_data_plt_arm_nacl): New class.
3297         (Target_arm_nacl): New class.
3298         (Target_selector_arm_nacl): New class.
3299         (target_selector_arm, target_selector_armbe): Use it instead of
3300         Target_selector_arm.
3301
3302         * target-select.cc (select_target): Take new Input_file* and off_t
3303         arguments, pass them on to recognize method of selector.
3304         * object.cc (make_elf_sized_object): Update caller.
3305         * parameters.cc (parameters_force_valid_target): Likewise.
3306         * incremental.cc (make_sized_incremental_binary): Likewise.
3307         * target-select.h: Update decl.
3308         (Target_selector::recognize): Take new Input_file* argument,
3309         pass it on to do_recognize.
3310         (Target_selector::do_recognize): Take new Input_file* argument.
3311         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3312         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3313         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3314         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3315
3316         * target.h (Target::Target_info): New members isolate_execinstr
3317         and rosegment_gap.
3318         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3319         * arm.cc (Target_arm::arm_info): Update initializer.
3320         * i386.cc (Target_i386::i386_info): Likewise.
3321         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3322         * sparc.cc (Target_sparc::sparc_info): Likewise.
3323         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3324         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3325         * layout.cc (Layout::attach_allocated_section_to_segment):
3326         Take new const Target* argument.  If target->isolate_execinstr(), act
3327         like --rosegment.
3328         (Layout::find_first_load_seg): Take new const Target* argument;
3329         if target->isolate_execinstr(), reject PF_X segments.
3330         (Layout::relaxation_loop_body): Update caller.
3331         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3332         reset file offset to zero when we hit LOAD_SEG, and then do a second
3333         loop over the segments before LOAD_SEG to reassign offsets after
3334         addresses have been determined.  Handle target->rosegment_gap().
3335         (Layout::attach_section_to_segment): Take new const Target* argument;
3336         pass it to attach_allocated_section_to_segment.
3337         (Layout::make_output_section): Update caller.
3338         (Layout::attach_sections_to_segments): Take new const Target* argument;
3339         pass it to attach_section_to_segment.
3340         * gold.cc (queue_middle_tasks): Update caller.
3341         * layout.h (Layout): Update method decls with new arguments.
3342
3343         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3344         Target_info pointer to use.
3345         (Target_arm::do_make_data_plt): New virtual method.
3346         (Target_arm::make_data_plt): New method that calls it.
3347         (Target_arm::make_plt_entry): Use it.
3348         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3349         for the section alignment.
3350         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3351         method.
3352         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3353         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3354         method.
3355         (Output_data_plt_arm::get_plt_entry_size): Call it.
3356         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3357         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3358         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3359         method.
3360         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3361         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3362         method instead of sizeof(plt_entry).
3363         (Output_data_plt_arm::add_entry): Likewise.
3364         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3365         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3366         than static method.
3367         (Target_arm::plt_entry_size): Likewise.
3368         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3369         Move to ...
3370         (Output_data_plt_arm_standard): ... here, new class.
3371         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3372         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3373         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3374
3375         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3376         Take additional argument for the PLT entry size.
3377         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3378         Use get_plt_entry_size method rather than plt_entry_size variable.
3379         (Output_data_plt_x86_64::reserve_slot): Likewise.
3380         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3381         (Output_data_plt_x86_64::add_entry): Likewise.
3382         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3383         (Output_data_plt_x86_64::address_for_global): Likewise.
3384         (Output_data_plt_x86_64::address_for_local): Likewise.
3385         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3386         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3387         Make method non-static.
3388         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3389         method.
3390         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3391         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3392         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3393         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3394         virtual method.
3395         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3396         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3397         virtual method.
3398         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3399         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3400         virtual method.
3401         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3402         (Output_data_plt_x86_64::plt_entry_size)
3403         (Output_data_plt_x86_64::first_plt_entry)
3404         (Output_data_plt_x86_64::plt_entry)
3405         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3406         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3407         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3408         (Output_data_plt_x86_64_standard): ... here, new class.
3409         (Target_x86_64::Target_x86_64): Take optional argument for the
3410         Target_info pointer to use.
3411         (Target_x86_64::do_make_data_plt): New virtual method.
3412         (Target_x86_64::make_data_plt): New method to call it.
3413         (Target_x86_64::init_got_plt_for_update): Use that.
3414         Call this->plt_->add_eh_frame method here.
3415         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3416         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3417         rather than static method.
3418         (Target_x86_64::plt_entry_size): Likewise.
3419         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3420         rather than plt_entry_size variable.  Move guts of PLT filling to...
3421         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3422         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3423         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3424
3425         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3426         additional argument for the section alignment.
3427         Don't do add_eh_frame_for_plt here.
3428         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3429         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3430         variable.
3431         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3432         method.
3433         (Output_data_plt_i386::get_plt_entry_size): Call it.
3434         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3435         (Output_data_plt_i386::add_eh_frame): New method to call it.
3436         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3437         method.
3438         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3439         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3440         method.
3441         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3442         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3443         method instead of plt_entry_size.
3444         (Output_data_plt_i386::plt_entry_size)
3445         (Output_data_plt_i386::plt_eh_frame_fde_size)
3446         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3447         (Output_data_plt_i386_standard): ... here, new class.
3448         (Output_data_plt_i386_exec): New class.
3449         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3450         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3451         (Output_data_plt_i386::exec_plt_entry): Move to ...
3452         (Output_data_plt_i386_exec::plt_entry): ... here.
3453         (Output_data_plt_i386_dyn): New class.
3454         (Output_data_plt_i386::first_plt_entry): Move to ...
3455         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3456         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3457         (Output_data_plt_i386_dyn::plt_entry): ... here.
3458         (Target_i386::Target_i386): Take optional argument for the Target_info
3459         pointer to use.
3460         (Target_i386::do_make_data_plt): New virtual method.
3461         (Target_i386::make_data_plt): New method to call it.
3462         (Target_i386::make_plt_section): Use that.
3463         Call this->plt_->add_eh_frame method here.
3464         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3465         rather than plt_entry_size variable.
3466         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3467         (Output_data_plt_i386::address_for_local): Likewise.
3468         (Output_data_plt_i386::do_write): Likewise.
3469         Move guts of PLT filling to...
3470         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3471         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3472         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3473         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3474
3475 2012-05-01  Cary Coutant  <ccoutant@google.com>
3476
3477         * dwarf_reader.cc (Dwarf_die::read_attributes)
3478         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3479         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3480         * reduced_debug_output.cc
3481         (Output_reduced_debug_info_section::get_die_end): Remove
3482         DW_FORM_GNU_ref_index.  Add default case.
3483
3484 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3485
3486         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3487         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3488         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3489         DW_AT_high_pc as offset from DW_AT_low_pc.
3490
3491         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3492         * testsuite/Makefile.in: Regenerate.
3493         * testsuite/gdb_index_test_3.c: New test source file.
3494         * testsuite/gdb_index_test_3.sh: New test source file.
3495
3496 2012-04-25  Ian Lance Taylor  <iant@google.com>
3497
3498         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3499         pointer.
3500         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3501         as a class, not a struct.
3502         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3503         (Target_arm::apply_cortex_a8_workaround): Likewise.
3504         * gc.h: Declare Reloc_types as a struct, not a class.
3505         * object.h: Declare Symbols_data as a struct.
3506         * reloc.h: Declare Read_relocs_data as a struct.
3507         * target.h: Declare Relocate_info as a struct.
3508
3509 2012-04-24  David S. Miller  <davem@davemloft.net>
3510
3511         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3512         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3513         and R_SPARC_WPLT30.
3514
3515 2012-04-24  Cary Coutant  <ccoutant@google.com>
3516
3517         * incremental-dump.cc (find_input_containing_global): Replace
3518         magic number with symbolic constant.
3519         (dump_incremental_inputs): Update version number.
3520         * incremental.cc (Output_section_incremental_inputs): Update version
3521         number; import symbolic constants from Incremental_inputs_reader.
3522         (Incremental_inputs::create_data_sections): Align relocations
3523         section correctly for 64-bit targets.
3524         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3525         constants; add padding.
3526         (Output_section_incremental_inputs::write_header): Add assert for
3527         header_size.
3528         (Output_section_incremental_inputs::write_input_files): Add assert
3529         for input_entry_size.
3530         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3531         add assert for object_info_size, input_section_entry_size,
3532         global_sym_entry_size.
3533         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3534         for data structure sizes; use them.
3535         (Incremental_input_entry_reader): Import symbolic constants from
3536         Incremental_inputs_reader; use them.
3537
3538 2012-04-23  David S. Miller  <davem@davemloft.net>
3539
3540         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3541         and elf_flags_set_.
3542         (Target_sparc::Target_sparc): Initialize new fields.
3543         (Target_sparc::do_make_elf_object): New function.
3544         (Target_sparc::do_adjust_elf_header): New function.
3545
3546 2012-04-23  Cary Coutant  <ccoutant@google.com>
3547
3548         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3549         CU range table of gdb index.
3550
3551 2012-04-20  David S. Miller  <davem@davemloft.net>
3552
3553         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3554         instead of false.
3555
3556 2012-04-16  David S. Miller  <davem@davemloft.net>
3557
3558         * sparc.cc (Target_sparc::got_address): New function.
3559         (Sparc_relocate_functions::gdop_hix22): New function.
3560         (Sparc_relocate_functions::gdop_lox10): New function.
3561         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3562         relocs.
3563         (Target_sparc::Scan::local): Likewise if the global symbol is not
3564         preemptible and is not IFUNC.
3565         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3566         transformations for local and non-preemptible non-IFUNC global
3567         symbols.
3568
3569         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3570         writing out 64-bit part of ranges.
3571
3572         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3573         -fpic and -fpie respectively.
3574         * Makefile.in: Regenerate.
3575
3576         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3577         (Target_sparc::Target_sparc): Initialize new field.
3578         (Target_sparc::do_plt_section_for_global): New function.
3579         (Target_sparc::do_plt_section_for_local): New function.
3580         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3581         (Target_sparc::make_plt_section): New function, broken out of
3582         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3583         (Target_sparc::make_plt_entry): Call make_plt_section.
3584         (Target_sparc::make_local_ifunc_plt_entry): New function.
3585         (Target_sparc::rela_ifunc_section): New function.
3586         (Target_sparc::plt_section): Remove const.
3587         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3588         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3589         and ifunc_count_ fields.
3590         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3591         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3592         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3593         (Output_data_plt_sparc::rela_ifunc): New function.
3594         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3595         (Output_data_plt_sparc::has_ifunc_section): New function.
3596         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3597         (Output_data_plt_sparc::address_for_global): New function.
3598         (Output_data_plt_sparc::address_for_local): New function.
3599         (Output_data_plt_sparc::plt_index_to_offset): New function.
3600         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3601         and entry_count.
3602         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3603         entry_count.
3604         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3605         R_SPARC_JMP_IREL to switch.
3606         (Target_sparc::Scan::check_non_pic): Likewise.
3607         (Target_sparc::Scan::local): Handle IFUNC symbols.
3608         (Target_sparc::Scan::local): Likewise.
3609         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3610         and plt_address_for_local.
3611         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3612         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3613
3614         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3615         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3616         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3617         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3618         global relocs too.
3619         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3620         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3621         calls.
3622         * sparc.cc (Target_sparc::Scan::global): Likewise.
3623         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3624
3625 2012-04-16  Cary Coutant  <ccoutant@google.com>
3626
3627         * archive.cc (Library_base::should_include_member): Check for
3628         --export-dynamic-symbol.
3629         * options.h (class General_options): Add --export-dynamic-symbol.
3630         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3631         --export-dynamic-symbol.
3632         (Symbol_table::gc_mark_undef_symbols): Likewise.
3633         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3634
3635 2012-04-12  David S. Miller  <davem@davemloft.net>
3636
3637         * sparc.cc (Reloc::wdisp10): New relocation method.
3638         (Reloc::h34): Likewise.
3639         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3640         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3641         R_SPARC_WDISP10.
3642         (Target_sparc::Scan::local): Likewise.
3643         (Target_sparc::Scan::global): Likewise.
3644         (Target_sparc::Relocate::relocate): Likewise.
3645
3646 2012-04-09  Cary Coutant  <ccoutant@google.com>
3647
3648         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3649         low_pc == 0.
3650
3651 2012-04-06  Ian Lance Taylor  <iant@google.com>
3652
3653         * timer.cc: #include <unistd.h>.
3654
3655 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3656
3657         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3658         * config.in: Regenerate.
3659         * configure: Regenerate.
3660
3661 2012-04-05  Nick Clifton  <nickc@redhat.com>
3662
3663         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3664         (AM_LC_MESSAGES): Add.
3665         * aclocal.m4: Regenerate.
3666         * config.in: Regenerate.
3667         * configure: Regenerate.
3668
3669 2012-03-21  Cary Coutant  <ccoutant@google.com>
3670
3671         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3672         * Makefile.in: Regenerate.
3673         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3674         (Sized_elf_reloc_mapper::symbol_section): New function.
3675         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3676         (make_elf_reloc_mapper): New function.
3677         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3678         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3679         (Dwarf_abbrev_table::do_get_abbrev): New function.
3680         (Dwarf_ranges_table::read_ranges_table): New function.
3681         (Dwarf_ranges_table::read_range_list): New function.
3682         (Dwarf_pubnames_table::read_section): New function.
3683         (Dwarf_pubnames_table::read_header): New function.
3684         (Dwarf_pubnames_table::next_name): New function.
3685         (Dwarf_die::Dwarf_die): New function.
3686         (Dwarf_die::read_attributes): New function.
3687         (Dwarf_die::skip_attributes): New function.
3688         (Dwarf_die::set_name): New function.
3689         (Dwarf_die::set_linkage_name): New function.
3690         (Dwarf_die::attribute): New function.
3691         (Dwarf_die::string_attribute): New function.
3692         (Dwarf_die::int_attribute): New function.
3693         (Dwarf_die::uint_attribute): New function.
3694         (Dwarf_die::ref_attribute): New function.
3695         (Dwarf_die::child_offset): New function.
3696         (Dwarf_die::sibling_offset): New function.
3697         (Dwarf_info_reader::check_buffer): New function.
3698         (Dwarf_info_reader::parse): New function.
3699         (Dwarf_info_reader::do_parse): New function.
3700         (Dwarf_info_reader::do_read_string_table): New function.
3701         (Dwarf_info_reader::lookup_reloc): New function.
3702         (Dwarf_info_reader::get_string): New function.
3703         (Dwarf_info_reader::visit_compilation_unit): New function.
3704         (Dwarf_info_reader::visit_type_unit): New function.
3705         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3706         Sized_elf_reloc_mapper.
3707         (Sized_dwarf_line_info::symbol_section): Remove function.
3708         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3709         (Sized_dwarf_line_info::read_line_mappings): Remove object
3710         parameter, adjust callers.
3711         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3712         * dwarf_reader.h: Include <sys/types.h>.
3713         (class Track_relocs): Remove forward declaration.
3714         (class Elf_reloc_mapper): New class.
3715         (class Sized_elf_reloc_mapper): New class.
3716         (class Dwarf_abbrev_table): New class.
3717         (class Dwarf_range_list): New class.
3718         (class Dwarf_ranges_table): New class.
3719         (class Dwarf_pubnames_table): New class.
3720         (class Dwarf_die): New class.
3721         (class Dwarf_info_reader): New class.
3722         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3723         (Sized_dwarf_line_info::symbol_section): Remove member function.
3724         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3725         base class.
3726         * gdb-index.cc: New source file.
3727         * gdb-index.h: New source file.
3728         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3729         and .debug_types sections, call Layout::add_to_gdb_index.
3730         (Sized_relobj_incr::do_section_name): Implement.
3731         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3732         return type; Implement.
3733         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3734         return type.
3735         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3736         parameter list and return type.
3737         (Sized_incr_dynobj::do_section_contents): Likewise.
3738         * layout.cc: Include gdb-index.h.
3739         (Layout::Layout): Initialize gdb_index_data_.
3740         (Layout::init_fixed_output_section): Check for .gdb_index section.
3741         (Layout::add_to_gdb_index): New function. Instantiate.
3742         * layout.h: Add forward declaration for class Gdb_index.
3743         (Layout::add_to_gdb_index): New member function.
3744         (Layout::gdb_index_data_): New data member.
3745         * main.cc: Include gdb-index.h.
3746         (main): Print statistics for gdb index.
3747         * object.cc (Object::section_contents): Move code into
3748         do_section_contents.
3749         (need_decompressed_section): Check for sections needed when building
3750         gdb index.
3751         (build_compressed_section_map): Likewise.
3752         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3753         gdb index.
3754         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3755         sections; call Layout::add_to_gdb_index.
3756         (Sized_relobj_file::do_decompressed_section_contents): Call
3757         do_section_contents directly.
3758         * object.h (Object::do_section_contents): Adjust parameter list and
3759         return type.
3760         (Object::do_decompressed_section_contents): Call do_section_contents
3761         directly.
3762         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3763         return type.
3764         * options.h (class General_options): Add --gdb-index option.
3765         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3766         list and return type.
3767         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3768         * reloc.h (Track_relocs::checkpoint): New function.
3769         (Track_relocs::reset): New function.
3770
3771         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3772         New test cases.
3773         * testsuite/Makefile.in: Regenerate.
3774         * testsuite/gdb_index_test.cc: New test source file.
3775         * testsuite/gdb_index_test_1.sh: New test source file.
3776         * testsuite/gdb_index_test_2.sh: New test source file.
3777
3778 2012-03-19  Doug Kwan  <dougkwan@google.com>
3779
3780         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3781         (Target_arm::do_finalize_sections): Remove code which defines
3782         __exidx_start and __exidx_end.  Make symbol table parameter
3783         anonymous as it is not used.
3784         * gold.cc (queue_middle_tasks): Call target hook to define any
3785         target-specific symbols.
3786         * target.h (Target::define_standard_symbols): New method.
3787         (Target::do_define_standard_symbols): Same.
3788         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3789         * testsuite/Makefile.in: Regenerate.
3790         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3791         and __exidx_end.
3792         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3793         relocations are generated for __exidx_start and __exidx_end.
3794
3795 2012-03-16  Doug Kwan  <dougkwan@google.com>
3796
3797         * testsuite/Makefile.am: Disable test initpri3b.
3798         * testsuite/Makefile.in: Regenerate.
3799
3800 2012-03-15  Doug Kwan  <dougkwan@google.com>
3801
3802         * arm.cc (Target_arm::got_section): Make .got section read-only
3803         if -z now is given.
3804
3805 2012-03-15  Ian Lance Taylor  <iant@google.com>
3806
3807         PR gold/13850
3808         * layout.cc (Layout::make_output_section): Correctly mark
3809         SHT_INIT_ARRAY, et. al., as relro.
3810
3811 2012-03-14  Doug Kwan  <dougkwan@google.com>
3812
3813         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3814         dynamic relocations for protected symbols in shared objects.
3815
3816 2012-03-13  Ian Lance Taylor  <iant@google.com>
3817
3818         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3819         keep the larger alignment.
3820
3821 2012-03-12  Cary Coutant  <ccoutant@google.com>
3822
3823         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3824         handling of DW_LNE_define_file.
3825
3826 2012-03-12  Cary Coutant  <ccoutant@google.com>
3827
3828         * reduced_debug_output.cc
3829         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3830         codes to switch.
3831
3832 2012-02-29  Cary Coutant  <ccoutant@google.com>
3833
3834         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3835
3836 2012-02-29  Cary Coutant  <ccoutant@google.com>
3837
3838         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3839         Call Object::decompressed_section_contents.
3840         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3841         New dtor.
3842         (Sized_dwarf_line_info::buffer_start_): New data member.
3843         * merge.cc (Output_merge_data::do_add_input_section): Call
3844         Object::decompressed_section_contents.
3845         (Output_merge_string::do_add_input_section): Likewise.
3846         * object.cc (need_decompressed_section): New function.
3847         (build_compressed_section_map): Decompress sections needed later.
3848         (Sized_relobj_file::do_decompressed_section_contents): New function.
3849         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3850         * object.h (Object::decompressed_section_contents): New function.
3851         (Object::discard_decompressed_sections): New function.
3852         (Object::do_decompressed_section_contents): New function.
3853         (Object::do_discard_decompressed_sections): New function.
3854         (Compressed_section_info): New type.
3855         (Compressed_section_map): Include decompressed section contents.
3856         (Sized_relobj_file::do_decompressed_section_contents): New function.
3857         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3858
3859 2012-02-16  Cary Coutant  <ccoutant@google.com>
3860
3861         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3862         * testsuite/Makefile.in: Regenerate.
3863
3864 2012-02-14  Cary Coutant  <ccoutant@google.com>
3865
3866         * options.cc (General_options::finalize): Disallow -pie and -static.
3867
3868 2012-02-03  Doug Kwan  <dougkwan@google.com>
3869
3870         * arm.cc (Arm_relocate_functions::abs8,
3871         Arm_relocate_functions::abs16): Use
3872         Bits::has_signed_unsigned_overflow32.
3873         (Arm_relocate_functions::thm_abs8): Correct range of
3874         overflow check.
3875         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3876         in assertions.
3877
3878 2012-02-02  Doug Kwan  <dougkwan@google.com>
3879
3880         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3881         position independent outputs, not just shared objects.
3882
3883 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3884
3885         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3886         * configure: Regenerated.
3887
3888 2012-01-27  Ian Lance Taylor  <iant@google.com>
3889
3890         * reloc.h (Bits): New class with static functions, copied from
3891         namespace utils in arm.cc.
3892         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3893         instead.
3894
3895 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3896
3897         * incremental.cc (write_info_blocks): Correct relocation offset.
3898
3899 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3900
3901         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3902         (Relocate::tls_gd_to_le): Likewise.
3903
3904 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3905
3906         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3907
3908 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3909
3910         * configure.ac: Check if -mcmodel=medium works.
3911         * configure: Regenerated.
3912
3913 2012-01-24  Cary Coutant  <ccoutant@google.com>
3914
3915         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3916         definition and ...
3917         (read_unsigned_LEB_128_x): ... this new function.
3918         (read_signed_LEB_128): Replaced with inline definition and ...
3919         (read_signed_LEB_128_x): ... this new function.
3920         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3921         (read_unsigned_LEB_128): Add inline definition.
3922         (read_signed_LEB_128_x): New function.
3923         (read_signed_LEB_128): Add inline definition.
3924         * testsuite/Makefile.am (leb128_unittest): New unit test.
3925         * testsuite/Makefile.in: Regenerate.
3926         * testsuite/leb128_unittest.cc: New unit test.
3927
3928 2012-01-23  Ian Lance Taylor  <iant@google.com>
3929
3930         PR gold/13617
3931         * i386.cc (Target_i386::do_code_fill): When using a jmp
3932         instruction, pad with nop instructions.
3933         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3934
3935 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3936
3937         * x86_64.cc (gc_process_relocs): Add typename on types used in
3938         template.
3939         (scan_relocs): Likewise.
3940         (relocate_section): Likewise.
3941         (apply_relocation): Likewise.
3942
3943 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3944
3945         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3946         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3947         under x32.
3948
3949 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3950
3951         * x86_64.cc: Initial support for x32.
3952
3953 2012-01-03  Cary Coutant  <ccoutant@google.com>
3954
3955         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3956         Use abstract base class for GOT.
3957         * gold/output.h (class Output_data_got_base): New abstract base class.
3958         (class Output_data_got): Derive from new base class, adjust ctors.
3959         (Output_data_got::reserve_slot): Make virtual; rename to
3960         do_reserve_slot; Adjust callers.
3961         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3962         pointer to abstract base class.
3963         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3964
3965 2011-12-18  Ian Lance Taylor  <iant@google.com>
3966
3967         * object.h (Relobj::local_symbol_value): New function.
3968         (Relobj::local_plt_offset): New function.
3969         (Relobj::local_has_got_offset): New function.
3970         (Relobj::local_got_offset): New function.
3971         (Relobj::set_local_got_offset): New function.
3972         (Relobj::do_local_symbol_value): New pure virtual function.
3973         (Relobj::do_local_plt_offset): Likewise.
3974         (Relobj::do_local_has_got_offset): Likewise.
3975         (Relobj::do_local_got_offset): Likewise.
3976         (Relobj::do_set_local_got_offset): Likewise.
3977         (Sized_relobj::do_local_has_got_offset): Rename from
3978         local_has_got_offset.
3979         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3980         (Sized_relobj::do_set_local_got_offset): Rename from
3981         set_local_got_offset.
3982         (Sized_relobj_file::do_local_plt_offset): Rename from
3983         local_plt_offset.
3984         (Sized_relobj_file::do_local_symbol_value): New function.
3985         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3986         local_plt_offset.
3987         * output.cc (Output_data_got::Got_entry::write): Change object to
3988         Relobj.  Use local_symbol_value.
3989         (Output_data_got::add_global_with_rel): Change rel_dyn to
3990         Output_data_reloc_generic*.  Use add_global_generic.
3991         (Output_data_got::add_global_with_rela): Remove.  Change all
3992         callers to use add_global_with_rel.
3993         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3994         Output_data_reloc_generic*.  Use add_global_generic.
3995         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3996         callers to use add_global_pair_with_rel.
3997         (Output_data_got::add_local): Change object to Relobj*.
3998         (Output_data_got::add_local_plt): Likewise.
3999         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4000         change rel_dyn to Output_data_reloc_generic*.  Use
4001         add_local_generic.
4002         (Output_data_got::add_local_with_rela): Remove.  Change all
4003         callers to use all_local_with_rel.
4004         (Output_data_got::add_local_pair_with_rel): Change object to
4005         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4006         add_output_section_generic.
4007         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4008         callers to use add_local_pair_with_rel.
4009         (Output_data_got::reserve_local): Change object to Relobj*.
4010         * output.h: (class Output_data_reloc_generic): Add pure virtual
4011         declarations for add_global_generic, add_local_generic,
4012         add_output_section_generic.
4013         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4014         functions for Output_data_reloc_generic.  Update declarations for
4015         changes listed in output.cc.
4016         (class Output_data_got): Change template parameter to got_size.
4017         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4018         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4019         function.
4020         (Sized_relobj_incr::do_local_plt_offset): New function.
4021         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4022         add_global_generic.
4023
4024 2011-12-17  Cary Coutant  <ccoutant@google.com>
4025
4026         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4027         * resolve.cc (Symbol_table::resolve): Likewise.
4028         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4029         arrays.
4030         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4031
4032 2011-12-16  Ian Lance Taylor  <iant@google.com>
4033
4034         * output.h (Output_data_reloc_generic::add): Only call
4035         add_dynamic_reloc if this is a dynamic reloc section.
4036
4037 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4038
4039         PR gold/13505
4040         * target-reloc.h (apply_relocation): Replace <64, false> with
4041         <size, big_endian>.
4042
4043 2011-11-25  Nick Clifton  <nickc@redhat.com>
4044
4045         * po/it.po: New Italian translation.
4046
4047 2011-11-17  Sterling Augustine  <saugustine@google.com>
4048
4049         * script.cc (script_include_directive): Implement.
4050         (read_script_file): New local variables name and search_path. Update
4051         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4052         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4053         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4054
4055 2011-11-11  Sterling Augustine  <saugustine@google.com>
4056
4057         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4058         (file_or_sections_cmd): Likewise.
4059
4060 2011-11-11  Doug Kwan  <dougkwan@google.com>
4061
4062         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4063         if --just-symbols is given.
4064
4065 2011-11-10  Doug Kwan  <dougkwan@google.com>
4066
4067         PR gold/13362
4068         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4069         when processing data relocs.
4070         * reloc.h (Relocate_functions::rel_unaligned): New method.
4071         (Relocate_functions::pcrel_unaligned): Ditto.
4072         (Relocate_functions::rel32_unaligned): Ditto.
4073         (Relocate_functions::pcrel32_unaligned): Ditto.
4074
4075 2011-11-09  Doug Kwan  <dougkwan@google.com>
4076
4077         PR gold/13362
4078         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4079         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4080         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4081         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4082         (Relocate_functions::rel_unaligned): New.
4083         (Relocate_functions::rel32_unaligned): New.
4084         * target-reloc.h (relocate_for_relocatable): Add code to handle
4085         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4086         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4087         arm_unaligned_reloc_r): New targets.
4088         * testsuite/Makefile.in: Regenerate.
4089         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4090         linking.
4091
4092 2011-11-02  Ian Lance Taylor  <iant@google.com>
4093
4094         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4095         NATIVE_LINKER.
4096         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4097         * options.cc (General_options::finalize): Use library search path
4098         from configure script if specified.  If not native and no sysroot,
4099         only search TOOLLIBDIR.
4100         * options.h (Search_directory::Search_directory): Change name to
4101         const std::string&.
4102         (General_options::add_to_library_path_with_sysroot): Change arg to
4103         const std::string&.
4104         * configure, Makefile.in, config.in: Rebuild.
4105
4106 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4107
4108         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4109         we are working around the ARM1176 Erratum.
4110         * options.h (General_options::fix_arm1176): Add option.
4111         * testsuite/Makefile.am: Add testcases, and keep current ones
4112         working.
4113         * testsuite/Makefile.in: Regenerate.
4114         * testsuite/arm_fix_1176.s: New file.
4115         * testsuite/arm_fix_1176.sh: Likewise.
4116
4117 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4118
4119         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4120         may_use_blx_.
4121         (Target_arm::may_use_blx): Remove method.
4122         (Target_arm::set_may_use_blx): Likewise.
4123         (Target_arm::may_use_v4t_interworking): New method.
4124         (Target_arm::may_use_v5t_interworking): Likewise.
4125         (Target_arm::may_use_blx_): Remove member variable.
4126         (Arm_relocate_functions::arm_branch_common): Check for v5T
4127         interworking.
4128         (Arm_relocate_functions::thumb_branch_common): Likewise.
4129         (Reloc_stub::stub_type_for_reloc): Likewise.
4130         (Target_arm::do_finalize_sections): Correct interworking checks.
4131         * testsuite/Makefile.am: Add new tests.
4132         * testsuite/Makefile.in: Regenerate.
4133         * testsuite/arm_farcall_arm_arm.s: New test.
4134         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4135         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4136         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4137         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4138         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4139         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4140         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4141
4142 2011-10-31  Cary Coutant  <ccoutant@google.com>
4143
4144         PR gold/13023
4145         * expression.cc (Expression::eval_with_dot): Add
4146         is_section_dot_assignment parameter.
4147         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4148         absolute and assigning to dot within a section.
4149         * script-sections.cc
4150         (Output_section_element_assignment::set_section_addresses): Pass
4151         dot_section to set_if_absolute.
4152         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4153         as is_section_dot_assignment flag to eval_with_dot.
4154         (Output_section_element_dot_assignment::set_section_addresses):
4155         Likewise.
4156         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4157         parameter.  Also set value if relative to dot_section; set the
4158         symbol's output_section.
4159         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4160         parameter.  Adjust all callers.
4161         (Expression::eval_maybe_dot): Likewise.
4162         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4163         Adjust all callers.
4164         * testsuite/script_test_2.t: Test assignment of an absolute value
4165         to dot within an output section element.
4166
4167 2011-10-31  Cary Coutant  <ccoutant@google.com>
4168
4169         * options.h (class General_options): Add --[no-]gnu-unique options.
4170         * symtab.cc (Symbol_table::sized_write_globals): Convert
4171         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4172
4173 2011-10-31  Cary Coutant  <ccoutant@google.com>
4174
4175         PR gold/13359
4176         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4177         unnecessary assertion.
4178         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4179
4180 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4181
4182         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4183         gc_mark_symbol.
4184         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4185         gc_mark_symbol.
4186         Change to just keep the section associated with symbol.
4187         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4188         they are externally visible and --export-dynamic is turned on.
4189         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4190
4191 2011-10-19  Ian Lance Taylor  <iant@google.com>
4192
4193         PR gold/13163
4194         * script-sections.cc
4195         (Output_section_element_dot_assignment::needs_output_section): New
4196         function.
4197
4198 2011-10-19  Ian Lance Taylor  <iant@google.com>
4199
4200         PR gold/13204
4201         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4202         --section-start option was seen.
4203         * options.h (General_options::any_section_start): New function.
4204
4205 2011-10-18  David S. Miller  <davem@davemloft.net>
4206
4207         PR binutils/13301
4208         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4209         member to track relocation locations that have moved during TLS
4210         reloc optimizations.
4211         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4212         (Target_sparc::Relocate::relocate): Adjust view down by 4
4213         bytes if it matches reloc_adjust_addr_.
4214         (Target_sparc::Relocate::relocate_tls): Always move the
4215         __tls_get_addr call delay slot instruction forward 4 bytes when
4216         performing relaxation.
4217
4218 2011-10-18  Cary Coutant  <ccoutant@google.com>
4219
4220         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4221         (Output_file::map_no_anonymous): Check for non-zero
4222         return code from posix_fallocate.
4223
4224 2011-10-17  Cary Coutant  <ccoutant@google.com>
4225
4226         PR gold/13245
4227         * plugin.cc (is_visible_from_outside): Check for symbols
4228         referenced from dynamic objects.
4229         * resolve.cc (Symbol_table::resolve): Don't count references
4230         from dynamic objects as references from real ELF files.
4231         * testsuite/plugin_test_2.sh: Adjust expected result.
4232
4233 2011-10-17  Cary Coutant  <ccoutant@google.com>
4234
4235         * gold.cc: Include timer.h.
4236         (queue_middle_tasks): Stamp time.
4237         (queue_final_tasks): Likewise.
4238         * main.cc (main): Store timer in parameters.  Print timers
4239         for each pass.
4240         * parameters.cc (Parameters::Parameters): Initialize timer_.
4241         (Parameters::set_timer): New function.
4242         (set_parameters_timer): New function.
4243         * parameters.h (Parameters::set_timer): New function.
4244         (Parameters::timer): New function.
4245         (Parameters::timer_): New data member.
4246         (set_parameters_timer): New function.
4247         * timer.cc (Timer::stamp): New function.
4248         (Timer::get_pass_time): New function.
4249         * timer.h (Timer::stamp): New function.
4250         (Timer::get_pass_time): New function.
4251         (Timer::pass_times_): New data member.
4252
4253 2011-10-17  Cary Coutant  <ccoutant@google.com>
4254
4255         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4256         task for members of lib groups.
4257
4258 2011-10-17  Cary Coutant  <ccoutant@google.com>
4259
4260         PR gold/13288
4261         * fileread.cc (File_read::find_view): Add assert.
4262         (File_read::make_view): Move bounds check (replace with assert)...
4263         (File_read::find_or_make_view): ... to here.
4264
4265 2011-10-12  Cary Coutant  <ccoutant@google.com>
4266
4267         * output.cc (Output_file::open_base_file): Handle case where
4268         ::read returns less than requested size.
4269
4270 2011-10-10  Cary Coutant  <ccoutant@google.com>
4271
4272         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4273         Initialize defined_count_.
4274         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4275         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4276         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4277         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4278         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4279         * incremental.h (Sized_relobj_incr::defined_count_): New data
4280         member.
4281         (Sized_incr_dynobj::defined_count_): New data member.
4282         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4283         Return zeroes instead of internal error.
4284
4285 2011-10-10  Cary Coutant  <ccoutant@google.com>
4286
4287         PR gold/13249
4288         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4289         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4290         * output.h (class Output_reloc): Add use_plt_offset flag.
4291         (Output_reloc::type_): Adjust size of bit field.
4292         (Output_reloc::use_plt_offset_): New bit field.
4293         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4294         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4295         flag.  Adjust all callers.
4296         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4297         creating RELATIVE relocations.
4298
4299 2011-10-10  Nick Clifton  <nickc@redhat.com>
4300
4301         * po/es.po: Updated Spanish translation.
4302         * po/fi.po: Updated Finnish translation.
4303
4304 2011-10-03   Diego Novillo  <dnovillo@google.com>
4305
4306         * options.cc (parse_uint): Fix dereference of RETVAL.
4307
4308 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4309
4310         * layout.h (section_order_map_): New member.
4311         (get_section_order_map): New member function.
4312         * output.cc (Output_section::add_input_section): Check for patterns
4313         only when --section-ordering-file is specified.
4314         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4315         output_sections have been formed.
4316         * layout.cc (Layout_Layout): Initialize section_order_map_.
4317         * plugin.cc (update_section_order): Store order in order_map. Do not
4318         update the order.
4319         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4320         * testsuite/Makefile.in: Regenerate.
4321         * testsuite/plugin_section_order.c: New file.
4322         * testsuite/plugin_final_layout.cc: New file.
4323         * testsuite/plugin_final_layout.sh: New file.
4324
4325 2011-09-29  Cary Coutant  <ccoutant@google.com>
4326
4327         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4328         Check for NULL.
4329         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4330         symbols during incremental update.
4331         (Symbol_table::add_from_dynobj): Likewise.
4332
4333 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4334             Ian Lance Taylor  <iant@google.com>
4335
4336         * symtab.cc (Symbol_table::define_special_symbol): Always
4337         canonicalize version string.
4338
4339 2011-09-26  Cary Coutant  <ccoutant@google.com>
4340
4341         * gold.cc (queue_initial_tasks): Move option checks ...
4342         * options.cc (General_options::finalize): ... to here. Disable
4343         some options; make others fatal.
4344
4345 2011-09-26  Cary Coutant  <ccoutant@google.com>
4346
4347         gcc PR lto/47247
4348         * plugin.cc (get_symbols_v2): New function.
4349         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4350         (is_referenced_from_outside): New function.
4351         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4352         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4353         (get_symbols): Pass version parameter.
4354         (get_symbols_v2): New function.
4355         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4356         parameter.
4357         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4358         (onload): Add LDPT_GET_SYMBOLS_V2.
4359         (all_symbols_read_hook): Use get_symbols_v2; check for
4360         LDPR_PREVAILING_DEF_IRONLY_EXP.
4361         * testsuite/plugin_test_3.sh: Update expected results.
4362
4363 2011-09-23  Simon Baldwin  <simonb@google.com>
4364
4365         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4366         configuration options.
4367         * configure: Regenerate.
4368         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4369         * Makefile.in: Regenerate.
4370         * testsuite/Makefile.in: Regenerate.
4371
4372 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4373
4374         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4375
4376 2011-09-19  Cary Coutant  <ccoutant@google.com>
4377
4378         * incremental.cc (can_incremental_update): Fix typo in comment.
4379         * incremental.h (can_incremental_update): Likewise.
4380
4381 2011-09-18  Cary Coutant  <ccoutant@google.com>
4382
4383         * incremental.cc (can_incremental_update): New function.
4384         * incremental.h (can_incremental_update): New function.
4385         * layout.cc (Layout::init_fixed_output_section): Call it.
4386         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4387         * object.cc (Sized_relobj_file::do_layout): Call
4388         can_incremental_update.
4389
4390 2011-09-13  Cary Coutant  <ccoutant@google.com>
4391
4392         * configure.ac: Check for glibc support for gnu_indirect_function
4393         support with static linking, setting automake conditional
4394         IFUNC_STATIC.
4395         * Makefile.in: Regenerate.
4396         * configure: Regenerate.
4397
4398         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4399         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4400         for IFUNC_STATIC.
4401         * testsuite/Makefile.in: Regenerate.
4402
4403 2011-09-13  Cary Coutant  <ccoutant@google.com>
4404
4405         * incremental.cc (Sized_relobj_incr::do_layout): Call
4406         report_comdat_group for kept comdat sections.
4407         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4408         * testsuite/Makefile.in: Regenerate.
4409         * testsuite/incr_comdat_test_1.cc: New source file.
4410         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4411         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4412         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4413
4414 2011-09-13  Ian Lance Taylor  <iant@google.com>
4415
4416         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4417         variable external_symbols_offset.
4418
4419 2011-09-12  Ian Lance Taylor  <iant@google.com>
4420
4421         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4422         triggered if object has no symbols.
4423
4424 2011-09-09  David S. Miller  <davem@davemloft.net>
4425
4426         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4427         (Output_fill_debug_line::do_write): Likewise.
4428
4429 2011-08-29  Cary Coutant  <ccoutant@google.com>
4430
4431         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4432         casts to match formatting specs.
4433         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4434
4435 2011-08-26  Cary Coutant  <ccoutant@google.com>
4436
4437         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4438         remaining hole size when allocating.
4439         (Layout::make_output_section): Set fill methods for debug sections.
4440         * layout.h (Free_list::Free_list_node): Move from private to
4441         public.
4442         (Free_list::set_min_hole_size): New function.
4443         (Free_list::begin, Free_list::end): New functions.
4444         (Free_list::min_hole_): New data member.
4445         * output.cc: Include dwarf.h.
4446         (Output_fill_debug_info::do_minimum_hole_size): New function.
4447         (Output_fill_debug_info::do_write): New function.
4448         (Output_fill_debug_line::do_minimum_hole_size): New function.
4449         (Output_fill_debug_line::do_write): New function.
4450         (Output_section::Output_section): Initialize new data member.
4451         (Output_section::set_final_data_size): Ensure patch space is larger
4452         than minimum hole size.
4453         (Output_section::do_write): Fill holes in debug sections.
4454         * output.h (Output_fill): New class.
4455         (Output_fill_debug_info): New class.
4456         (Output_fill_debug_line): New class.
4457         (Output_section::set_free_space_fill): New function.
4458         (Output_section::free_space_fill_): New data member.
4459         * testsuite/Makefile.am (incremental_test_3): Add
4460         --incremental-patch option.
4461         (incremental_test_4): Likewise.
4462         (incremental_test_5): Likewise.
4463         (incremental_test_6): Likewise.
4464         (incremental_copy_test): Likewise.
4465         (incremental_common_test_1): Likewise.
4466         * testsuite/Makefile.in: Regenerate.
4467
4468 2011-08-26  Nick Clifton  <nickc@redhat.com>
4469
4470         * po/es.po: Updated Spanish translation.
4471
4472 2011-08-01  Cary Coutant  <ccoutant@google.com>
4473
4474         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4475         * gold/testsuite/Makefile.in: Regenerate.
4476         * gold/testsuite/justsyms_exec.c: New source file.
4477         * gold/testsuite/justsyms_lib.c: New source file.
4478
4479 2011-08-01  Cary Coutant  <ccoutant@google.com>
4480
4481         * layout.cc (Layout::set_segment_offsets): Don't realign text
4482         segment if -Ttext was specified.
4483         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4484         file type.
4485         * object.h (Sized_relobj_file::e_type): New function.
4486         (Sized_relobj_file::e_type_): New data member.
4487         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4488         base address for ET_EXEC files.
4489         * target.cc (Target::do_make_elf_object_implementation): Allow
4490         ET_EXEC files with --just-symbols option.
4491
4492 2011-07-28  Cary Coutant  <ccoutant@google.com>
4493
4494         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4495         Add thread_number parameter.
4496         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4497         * workqueue-threads.cc
4498         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4499         current thread if its thread number is greater than desired thread
4500         count.
4501         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4502         Add thread_number parameter.
4503         (Workqueue::should_cancel_thread): Likewise.
4504         (Workqueue::find_runnable_or_wait): Pass thread_number to
4505         should_cancel_thread.
4506         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4507         parameter.
4508
4509 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4510
4511         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4512         only after checking if it cannot be forced local.
4513         * symtab.h (is_externally_visible): Check if the symbol is not forced
4514         local.
4515
4516 2011-07-15  Ian Lance Taylor  <iant@google.com>
4517
4518         * options.h (class General_options): Add --print-output-format.
4519         Move -EL next to -EB, for  better --help output.
4520         * target-select.cc: Include <cstdio>, "options.h", and
4521         "parameters.h".
4522         (Target_selector::do_target_bfd_name): New function.
4523         (print_output_format): New function.
4524         * target-select.h (class Target_selector): Update declarations.
4525         (Target_selector::target_bfd_name): New function.
4526         (print_output_format): Declare.
4527         * main.cc: Include "target-select.h".
4528         (main): Handle --print-output-format.
4529         * gold.cc: Include "target-select.h".
4530         (queue_initial_tasks): Handle --print-output-format when there are
4531         no input files.
4532         * parameters.cc (parameters_force_valid_target): Give a better
4533         error message if -EB/-EL does not match target.
4534         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4535         function.
4536
4537 2011-07-15  Ian Lance Taylor  <iant@google.com>
4538
4539         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4540         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4541         (Output_data_plt_i386::do_write): Write address of .dynamic
4542         section to first entry in .got.plt section.
4543         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4544         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4545         Initialize layout_.
4546         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4547         section to first entry in .got.plt section.
4548         * layout.h (Layout::dynamic_section): New function.
4549
4550 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4551
4552         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4553         to claim_file call.
4554         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4555         input_section_position_, and input_section_glob_.
4556         (read_layout_from_file): Call function section_ordering_specified.
4557         * layout.h (is_section_ordering_specified): New function.
4558         (section_ordering_specified): New function.
4559         (section_ordering_specified_): New boolean member.
4560         * main.cc(main): Call load_plugins after layout object is defined.
4561         * output.cc (Output_section::add_input_section): Use
4562         function section_ordering_specified to check if section ordering is
4563         needed.
4564         * output.cc (Output_section::add_relaxed_input_section): Use
4565         function section_ordering_specified to check if section ordering is
4566         needed.
4567         (Output_section::update_section_layout): New function.
4568         (Output_section::sort_attached_input_sections): Check if input section
4569         must be reordered.
4570         * output.h (Output_section::update_section_layout): New function.
4571         * plugin.cc (get_section_count): New function.
4572         (get_section_type): New function.
4573         (get_section_name): New function.
4574         (get_section_contents): New function.
4575         (update_section_order): New function.
4576         (allow_section_ordering): New function.
4577         (Plugin::load): Add the new interfaces to the transfer vector.
4578         (Plugin_manager::load_plugins): New parameter.
4579         (Plugin_manager::all_symbols_read): New parameter.
4580         (Plugin_manager::claim_file): New parameter. Save the elf object for
4581         unclaimed objects.
4582         (Plugin_manager::get_elf_object): New function.
4583         (Plugin_manager::get_view): Change to directly use the bool to check
4584         if get_view is called from claim_file_hook.
4585         * plugin.h (input_objects): New function
4586         (Plugin__manager::load_plugins): New parameter.
4587         (Plugin_manager::claim_file): New parameter.
4588         (Plugin_manager::get_elf_object): New function.
4589         (Plugin_manager::in_claim_file_handler): New function.
4590         (Plugin_manager::in_claim_file_handler_): New member.
4591         (layout): New function.
4592         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4593         handler with an extra parameter. Make the elf object before calling
4594         claim_file handler.
4595         * testsuite/plugin_test.c (get_section_count): New function pointer.
4596         (get_section_type): New function pointer.
4597         (get_section_name): New function pointer.
4598         (get_section_contents): New function pointer.
4599         (update_section_order): New function pointer.
4600         (allow_section_ordering): New function pointer.
4601         (onload): Check if the new interfaces exist.
4602
4603 2011-07-13  Ian Lance Taylor  <iant@google.com>
4604
4605         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4606         relro section.
4607         * x86_64.cc (Target_x86_64::got_section): Likewise.
4608         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4609         (relro_now_test_SOURCES): New variable.
4610         (relro_now_test_DEPENDENCIES): New variable.
4611         (relro_now_test_LDFLAGS): New variable.
4612         (relro_now_test_LDADD): New variable.
4613         (relro_now_test.so): New target.
4614         * testsuite/Makefile.in: Rebuild.
4615
4616 2011-07-12  Ian Lance Taylor  <iant@google.com>
4617
4618         PR gold/12980
4619         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4620         GLOB_DAT relocation rather than a RELATIVE relocation for a
4621         protected symbol when creating a shared library.
4622         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4623         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4624         * testsuite/protected_main_1.cc (main): Test that protected
4625         function has same address.
4626
4627 2011-07-11  Ian Lance Taylor  <iant@google.com>
4628
4629         PR gold/12979
4630         * options.h (class General_options): Add -Bgroup.
4631         * options.cc (General_options::finalize): If -Bgroup is set,
4632         default to --unresolved-symbols=report-all.
4633         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4634         * target-reloc.h (issue_undefined_symbol_error): Handle
4635         --unresolved-symbols=report-all.
4636
4637 2011-07-08  Ian Lance Taylor  <iant@google.com>
4638
4639         PR gold/11985
4640         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4641         if linker script discards key sections.
4642         (Layout::create_dynamic_symtab): Likewise.
4643         (Layout::assign_local_dynsym_offsets): Likewise.
4644         (Layout::sized_create_version_sections): Likewise.
4645         (Layout::create_interp): Likewise.
4646         (Layout::finish_dynamic_section): Likewise.
4647         (Layout::set_dynamic_symbol_size): Likewise.
4648
4649 2011-07-08  Ian Lance Taylor  <iant@google.com>
4650
4651         PR gold/12386
4652         * options.h (class General_options): Add --unresolved-symbols.
4653         * target-reloc.h (issue_undefined_symbol_error): Check
4654         --unresolved-symbols.  Add comments.
4655
4656 2011-07-08  Ian Lance Taylor  <iant@google.com>
4657
4658         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4659         expression more complex.
4660
4661 2011-07-08  Ian Lance Taylor  <iant@google.com>
4662
4663         PR gold/11317
4664         * target-reloc.h (issue_undefined_symbol_error): New inline
4665         function, broken out of relocate_section.
4666         (relocate_section): Call issue_undefined_symbol_error.
4667         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4668         there is no TLS segment if we are about to issue an undefined
4669         symbol error.
4670         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4671
4672 2011-07-08  Ian Lance Taylor  <iant@google.com>
4673
4674         PR gold/12279
4675         * resolve.cc (Symbol_table::should_override): Add fromtype
4676         parameter.  Change all callers.  Give error when linking together
4677         TLS and non-TLS symbol.
4678         (Symbol_table::should_override_with_special): Add fromtype
4679         parameter.  Change all callers.
4680         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4681         there is no TLS segment if we have reported some errors.
4682         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4683
4684 2011-07-08  Ian Lance Taylor  <iant@google.com>
4685
4686         PR gold/12372
4687         * target.h (Target::plt_address_for_global): New function.
4688         (Target::plt_address_for_local): New function.
4689         (Target::plt_section_for_global): Remove.
4690         (Target::plt_section_for_local): Remove.
4691         (Target::do_plt_address_for_global): New virtual function.
4692         (Target::do_plt_address_for_local): New virtual function.
4693         (Target::do_plt_section_for_global): Remove.
4694         (Target::do_plt_section_for_local): Remove.
4695         (Target::register_global_plt_entry): Add Symbol_table and Layout
4696         parameters.
4697         * output.cc (Output_data_got::Got_entry::write): Use
4698         plt_address_for_global and plt_address_for_local.
4699         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4700         address of output section.
4701         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4702         got_irelative_, and irelative_count_ fields.  Update
4703         declarations.
4704         (Output_data_plt_i386::has_irelative_section): New function.
4705         (Output_data_plt_i386::entry_count): Add irelative_count_.
4706         (Output_data_plt_i386::set_final_data_size): Likewise.
4707         (class Target_i386): Add got_irelative_ and rel_irelative_
4708         fields.  Update declarations.
4709         (Target_i386::Target_i386): Initialize new fields.
4710         (Target_i386::do_plt_address_for_global): New function replacing
4711         do_plt_section_for_global.
4712         (Target_i386::do_plt_address_for_local): New function replacing
4713         do_plt_section_for_local.
4714         (Target_i386::got_section): Create got_irelative_.
4715         (Target_i386::rel_irelative_section): New function.
4716         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4717         fields.  Don't define __rel_iplt_{start,end}.
4718         (Output_data_plt_i386::add_entry): Add symtab and layout
4719         parameters.  Change all callers.  Use different PLT and GOT for
4720         IFUNC symbols.
4721         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4722         layout parameters.  Change all callers.  Use different PLT and
4723         GOT.
4724         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4725         (Output_data_plt_i386::rel_irelative): New function.
4726         (Output_data_plt_i386::address_for_global): New function.
4727         (Output_data_plt_i386::address_for_local): New function.
4728         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4729         IRELATIVE GOT when changing IFUNC GOT entries.
4730         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4731         reloc.
4732         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4733         if we didn't create an IRELATIVE GOT.
4734         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4735         plt_address_for_local.
4736         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4737         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4738         got_irelative_, and irelative_count_ fields.  Update
4739         declarations.
4740         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4741         Initialize new fields.  Remove symtab parameter.  Change all
4742         callers.
4743         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4744         irelative_count_.
4745         (Output_data_plt_x86_64::has_irelative_section): New function.
4746         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4747         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4748         fields.  Update declarations.
4749         (Target_x86_64::Target_x86_64): Initialize new fields.
4750         (Target_x86_64::do_plt_address_for_global): New function replacing
4751         do_plt_section_for_global.
4752         (Target_x86_64::do_plt_address_for_local): New function replacing
4753         do_plt_section_for_local.
4754         (Target_x86_64::got_section): Create got_irelative_.
4755         (Target_x86_64::rela_irelative_section): New function.
4756         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4757         all callers.  Don't create __rel_iplt_{start,end}.
4758         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4759         parameters.  Change all callers.  Use different PLT and GOT for
4760         IFUNC symbols.
4761         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4762         layout parameters.  Change all callers.  Use different PLT and
4763         GOT.
4764         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4765         parameters.  Change all callers.  Use different PLT and GOT for
4766         IFUNC symbols.
4767         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4768         (Output_data_plt_x86_64::rela_irelative): New function.
4769         (Output_data_plt_x86_64::address_for_global): New function.
4770         (Output_data_plt_x86_64::address_for_local): New function.
4771         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4772         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4773         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4774         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4775         parameters.
4776         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4777         reloc.
4778         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4779         symbols if we didn't create an IRELATIVE GOT.
4780         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4781         plt_address_for_local.
4782         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4783         * testsuite/ifuncvar1.c: New test file.
4784         * testsuite/ifuncvar2.c: New test file.
4785         * testsuite/ifuncvar3.c: New test file.
4786         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4787         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4788         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4789         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4790         * testsuite/Makefile.in: Rebuild.
4791
4792 2011-07-07  Cary Coutant  <ccoutant@google.com>
4793
4794         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4795         (two_file_test_1_ndebug.o): Likewise.
4796         (two_file_test_1b_ndebug.o): Likewise.
4797         (two_file_test_2_ndebug.o): Likewise.
4798         (two_file_test_main_ndebug.o): Likewise.
4799         (incremental_test_2): Link with no-debug versions.
4800
4801 2011-07-06  Cary Coutant  <ccoutant@google.com>
4802
4803         * gold/incremental.cc
4804         (Output_section_incremental_inputs::write_info_blocks): Check for
4805         hidden and internal symbols.
4806
4807 2011-07-06  Cary Coutant  <ccoutant@google.com>
4808
4809         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4810         Check disposition for startup file.
4811         (Incremental_inputs::report_command_line): Ignore
4812         --incremental-startup-unchanged option.
4813         * options.cc (General_options::parse_incremental_startup_unchanged):
4814         New function.
4815         (General_options::General_options): Initialize new data member.
4816         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4817         (General_options): Add --incremental-startup-unchanged option.
4818         (General_options::incremental_startup_disposition): New function.
4819         (General_options::incremental_startup_disposition_): New data member.
4820
4821 2011-07-06  Cary Coutant  <ccoutant@google.com>
4822
4823         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4824         input file index to Script_info ctor.
4825         (Sized_incremental_binary::do_file_has_changed): Find the
4826         command-line argument for files named in scripts.
4827         * incremental.h (Script_info::Script_info): New ctor
4828         with input file index.
4829         (Script_info::input_file_index): New function.
4830         (Script_info::input_file_index_): New data member.
4831         (Incremental_binary::get_library): Add const.
4832         (Incremental_binary::get_script_info): Add const.
4833         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4834         * testsuite/Makefile.am (incremental_test_5): New test case.
4835         (incremental_test_6): New test case.
4836         * testsuite/Makefile.in: Regenerate.
4837
4838 2011-07-06  Cary Coutant  <ccoutant@google.com>
4839
4840         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4841         debug output when command lines differ.
4842
4843 2011-07-06  Cary Coutant  <ccoutant@google.com>
4844
4845         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4846         --incremental-patch option.
4847         * layout.cc (Free_list::allocate): Extend allocation beyond original
4848         end if enabled.
4849         (Layout::make_output_section): Mark sections that should get
4850         patch space.
4851         * options.cc (parse_percent): New function.
4852         * options.h (parse_percent): New function.
4853         (DEFINE_percent): New macro.
4854         (General_options): Add --incremental-patch option.
4855         * output.cc (Output_section::Output_section): Initialize new data
4856         members.
4857         (Output_section::add_input_section): Print section name when out
4858         of patch space.
4859         (Output_section::add_output_section_data): Likewise.
4860         (Output_section::set_final_data_size): Add patch space when
4861         doing --incremental-full.
4862         (Output_section::do_reset_address_and_file_offset): Remove patch
4863         space.
4864         (Output_segment::set_section_list_addresses): Print debug output
4865         only if --incremental-update.
4866         * output.h (Output_section::set_is_patch_space_allowed): New function.
4867         (Output_section::is_patch_space_allowed_): New data member.
4868         (Output_section::patch_space_): New data member.
4869         * parameters.cc (Parameters::incremental_full): New function.
4870         * parameters.h (Parameters::incremental_full): New function
4871         * testsuite/Makefile.am (incremental_test_2): Add test for
4872         --incremental-patch option.
4873         * testsuite/Makefile.in: Regenerate.
4874         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4875         (t18): Remove function body.
4876
4877 2011-07-05  Doug Kwan  <dougkwan@google.com>
4878
4879         PR gold/12771
4880         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4881         Arm_Address type for relocation result.
4882         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4883         overflow check.
4884         (Arm_relocate_functions::abs32): Use unaligned access.
4885         (Arm_relocate_functions::rel32): Ditto.
4886         (Arm_relocate_functions::prel31): Ditto.
4887         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4888         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4889         static data relocations.
4890         * testsuite/Makefile.in: Regnerate.
4891         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4892
4893 2011-07-05  Ian Lance Taylor  <iant@google.com>
4894
4895         PR gold/12392
4896         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4897         symbols if necessary.
4898         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4899
4900 2011-07-05  Ian Lance Taylor  <iant@google.com>
4901
4902         PR gold/12952
4903         * resolve.cc (Symbol::override_base_with_special): Simply override
4904         version with special symbol version, ignoring previous version.
4905
4906 2011-07-05  Ian Lance Taylor  <iant@google.com>
4907
4908         * object.cc (Sized_relobj_file::include_section_group): Add
4909         information to comment about signature location.
4910
4911 2011-07-02  Ian Lance Taylor  <iant@google.com>
4912
4913         PR gold/12957
4914         * options.h (class General_options): Add -f and -F.
4915         * options.cc (General_options::finalize): Fatal error if -f/-F
4916         are used without -shared.
4917         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4918
4919 2011-07-02  Ian Lance Taylor  <iant@google.com>
4920
4921         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4922
4923 2011-07-01  Ian Lance Taylor  <iant@google.com>
4924
4925         PR gold/12525
4926         PR gold/12952
4927         * resolve.cc (Symbol::override_base_with_special): Don't override
4928         the version if the overriding symbol has a different name.
4929         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4930         all callers.  If we give an error about an undefined version,
4931         define the base version if necessary.
4932         * dynobj.h (class Versions): Update declaration.
4933         * testsuite/weak_alias_test_5.cc: New file.
4934         * testsuite/weak_alias_test.script: New file.
4935         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4936         and versioned_alias have the right value, and call t2.
4937         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4938         weak_alias_test_5.so.
4939         (weak_alias_test_LDADD): Likewise.
4940         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4941         * testsuite/Makefile.in: Rebuild.
4942
4943 2011-07-01  Ian Lance Taylor  <iant@google.com>
4944
4945         PR gold/12525
4946         * options.h (class General_options): Support -z notext.
4947         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4948         -Wl,-z,notext.
4949         (two_file_shared_nonpic.so): Likewise.
4950         (two_file_shared_mixed.so): Likewise.
4951         (two_file_shared_mixed_1.so): Likewise.
4952         (weak_undef_lib_nonpic.so): Likewise.
4953         (alt/weak_undef_lib_nonpic.so): Likewise.
4954         (tls_test_shared_nonpic.so): Likewise.
4955         * testsuite/Makefile.in: Rebuild.
4956
4957 2011-07-01  Ian Lance Taylor  <iant@google.com>
4958
4959         PR gold/12525
4960         * configure.ac: Test whether static linking works, setting
4961         the automake conditional HAVE_STATIC.
4962         * testsuite/Makefile.am: Disable tests using -static if
4963         HAVE_STATIC is not true.
4964         * configure, testsuite/Makefile.in: Rebuild.
4965
4966 2011-07-01  Ian Lance Taylor  <iant@google.com>
4967
4968         PR gold/12525
4969         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4970         Assert if we see DW_EH_PE_indirect.
4971         * target.h (Target::ehframe_datarel_base): New function.
4972         (Target::do_ehframe_datarel_base): New target function.
4973         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4974         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4975         function.
4976
4977 2011-07-01  Ian Lance Taylor  <iant@google.com>
4978
4979         PR gold/12571
4980         * options.h (class General_options): Add
4981         --ld-generated-unwind-info.
4982         * ehframe.cc (Fde::write): Add address parameter.  Change all
4983         callers.  If associated with PLT, fill in address and size.
4984         (Cie::set_output_offset): Only add merge mapping if there is an
4985         object.
4986         (Cie::write): Add address parameter.  Change all callers.
4987         (Eh_frame::add_ehframe_for_plt): New function.
4988         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4989         input_offset_ fields into union u_, with new plt field.
4990         (Fde::Fde): Adjust for new union field.
4991         (Fde::Fde) [Output_data version]: New constructor.
4992         (Fde::add_mapping): Only add merge mapping if there is an object.
4993         (class Cie): Update declarations.
4994         (class Eh_frame): Declare add_ehframe_for_plt.
4995         * layout.cc (Layout::layout_eh_frame): Break out code into
4996         make_eh_frame_section, and call it.
4997         (Layout::make_eh_frame_section): New function.
4998         (Layout::add_eh_frame_for_plt): New function.
4999         * layout.h (class Layout): Update declarations.
5000         * merge.cc (Merge_map::add_mapping): Add assertion.
5001         * i386.cc: Include "dwarf.h".
5002         (class Output_data_plt_i386): Make first_plt_entry,
5003         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5004         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5005         and plt_eh_frame_fde.
5006         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5007         boundary.  Call add_eh_frame_for_plt if appropriate.
5008         * x86_64.cc: Include "dwarf.h".
5009         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5010         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5011         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5012         and plt_eh_frame_fde.
5013         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5014         appropriate.
5015
5016 2011-06-29  Ian Lance Taylor  <iant@google.com>
5017
5018         PR gold/12629
5019         * object.cc (Sized_relobj_file::layout_section): Change shdr
5020         parameter to be const.
5021         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5022         out of do_layout.
5023         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5024         appropriate.  Call layout_eh_frame_section.
5025         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5026         sections.
5027         * object.h (class Sized_relobj_file): Update declarations.
5028
5029 2011-06-29  Ian Lance Taylor  <iant@google.com>
5030
5031         PR gold/12652
5032         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5033         modifier.
5034         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5035
5036 2011-06-29  Ian Lance Taylor  <iant@google.com>
5037
5038         PR gold/12675
5039         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5040         SHT_X86_64_UNWIND.
5041         * layout.cc (Layout::layout_eh_frame): Likewise.
5042
5043 2011-06-29  Ian Lance Taylor  <iant@google.com>
5044
5045         PR gold/12695
5046         * layout.cc (Layout::symtab_section_shndx): New function.
5047         * layout.h (class Layout): Declare symtab_section_shndx.
5048         * output.cc (Output_section::write_header): Call it.
5049
5050 2011-06-29  Ian Lance Taylor  <iant@google.com>
5051
5052         PR gold/12818
5053         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5054         symbols which are not used in a relocation.
5055
5056 2011-06-28  Ian Lance Taylor  <iant@google.com>
5057
5058         PR gold/12898
5059         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5060         script create indistinguishable segments.
5061         (Layout::set_segment_offsets): Use stable_sort when sorting
5062         segments.  Pass this to Compare_segments constructor.
5063         * layout.h (class Layout): Make segment_precedes non-static.
5064         (class Compare_segments): Change from struct to class.  Add
5065         layout_ field.  Add constructor.
5066         * script-sections.cc
5067         (Script_sections::attach_sections_using_phdrs_clause): Rename
5068         local orphan to is_orphan.  Don't report failure to put empty
5069         section in segment.  On attachment failure, report name of
5070         section, and attach to first PT_LOAD segment.
5071
5072 2011-06-28  Ian Lance Taylor  <iant@google.com>
5073
5074         PR gold/12934
5075         * target-select.cc (Target_selector::Target_selector): Add
5076         emulation parameter.  Change all callers.
5077         (select_target_by_bfd_name): Rename from select_target_by_name.
5078         Change all callers.
5079         (select_target_by_emulation): New function.
5080         (supported_emulation_names): New function.
5081         * target-select.h (class Target_selector): Add emulation_ field.
5082         Update declarations.
5083         (Target_selector::recognize_by_bfd_name): Rename from
5084         recognize_by_name.  Change all callers.
5085         (Target_selector::supported_bfd_names): Rename from
5086         supported_names.  Change all callers.
5087         (Target_selector::recognize_by_emulation): New function.
5088         (Target_selector::supported_emulations): New function.
5089         (Target_selector::emulation): New function.
5090         (Target_selector::do_recognize_by_bfd_name): Rename from
5091         do_recognize_by_name.  Change all callers.
5092         (Target_selector::do_supported_bfd_names): Rename from
5093         do_supported_names.  Change all callers.
5094         (Target_selector::do_recognize_by_emulation): New function.
5095         (Target_selector::do_supported_emulations): New function.
5096         (select_target_by_bfd_name): Change name in declaration.
5097         (select_target_by_emulation): Declare.
5098         (supported_emulation_names): Declare.
5099         * parameters.cc (parameters_force_valid_target): Try to find
5100         target based on emulation from -m option.
5101         * options.h (class General_options): Change doc string for -m.
5102         * options.cc (help): Print emulations.
5103         (General_options::parse_V): Likewise.
5104         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5105         Add emulation parameter.  Change all callers.
5106
5107 2011-06-28  Ian Lance Taylor  <iant@google.com>
5108
5109         * target.h (class Target): Add osabi_ field.
5110         (Target::osabi): New function.
5111         (Target::set_osabi): New function.
5112         (Target::Target): Initialize osabi_.
5113         (Target::do_adjust_elf_header): Make pure virtual.
5114         (Sized_target::do_adjust_elf_header): Declare.
5115         * target.cc (Sized_target::do_adjust_elf_header): New function.
5116         (class Sized_target): Instantiate all versions.
5117         * freebsd.h (class Target_freebsd): Remove.
5118         (Target_selector_freebsd::do_recognize): Call set_osabi on
5119         Target.
5120         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5121         (Target_selector_freebsd::set_osabi): Remove.
5122         * i386.cc (class Target_i386): Inherit from Sized_target rather
5123         than Target_freebsd.
5124         * x86_64.cc (class Target_x86_64): Likewise.
5125
5126 2011-06-28  Ian Lance Taylor  <iant@google.com>
5127
5128         * target.h (Target::can_check_for_function_pointers): Rewrite.
5129         Make non-virtual.
5130         (Target::can_icf_inline_merge_sections): Likewise.
5131         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5132         (Target::Target_info): Add can_icf_inline_merge_sections field.
5133         (Target::do_can_check_for_function_pointers): New virtual
5134         function.
5135         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5136         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5137         from can_check_for_function_pointers, move in file.
5138         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5139         section_may_have_icf_unsafe_poineters, move in file.
5140         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5141         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5142         Rename from can_check_for_function_pointers, move in file.
5143         (Target_i386::can_icf_inline_merge_sections): Remove.
5144         (Target_i386::i386_info): Initialize
5145         can_icf_inline_merge_sections.
5146         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5147         Initialize can_icf_inline_merge_sections.
5148         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5149         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5150         Rename from can_check_for_function_pointers, move in file.
5151         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5152         (Target_x86_64::x86_64_info): Initialize
5153         can_icf_inline_merge_sections.
5154         * testsuite/testfile.cc (Target_test::test_target_info):
5155         Likewise.
5156         * icf.cc (get_section_contents): Correct formatting.
5157
5158 2011-06-27  Ian Lance Taylor  <iant@google.com>
5159
5160         * symtab.cc (Symbol::versioned_name): New function.
5161         (Symbol_table::add_to_final_symtab): Use versioned_name when
5162         appropriate.
5163         (Symbol_table::sized_write_symbol): Likewise.
5164         * symtab.h (class Symbol): Declare versioned_name.
5165         * stringpool.h (class Stringpool_template): Add variant of add
5166         which takes a std::basic_string.
5167         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5168         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5169         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5170         (ver_test_12.o): New target.
5171         * testsuite/Makefile.in: Rebuild.
5172
5173 2011-06-27  Doug Kwan  <dougkwan@google.com>
5174
5175         * arm.cc (Arm_relocate_functions::thm_jump8,
5176         Arm_relocate_functions::thm_jump11): Use a wider signed
5177         type to compute offset.
5178         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5179         arm_thm_jump8.
5180         * testsuite/Makefile.in: Regenerate.
5181         * testsuite/arm_branch_in_range.sh: Check test results of
5182         arm_thm_jump11 and arm_thm_jump8.
5183         * testsuite/arm_thm_jump11.s: New test source file.
5184         * testsuite/arm_thm_jump11.t: New linker script.
5185         * testsuite/arm_thm_jump8.s: New test source file.
5186         * testsuite/arm_thm_jump8.t: New linker script.
5187
5188 2011-06-24  Ian Lance Taylor  <iant@google.com>
5189
5190         * layout.cc: Include "object.h".
5191         (ctors_sections_in_init_array): New static variable.
5192         (Layout::is_ctors_in_init_array): New function.
5193         (Layout::layout): Add entry to ctors_sections_in_init_array if
5194         appropriate.
5195         * layout.h (class Layout): Declare is_ctors_in_init_array.
5196         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5197         is_ctors_reverse_view is set.
5198         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5199         all callers.  Set is_ctors_reverse_view field of View_size.
5200         (Sized_relobj_file::reverse_words): New function.
5201         * object.h (Sized_relobj_file::View_size): Add
5202         is_ctors_reverse_view field.
5203         (class Sized_relobj_file): Update declarations.
5204         * testsuite/initpri3.c: New test.
5205         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5206         initpri3b.
5207         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5208         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5209         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5210         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5211         * testsuite/Makefile.in: Rebuild.
5212
5213 2011-06-24  Cary Coutant  <ccoutant@google.com>
5214
5215         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5216         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5217         (debug_msg_cdebug.err): New targets.
5218         * testsuite/Makefile.in: Regenerate.
5219         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5220         Fix checks for link with shared library.
5221
5222 2011-06-24  Doug Kwan  <dougkwan@google.com>
5223
5224         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5225         skip empty text sections.
5226         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5227
5228 2011-06-22  Ian Lance Taylor  <iant@google.com>
5229
5230         PR gold/12910
5231         * options.h (class General_options): Add --ctors-in-init-array.
5232         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5233         friends as SHT_PROGBITS for merging sections.
5234         (Layout::layout): Remove special handling of .init_array and
5235         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5236         and .dtors if ctors_in_init_array.
5237         (Layout::make_output_section): Force correct section types for
5238         .init_array and friends.  Don't sort if doing relocatable link,
5239         Don't sort .ctors and .dtors if ctors_in_init_array.
5240         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5241         (Layout::output_section_name): Add relobj parameter.  Change all
5242         callers.  Handle .ctors. and .dtors. in code rather than table.
5243         Handle .ctors and .dtors if ctors_in_init_array.
5244         (Layout::match_file_name): New function, moved from output.cc.
5245         * layout.h (class Layout): Update declarations.
5246         * output.cc: Include "layout.h".
5247         (Input_section_sort_entry::get_priority): New function.
5248         (Input_section_sort_entry::match_file_name): Just call
5249         Layout::match_file_name.
5250         (Output_section::Input_section_sort_init_fini_compare::operator()):
5251         Handle .ctors and .dtors.  Sort by explicit priority rather than
5252         by name.
5253         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5254         * testsuite/initpri2.c: New test.
5255         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5256         (check_PROGRAMS): Add initpri2.
5257         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5258         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5259         * configure, testsuite/Makefile.in: Rebuild.
5260
5261 2011-06-19  Ian Lance Taylor  <iant@google.com>
5262
5263         PR gold/12880
5264         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5265         .interp section to a PT_INTERP segment even if we have seen a
5266         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5267         clause in a linker script.
5268         (Layout::finalize): Don't create a .interp section if we've
5269         already create a PT_INTERP segment.
5270         (Layout::create_interp): Always call choose_output_section (revert
5271         patch of 2011-06-17).  Don't create PT_INTERP segment.
5272         * script-sections.cc
5273         (Script_sections::create_note_and_tls_segments): Add a .interp
5274         section to a PT_INTERP segment even if we have seen a
5275         --dynamic-linker option.
5276
5277 2011-06-18  Ian Lance Taylor  <iant@google.com>
5278
5279         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5280         merely because a non-PT_LOAD segment has a dynamic reloc.
5281
5282 2011-06-18  Ian Lance Taylor  <iant@google.com>
5283
5284         * layout.cc (Layout::finish_dynamic_section): Don't create
5285         DT_FLAGS entry if not needed.
5286
5287 2011-06-18  Ian Lance Taylor  <iant@google.com>
5288
5289         PR gold/12745
5290         * layout.cc (Layout::layout_eh_frame): Correct handling of
5291         writable .eh_frame section.
5292
5293 2011-06-17  Ian Lance Taylor  <iant@google.com>
5294
5295         PR gold/12893
5296         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5297         symbol is redefined with the exact same object and value.
5298
5299 2011-06-17  Ian Lance Taylor  <iant@google.com>
5300
5301         PR gold/12880
5302         * layout.h (class Layout): Add interp_segment_ field.
5303         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5304         (Layout::attach_allocated_section_to_segment): If making shared
5305         library, put .interp section in PT_INTERP segment.
5306         (Layout::finalize): Also call create_interp if -dynamic-linker
5307         option was used.
5308         (Layout::create_interp): Assert that there is no PT_INTERP
5309         segment.  If not using a SECTIONS clause, use make_output_section.
5310         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5311         * script-sections.cc
5312         (Script_sections::create_note_and_tls_segments): If making shared
5313         library, put .interp section in PT_INTERP segment.
5314
5315 2011-06-17  Ian Lance Taylor  <iant@google.com>
5316
5317         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5318         when making a shared library.
5319
5320 2011-06-17  Ian Lance Taylor  <iant@google.com>
5321
5322         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5323         parameter.  Change all callers.  Don't issue warning about PC32
5324         against locally defined symbol.
5325
5326 2011-06-16  Ian Lance Taylor  <iant@google.com>
5327
5328         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5329         occurs in same object.
5330
5331 2011-06-14  Alan Modra  <amodra@gmail.com>
5332
5333         * po/POTFILES.in: Regenerate.
5334
5335 2011-06-09  Ian Lance Taylor  <iant@google.com>
5336
5337         * script-sections.cc
5338         (Orphan_output_section::set_section_addresses): For a relocatable
5339         link set address to 0.
5340
5341 2011-06-09  Cary Coutant  <ccoutant@google.com>
5342
5343         PR gold/12804
5344         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5345         used with --compress-debug-sections.
5346         * gold/object.cc (Sized_relobj_file::do_layout): Report
5347         uncompressed size of compressed input sections.
5348
5349 2011-06-08  Cary Coutant  <ccoutant@google.com>
5350
5351         PR gold/12804
5352         * testsuite/two_file_test_2_v1.cc: Change initialization of
5353         v2 to keep it in .data.
5354
5355 2011-06-07  Cary Coutant  <ccoutant@google.com>
5356
5357         * common.cc (Symbol_table::do_allocate_commons_list): Call
5358         gold_fallback.
5359         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5360         (Errors::fallback): New function.
5361         (gold_fallback): New function.
5362         * errors.h (Errors::fallback): New function.
5363         * gold.cc (gold_exit): Change status parameter to enum; adjust
5364         all callers.
5365         (queue_initial_tasks): Call gold_fallback.
5366         * gold.h: Include cstdlib.
5367         (Exit_status): New enum type.
5368         (gold_exit): Change status parameter to enum.
5369         (gold_fallback): New function.
5370         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5371         (Layout::create_symtab_sections): Likewise.
5372         (Layout::create_shdrs): Likewise.
5373         * main.cc (main): Adjust call to gold_exit.
5374         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5375         (Output_data_got::add_got_entry_pair): Likewise.
5376         (Output_section::add_input_section): Likewise.
5377         (Output_section::add_output_section_data): Likewise.
5378         (Output_segment::set_section_list_addresses): Likewise.
5379         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5380
5381 2011-06-07  Cary Coutant  <ccoutant@google.com>
5382
5383         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5384         for incremental links.
5385         * output.cc (Output_segment::set_section_list_addresses): Remove
5386         FIXME and test for TLS or BSS.
5387
5388 2011-06-07  Cary Coutant  <ccoutant@google.com>
5389
5390         * testsuite/Makefile.am: Add incremental_copy_test,
5391         incremental_common_test_1.
5392         * testsuite/Makefile.in: Regenerate.
5393         * testsuite/common_test_1_v1.c: New source file.
5394         * testsuite/common_test_1_v2.c: New source file.
5395         * testsuite/copy_test_v1.cc: New source file.
5396
5397 2011-06-07  Cary Coutant  <ccoutant@google.com>
5398
5399         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5400         update, allocate common from bss section's free list.
5401         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5402         linker-defined symbols.
5403         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5404         Skip GOT and PLT entries that are no longer referenced.
5405         (Output_section_incremental_inputs::write_info_blocks): Mark
5406         linker-defined symbols.
5407         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5408         * output.cc (Output_section::allocate): New function.
5409         * output.h (Output_section::allocate): New function.
5410         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5411         linker-defined symbols.
5412         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5413         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5414         (Symbol::init_base_output_data): Likewise.
5415         (Symbol::init_base_output_segment): Likewise.
5416         (Symbol::init_base_constant): Likewise.
5417         (Sized_symbol::init_output_data): Likewise.
5418         (Sized_symbol::init_output_segment): Likewise.
5419         (Sized_symbol::init_constant): Likewise.
5420         (Symbol_table::do_define_in_output_data): Likewise.
5421         (Symbol_table::do_define_in_output_segment): Likewise.
5422         (Symbol_table::do_define_as_constant): Likewise.
5423         * symtab.h (Symbol::is_predefined): New function.
5424         (Symbol::init_base_output_data): Add is_predefined parameter.
5425         (Symbol::init_base_output_segment): Likewise.
5426         (Symbol::init_base_constant): Likewise.
5427         (Symbol::is_predefined_): New data member.
5428         (Sized_symbol::init_output_data): Add is_predefined parameter.
5429         (Sized_symbol::init_output_segment): Likewise.
5430         (Sized_symbol::init_constant): Likewise.
5431         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5432
5433 2011-06-07  Cary Coutant  <ccoutant@google.com>
5434
5435         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5436         instead of emit_copy_reloc.
5437         (Copy_relocs::emit_copy_reloc): Refactor.
5438         (Copy_relocs::make_copy_reloc): New function.
5439         (Copy_relocs::add_copy_reloc): Remove.
5440         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5441         section.
5442         (Copy_relocs::make_copy_reloc): New function.
5443         (Copy_relocs::add_copy_reloc): Remove.
5444         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5445         unchanged input files.
5446         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5447         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5448         Reserve BSS space for COPY relocations.
5449         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5450         (Output_section_incremental_inputs::write_info_blocks): Record
5451         whether a symbol is copied from a shared object.
5452         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5453         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5454         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5455         (Incremental_input_entry_reader::get_output_symbol_index): Add
5456         is_copy parameter.
5457         (Incremental_binary::emit_copy_relocs): New function.
5458         (Incremental_binary::do_emit_copy_relocs): New function.
5459         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5460         new data member.
5461         (Sized_incremental_binary::add_copy_reloc): New function.
5462         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5463         (Sized_incremental_binary::Copy_reloc): New struct.
5464         (Sized_incremental_binary::Copy_relocs): New typedef.
5465         (Sized_incremental_binary::copy_relocs_): New data member.
5466         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5467         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5468         * target.h (Sized_target::emit_copy_reloc): New function.
5469         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5470
5471 2011-06-02  Cary Coutant  <ccoutant@google.com>
5472
5473         PR gold/12163
5474         * gold/archive.cc (Archive::Archive): Initialize new data member.
5475         (Archive::include_all_members): Return if archive has already been
5476         included.
5477         * gold/archive.h (Archive::include_all_members_): New data member.
5478
5479 2011-06-02  Nick Clifton  <nickc@redhat.com>
5480
5481         * dynobj.h: Fix spelling mistake in comment.
5482         * output.cc: Likewise.
5483
5484 2011-05-31  Doug Kwan  <dougkwan@google.com>
5485             Asier Llano
5486
5487         PR gold/12826
5488         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5489         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5490         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5491         redundant arm_exidx_test.so.
5492         * testsuite/Makefile.in: Regenerate.
5493         (check_SCRIPTS): Add pr12826.sh
5494         (check_DATA): Add pr12826.stdout
5495         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5496         * testsuite/pr12826.sh: New file.
5497         * testsuite/pr12826_1.s: Ditto.
5498         * testsuite/pr12826_1.s: Ditto.
5499
5500 2011-05-30  Ian Lance Taylor  <iant@google.com>
5501
5502         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5503         sections.
5504
5505 2011-05-29  Ian Lance Taylor  <iant@google.com>
5506
5507         PR gold/12804
5508         * testsuite/Makefile.am: Use different file name for two_file_test
5509         temporary file for each incremental test.
5510         * testsuite/Makefile.in: Rebuild.
5511
5512 2011-05-29  Ian Lance Taylor  <iant@google.com>
5513
5514         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5515         binary input file is empty.
5516
5517 2011-05-27  Ian Lance Taylor  <iant@google.com>
5518
5519         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5520         (ver_test_9.so): Likewise.
5521         * testsuite/Makefile.in: Rebuild.
5522
5523 2011-05-26 Cary Coutant  <ccoutant@google.com>
5524
5525         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5526         * incremental.cc (Incremental_inputs::report_input_section): Fix
5527         comment, indentation.
5528         (Incremental_inputs::report_comdat_group): New function.
5529         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5530         of data for incremental input file entry.
5531         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5532         group count, COMDAT group signatures.
5533         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5534         an unchanged input file.
5535         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5536         Initialize new data member.
5537         (Incremental_object_entry::add_comdat_group): New function.
5538         (Incremental_object_entry::get_comdat_group_count): New function.
5539         (Incremental_object_entry::get_comdat_signature_key): New function.
5540         (Incremental_object_entry::groups_): New data member.
5541         (Incremental_inputs::report_comdat_group): New function.
5542         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5543         data for incremental input file entry.
5544         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5545         (Incremental_input_entry_reader::get_input_section): Adjust size of
5546         data for incremental input file entry.
5547         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5548         (Incremental_input_entry_reader::get_comdat_group_signature): New
5549         function.
5550         * object.cc (Sized_relobj::include_section_group): Report kept
5551         COMDAT groups for incremental links.
5552
5553 2011-05-24  David Meyer  <pdox@google.com>
5554
5555         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5556         with name parameter.  Add found_name parameter.
5557         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5558         * dirsearch.h (class Dirsearch): Update declaration.
5559
5560 2011-05-24  Ian Lance Taylor  <iant@google.com>
5561
5562         * archive.cc (Library_base::should_include_member): Pull in object
5563         from archive if it defines the entry symbol.
5564         * parameters.cc (Parameters::entry): New function.
5565         * parameters.h (class Parameters): Declare entry.
5566         * output.h (class Output_file_header): Remove entry_ field.
5567         * output.cc (Output_file_header::Output_file_header): Remove entry
5568         parameter.  Change all callers.
5569         (Output_file_header::entry): Use parameters->entry.
5570         * gold.cc (queue_middle_tasks): Likewise.
5571         * plugin.cc (Plugin_hook::run): Likewise.
5572
5573 2011-05-24 Cary Coutant  <ccoutant@google.com>
5574
5575         * gold.cc (queue_initial_tasks): Pass incremental base filename
5576         to Output_file::open_base_file; don't print error message.
5577         * incremental-dump.cc (main): Adjust call to
5578         Output_file::open_for_modification.
5579         * incremental-dump.cc (main): Likewise.
5580         * incremental.cc (Incremental_inputs::report_command_line):
5581         Ignore --incremental-base option when comparing command lines.
5582         Ignore parameter when given as separate argument.
5583         * options.h (class General_options): Add --incremental-base.
5584         * output.cc (Output_file::Output_file):
5585         (Output_file::open_base_file): Add base_name and writable parameters;
5586         read base file into new file; print error message here.
5587         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5588         callers.
5589         * output.h (Output_file::open_for_modification): Rename to...
5590         (Output_file::open_base_file): ...this; add base_name and
5591         writable parameters; adjust all callers.
5592         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5593         callers.
5594         * testsuite/Makefile.am (incremental_test_4): Test
5595         --incremental-base.
5596         * testsuite/Makefile.in: Regenerate.
5597
5598 2011-05-24 Cary Coutant  <ccoutant@google.com>
5599
5600         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5601         incremental_test_4.
5602         * testsuite/Makefile.in: Regenerate.
5603         * testsuite/two_file_test_1_v1.cc: New test source file.
5604         * testsuite/two_file_test_1b_v1.cc: New test source file.
5605         * testsuite/two_file_test_2_v1.cc: New test source file.
5606
5607 2011-05-24 Cary Coutant  <ccoutant@google.com>
5608
5609         * dynobj.h (Dynobj::do_dynobj): New function.
5610         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5611         flag and soname for shared objects.
5612         * incremental.cc (Incremental_inputs::report_object): Make
5613         either Incremental_object_entry or Incremental_dynobj_entry; add
5614         soname to string table.
5615         (Incremental_inputs::report_input_section): Add assertion.
5616         (Output_section_incremental_inputs::set_final_data_size): Adjust
5617         type of input file entry for shared libraries; adjust size of
5618         shared library info entry.
5619         (Output_section_incremental_inputs::write_input_files): Write
5620         as_needed flag for shared libraries.
5621         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5622         of input file entry for shared libraries; write soname.
5623         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5624         soname from incremental info.
5625         * incremental.h (enum Incremental_input_flags): Add
5626         INCREMENTAL_INPUT_AS_NEEDED.
5627         (Incremental_input_entry::Incremental_input_entry): Initialize new
5628         data member.
5629         (Incremental_input_entry::set_as_needed): New function.
5630         (Incremental_input_entry::as_needed): New function.
5631         (Incremental_input_entry::do_dynobj_entry): New function.
5632         (Incremental_input_entry::as_needed_): New data member.
5633         (Incremental_object_entry::Incremental_object_entry): Don't check
5634         for shared library.
5635         (Incremental_object_entry::do_type): Likewise.
5636         (class Incremental_dynobj_entry): New class.
5637         (Incremental_input_entry_reader::as_needed): New function.
5638         (Incremental_input_entry_reader::get_soname): New function.
5639         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5640         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5641         size of shared library info entry.
5642         * layout.cc (Layout::finish_dynamic_section): Don't test for
5643         incremental link when adding DT_NEEDED entries.
5644         * object.h (Object::Object): Initialize new data member.
5645         (Object::dynobj): New function.
5646         (Object::set_as_needed): New function.
5647         (Object::as_needed): New function.
5648         (Object::do_dynobj): New function.
5649         (Object::as_needed_): New data member.
5650
5651 2011-05-24 Cary Coutant  <ccoutant@google.com>
5652
5653         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5654         info; adjust display of GOT entries.
5655         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5656         vector of input objects; remove file_status_.
5657         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5658         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5659         got_plt reader; call target hooks to reserve GOT entries.
5660         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5661         of input file info header and GOT info entry.
5662         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5663         relocation info.
5664         (Got_plt_view_info::got_descriptor): Remove.
5665         (Got_plt_view_info::sym_index): New data member.
5666         (Got_plt_view_info::input_index): New data member.
5667         (Local_got_offset_visitor::visit): Write input file index.
5668         (Global_got_offset_visitor::visit): Write 0 for input file index.
5669         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5670         with sym_index and input_index.
5671         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5672         incremental info GOT entry; replace got_descriptor with input_index.
5673         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5674         map from input file index to object.
5675         (Sized_relobj_incr::do_layout): Replace direct data member reference
5676         with accessor function.
5677         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5678         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5679         Adjust size of input file info header.
5680         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5681         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5682         (Incremental_input_entry_reader::get_input_section): Adjust size of
5683         input file info header.
5684         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5685         of incremental info GOT entry.
5686         (Incremental_got_plt_reader::get_got_desc): Remove.
5687         (Incremental_got_plt_reader::get_got_symndx): New function.
5688         (Incremental_got_plt_reader::get_got_input_index): New function.
5689         (Sized_incremental_binary::Sized_incremental_binary): Remove
5690         file_status_; add input_objects_.
5691         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5692         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5693         (Sized_incremental_binary::file_is_unchanged): Remove.
5694         (Sized_incremental_binary::set_input_object): New function.
5695         (Sized_incremental_binary::input_object): New function.
5696         (Sized_incremental_binary::file_status_): Remove.
5697         (Sized_incremental_binary::input_objects_): New data member.
5698         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5699         references.
5700         (Sized_relobj_incr::invalid_address): Move to base class.
5701         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5702         class.
5703         (Sized_relobj_incr::do_output_section_offset): Likewise.
5704         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5705         (Sized_relobj_incr::section_offsets_): Likewise.
5706         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5707         function.
5708         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5709         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5710         with accessor function.
5711         (Sized_relobj_file::do_layout): Likewise.
5712         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5713         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5714         (Sized_relobj_file::compute_final_local_value): Replace refs to
5715         section_offsets_ with accessor function.
5716         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5717         * object.h (Relobj::Relobj): Initialize new data members.
5718         (Relobj::add_dyn_reloc): New function.
5719         (Relobj::first_dyn_reloc): New function.
5720         (Relobj::dyn_reloc_count): New function.
5721         (Relobj::first_dyn_reloc_): New data member.
5722         (Relobj::dyn_reloc_count_): New data member.
5723         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5724         references.
5725         (Sized_relobj::Address): New typedef.
5726         (Sized_relobj::invalid_address): Move here from child class.
5727         (Sized_relobj::Sized_relobj): Initialize new data members.
5728         (Sized_relobj::sized_relobj): New function.
5729         (Sized_relobj::is_output_section_offset_invalid): Move here from
5730         child class.
5731         (Sized_relobj::get_output_section_offset): Likewise.
5732         (Sized_relobj::local_has_got_offset): Likewise.
5733         (Sized_relobj::local_got_offset): Likewise.
5734         (Sized_relobj::set_local_got_offset): Likewise.
5735         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5736         (Sized_relobj::clear_got_offsets): New function.
5737         (Sized_relobj::section_offsets): Move here from child class.
5738         (Sized_relobj::do_output_section_offset): Likewise.
5739         (Sized_relobj::do_set_section_offset): Likewise.
5740         (Sized_relobj::Local_got_offsets): Likewise.
5741         (Sized_relobj::local_got_offsets_): Likewise.
5742         (Sized_relobj::section_offsets_): Likewise.
5743         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5744         references.
5745         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5746         class.
5747         (Sized_relobj_file::sized_relobj): New function
5748         (Sized_relobj_file::local_has_got_offset): Move to base class.
5749         (Sized_relobj_file::local_got_offset): Likewise.
5750         (Sized_relobj_file::set_local_got_offset): Likewise.
5751         (Sized_relobj_file::get_output_section_offset): Likewise.
5752         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5753         (Sized_relobj_file::do_output_section_offset): Likewise.
5754         (Sized_relobj_file::do_set_section_offset): Likewise.
5755         (Sized_relobj_file::Local_got_offsets): Likewise.
5756         (Sized_relobj_file::local_got_offsets_): Likewise.
5757         (Sized_relobj_file::section_offsets_): Likewise.
5758         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5759         (all constructors).
5760         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5761         (Output_reloc::get_symbol_index): Likewise.
5762         (Output_reloc::local_section_offset): Likewise.
5763         (Output_reloc::get_address): Likewise.
5764         (Output_reloc::symbol_value): Likewise.
5765         (Output_data_got::reserve_slot): Move to class definition.
5766         (Output_data_got::reserve_local): New function.
5767         (Output_data_got::reserve_slot_for_global): Remove.
5768         (Output_data_got::reserve_global): New function.
5769         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5770         (all constructors, two instantiations).
5771         (Output_reloc::get_relobj): New function (two instantiations).
5772         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5773         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5774         (Output_data_reloc::add_global): Adjust type of relobj.
5775         (Output_data_reloc::add_global_relative): Likewise.
5776         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5777         (Output_data_reloc::add_local): Likewise.
5778         (Output_data_reloc::add_local_relative): Likewise.
5779         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5780         (Output_data_reloc::add_local_section): Likewise.
5781         (Output_data_reloc::add_output_section): Likewise.
5782         (Output_data_reloc::add_absolute): Likewise.
5783         (Output_data_reloc::add_target_specific): Likewise.
5784         (Output_data_got::reserve_slot): Move definition here.
5785         (Output_data_got::reserve_local): New function.
5786         (Output_data_got::reserve_global): New function.
5787         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5788         section_offsets_ with accessor function.
5789         (Sized_relobj_file::write_sections): Likewise.
5790         (Sized_relobj_file::do_relocate_sections): Likewise.
5791         * target.h (Sized_target::reserve_local_got_entry): New function.
5792         (Sized_target::reserve_global_got_entry): New function.
5793         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5794         (Target_x86_64::reserve_global_got_entry): New function.
5795         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5796
5797 2011-05-23 Cary Coutant  <ccoutant@google.com>
5798
5799         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5800         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5801         bit when checking got_type.
5802         * incremental.cc (Sized_incremental_binary::setup_readers):
5803         Store symbol table and string table locations; initialize bit vector
5804         of file status flags.
5805         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5806         unchanged files.
5807         (Sized_incremental_binary::do_process_got_plt): New function.
5808         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5809         (Output_section_incremental_inputs::set_final_data_size): Record
5810         file index for each input file.
5811         (Output_section_incremental_inputs::write_got_plt): Store file index
5812         instead of input entry offset for each GOT entry.
5813         * incremental.h
5814         (Incremental_input_entry::Incremental_input_entry): Initialize new
5815         data member.
5816         (Incremental_input_entry::set_offset): Store file index.
5817         (Incremental_input_entry::get_file_index): New function.
5818         (Incremental_input_entry::file_index_): New data member.
5819         (Incremental_binary::process_got_plt): New function.
5820         (Incremental_binary::do_process_got_plt): New function.
5821         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5822         data members.
5823         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5824         (Sized_incremental_binary::set_file_is_unchanged): New function.
5825         (Sized_incremental_binary::file_is_unchanged): New function.
5826         (Sized_incremental_binary::do_process_got_plt): New function.
5827         (Sized_incremental_binary::file_status_): New data member.
5828         (Sized_incremental_binary::main_symtab_loc_): New data member.
5829         (Sized_incremental_binary::main_strtab_loc_): New data member.
5830         * output.cc (Output_data_got::Got_entry::write): Add case
5831         RESERVED_CODE.
5832         (Output_data_got::add_global): Call add_got_entry.
5833         (Output_data_got::add_global_plt): Likewise.
5834         (Output_data_got::add_global_with_rel): Likewise.
5835         (Output_data_got::add_global_with_rela): Likewise.
5836         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5837         (Output_data_got::add_global_pair_with_rela): Likewise.
5838         (Output_data_got::add_local): Call add_got_entry.
5839         (Output_data_got::add_local_plt): Likewise.
5840         (Output_data_got::add_local_with_rel): Likewise.
5841         (Output_data_got::add_local_with_rela): Likewise.
5842         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5843         (Output_data_got::add_local_pair_with_rela): Likewise.
5844         (Output_data_got::reserve_slot): New function.
5845         (Output_data_got::reserve_slot_for_global): New function.
5846         (Output_data_got::add_got_entry): New function.
5847         (Output_data_got::add_got_entry_pair): New function.
5848         (Output_section::add_output_section_data): Edit FIXME.
5849         * output.h
5850         (Output_section_data_build::Output_section_data_build): New
5851         constructor with size parameter.
5852         (Output_data_space::Output_data_space): Likewise.
5853         (Output_data_got::Output_data_got): Initialize new data member; new
5854         constructor with size parameter.
5855         (Output_data_got::add_constant): Call add_got_entry.
5856         (Output_data_got::reserve_slot): New function.
5857         (Output_data_got::reserve_slot_for_global): New function.
5858         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5859         (Output_data_got::add_got_entry): New function.
5860         (Output_data_got::add_got_entry_pair): New function.
5861         (Output_data_got::free_list_): New data member.
5862         * target.h (Sized_target::init_got_plt_for_update): New function.
5863         (Sized_target::register_global_plt_entry): New function.
5864         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5865         Initialize new data member; call init; add constructor with PLT count.
5866         (Output_data_plt_x86_64::init): New function.
5867         (Output_data_plt_x86_64::add_relocation): New function.
5868         (Output_data_plt_x86_64::reserve_slot): New function.
5869         (Output_data_plt_x86_64::free_list_): New data member.
5870         (Target_x86_64::init_got_plt_for_update): New function.
5871         (Target_x86_64::register_global_plt_entry): New function.
5872         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5873         incremental updates.
5874         (Output_data_plt_x86_64::add_relocation): New function.
5875         * testsuite/object_unittest.cc (Object_test): Set default options.
5876
5877 2011-05-16  Ian Lance Taylor  <iant@google.com>
5878
5879         * options.h (class General_options): Make -i a synonym for -r.
5880
5881 2011-05-16  Ian Lance Taylor  <iant@google.com>
5882
5883         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5884
5885 2011-05-10 Cary Coutant  <ccoutant@google.com>
5886
5887         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5888         strip_all (-s).
5889
5890 2011-05-06  Ian Lance Taylor  <iant@google.com>
5891
5892         * layout.cc (Layout::layout): If the output section flags change,
5893         update the ordering.
5894
5895 2011-04-25 Cary Coutant  <ccoutant@google.com>
5896
5897         * incremental-dump.cc (dump_incremental_inputs): Print local
5898         symbol info for each input file.
5899         * incremental.cc
5900         (Output_section_incremental_inputs::set_final_data_size): Add local
5901         symbol info to input file entries in incremental info.
5902         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5903         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5904         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5905         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5906         implementation.
5907         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5908         (Sized_incr_relobj::do_relocate): Write the local symbols.
5909         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5910         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5911         Adjust size of input file header.
5912         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5913         (Incremental_inputs_reader::get_local_symbol_count): New function.
5914         (Incremental_inputs_reader::get_input_section): Adjust size of input
5915         file header.
5916         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5917         (Sized_incr_relobj::This): New typedef.
5918         (Sized_incr_relobj::sym_size): New const data member.
5919         (Sized_incr_relobj::Local_symbol): New struct.
5920         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5921         (Sized_incr_relobj::do_local_symbol_offset): New function.
5922         (Sized_incr_relobj::local_symbol_count_): New data member.
5923         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5924         (Sized_incr_relobj::local_symbol_index_): New data member.
5925         (Sized_incr_relobj::local_symbol_offset_): New data member.
5926         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5927         (Sized_incr_relobj::local_symbols_): New data member.
5928         * object.h (Relobj::output_local_symbol_count): New function.
5929         (Relobj::local_symbol_offset): New function.
5930         (Relobj::do_output_local_symbol_count): New function.
5931         (Relobj::do_local_symbol_offset): New function.
5932         (Sized_relobj::do_output_local_symbol_count): New function.
5933         (Sized_relobj::do_local_symbol_offset): New function.
5934
5935 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5936
5937         * descriptors.cc (set_close_on_exec): New function.
5938         (Descriptors::open): Use set_close_on_exec.
5939         * output.cc (S_ISLNK): Define if not defined.
5940
5941 2011-04-22 Cary Coutant  <ccoutant@google.com>
5942
5943         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5944         global symbol map.
5945         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5946         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5947         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5948         relocations.
5949         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5950         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5951         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5952         * incremental.h
5953         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5954         function.
5955         (Incremental_binary::apply_incremental_relocs): New function.
5956         (Incremental_binary::do_apply_incremental_relocs): New function.
5957         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5958         data member.
5959         (Sized_incremental_binary::add_global_symbol): New function.
5960         (Sized_incremental_binary::global_symbol): New function.
5961         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5962         (Sized_incremental_binary::symbol_map_): New data member.
5963         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5964         * target.h (Sized_target::apply_relocation): New function.
5965         * target-reloc.h (apply_relocation): New function.
5966         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5967
5968 2011-04-22  Doug Kwan  <dougkwan@google.com>
5969
5970         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5971         flag of a SHT_ARM_EXIDX section.
5972         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5973         * testsuite/Makefile.in: Regenerate.
5974         * testsuite/arm_exidx_test.s: New file.
5975         * testsuite/arm_exidx_test.sh: Same.
5976
5977 2011-04-20 Cary Coutant  <ccoutant@google.com>
5978
5979         PR gold/12689
5980         * archive.h (Incremental_archive_entry::Archive_member):
5981         Initialize arg_serial_ (second constructor).
5982
5983 2011-04-17  Ian Lance Taylor  <iant@google.com>
5984
5985         * object.cc (Relocate_info::location): Simplify location string.
5986         * errors.cc (Errors::error_at_location): Don't print program
5987         name.
5988         (Errors::warning_at_location): Likewise.
5989         (Errors::undefined_symbol): Likewise.
5990         * testsuite/debug_msg.sh: Update accordingly.
5991
5992 2011-04-14 Cary Coutant  <ccoutant@google.com>
5993
5994         * gold/layout.cc (Layout::symtab_section_offset): New function.
5995         * gold/layout.h (Layout::symtab_section_offset): New function.
5996         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5997
5998 2011-04-12  Ian Lance Taylor  <iant@google.com>
5999
6000         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6001         with MREMAP_MAYMOVE.
6002         * output.h (class Output_file): Add map_is_allocated_ field.
6003         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6004         not available, provide stubs.  If mremap is not available, #define
6005         it to gold_mremap.
6006         (MREMAP_MAYMOVE): Define if not defined.
6007         (Output_file::Output_file): Initialize map_is_allocated_.
6008         (Output_file::resize): Check map_is_allocated_.
6009         (Output_file::map_anonymous): If mmap fails, use malloc.
6010         (Output_file::unmap): Don't do anything for an anonymous map.
6011         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6012         is not available, provide stubs.
6013         (File_read::View::~View): Use free rather than delete[].
6014         (File_read::make_view): Use malloc rather than new[].  If mmap
6015         fails, use malloc.
6016         (File_read::find_or_make_view): Use malloc rather than new[].
6017         * gold.h: Remove HAVE_REMAP code.
6018         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6019         exists.  Rename mremap to gold_mremap.  If mmap is not available
6020         don't do anything.
6021         * configure, config.in: Rebuild.
6022
6023 2011-04-11  Ian Lance Taylor  <iant@google.com>
6024
6025         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6026         initialize local variable v.
6027
6028 2011-04-11  Cary Coutant  <ccoutant@google.com>
6029
6030         * archive.cc (Archive::include_member): Adjust call to
6031         report_object.
6032         (Add_archive_symbols::run): Track argument serial numbers.
6033         (Lib_group::include_member): Likewise.
6034         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6035         * archive.h (Incremental_archive_entry::Archive_member):
6036         Initialize arg_serial_.
6037         (Archive_member::arg_serial_): New data member.
6038         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6039         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6040         incremental link.
6041         (Sized_dynobj::do_for_all_local_got_entries): New function.
6042         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6043         function.
6044         * fileread.cc (get_mtime): New function.
6045         * fileread.h (get_mtime): New function.
6046         * gold.cc (queue_initial_tasks): Check for incremental update.
6047         (process_incremental_input): New function.
6048         (queue_middle_tasks): Don't force valid target for incremental
6049         update.
6050         * incremental-dump.cc (find_input_containing_global): Adjust
6051         size of symbol info entry.
6052         (dump_incremental_inputs): Dump argument serial number and
6053         in_system_directory flag; bias shndx by 1; print symbol names
6054         when dumping per-file symbol lists; use new symbol info readers.
6055         * incremental.cc
6056         (Output_section_incremental_inputs:update_data_size): New function.
6057         (Sized_incremental_binary::setup_readers): Setup input readers
6058         for each input file; build maps for files added from libraries
6059         and scripts.
6060         (Sized_incremental_binary::check_input_args): New function.
6061         (Sized_incremental_binary::do_check_inputs): Build map of argument
6062         serial numbers to input arguments.
6063         (Sized_incremental_binary::do_file_has_changed): Rename
6064         do_file_is_unchanged to this; compare file modification times.
6065         (Sized_incremental_binary::do_init_layout): New function.
6066         (Sized_incremental_binary::do_reserve_layout): New function.
6067         (Sized_incremental_binary::do_get_input_reader): Remove.
6068         (Sized_incremental_binary::get_symtab_view): New function.
6069         (Incremental_checker::can_incrementally_link_output_file): Remove.
6070         (Incremental_inputs::report_command_line): Exclude --debug options.
6071         (Incremental_inputs::report_archive_begin): Add parameter; track
6072         argument serial numbers; don't put input file entry for archive
6073         before archive members.
6074         (Incremental_inputs::report_archive_end): Put input file entry
6075         for archive after archive members.
6076         (Incremental_inputs::report_object): Add parameter; track argument
6077         serial numbers and in_system_directory flag.
6078         (Incremental_inputs::report_script): Add parameter; track argument
6079         serial numbers.
6080         (Output_section_incremental_inputs::set_final_data_size): Adjust
6081         size of symbol info entry; check for forwarding symbols.
6082         (Output_section_incremental_inputs::write_input_files): Write
6083         in_system_directory flag and argument serial number.
6084         (Output_section_incremental_inputs::write_info_blocks): Map section
6085         indices between incremental info and original input file; store
6086         input section index for each symbol.
6087         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6088         change operator() to visit().
6089         (class Global_got_offset_visitor): Likewise.
6090         (class Global_symbol_visitor_got_plt):
6091         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6092         classes.
6093         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6094         (Sized_incr_relobj::do_read_symbols): New function.
6095         (Sized_incr_relobj::do_layout): New function.
6096         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6097         (Sized_incr_relobj::do_add_symbols): New function.
6098         (Sized_incr_relobj::do_should_include_member): New function.
6099         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6100         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6101         (Sized_incr_relobj::do_section_size): New function.
6102         (Sized_incr_relobj::do_section_name): New function.
6103         (Sized_incr_relobj::do_section_contents): New function.
6104         (Sized_incr_relobj::do_section_flags): New function.
6105         (Sized_incr_relobj::do_section_entsize): New function.
6106         (Sized_incr_relobj::do_section_address): New function.
6107         (Sized_incr_relobj::do_section_type): New function.
6108         (Sized_incr_relobj::do_section_link): New function.
6109         (Sized_incr_relobj::do_section_info): New function.
6110         (Sized_incr_relobj::do_section_addralign): New function.
6111         (Sized_incr_relobj::do_initialize_xindex): New function.
6112         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6113         (Sized_incr_relobj::do_read_relocs): New function.
6114         (Sized_incr_relobj::do_gc_process_relocs): New function.
6115         (Sized_incr_relobj::do_scan_relocs): New function.
6116         (Sized_incr_relobj::do_count_local_symbols): New function.
6117         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6118         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6119         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6120         (Sized_incr_relobj::do_relocate): New function.
6121         (Sized_incr_relobj::do_set_section_offset): New function.
6122         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6123         (Sized_incr_dynobj::do_read_symbols): New function.
6124         (Sized_incr_dynobj::do_layout): New function.
6125         (Sized_incr_dynobj::do_add_symbols): New function.
6126         (Sized_incr_dynobj::do_should_include_member): New function.
6127         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6128         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6129         (Sized_incr_dynobj::do_section_size): New function.
6130         (Sized_incr_dynobj::do_section_name): New function.
6131         (Sized_incr_dynobj::do_section_contents): New function.
6132         (Sized_incr_dynobj::do_section_flags): New function.
6133         (Sized_incr_dynobj::do_section_entsize): New function.
6134         (Sized_incr_dynobj::do_section_address): New function.
6135         (Sized_incr_dynobj::do_section_type): New function.
6136         (Sized_incr_dynobj::do_section_link): New function.
6137         (Sized_incr_dynobj::do_section_info): New function.
6138         (Sized_incr_dynobj::do_section_addralign): New function.
6139         (Sized_incr_dynobj::do_initialize_xindex): New function.
6140         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6141         (make_sized_incremental_object): New function.
6142         (Incremental_library::copy_unused_symbols): New function.
6143         (Incremental_library::do_for_all_unused_symbols): New function.
6144         * incremental.h (enum Incremental_input_flags): New type.
6145         (class Incremental_checker): Remove.
6146         (Incremental_input_entry::Incremental_input_entry): Add argument
6147         serial number.
6148         (Incremental_input_entry::arg_serial): New function.
6149         (Incremental_input_entry::set_is_in_system_directory): New function.
6150         (Incremental_input_entry::is_in_system_directory): New function.
6151         (Incremental_input_entry::arg_serial_): New data member.
6152         (Incremental_input_entry::is_in_system_directory_): New data member.
6153         (class Script_info): Move here from script.h.
6154         (Script_info::Script_info): Add filename parameter.
6155         (Script_info::filename): New function.
6156         (Script_info::filename_): New data member.
6157         (Incremental_script_entry::Incremental_script_entry): Add argument
6158         serial number.
6159         (Incremental_object_entry::Incremental_object_entry): Likewise.
6160         (Incremental_object_entry::add_input_section): Build list of input
6161         sections with map to original shndx.
6162         (Incremental_object_entry::get_input_section_index): New function.
6163         (Incremental_object_entry::shndx_): New data member.
6164         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6165         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6166         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6167         serial number.
6168         (Incremental_inputs::report_archive_begin): Likewise.
6169         (Incremental_inputs::report_object): Likewise.
6170         (Incremental_inputs::report_script): Likewise.
6171         (class Incremental_global_symbol_reader): New class.
6172         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6173         and store flags and input file type.
6174         (Incremental_input_entry_reader::arg_serial): New function.
6175         (Incremental_input_entry_reader::type): Extract type from flags.
6176         (Incremental_input_entry_reader::is_in_system_directory): New function.
6177         (Incremental_input_entry_reader::get_input_section_count): Call
6178         accessor function for type.
6179         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6180         function for type; adjust size of global symbol entry.
6181         (Incremental_input_entry_reader::get_global_symbol_count): Call
6182         accessor function for type.
6183         (Incremental_input_entry_reader::get_object_count): Likewise.
6184         (Incremental_input_entry_reader::get_object_offset): Likewise.
6185         (Incremental_input_entry_reader::get_member_count): Likewise.
6186         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6187         (Incremental_input_entry_reader::get_member_offset): Likewise.
6188         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6189         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6190         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6191         (Incremental_input_entry_reader::get_global_symbol_reader): New
6192         function.
6193         (Incremental_input_entry_reader::get_output_symbol_index): New
6194         function.
6195         (Incremental_input_entry_reader::type_): Remove.
6196         (Incremental_input_entry_reader::flags_): New data member.
6197         (Incremental_inputs_reader::input_file_offset): New function.
6198         (Incremental_inputs_reader::input_file_index): New function.
6199         (Incremental_inputs_reader::input_file): Call input_file_offset.
6200         (Incremental_inputs_reader::input_file_at_offset): New function.
6201         (Incremental_relocs_reader::get_r_type): Reformat.
6202         (Incremental_relocs_reader::get_r_shndx): Reformat.
6203         (Incremental_relocs_reader::get_r_offset): Reformat.
6204         (Incremental_relocs_reader::data): New function.
6205         (Incremental_binary::Incremental_binary): Initialize new data members.
6206         (Incremental_binary::check_inputs): Add cmdline parameter.
6207         (Incremental_binary::file_is_unchanged): Remove.
6208         (Input_reader::arg_serial): New function.
6209         (Input_reader::get_unused_symbol_count): New function.
6210         (Input_reader::get_unused_symbol): New function.
6211         (Input_reader::do_arg_serial): New function.
6212         (Input_reader::do_get_unused_symbol_count): New function.
6213         (Input_reader::do_get_unused_symbol): New function.
6214         (Incremental_binary::input_file_count): New function.
6215         (Incremental_binary::get_input_reader): Change signature to use
6216         index instead of filename.
6217         (Incremental_binary::file_has_changed): New function.
6218         (Incremental_binary::get_input_argument): New function.
6219         (Incremental_binary::get_library): New function.
6220         (Incremental_binary::get_script_info): New function.
6221         (Incremental_binary::init_layout): New function.
6222         (Incremental_binary::reserve_layout): New function.
6223         (Incremental_binary::output_file): New function.
6224         (Incremental_binary::do_check_inputs): New function.
6225         (Incremental_binary::do_file_is_unchanged): Remove.
6226         (Incremental_binary::do_file_has_changed): New function.
6227         (Incremental_binary::do_init_layout): New function.
6228         (Incremental_binary::do_reserve_layout): New function.
6229         (Incremental_binary::do_input_file_count): New function.
6230         (Incremental_binary::do_get_input_reader): Change signature.
6231         (Incremental_binary::input_args_map_): New data member.
6232         (Incremental_binary::library_map_): New data member.
6233         (Incremental_binary::script_map_): New data member.
6234         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6235         new data members.
6236         (Sized_incremental_binary::output_section): New function.
6237         (Sized_incremental_binary::inputs_reader): Add const.
6238         (Sized_incremental_binary::symtab_reader): Add const.
6239         (Sized_incremental_binary::relocs_reader): Add const.
6240         (Sized_incremental_binary::got_plt_reader): Add const.
6241         (Sized_incremental_binary::get_symtab_view): New function.
6242         (Sized_incremental_binary::Inputs_reader): New typedef.
6243         (Sized_incremental_binary::Input_entry_reader): New typedef.
6244         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6245         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6246         (Sized_incremental_binary::do_file_has_changed): New function.
6247         (Sized_incremental_binary::do_init_layout): New function.
6248         (Sized_incremental_binary::do_reserve_layout): New function.
6249         (Sized_input_reader::Inputs_reader): Remove.
6250         (Sized_input_reader::Input_entry_reader): Remove.
6251         (Sized_input_reader::do_arg_serial): New function.
6252         (Sized_input_reader::do_get_unused_symbol_count): New function.
6253         (Sized_input_reader::do_get_unused_symbol): New function.
6254         (Sized_incremental_binary::do_input_file_count): New function.
6255         (Sized_incremental_binary::do_get_input_reader): Change signature;
6256         use index instead of filename.
6257         (Sized_incremental_binary::section_map_): New data member.
6258         (Sized_incremental_binary::input_entry_readers_): New data member.
6259         (class Sized_incr_relobj): New class.
6260         (class Sized_incr_dynobj): New class.
6261         (make_sized_incremental_object): New function.
6262         (class Incremental_library): New class.
6263         * layout.cc (Free_list::num_lists): New static data member.
6264         (Free_list::num_nodes): New static data member.
6265         (Free_list::num_removes): New static data member.
6266         (Free_list::num_remove_visits): New static data member.
6267         (Free_list::num_allocates): New static data member.
6268         (Free_list::num_allocate_visits): New static data member.
6269         (Free_list::init): New function.
6270         (Free_list::remove): New function.
6271         (Free_list::allocate): New function.
6272         (Free_list::dump): New function.
6273         (Free_list::print_stats): New function.
6274         (Layout_task_runner::run): Resize output file for incremental updates.
6275         (Layout::Layout): Initialize new data members.
6276         (Layout::set_incremental_base): New function.
6277         (Layout::init_fixed_output_section): New function.
6278         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6279         incremental updates.
6280         (Layout::create_gold_note): Do not create gold note section for
6281         incremental updates.
6282         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6283         for incremental updates.
6284         (Layout::set_section_offsets): For incremental updates, allocate space
6285         from free list.
6286         (Layout::create_symtab_sections): Layout with offsets relative to
6287         start of section; for incremental updates, allocate space from free
6288         list.
6289         (Layout::create_shdrs): For incremental updates, allocate space from
6290         free list.
6291         (Layout::finish_dynamic_section): For incremental updates, do not
6292         check --as-needed (fixed in subsequent patch).
6293         * layout.h (class Free_list): New class.
6294         (Layout::set_incremental_base): New function.
6295         (Layout::incremental_base): New function.
6296         (Layout::init_fixed_output_section): New function.
6297         (Layout::allocate): New function.
6298         (Layout::incremental_base_): New data member.
6299         (Layout::free_list_): New data member.
6300         * main.cc (main): Print Free_list statistics.
6301         * object.cc (Relobj::finalize_incremental_relocs): Add
6302         clear_counts parameter; clear counts only when clear_counts is set.
6303         (Sized_relobj::Sized_relobj): Initialize new base class.
6304         (Sized_relobj::do_layout): Don't report special sections.
6305         (Sized_relobj::do_for_all_local_got_entries): New function.
6306         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6307         symtab_off to all symbol table offsets.
6308         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6309         * object.h (class Got_offset_list): Move to top of file.
6310         (Object::Object): Allow case where input_file == NULL.
6311         (Object::~Object): Likewise.
6312         (Object::input_file): Assert that input_file != NULL.
6313         (Object::lock): Allow case where input_file == NULL.
6314         (Object::unlock): Likewise.
6315         (Object::is_locked): Likewise.
6316         (Object::token): Likewise.
6317         (Object::release): Likewise.
6318         (Object::is_incremental): New function.
6319         (Object::get_mtime): New function.
6320         (Object::for_all_local_got_entries): New function.
6321         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6322         (Object::set_is_in_system_directory): New function.
6323         (Object::is_in_system_directory): New function.
6324         (Object::do_is_incremental): New function.
6325         (Object::do_get_mtime): New function.
6326         (Object::do_for_all_local_got_entries): New function.
6327         (Object::is_in_system_directory_): New data member.
6328         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6329         (class Sized_relobj_base): New class.
6330         (class Sized_relobj): Derive from Sized_relobj_base.
6331         (class Sized_relobj::Symbols): Redeclare from base class.
6332         (class Sized_relobj::local_got_offset_list): Remove.
6333         (class Sized_relobj::Output_sections): Redeclare from base class.
6334         (class Sized_relobj::do_for_all_local_got_entries): New function.
6335         (class Sized_relobj::write_local_symbols): Add offset parameter.
6336         (class Sized_relobj::local_symbol_offset_): Update comment.
6337         (class Sized_relobj::local_dynsym_offset_): Update comment.
6338         * options.cc (Input_arguments::add_file): Remove const.
6339         * options.h (Input_file_argument::Input_file_argument):
6340         Initialize arg_serial_ (all constructors).
6341         (Input_file_argument::set_arg_serial): New function.
6342         (Input_file_argument::arg_serial): New function.
6343         (Input_file_argument::arg_serial_): New data member.
6344         (Input_arguments::Input_arguments): Initialize file_count_.
6345         (Input_arguments::add_file): Remove const.
6346         (Input_arguments::number_of_input_files): New function.
6347         (Input_arguments::file_count_): New data member.
6348         (Command_line::number_of_input_files): Call
6349         Input_arguments::number_of_input_files.
6350         * output.cc (Output_segment_headers::Output_segment_headers):
6351         Set current size.
6352         (Output_section::Input_section::current_data_size): New function.
6353         (Output_section::Output_section): Initialize new data members.
6354         (Output_section::add_input_section): Don't do merge sections for
6355         an incremental link; allocate space from free list for an
6356         incremental update.
6357         (Output_section::add_output_section_data): Allocate space from
6358         free list for an incremental update.
6359         (Output_section::update_data_size): New function.
6360         (Output_section::set_fixed_layout): New function.
6361         (Output_section::reserve): New function.
6362         (Output_segment::set_section_addresses): Remove const.
6363         (Output_segment::set_section_list_addresses): Remove const; allocate
6364         space from free list for an incremental update.
6365         (Output_segment::set_offset): Adjust size of RELRO segment for an
6366         incremental update.
6367         * output.h (Output_data::current_data_size): Move here from
6368         child classes.
6369         (Output_data::pre_finalize_data_size): New function.
6370         (Output_data::update_data_size): New function.
6371         (Output_section_headers::update_data_size): new function.
6372         (Output_section_data_build::current_data_size): Move to Output_data.
6373         (Output_data_strtab::update_data_size): New function.
6374         (Output_section::current_data_size): Move to Output_data.
6375         (Output_section::set_fixed_layout): New function.
6376         (Output_section::has_fixed_layout): New function.
6377         (Output_section::reserve): New function.
6378         (Output_section::update_data_size): New function.
6379         (Output_section::has_fixed_layout_): New data member.
6380         (Output_section::free_list_): New data member.
6381         (Output_segment::set_section_addresses): Remove const.
6382         (Output_segment::set_section_list_addresses): Remove const.
6383         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6384         New function.
6385         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6386         New function.
6387         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6388         parameter when calling Add_symbols constructor; store argument
6389         serial number for members of a lib group.
6390         (Add_symbols::locks): Allow case where token == NULL.
6391         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6392         (Read_member::~Read_member): New function.
6393         (Read_member::is_runnable): New function.
6394         (Read_member::locks): New function.
6395         (Read_member::run): New function.
6396         (Check_script::~Check_script): New function.
6397         (Check_script::is_runnable): New function.
6398         (Check_script::locks): New function.
6399         (Check_script::run): New function.
6400         (Check_library::~Check_library): New function.
6401         (Check_library::is_runnable): New function.
6402         (Check_library::locks): New function.
6403         (Check_library::run): New function.
6404         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6405         (Add_symbols::library_): New data member.
6406         (class Read_member): New class.
6407         (class Check_script): New class.
6408         (class Check_library): New class.
6409         * reloc.cc (Read_relocs::is_runnable): Allow case where
6410         token == NULL.
6411         (Read_relocs::locks): Likewise.
6412         (Scan_relocs::locks): Likewise.
6413         (Relocate_task::locks): Likewise.
6414         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6415         to clear counters.
6416         (Sized_relobj::incremental_relocs_scan): Fix comment.
6417         (Sized_relobj::do_relocate): Pass output file offset to
6418         write_local_symbols.
6419         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6420         from class declaration.
6421         * script.cc (read_input_script): Allocate Script_info; pass
6422         argument serial number to report_script.
6423         * script.h (class Script_info): Move to incremental.h.
6424         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6425         * symtab.h (Symbol_table::add_from_incrobj): New function.
6426         (Symbol_table::set_file_offset): New function.
6427
6428 2011-04-05  Cary Coutant  <ccoutant@google.com>
6429
6430         * incremental-dump.cc (dump_incremental_inputs): Change signature
6431         to take a Sized_incremental_binary; change caller.  Use readers
6432         in Sized_incremental_binary.
6433         * incremental.cc
6434         (Sized_incremental_binary::find_incremental_inputs_sections):
6435         Rename do_find_incremental_inputs_sections to this.
6436         (Sized_incremental_binary::setup_readers): New function.
6437         (Sized_incremental_binary::do_check_inputs): Check
6438         has_incremental_info_ flag; move setup code to setup_readers;
6439         use input readers.
6440         (Sized_incremental_binary::do_file_is_unchanged): New function.
6441         (Sized_incremental_binary::do_get_input_reader): New function.
6442         * incremental.h (class Incremental_binary): Move to end of file.
6443         (Incremental_binary::file_is_unchanged): New function.
6444         (Incremental_binary::do_file_is_unchanged): New function.
6445         (Incremental_binary::Input_reader): New class.
6446         (Incremental_binary::get_input_reader): New function.
6447         (class Sized_incremental_binary): Move to end of file.
6448         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6449         input section reader classes.
6450         (Sized_incremental_binary::has_incremental_info): New function.
6451         (Sized_incremental_binary::inputs_reader): New function.
6452         (Sized_incremental_binary::symtab_reader): New function.
6453         (Sized_incremental_binary::relocs_reader): New function.
6454         (Sized_incremental_binary::got_plt_reader): New function.
6455         (Sized_incremental_binary::do_file_is_unchanged): New function.
6456         (Sized_incremental_binary::Sized_input_reader): New class.
6457         (Sized_incremental_binary::get_input_reader): New function.
6458         (Sized_incremental_binary::find_incremental_inputs_sections):
6459         Rename do_find_incremental_inputs_sections to this.
6460         (Sized_incremental_binary::setup_readers): New function.
6461         (Sized_incremental_binary::has_incremental_info_): New data member.
6462         (Sized_incremental_binary::inputs_reader_): New data member.
6463         (Sized_incremental_binary::symtab_reader_): New data member.
6464         (Sized_incremental_binary::relocs_reader_): New data member.
6465         (Sized_incremental_binary::got_plt_reader_): New data member.
6466         (Sized_incremental_binary::current_input_file_): New data member.
6467
6468 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6469
6470         PR gold/12640
6471         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6472         violation.
6473
6474 2011-03-30  Cary Coutant  <ccoutant@google.com>
6475
6476         * archive.cc (Archive::include_member): Adjust call to report_object.
6477         (Add_archive_symbols::run): Add script_info to call to
6478         report_archive_begin.
6479         (Lib_group::include_member): Adjust call to report_object.
6480         (Add_lib_group_symbols::run): Adjust call to report_object.
6481         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6482         blocks.  Add object count for script input files.
6483         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6484         script_info parameter; change all callers.
6485         (Incremental_inputs::report_object): Add script_info parameter;
6486         change all callers.
6487         (Incremental_inputs::report_script): Store backpointer to
6488         incremental info entry.
6489         (Output_section_incremental_inputs::set_final_data_size): Record
6490         additional information for scripts.
6491         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6492         * incremental.h (Incremental_script_entry::add_object): New function.
6493         (Incremental_script_entry::get_object_count): New function.
6494         (Incremental_script_entry::get_object): New function.
6495         (Incremental_script_entry::objects_): New data member; adjust
6496         constructor.
6497         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6498         (Incremental_inputs::report_object): Add script_info parameter.
6499         (Incremental_inputs_reader::get_object_count): New function.
6500         (Incremental_inputs_reader::get_object_offset): New function.
6501         * options.cc (Input_arguments::add_file): Return reference to
6502         new input argument.
6503         * options.h (Input_argument::set_script_info): New function.
6504         (Input_argument::script_info): New function.
6505         (Input_argument::script_info_): New data member; adjust all
6506         constructors.
6507         (Input_file_group::add_file): Return reference to new input argument.
6508         (Input_file_lib::add_file): Likewise.
6509         (Input_arguments::add_file): Likewise.
6510         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6511         * script.cc (Parser_closure::Parser_closure): Add script_info
6512         parameter; adjust all callers.
6513         (Parser_closure::script_info): New function.
6514         (Parser_closure::script_info_): New data member.
6515         (read_input_script): Report scripts earlier to incremental info.
6516         (script_add_file): Set script_info in Input_argument.
6517         (script_add_library): Likewise.
6518         * script.h (Script_options::Script_info): Rewrite class.
6519
6520 2011-03-29  Cary Coutant  <ccoutant@google.com>
6521
6522         * archive.cc (Library_base::should_include_member): Move
6523         method here from class Archive.
6524         (Archive::Archive): Initialize base class.
6525         (Archive::should_include_member): Move to base class.
6526         (Archive::do_for_all_unused_symbols): New function.
6527         (Add_archive_symbols::run): Remove redundant access to
6528         incremental_inputs.
6529         (Lib_group::Lib_group): Initialize base class.
6530         (Lib_group::do_filename): New function.
6531         (Lib_group::include_member): Pass pointer to Lib_group to
6532         report_object.
6533         (Lib_group::do_for_all_unused_symbols): New function.
6534         (Add_lib_group_symbols::run): Report archive information for
6535         incremental links.
6536         * archive.h (class Library_base): New base class.
6537         (class Archive): Derive from Library_base.
6538         (Archive::filename): Move to base class.
6539         (Archive::set_incremental_info): Likewise.
6540         (Archive::incremental_info): Likewise.
6541         (Archive::Should_include): Likewise.
6542         (Archive::should_include_member): Likewise.
6543         (Archive::Armap_entry): Remove.
6544         (Archive::Unused_symbol_iterator): Remove.
6545         (Archive::unused_symbols_begin): Remove.
6546         (Archive::unused_symbols_end): Remove.
6547         (Archive::do_filename): New function.
6548         (Archive::do_get_mtime): New function.
6549         (Archive::do_for_all_unused_symbols): New function.
6550         (Archive::task_): Move to base class.
6551         (Archive::incremental_info_): Likewise.
6552         (class Lib_group): Derive from Library_base.
6553         (Lib_group::do_filename): New function.
6554         (Lib_group::do_get_mtime): New function.
6555         (Lib_group::do_for_all_unused_symbols): New function.
6556         (Lib_group::task_): Move to base class.
6557         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6558         function.
6559         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6560         function.
6561         * incremental.cc (Incremental_inputs::report_archive_begin):
6562         Use Library_base; call library's get_mtime; add incremental inputs
6563         entry before members.
6564         (class Unused_symbol_visitor): New class.
6565         (Incremental_inputs::report_archive_end): Use Library_base; use
6566         visitor class to record unused symbols; don't add incremental inputs
6567         entry after members.
6568         (Incremental_inputs::report_object): Use Library_base.
6569         * incremental.h
6570         (Incremental_archive_entry::Incremental_archive_entry): Remove
6571         unused Archive parameter.
6572         (Incremental_inputs::report_archive_begin): Use Library_base.
6573         (Incremental_inputs::report_archive_end): Likewise.
6574         (Incremental_inputs::report_object): Likewise.
6575         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6576         function.
6577         * object.h (Object::for_all_global_symbols): New function.
6578         (Object::do_for_all_global_symbols): New function.
6579         (Sized_relobj::do_for_all_global_symbols): New function.
6580         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6581         function.
6582         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6583         function.
6584
6585 2011-03-27  Ian Lance Taylor  <iant@google.com>
6586
6587         * archive.cc (Archive::interpret_header): Return -1 if something
6588         goes wrong.  Change callers accordingly.
6589
6590 2011-03-25  Cary Coutant  <ccoutant@google.com>
6591
6592         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6593         * testsuite/Makefile.in: Regenerate.
6594
6595 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6596
6597         * plugin.cc (get_view): New.
6598         (Plugin::load): Pass get_view to the plugin.
6599         (Plugin_manager::get_view): New.
6600
6601 2011-03-21  Ian Lance Taylor  <iant@google.com>
6602
6603         * testsuite/final_layout.sh: Rewrite to not use dc.
6604         * testsuite/relro_test.sh: Fail if dc is not present.
6605
6606 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6607
6608         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6609         Change == to -eq.
6610         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6611         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6612         Change == to -eq.
6613         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6614         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6615
6616 2011-03-14  Ian Lance Taylor  <iant@google.com>
6617
6618         * script-sections.cc (Sort_output_sections::script_compare):
6619         Rename from is_before, change return type.
6620         (Sort_output_sections::operator()): Adjust accordingly.
6621
6622 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6623
6624         PR gold/12572
6625         * testsuite/odr_violation2.cc: Add comment to make all error line
6626         numbers double digits.
6627         * testsuite/debug_msg.sh: Adjust expected errors.
6628
6629 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6630
6631         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6632         but mark earlier ones as non-canonical
6633         (offset_to_iterator): Update search target and example
6634         (do_addr2line): Return extra lines in a vector*
6635         (format_file_lineno): Extract from do_addr2line
6636         (one_addr2line): Add vector* out-param
6637         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6638         when a lineno entry appeared last for its instruction
6639         (Dwarf_line_info): Add vector* out-param
6640         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6641         * symtab.cc (Odr_violation_compare): Include the lineno in the
6642         comparison again.
6643         (linenos_from_loc): New. Combine the canonical line for an
6644         address with its other lines.
6645         (True_if_intersect): New. Helper functor to make
6646         std::set_intersection a query.
6647         (detect_odr_violations): Compare sets of lines instead of just
6648         one line for each function. This became less deterministic, but
6649         has fewer false positives.
6650         * symtab.h: Declarations.
6651         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6652         mix an optimized and non-optimized object in the same binary
6653         (odr_violation2.so): Same.
6654         * testsuite/Makefile.in: Regenerate from Makefile.am.
6655         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6656         * testsuite/debug_msg.sh: Update line numbers and add
6657         assertions.
6658         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6659         non-optimized context.
6660         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6661         isn't inlined, and use OdrDerived in an optimized context.
6662         * testsuite/odr_header1.h: Defines OdrDerived, where
6663         optimization will change the
6664         first-instruction-in-the-destructor's file and line number.
6665         * testsuite/odr_header2.h: Defines OdrBase.
6666
6667 2011-03-09  Ian Lance Taylor  <iant@google.com>
6668
6669         * fileread.cc (File_read::clear_views): Don't delete the whole
6670         file view.
6671
6672 2011-03-08  Ian Lance Taylor  <iant@google.com>
6673
6674         PR gold/12525
6675         * fileread.cc: #include <climits>.
6676         (GOLD_IOV_MAX): Define.
6677         (File_read::read_multiple): Limit number of entries by iov_max.
6678         * fileread.h (class File_read): Always set max_readv_entries to
6679         128.
6680
6681 2011-03-07  Ian Lance Taylor  <iant@google.com>
6682
6683         PR gold/12525
6684         * options.h (class General_options): Add -dy and -dn.
6685
6686 2011-03-02  Cary Coutant  <ccoutant@google.com>
6687
6688         * testsuite/script_test_9.t: Add TLS segment.
6689
6690 2011-03-02  Simon Baldwin  <simonb@google.com>
6691
6692         * configure.ac: Add check for gnu_indirect_function support in
6693         the toolchain building binutils.
6694         * configure: Rebuild.
6695
6696 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6697
6698         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6699         plugin only symbols.
6700         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6701         in plugin files as not needed in the symbol table.
6702
6703 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6704
6705         * output.cc (Output_section::add_input_section): Delay fill
6706         generation for section ordering.
6707
6708 2011-02-09  Ian Lance Taylor  <iant@google.com>
6709
6710         PR gold/12316
6711         * object.h (class Sized_relobj): Remove clear_local_symbols.
6712         * reloc.cc (Sized_relobj::do_relocate): Don't call
6713         clear_local_symbols.
6714
6715 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6716
6717         * plugin.cc (is_visible_from_outside): Return true for symbols
6718         in the -u option.
6719
6720 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6721
6722         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6723         filename.
6724
6725 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6726
6727         * icf.h (is_section_foldable_candidate): Change type of parameter
6728         to std::string.
6729         * icf.cc (Icf::find_identical_sections): Change type of local variable
6730         section_name to be std::string.
6731         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6732
6733 2011-01-25  Ian Lance Taylor  <iant@google.com>
6734
6735         * script.cc (script_add_extern): Rewrite to use
6736         add_symbol_reference.
6737
6738 2011-01-25  Doug Kwan  <dougkwan@google.com>
6739
6740         * icf.cc (get_section_contents): Always lock section's object.
6741
6742 2011-01-24  Ian Lance Taylor  <iant@google.com>
6743
6744         * options.h (class General_options): Accept
6745         --no-detect-odr-violations.
6746
6747 2011-01-24  Ian Lance Taylor  <iant@google.com>
6748
6749         * version.cc (version_string): Bump to 1.11.
6750
6751 2011-01-24  Ian Lance Taylor  <iant@google.com>
6752
6753         * plugin.cc (class Plugin_rescan): Define new class.
6754         (Plugin_manager::claim_file): Set any_claimed_.
6755         (Plugin_manager::save_archive): New function.
6756         (Plugin_manager::save_input_group): New function.
6757         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6758         necessary.
6759         (Plugin_manager::new_undefined_symbol): New function.
6760         (Plugin_manager::rescan): New function.
6761         (Plugin_manager::rescannable_defines): New function.
6762         (Plugin_manager::add_input_file): Set any_added_.
6763         * plugin.h (class Plugin_manager): define new fields rescannable_,
6764         undefined_symbols_, any_claimed_, and any_added_.  Declare
6765         Plugin_rescan as friend.  Declare new functions.
6766         (Plugin_manager::Rescannable): Define type.
6767         (Plugin_manager::Rescannable_list): Define type.
6768         (Plugin_manager::Undefined_symbol_list): Define type.
6769         (Plugin_manager::Plugin_manager): Initialize new fields.
6770         * archive.cc (Archive::defines_symbol): New function.
6771         (Add_archive_symbols::run): Pass archive to plugins if any.
6772         * archive.h (class Archive): Declare defines_symbol.
6773         * readsyms.cc (Input_group::~Input_group): New function.
6774         (Finish_group::run): Pass input_group to plugins if any.
6775         * readsyms.h (class Input_group): Declare destructor.
6776         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6777         any.
6778
6779 2011-01-10  Ian Lance Taylor  <iant@google.com>
6780
6781         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6782         section as relro.
6783         (Layout::set_segment_offsets): Reset increase_relro before calling
6784         set_section_addresses a second time.
6785
6786 2011-01-04  Cary Coutant  <ccoutant@google.com>
6787
6788         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6789         sections before NOBITS sections.
6790
6791 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6792
6793         * version.cc (print_version): Update copyright to 2011.
6794
6795 2010-12-23  Cary Coutant  <ccoutant@google.com>
6796
6797         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6798         of OS to this->add.  Add OD parameter to second form of the function.
6799
6800 2010-12-20  Ian Lance Taylor  <iant@google.com>
6801
6802         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6803         second of two consecutive entries with same offset.
6804
6805 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6806
6807         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6808         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6809         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6810         to avoid unneeded links against $(LDADD).
6811         * testsuite/Makefile.in: Regenerate.
6812
6813 2010-12-15  Ian Lance Taylor  <iant@google.com>
6814
6815         PR gold/12324
6816         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6817         for R_X86_64_32 and R_X86_64_PC32.
6818         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6819         ver_matching_def_pic.o.
6820         (ver_matching_def_pic.o): New target.
6821
6822 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6823
6824         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6825         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6826         Move definition before File_read::View member definitions.
6827         (File_read::View::~View): Initialize and hold lock before
6828         updating current_mapped_bytes.
6829
6830 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6831
6832         * dwarf_reader.cc: Remove outdated comment.
6833         * gold-threads.cc: Fix typo in error message.
6834         * archive.cc: Fix typos in comments.
6835         * archive.h: Likewise.
6836         * arm-reloc-property.cc: Likewise.
6837         * arm-reloc-property.h: Likewise.
6838         * arm-reloc.def: Likewise.
6839         * arm.cc: Likewise.
6840         * attributes.h: Likewise.
6841         * cref.cc: Likewise.
6842         * ehframe.cc: Likewise.
6843         * fileread.h: Likewise.
6844         * gold.h: Likewise.
6845         * i386.cc: Likewise.
6846         * icf.cc: Likewise.
6847         * incremental.h: Likewise.
6848         * int_encoding.cc: Likewise.
6849         * layout.h: Likewise.
6850         * main.cc: Likewise.
6851         * merge.h: Likewise.
6852         * object.cc: Likewise.
6853         * object.h: Likewise.
6854         * options.cc: Likewise.
6855         * readsyms.cc: Likewise.
6856         * reduced_debug_output.cc: Likewise.
6857         * reloc.cc: Likewise.
6858         * script-sections.cc: Likewise.
6859         * sparc.cc: Likewise.
6860         * symtab.h: Likewise.
6861         * target-reloc.h: Likewise.
6862         * target.cc: Likewise.
6863         * target.h: Likewise.
6864         * timer.cc: Likewise.
6865         * timer.h: Likewise.
6866         * x86_64.cc: Likewise.
6867
6868 2010-12-09  Cary Coutant  <ccoutant@google.com>
6869
6870         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6871         stack.
6872         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6873         parameter; change all callers.
6874         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6875         * options.h (warn_execstack): New option.
6876
6877 2010-12-07  Doug Kwan  <dougkwan@google.com>
6878
6879         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6880         like function call relocations.
6881
6882 2010-12-07  Ian Lance Taylor  <iant@google.com>
6883
6884         * archive.cc (Archive::get_elf_object_for_member): Permit
6885         punconfigured to be NULL.
6886         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6887         (Archive::include_member): Pass NULL to get_elf_object_for_member
6888         if we searched for the archive and this is the first included
6889         object.
6890
6891 2010-12-01  Ian Lance Taylor  <iant@google.com>
6892
6893         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6894         track_relocs_type_ field.
6895         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6896         Set track_relocs_type_.
6897         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6898         contents when using RELA relocs.
6899         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6900         reloc_map_.
6901         * reloc.cc (Track_relocs::next_addend): New function.
6902         * reloc.h (class Track_relocs): Declare next_addend.
6903
6904 2010-12-01  Ian Lance Taylor  <iant@google.com>
6905
6906         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6907         virtual destructor.
6908
6909 2010-12-01  Ian Lance Taylor  <iant@google.com>
6910
6911         * README: Update compilers known to work and fail.
6912
6913 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6914
6915         * configure.in: For --enable-gold, handle value `default' instead of
6916         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6917         not the default.
6918         * configure: Regenerate.
6919
6920 2010-11-18  Doug Kwan  <dougkwan@google.com>
6921
6922         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6923         and right_alignment to be zero.  Store result alignment only if it is
6924         greater than existing alignment.
6925
6926 2010-11-16  Cary Coutant  <ccoutant@google.com>
6927
6928         PR gold/12220
6929         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6930         Check for ".zdebug_line".
6931
6932 2010-11-16  Doug Kwan  <dougkwan@google.com>
6933             Cary Coutant  <ccoutant@google.com>
6934
6935         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6936         by reference; adjust all callers.
6937         * output.cc (Output_segment::set_section_addresses): Adjust references
6938         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6939         list is empty.
6940         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6941         end at page boundary.
6942
6943 2010-11-16  Cary Coutant  <ccoutant@google.com>
6944
6945         PR gold/12220
6946         * layout.cc (Layout::choose_output_section): Transform names of
6947         compressed sections even when using a script with a SECTIONS clause.
6948         (Layout::output_section_name): Remove code to transform
6949         compressed debug section names.
6950         * output.cc (Output_section::add_input_section): Use uncompressed
6951         section size when tracking input sections.
6952
6953 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6954
6955         * symtab.h (Symbol::NON_PIC_REF): Remove.
6956         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6957         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6958         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6959         (Symbol::use_plt_offset): Take a flags argument and pass it
6960         directly to needs_dynamic_reloc.  Restrict check for undefined
6961         weak symbols to function calls.
6962         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6963         (Target_arm::Scan::global): Use it.
6964         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6965         (Target_arm::Relocate::relocate): Likewise.
6966         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6967         parameter with an r_type parameter.  Use get_reference_flags
6968         to get the flags.
6969         (Target_arm::Relocate::relocate): Update accordingly.
6970         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6971         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6972         (Target_i386::Scan::global): Likewise.
6973         (Target_i386::Relocate::relocate): Likewise.
6974         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6975         parameter with an r_type parameter.  Use get_reference_flags
6976         to get the flags.
6977         (Target_i386::Relocate::relocate): Update accordingly.
6978         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6979         (Target_powerpc::Scan::global): Use it.
6980         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6981         (Target_powerpc::Relocate::relocate): Likewise.
6982         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6983         (Target_sparc::Scan::global): Use it.
6984         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6985         (Target_sparc::Relocate::relocate): Likewise.
6986         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6987         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6988         (Target_x86_64::Scan::global): Likewise.
6989         (Target_x86_64::Relocate::relocate): Likewise.
6990
6991 2010-11-08  Doug Kwan  <dougkwan@google.com>
6992             Cary Coutant  <ccoutant@google.com>
6993
6994         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6995         (Arm_exidx_merge_section::section_contents_): New data member.
6996         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6997         (Arm_input_section::~Arm_input_section): De-allocate memory.
6998         (Arm_input_section::original_contents_): New data member.
6999         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7000         in parameters instead of calling Object::section_contents without
7001         locking.
7002         (Arm_output_section::group_section): New parameter TASK.  Pass it
7003         to callees that need locking objects.
7004         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7005         to lock EXIDX input sections.  Fix a formatting issue.  Call
7006         Arm_exidx_merged_section::build_contents to create merged section
7007         contents.
7008         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7009         to lock object of stub table owner.
7010         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7011         TEXT_SIZE to initialize data member TEXT_SIZE_.
7012         (Arm_exidx_input_section::addralign): Fix typo in comment.
7013         (Arm_exidx_input_section::text_size): New method.
7014         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7015         that require locking objects.  Lock objects before scanning for stubs
7016         and updating local symbols.
7017         (Arm_input_section<big_endian>::init): Copy contents of original
7018         input section.
7019         (Arm_input_section<big_endian>::do_write): Use saved contents of
7020         original input section instead of calling Object::section_contents
7021         without locking.
7022         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7023         size without calling Object::section_size().
7024         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7025         for size.  Allocate a buffer for merged EXIDX entries.
7026         (Arm_exidx_merged_section::build_contents): New method.
7027         (Arm_exidx_merged_section::do_write): Move merge section contents
7028         building code to Arm_exidx_merged_section::build_contetns.  Write
7029         out contetns in buffer instead of building it on the fly.
7030         (Arm_relobj::make_exidx_input_section): Also pass text section size
7031         to Arm_exidx_input_section constructor.
7032         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7033         (Arm_dynobj::do_read_symbols): Fix memory leak.
7034         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7035         * target.h: (class Task): Add forward declaration.
7036         (Target::relax): Add new parameter TASK and pass it to
7037         Target::do_relax().
7038         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7039
7040 2010-11-05  Cary Coutant  <ccoutant@google.com>
7041
7042         PR gold/10708
7043         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7044         object when reading from the file.
7045         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7046         second layout pass.
7047         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7048         when reading section contents.
7049         (get_section_contents): Likewise.
7050         (icf::find_identical_sections): Likewise.
7051         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7052         object when reading from the file.
7053         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7054         the object when doing deferred section layout.
7055
7056 2010-11-03  Nick Clifton  <nickc@redhat.com>
7057
7058         PR gold/12001
7059         * script.h (class Symbol_assignment: name): New member.  Returns
7060         the name of the symbol.
7061         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7062         Returns true if the given symbol name is on the list of
7063         assignments wating to be processed.
7064         * archive.cc (should_incldue_member): If the symbol is undefined,
7065         check to see if it is on the list of symbols pending assignment.
7066
7067 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7068
7069         * script-sections.cc (Script_sections::find_memory_region): Check
7070         for a NULL output section pointer.
7071
7072 2010-10-29  Doug Kwan  <dougkwan@google.com>
7073
7074         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7075         Output_section::add_relaxed_input_section.
7076         * output.cc (Output_section::add_relaxed_input_section): Add new
7077         arguments LAYOUT and NAME.  Set section order index.
7078         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7079         Copy section order index.
7080         * output.h (Output_section::add_relaxed_input_section): Add new
7081         arguments LAYOUT and NAME.
7082
7083 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7084
7085         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7086         NATIVE_OR_CROSS_LINKER.
7087         * testsuite/Makefile.in: Regenerate.
7088
7089 2010-10-20  Doug Kwan  <dougkwan@google.com>
7090
7091         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7092         without SHF_LINK_ORDER flags.
7093         * layout.cc (Layout::choose_output_section): Do not filter
7094         SHF_LINK_ORDER flag in a relocatable link.
7095
7096 2010-10-17  Cary Coutant  <ccoutant@google.com>
7097
7098         * output.h (Output_segment::set_section_addresses): Change function
7099         signature.  Update all callers.
7100         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7101         sections.
7102         (Output_segment::set_section_addresses): Align after last TLS
7103         section.  Add padding before last relro section instead of after.
7104
7105 2010-10-17  Doug Kwan  <dougkwan@google.com>
7106
7107         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7108         GOT output section to be writable.
7109
7110 2010-10-14  Cary Coutant  <ccoutant@google.com>
7111
7112         * debug.h (DEBUG_INCREMENTAL): New flag.
7113         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7114         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7115         mode.
7116         * incremental.cc (report_command_line): Ignore all forms of
7117         --incremental.
7118         * layout.cc (Layout::Layout): Check parameters for incremental link
7119         mode.
7120         * options.cc (General_options::parse_incremental): New function.
7121         (General_options::parse_no_incremental): New function.
7122         (General_options::parse_incremental_full): New function.
7123         (General_options::parse_incremental_update): New function.
7124         (General_options::incremental_mode_): New data member.
7125         (General_options::finalize): Check incremental_mode_.
7126         * options.h (General_options): Update help text for --incremental.
7127         Add --no-incremental, --incremental-full, --incremental-update.
7128         (General_options::Incremental_mode): New enum type.
7129         (General_options::incremental_mode): New function.
7130         (General_options::incremental_mode_): New data member.
7131         * parameters.cc (Parameters::incremental_mode_): New data member.
7132         (Parameters::set_options): Set incremental_mode_.
7133         (Parameters::set_incremental_full): New function.
7134         (Parameters::incremental): New function.
7135         (Parameters::incremental_update): New function.
7136         (set_parameters_incremental_full): New function.
7137         * parameters.h (Parameters::set_incremental_full): New function.
7138         (Parameters::incremental): New function.
7139         (Parameters::incremental_update): New function.
7140         (Parameters::incremental_mode_): New data member.
7141         (set_parameters_incremental_full): New function.
7142         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7143         incremental link mode.
7144         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7145         (Sized_relobj::do_relocate_sections): Likewise.
7146         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7147         option.
7148         * testsuite/Makefile.in: Regenerate.
7149         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7150
7151 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7152
7153         * script-sections.h (class Script_sections): Make
7154         Sections_elements typedef public.
7155         * script-sections.cc (class Sort_output_sections): Add elements_
7156         field.  Add constructor which sets it; change all callers.
7157         (Sort_output_sections::is_before): New function.
7158         (Sort_output_sections::operator()): Call is_before.
7159         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7160         conditional.
7161         * testsuite/script_test_10.sh: New test. Test script section
7162         order.
7163         * testsuite/script_test_10.t: Likewise.
7164         * testsuite/script_test_10.s: Likewise.
7165         * testsuite/Makefile.am: Wrap the cross linker tests and the
7166         common tests into NATIVE_OR_CROSS_LINKER.
7167         (check_SCRIPTS): Add script_test_10.sh.
7168         (check_DATA): Add script_test_10.stdout.
7169         (script_test_10.o, script_test_10): New targets.
7170         (script_test_10.stdout): New target.
7171         * configure, testsuite/Makefile.in: Regenerate.
7172
7173 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7174
7175         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7176         error for the deprecated relocations.
7177         (Target_arm::Scan::global): Likewise.
7178         (Target_arm::Relocate::relocate): Likewise.
7179
7180 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7181
7182         * fileread.cc (Input_file::find_file): Initialize *found_name
7183         and *namep when using the fallback search for case 4.
7184
7185 2010-10-11  Cary Coutant  <ccoutant@google.com>
7186
7187         * options.h (class General_options): Redefine -z lazy as an alias for
7188         the negation of -z now.
7189
7190 2010-10-11  Ian Lance Taylor  <iant@google.com>
7191
7192         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7193         binding.
7194
7195 2010-10-06  Nick Clifton  <nickc@redhat.com>
7196
7197         * script-sections.cc(class Memory_region): Remove
7198         current_lma_offset_ field.  Rename current_vma_offset_ to
7199         current_offset_.  Add last_section_ field.
7200         (Memory_region::get_current_vma_address): Rename to
7201         get_current_address.
7202         (Memory_region::get_current_lma_address): Delete.
7203         (Memory_region::increment_vma_offset): Rename to
7204         increment_offset.
7205         (Memory_region::increment_lma_offset): Delete.
7206         (Memory_region::attributes_compatible): New method.  Returns
7207         true if the provided section is compatible with the region.
7208         (Memory_region::get_last_section): New method.  Returns the last
7209         section to use the region.
7210         (Memory_region::set_last_section): New method.  Stores the last
7211         section to use the region.
7212         (Script_sections::block_in_region): New method.  Returns true if
7213         a block of memory is contained within a region.
7214         (Script_sections::find_memory_region): New method.  Locates a
7215         memory region to be used to set a VMA or LMA address.
7216         (Output_section_definition::set_section_addresses): Add code to
7217         check for addresses set by memory regions.
7218         (Output_segment::set_section_addresses): Remove memory region
7219         walking code.
7220         (Script_sections::create_segment): Add a warning if a header
7221         segment is created outside of any region.
7222         * script-sections.h (class Script_sections): Add prototypes for
7223         find_memory_region and block_in_region methods.
7224         * testsuite/memory_test.s: Use .long instead of .word.
7225         * testsuite/memory_test.t: Add some more output sections.
7226         * testsuite/memory_test.sh: Update expected output.
7227
7228 2010-10-02  Doug Kwan  <dougkwan@google.com>
7229
7230         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7231         defintion to symtab.h
7232         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7233         declaration to defintion.
7234
7235 2010-10-01  Nick Clifton  <nickc@redhat.com>
7236
7237         * expression.cc (eval): Replace dummy argument with NULL.
7238         (eval_maybe_dot): Check for a NULL result section pointer.
7239         (Symbol_expression::value): Likewise.
7240         (Dot_expression::value): Likewise.
7241         (BINARY_EXPRESSION): Likewise.
7242         (Max_expression::value): Likewise.
7243         (Min_expression::value): Likewise.
7244         (Absolute_expression::value): Likewise.
7245         (Addr_expression::value_from_output_section): Likewise.
7246         (Loaddddr_expression::value_from_output_section): Likewise.
7247         (Segment_start_expression::value): Likewise.
7248         * script-sections.cc
7249         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7250         argument with NULL.
7251         (Sections_elememt_dot_assignment::set_section_addresses):
7252         Likewise.
7253         (Output_data_expression::do_write_to_buffer): Likewise.
7254         (Output_section_definition::finalize_symbols): Likewise.
7255         (Output_section_definition::set_section_addresses): Likewise.
7256
7257 2010-09-30  Doug Kwan  <dougkwan@google.com>
7258
7259         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7260
7261 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7262
7263         * target.h (Target::can_icf_inline_merge_sections): New virtual
7264         function.
7265         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7266         virtual function.
7267         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7268         virtual function.
7269         * icf.cc (get_section_contents): Inline merge sections only when
7270         target allows it.
7271
7272 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7273
7274         * configure: Regenerate.
7275
7276 2010-09-17  Ian Lance Taylor  <iant@google.com>
7277
7278         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7279         * testsuite/Makefile.am (memory_test.o): New target.
7280         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7281         memory_test.t.
7282         * testsuite/Makefile.in: Rebuild.
7283
7284 2010-09-17  Doug Kwan  <dougkwan@google.com>
7285
7286         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7287         defintion if relocation uses GOT entries of the symbol.
7288         * testsuite/icf_safe_test.sh: Fix test.
7289         * testsuite/icf_safe_so_test.sh: Fix test.
7290
7291 2010-09-16  Cary Coutant  <ccoutant@google.com>
7292
7293         * script_sections.cc (class Memory_region): Remove "NULL" from
7294         vector initializations.
7295
7296 2010-09-15  Cary Coutant  <ccoutant@google.com>
7297
7298         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7299         Resolve forwarding symbols.
7300
7301 2010-09-15  Doug Kwan  <dougkwan@google.com>
7302
7303         * gold/testsuite/script_test_3.t: Add ARM special sections.
7304         * gold/testsuite/script_test_4.t: Same.
7305         * gold/testsuite/script_test_5.t: Same.
7306         * gold/testsuite/script_test_6.t: Same.
7307         * gold/testsuite/script_test_7.t: Same.
7308         * gold/testsuite/script_test_7.t: Same.
7309         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7310
7311 2010-09-14  Cary Coutant  <ccoutant@google.com>
7312
7313         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7314         (Target_x86_64::Relocate::relocate_tls): Replace check for
7315         saw_tls_block_reloc_ with test for executable section.
7316
7317 2010-09-12  Cary Coutant  <ccoutant@google.com>
7318
7319         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7320         position-independent executables to shared libraries need dynamic
7321         relocations.
7322         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7323         position-independent executables.
7324         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7325         * testsuite/Makefile.in: Regenerate.
7326
7327 2010-09-10  Nick Clifton  <nickc@redhat.com>
7328
7329         PR gold/11997
7330         * testsuite/memory_test.t: Discard any sections that are not
7331         needed.
7332
7333 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7334
7335         PR gold/11996
7336         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7337         "This::" to work around a bug in gcc 4.2.
7338
7339         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7340
7341 2010-09-09  Rafael Espindola  <espindola@google.com>
7342
7343         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7344         sections with different PF_X flags in the same segment.
7345         (Layout::find_first_load_seg): Search all segments to find the first
7346         one.
7347         * options.h (rosegment): New.
7348
7349 2010-09-08  Rafael Espindola  <espindola@google.com>
7350
7351         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7352
7353 2010-09-08  Doug Kwan  <dougkwan@google.com>
7354
7355         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7356         (Arm_relobj::do_relocate_sections): Add new parameter for output
7357         file to match the parent.
7358         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7359         of local symbols instead of input values.  Update code to track
7360         changes in gold::relocate_section.
7361         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7362         (Sized_relobj::compute_final_local_value_internal): New methods.
7363         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7364         body into private version of Sized_relobj::compute_final_local_value.
7365         Call the inline method.
7366         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7367         merged symbol value if there is one.
7368         (Symbol_value::has_output_value): New method defintiion.
7369         (Sized_relobj::Compute_final_local_value_status): New enum type.
7370         (Sized_relobj::compute_final_local_value): New methods.
7371         (Sized_relobj::compute_final_local_value_internal): New methods.
7372         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7373         and arm_cortex_a8.sh.
7374         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7375         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7376         New tests.
7377         * Makefile.in: Regenerate.
7378         * testsuite/arm_bl_out_of_range.s: Update test.
7379         * testsuite/thumb_bl_out_of_range.s: Ditto.
7380         * testsuite/thumb_blx_out_of_range.s: Ditto.
7381         * testsuite/arm_branch_out_of_range.sh: New file.
7382         * testsuite/arm_cortex_a8.sh: Ditto.
7383         * testsuite/arm_cortex_a8_b.s: Ditto.
7384         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7385         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7386         * testsuite/arm_cortex_a8_bl.s: Ditto.
7387         * testsuite/arm_cortex_a8_blx.s: Ditto.
7388         * testsuite/arm_cortex_a8_local.s: Ditto.
7389         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7390         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7391
7392 2010-09-08  Rafael Espindola  <espindola@google.com>
7393
7394         * Makefile.am (memory_test.stdout): Run readelf with -W.
7395         * Makefile.in: Regenerate.
7396         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7397         64 bit output.
7398
7399 2010-09-08  Rafael Espindola  <espindola@google.com>
7400
7401         * script-sections.cc (Script_sections::add_memory_region): Convert
7402         field precision to int.
7403         * script.cc (script_set_section_region, script_set_section_region):
7404         Convert field precision to int.
7405
7406 2010-09-08  Rafael Espindola  <espindola@google.com>
7407
7408         * arm.cc (do_finalize_sections): Create the __exidx_start and
7409         __exdix_end symbols even when the section is missing.
7410
7411 2010-09-08  Nick Clifton  <nickc@redhat.com>
7412
7413         * README: Remove claim that MEMORY is not supported.
7414         * expression.cc (script_exp_function_origin)
7415         (script_exp_function_length): Move from here to ...
7416         * script.cc: ... here.
7417         (script_set_section_region, script_add_memory)
7418         (script_parse_memory_attr, script_include_directive): New
7419         functions.
7420         * script-sections.cc
7421         (class Memory_region): New class.
7422         (class Output_section_definition): Add set_memory_region,
7423         set_section_vma, set_section_lma and get_section_name methods.
7424         (class Script_Sections): Add add_memory_region,
7425         find_memory_region, find_memory_region_origin,
7426         find_memory_region_length and set_memory_region methods.
7427         Have set_section_addresses method walk the list of set memory
7428         regions.
7429         Extend the print methos to display memory regions.
7430         * script-sections.h: Add prototypes for new methods.
7431         Add enum for MEMORY region attributes.
7432         * yyscript.y: Add support for parsing MEMORY regions.
7433         * script-c.h: Add prototypes for new functions.
7434         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7435         * testsuite/Makefile.in: Regenerate.
7436         * testsuite/memory_test.sh: New script.
7437         * testsuite/memory_test.s: New assembler source file.
7438         * testsuite/memory_test.t: New linker script.
7439
7440 2010-08-27  Doug Kwan  <dougkwan@google.com>
7441
7442         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7443         reference override an existing dynamic weak reference.
7444         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7445         * testsuite/Makefile.in: Regenerate.
7446         * testsuite/dyn_weak_ref.sh: New file.
7447         * testsuite/dyn_weak_ref_1.c: Ditto.
7448         * testsuite/dyn_weak_ref_2.c: Ditto.
7449
7450 2010-08-27  Ian Lance Taylor  <iant@google.com>
7451
7452         * incremental.h (class Incremental_input_entry): Add virtual
7453         destructor.
7454
7455 2010-08-27  Ian Lance Taylor  <iant@google.com>
7456
7457         * testsuite/start_lib_test_3.c: Mark t3 as used.
7458
7459 2010-08-27  Nick Clifton  <nickc@redhat.com>
7460
7461         * options.cc (version_script): Fix small typo in previous
7462         whitespace tidyup.
7463
7464 2010-08-25  Nick Clifton  <nickc@redhat.com>
7465
7466         * archive.cc: Formatting fixes: Remove whitespace between
7467         typename and following asterisk.  Remove whitespace between
7468         function name and opening parenthesis.
7469         * archive.h: Likewise.
7470         * arm.cc: Likewise.
7471         * attributes.cc: Likewise.
7472         * attributes.h: Likewise.
7473         * common.cc: Likewise.
7474         * copy-relocs.cc: Likewise.
7475         * dirsearch.h: Likewise.
7476         * dynobj.cc: Likewise.
7477         * ehframe.cc: Likewise.
7478         * ehframe.h: Likewise.
7479         * expression.cc: Likewise.
7480         * fileread.cc: Likewise.
7481         * fileread.h: Likewise.
7482         * gc.h: Likewise.
7483         * gold-threads.cc: Likewise.
7484         * gold.cc: Likewise.
7485         * i386.cc: Likewise.
7486         * icf.h: Likewise.
7487         * incremental-dump.cc: Likewise.
7488         * incremental.cc: Likewise.
7489         * layout.cc: Likewise.
7490         * layout.h: Likewise.
7491         * main.cc: Likewise.
7492         * merge.cc: Likewise.
7493         * merge.h: Likewise.
7494         * object.cc: Likewise.
7495         * object.h: Likewise.
7496         * options.cc: Likewise.
7497         * options.h: Likewise.
7498         * output.cc: Likewise.
7499         * output.h: Likewise.
7500         * plugin.cc: Likewise.
7501         * plugin.h: Likewise.
7502         * powerpc.cc: Likewise.
7503         * reloc.cc: Likewise.
7504         * script-c.h: Likewise.
7505         * script-sections.cc: Likewise.
7506         * script.cc: Likewise.
7507         * stringpool.cc: Likewise.
7508         * symtab.cc: Likewise.
7509         * symtab.h: Likewise.
7510         * target.cc: Likewise.
7511         * timer.cc: Likewise.
7512         * timer.h: Likewise.
7513         * version.cc: Likewise.
7514         * x86_64.cc: Likewise.
7515
7516 2010-08-24  Nick Clifton  <nickc@redhat.com>
7517
7518         PR 11899
7519         * layout.cc (segment_precedes): Sort segments by their physical
7520         addresses, if they have been set.
7521
7522 2010-08-23  Cary Coutant  <ccoutant@google.com>
7523
7524         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7525         symbols data.
7526         (Lib_group::include_member): Unlock object after deleting its
7527         symbols data.
7528         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7529         the bug fixed here.
7530
7531 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7532             Cary Coutant  <ccoutant@google.com>
7533
7534         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7535         constructor, and set_blocker.
7536         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7537         readsyms_blocker_.
7538         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7539         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7540         * testsuite/Makefile.am (start_lib_test): New test case.
7541         * testsuite/Makefile.in: Regenerate.
7542         * testsuite/start_lib_test_main.c: New file.
7543         * testsuite/start_lib_test_1.c: New file.
7544         * testsuite/start_lib_test_2.c: New file.
7545         * testsuite/start_lib_test_3.c: New file.
7546
7547 2010-08-19  Ian Lance Taylor  <iant@google.com>
7548
7549         * Makefile.in: Rebuild with automake 1.11.1.
7550         * aclocal.m4: Likewise.
7551         * testsuite/Makefile.in: Likewise.
7552
7553 2010-08-19  Ian Lance Taylor  <iant@google.com>
7554
7555         PR 10893
7556         * i386.cc (class Output_data_plt_i386): Update declarations.
7557         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7558         local_ifuncs_ fields.
7559         (Target_i386::do_plt_section_for_global): New function.
7560         (Target_i386::do_plt_section_for_local): New function.
7561         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7562         parameter; change all callers.  Initialize global_ifuncs_ and
7563         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7564         __rel_iplt_end.
7565         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7566         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7567         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7568         symbols.
7569         (Target_i386::make_plt_section): New function, broken out of
7570         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7571         (Target_i386::make_plt_entry): Call make_plt_section.
7572         (Target_i386::make_local_ifunc_plt_entry): New function.
7573         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7574         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7575         R_386_IRELATIVE to switch.
7576         (Target_i386::Scan::global): Likewise.
7577         (Target_i386::Relocate::relocate): Likewise.
7578         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7579         switch.
7580         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7581         (Target_x86_64::do_plt_section_for_global): New function.
7582         (Target_x86_64::do_plt_section_for_local): New function.
7583         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7584         parameter; change all callers.  If doing a static link define
7585         __rela_iplt_start and __rela_iplt_end.
7586         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7587         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7588         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7589         to point to .plt.
7590         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7591         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7592         switch.
7593         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7594         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7595         R_X86_64_IRELATIVE to switch.
7596         (Target_x86_64::Scan::global): Likewise.
7597         (Target_x86_64::Relocate::relocate): Likewise.
7598         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7599         switch.
7600         * target.h (class Target): Add plt_section_for_global and
7601         plt_section_for_local functions.  Add do_plt_section_for_global
7602         and do_plt_section_for_local virtual functions.
7603         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7604         clarifying comments.
7605         (Symbol::use_plt_offset): Handle IFUNC symbol.
7606         * object.cc (Sized_relobj::Sized_relobj): Initialize
7607         local_plt_offsets_.
7608         (Sized_relobj::local_has_plt_offset): New function.
7609         (Sized_relobj::local_plt_offset): New function.
7610         (Sized_relobj::set_local_plt_offset): New function.
7611         (Sized_relobj::do_count): Handle IFUNC symbol.
7612         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7613         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7614         is_ifunc_symbol functions.
7615         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7616         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7617         local_plt_offsets_ field.
7618         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7619         * output.h (class Output_section_data): Add non-const
7620         output_section function.
7621         (class Output_data_got): Update declarations.
7622         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7623         Add use_plt_offset parameter to global and local constructors.
7624         Change all callers.  Change local_sym_index_ field to 31 bits.
7625         Change GSYM_CODE and CONSTANT_CODE accordingly.
7626         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7627         doing a static link don't set sh_link field.
7628         (Output_data_got::Got_entry::write): Use PLT offset if
7629         appropriate.
7630         (Output_data_got::add_global_plt): New function.
7631         (Output_data_got::add_local_plt): New function.
7632         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7633         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7634         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7635         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7636         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7637         IFUNC conditional.
7638         * testsuite/ifunc-sel.h: New file.
7639         * testsuite/ifuncmain1.c: New file.
7640         * testsuite/ifuncmain1vis.c: New file.
7641         * testsuite/ifuncmod1.c: New file.
7642         * testsuite/ifuncdep2.c: New file.
7643         * testsuite/ifuncmain2.c: New file.
7644         * testsuite/ifuncmain3.c: New file.
7645         * testsuite/ifuncmod3.c: New file.
7646         * testsuite/ifuncmain4.c: New file.
7647         * testsuite/ifuncmain5.c: New file.
7648         * testsuite/ifuncmod5.c: New file.
7649         * testsuite/ifuncmain6pie.c: New file.
7650         * testsuite/ifuncmod6.c: New file.
7651         * testsuite/ifuncmain7.c: New file.
7652         * configure, testsuite/Makefile.in: Rebuild.
7653
7654 2010-08-18  Ian Lance Taylor  <iant@google.com>
7655
7656         * incremental.cc
7657         (Output_section_incremental_inputs::write_input_files): Add cast
7658         to avoid signed/unsigned comparison warning.
7659         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7660
7661 2010-08-12  Cary Coutant  <ccoutant@google.com>
7662
7663         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7664
7665 2010-08-13  Ian Lance Taylor  <iant@google.com>
7666
7667         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7668
7669 2010-08-12  Cary Coutant  <ccoutant@google.com>
7670             Doug Kwan  <dougkwan@google.com>
7671
7672         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7673         defintion overrides non-weak undef, remember that the original undef
7674         is not weak.
7675         * symtab.cc (Symbol_table::sized_write_global): For undef without
7676         an original weak binding, set binding to global in output.
7677         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7678         * testsuite/Makefile.in: Regenerate.
7679         * testsuite/strong_ref_weak_def.sh: New file.
7680         * testsuite/strong_ref_weak_def_1.c: Ditto.
7681         * testsuite/strong_ref_weak_def_2.c: Ditto.
7682
7683 2010-08-12  Cary Coutant  <ccoutant@google.com>
7684
7685         * testsuite/incremental_test.sh: Rewrite.
7686         * testsuite/incremental_test_1.c: Rewrite.
7687         * testsuite/incremental_test_2.c: Rewrite.
7688
7689 2010-08-12  Cary Coutant  <ccoutant@google.com>
7690
7691         * arm.cc (Target_arm::got_size): Add const.
7692         (Target_arm::got_entry_count): New function.
7693         (Target_arm::plt_entry_count): New function.
7694         (Target_arm::first_plt_entry_offset): New function.
7695         (Target_arm::plt_entry_size): New function.
7696         (Output_data_plt_arm::entry_count): New function.
7697         (Output_data_plt_arm::first_plt_entry_offset): New function.
7698         (Output_data_plt_arm::get_plt_entry_size): New function.
7699         * i386.cc (Target_i386::got_size): Add const.
7700         (Target_i386::got_entry_count): New function.
7701         (Target_i386::plt_entry_count): New function.
7702         (Target_i386::first_plt_entry_offset): New function.
7703         (Target_i386::plt_entry_size): New function.
7704         (Output_data_plt_i386::entry_count): New function.
7705         (Output_data_plt_i386::first_plt_entry_offset): New function.
7706         (Output_data_plt_i386::get_plt_entry_size): New function.
7707         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7708         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7709         * incremental.cc: Include target.h.
7710         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7711         parameter.  Adjust all callers.  Find incremental_got_plt section.
7712         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7713         section.
7714         (Output_section_incremental_inputs::set_final_data_size): Calculate
7715         size of incremental_got_plt section.
7716         (Output_section_incremental_inputs::do_write): Write the
7717         incremental_got_plt section.
7718         (Got_plt_view_info): New struct.
7719         (Local_got_offset_visitor): New class.
7720         (Global_got_offset_visitor): New class.
7721         (Global_symbol_visitor_got_plt): New class.
7722         (Output_section_incremental_inputs::write_got_plt): New function.
7723         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7724         Add parameter.  Adjust all callers.
7725         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7726         (Incremental_inputs::got_plt_section): New function.
7727         (Incremental_inputs::got_plt_section_): New data member.
7728         (Incremental_got_plt_reader): New class.
7729         * layout.cc (Layout::create_incremental_info_sections): Add the
7730         incremental_got_plt section.
7731         * object.h (Got_offset_list::get_list): New function.
7732         (Got offset_list::for_all_got_offsets): New function.
7733         (Sized_relobj::local_got_offset_list): New function.
7734         * powerpc.cc (Target_powerpc::got_size): Add const.
7735         (Target_powerpc::got_entry_count): New function.
7736         (Target_powerpc::plt_entry_count): New function.
7737         (Target_powerpc::first_plt_entry_offset): New function.
7738         (Target_powerpc::plt_entry_size): New function.
7739         (Output_data_plt_powerpc::entry_count): New function.
7740         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7741         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7742         * sparc.cc (Target_sparc::got_size): Add const.
7743         (Target_sparc::got_entry_count): New function.
7744         (Target_sparc::plt_entry_count): New function.
7745         (Target_sparc::first_plt_entry_offset): New function.
7746         (Target_sparc::plt_entry_size): New function.
7747         (Output_data_plt_sparc::entry_count): New function.
7748         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7749         (Output_data_plt_sparc::get_plt_entry_size): New function.
7750         * symtab.h (Symbol::got_offset_list): New function.
7751         (Symbol_table::for_all_symbols): New function.
7752         * target.h (Sized_target::got_entry_count): New function.
7753         (Sized_target::plt_entry_count): New function.
7754         (Sized_target::plt_entry_size): New function.
7755         * x86_64.cc (Target_x86_64::got_size): Add const.
7756         (Target_x86_64::got_entry_count): New function.
7757         (Target_x86_64::plt_entry_count): New function.
7758         (Target_x86_64::first_plt_entry_offset): New function.
7759         (Target_x86_64::plt_entry_size): New function.
7760         (Output_data_plt_x86_64::entry_count): New function.
7761         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7762         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7763
7764 2010-08-12  Cary Coutant  <ccoutant@google.com>
7765
7766         * archive.cc: Include incremental.h.
7767         (Archive::Archive): Initialize incremental_info_.
7768         (Archive::include_member): Record archive members in incremental info.
7769         (Add_archive_symbols::run): Record begin and end of an archive in
7770         incremental info.
7771         (Lib_group::include_member): Record objects in incremental info.
7772         * archive.h (Incremental_archive_entry): Forward declaration.
7773         (Archive::set_incremental_info): New member function.
7774         (Archive::incremental_info): New member function.
7775         (Archive::Unused_symbol_iterator): New class.
7776         (Archive::unused_symbols_begin): New member function.
7777         (Archive::unused_symbols_end): New member function.
7778         (Archive::incremental_info_): New data member.
7779         * incremental-dump.cc (find_input_containing_global): New function.
7780         (dump_incremental_inputs): Dump new incremental info sections.
7781         * incremental.cc: Include symtab.h.
7782         (Output_section_incremental_inputs): New class.
7783         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7784         new incremental info sections.
7785         (Sized_incremental_binary::do_check_inputs): Likewise.
7786         (Incremental_inputs::report_archive): Remove.
7787         (Incremental_inputs::report_archive_begin): New function.
7788         (Incremental_inputs::report_archive_end): New function.
7789         (Incremental_inputs::report_object): New function.
7790         (Incremental_inputs::finalize_inputs): Remove.
7791         (Incremental_inputs::report_input_section): New function.
7792         (Incremental_inputs::report_script): Rewrite.
7793         (Incremental_inputs::finalize): Do nothing but finalize string table.
7794         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7795         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7796         (Incremental_inputs::create_data_sections): New function.
7797         (Incremental_inputs::relocs_entsize): New function.
7798         (Output_section_incremental_inputs::set_final_data_size): New function.
7799         (Output_section_incremental_inputs::do_write): New function.
7800         (Output_section_incremental_inputs::write_header): New function.
7801         (Output_section_incremental_inputs::write_input_files): New function.
7802         (Output_section_incremental_inputs::write_info_blocks): New function.
7803         (Output_section_incremental_inputs::write_symtab): New function.
7804         * incremental.h (Incremental_script_entry): Forward declaration.
7805         (Incremental_object_entry): Forward declaration.
7806         (Incremental_archive_entry): Forward declaration.
7807         (Incremental_inputs): Forward declaration.
7808         (Incremental_inputs_header_data): Remove.
7809         (Incremental_inputs_header): Remove.
7810         (Incremental_inputs_header_write): Remove.
7811         (Incremental_inputs_entry_data): Remove.
7812         (Incremental_inputs_entry): Remove.
7813         (Incremental_inputs_entry_write): Remove.
7814         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7815         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7816         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7817         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7818         Likewise.
7819         (Incremental_input_entry): New class.
7820         (Incremental_script_entry): New class.
7821         (Incremental_object_entry): New class.
7822         (Incremental_archive_entry): New class.
7823         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7824         (Incremental_inputs::report_inputs): Remove.
7825         (Incremental_inputs::report_archive): Remove.
7826         (Incremental_inputs::report_archive_begin): New function.
7827         (Incremental_inputs::report_archive_end): New function.
7828         (Incremental_inputs::report_object): Change prototype.
7829         (Incremental_inputs::report_input_section): New function.
7830         (Incremental_inputs::report_script): Change prototype.
7831         (Incremental_inputs::get_reloc_count): New function.
7832         (Incremental_inputs::set_reloc_count): New function.
7833         (Incremental_inputs::create_data_sections): New function.
7834         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7835         (Incremental_inputs::inputs_section): New function.
7836         (Incremental_inputs::symtab_section): New function.
7837         (Incremental_inputs::relocs_section): New function.
7838         (Incremental_inputs::get_stringpool): Add const.
7839         (Incremental_inputs::command_line): Add const.
7840         (Incremental_inputs::inputs): Remove.
7841         (Incremental_inputs::command_line_key): New function.
7842         (Incremental_inputs::input_file_count): New function.
7843         (Incremental_inputs::input_files): New function.
7844         (Incremental_inputs::relocs_entsize): New function.
7845         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7846         (Incremental_inputs::finalize_inputs): Remove.
7847         (Incremental_inputs::Input_info): Remove.
7848         (Incremental_inputs::lock_): Remove.
7849         (Incremental_inputs::inputs_): Change type.
7850         (Incremental_inputs::inputs_map_): Remove.
7851         (Incremental_inputs::current_object_entry_): New data member.
7852         (Incremental_inputs::inputs_section_): New data member.
7853         (Incremental_inputs::symtab_section_): New data member.
7854         (Incremental_inputs::relocs_section_): New data member.
7855         (Incremental_inputs::reloc_count_): New data member.
7856         (Incremental_inputs_reader): New class.
7857         (Incremental_symtab_reader): New class.
7858         (Incremental_relocs_reader): New class.
7859         * layout.cc (Layout::finalize): Move finalization of incremental info
7860         and creation of incremental info sections to follow finalization of
7861         symbol table.  Set offsets for postprocessing sections.
7862         (Layout::create_incremental_info_sections): Call
7863         Incremental_inputs::create_data_sections.  Add incremental symtab
7864         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7865         sections to layout after input sections.
7866         * layout.h (struct Timespec): Forward declaration.
7867         (Layout::incremental_inputs): Add const.
7868         (Layout::create_incremental_info_sections): Add parameter.
7869         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7870         * object.cc: Include incremental.h.
7871         (Relobj::finalize_incremental_relocs): New function.
7872         (Sized_relobj::do_layout): Record input sections in incremental info.
7873         * object.h (Object::output_section): New function.
7874         (Object::output_section_offset): Moved from Relobj.
7875         (Object::get_incremental_reloc_base): New function.
7876         (Object::get_incremental_reloc_count): New function.
7877         (Object::do_output_section): New function.
7878         (Object::do_output_section_offset): Moved from Relobj.
7879         (Object::do_get_incremental_reloc_base): New function.
7880         (Object::do_get_incremental_reloc_count): New function.
7881         (Object::Object): Initialize new data members.
7882         (Relobj::output_section): Renamed do_output_section and moved to
7883         protected.
7884         (Relobj::output_section_offset): Moved to Object.
7885         (Relobj::do_get_incremental_reloc_base): New function.
7886         (Relobj::do_get_incremental_reloc_count): New function.
7887         (Relobj::allocate_incremental_reloc_counts): New function.
7888         (Relobj::count_incremental_reloc): New function.
7889         (Relobj::finalize_incremental_relocs): New function.
7890         (Relobj::next_incremental_reloc_index): New function.
7891         (Relobj::reloc_counts_): New data member.
7892         (Relobj::reloc_bases_): New data member.
7893         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7894         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7895         (Sized_relobj::incremental_relocs_scan): New function.
7896         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7897         (Sized_relobj::incremental_relocs_write): New function.
7898         (Sized_relobj::incremental_relocs_write_reltype): New function.
7899         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7900         incremental link.
7901         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7902         archives and object files elsewhere.
7903         (Add_symbols::run): Report object files here.
7904         (Finish_group::run): Report end of archive at end of group.
7905         * reloc.cc: Include layout.h, incremental.h.
7906         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7907         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7908         (Sized_relobj::incremental_relocs_scan): New function.
7909         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7910         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7911         (Sized_relobj::incremental_relocs_write): New function.
7912         (Sized_relobj::incremental_relocs_write_reltype): New function.
7913         * script.cc (read_input_script): Rewrite test for incremental link.
7914         Change call to Incremental_inputs::report_script.
7915         * symtab.h (Symbol_table::first_global_index): New function.
7916         (Symbol_table::output_count): New function.
7917
7918 2010-08-12  Doug Kwan  <dougkwan@google.com>
7919
7920         * arm.cc (Target_arm::merge_object_attributes): Check command line
7921         options --no-wchar-size-warning and --no-enum-size-warning.
7922         * options.h (General_options): Add ld-compatible options
7923         --no-enum-size-warning and --no-wchar-size-warning.
7924
7925 2010-08-04  Ian Lance Taylor  <iant@google.com>
7926
7927         * x86_64.cc (Target_x86_64::Scan::local): Use
7928         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7929         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7930         (Target_x86_64::Scan::global): Likewise.
7931         (Target_x86_64::Relocate::relocate): Likewise.
7932         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7933         Likewise.
7934
7935 2010-08-03  Cary Coutant  <ccoutant@google.com>
7936
7937         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7938         to reserve space in merged_strings vector. Keep total input size
7939         for stats.
7940         (Output_merge_string::do_print_merge_stats): Print total input size.
7941         * merge.h (Output_merge_string): Add input_size_ field.
7942         * stringpool.cc (Stringpool_template::string_length): Move
7943         implementations out of Stringpool_template class and place in
7944         stringpool.h.
7945         * stringpool.h (string_length): Move out of Stringpool_template.
7946
7947 2010-08-03  Ian Lance Taylor  <iant@google.com>
7948
7949         PR 11712
7950         * layout.cc (relaxation_loop_body): If address of load segment is
7951         set, adjust address to include headers if possible.
7952
7953 2010-08-03  Ian Lance Taylor  <iant@google.com>
7954
7955         * version.cc (version_string): Bump to 1.10.
7956
7957 2010-08-03  Ian Lance Taylor  <iant@google.com>
7958
7959         PR 11805
7960         * layout.h (enum Output_section_order): Define.
7961         (class Layout): Update declarations.
7962         * layout.cc (Layout::get_output_section): Add order parameter.
7963         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7964         is_first_non_relro parameters.  Change all callers.
7965         (Layout::choose_output_section): Likewise.
7966         (Layout::add_output_section_data): Likewise.
7967         (Layout::make_output_section): Likewise.  Set order.
7968         (Layout::default_section_order): New function.
7969         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7970         * output.cc (Output_section::Output_section): Initialize order_.
7971         Don't initialize deleted fields.
7972         (Output_segment::Output_segment): Don't initialize deleted
7973         fields.
7974         (Output_segment::add_output_section_to_load): New function
7975         replacing add_output_section.  Change all callers to call this or
7976         add_output_section_to_nonload.
7977         (Output_segment::add_output_section_to_nonload): New function.
7978         (Output_segment::remove_output_section): Rewrite.
7979         (Output_segment::add_initial_output_data): Likewise.
7980         (Output_segment::has_any_data_sections): Likewise.
7981         (Output_segment::is_first_section_relro): Likewise.
7982         (Output_segment::maximum_alignment): Likewise.
7983         (Output_segment::has_dynamic_reloc): New function replacing
7984         dynamic_reloc_count.  Change all callers.
7985         (Output_segment::has_dynamic_reloc_list): New function replacing
7986         dynamic_reloc_count_list.  Change all callers.
7987         (Output_segment::set_section_addresses): Rewrite.
7988         (Output_segment::set_offset): Rewrite.
7989         (Output_segment::find_first_and_last_list): Remove.
7990         (Output_segment::set_tls_offsets): Rewrite.
7991         (Output_segment::first_section_load_address): Likewise.
7992         (Output_segment::output_section_count): Likewise.
7993         (Output_segment::section_with_lowest_load_address): Likewise.
7994         (Output_segment::write_section_headers): Likewise.
7995         (Output_segment::print_sections_to_map): Likewise.
7996         * output.h (class Output_data): Remove dynamic_reloc_count_
7997         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7998         (Output_data::add_dynamic_reloc): Rewrite.
7999         (Output_data::has_dynamic_reloc): New function.
8000         (Output_data::dynamic_reloc_count): Remove.
8001         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8002         is_last_relro_, is_first_non_relro_, is_interp_,
8003         is_dynamic_linker_section_ fields.  Add order and set_order
8004         functions.  Remove is_relro_local, set_is_relro_local,
8005         is_last_relro, set_is_last_relro, is_first_non_relro,
8006         set_is_first_non_relro functions, is_interp, set_is_interp,
8007         is_dynamic_linker_section, and set_is_dynamic_linker_section
8008         functions.
8009         (class Output_segment): Change Output_data_list from std::list to
8010         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8011         output_bss_ fields.  Update declarations.
8012
8013 2010-08-02  Ian Lance Taylor  <iant@google.com>
8014
8015         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8016         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8017         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8018
8019 2010-08-02  Ian Lance Taylor  <iant@google.com>
8020
8021         PR 11855
8022         * script.cc (Script_options::Script_options): Initialize
8023         symbol_definitions_ and symbol_references_.
8024         (Script_options::add_symbol_assignment): Update
8025         symbol_definitions_ and symbol_references_.
8026         (Script_options::add_symbol_reference): New function.
8027         (script_symbol): New function.
8028         * script.h (class Script_options): Add symbol_definitions_ and
8029         symbol_references_ fields.
8030         (Script_options::referenced_const_iterator): New type.
8031         (Script_options::referenced_begin): New function.
8032         (Script_options::referenced_end): New function.
8033         (Script_options::is_referenced): New function.
8034         (Script_options::any_unreferenced): New function.
8035         * script-c.h (script_symbol): Declare.
8036         * yyscript.y (exp): Call script_symbol.
8037         * symtab.cc: Include "script.h".
8038         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8039         Change all callers.  Check symbols referenced by scripts.
8040         (Symbol_table::add_undefined_symbols_from_command_line): Add
8041         layout parameter.  Change all callers.
8042         (Symbol_table::do_add_undefined_symbols_from_command_line):
8043         Likewise.  Break out loop body.  Check symbols referenced by
8044         scripts.
8045         (Symbol_table::add_undefined_symbol_from_command_line): New
8046         function broken out of
8047         do_add_undefined_symbols_from_command_line.
8048         * symtab.h (class Symbol_table): Update declarations.
8049         * archive.cc: Include "layout.h".
8050         (Archive::should_include_member): Add layout parameter.  Change
8051         all callers.  Check for symbol mentioned in expression.
8052         * archive.h (class Archive): Update declaration.
8053         * object.cc (Sized_relobj::do_should_include_member): Add layout
8054         parameter.
8055         * object.h (Object::should_include_member): Add layout parameter.
8056         Change all callers.
8057         (Object::do_should_include_member): Add layout parameter.
8058         (class Sized_relobj): Update declaration.
8059         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8060         parameter.
8061         * dynobj.h (class Sized_dynobj): Update declaration.
8062         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8063         layout parameter.
8064         * plugin.h (class Sized_pluginobj): Update declaration.
8065
8066 2010-08-02  Ian Lance Taylor  <iant@google.com>
8067
8068         PR 11866
8069         * output.cc (Output_segment::set_offset): Search for the first and
8070         last sections rather than assuming that the list is in order.
8071         (Output_segment::find_first_and_last_list): New function.
8072         * output.h (class Output_segment): Update declarations.
8073         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8074         (relro_strip_test_SOURCES): New variable.
8075         (relro_strip_test_DEPENDENCIES): New variable.
8076         (relro_strip_test_LDFLAGS): New variable.
8077         (relro_strip_test_LDADD): New variable.
8078         (relro_strip_test.so): New target.
8079
8080 2010-08-02  Ian Lance Taylor  <iant@google.com>
8081
8082         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8083         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8084         (Target_i386::got_tlsdesc_section): New function.
8085         (Target_i386::got_section): Create space for GOT entries for
8086         TLSDESC relocations.
8087         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8088         R_386_TLS_GOTDESC.
8089         (Target_i386::Scan::global): Likewise.
8090         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8091         using TLSDESC GOT.
8092         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8093         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8094         (Target_x86_64::got_tlsdesc_section): New function.
8095         (Target_x86_64::got_section): Create space for GOT entries for
8096         TLSDESC relocations.
8097         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8098         R_386_TLS_GOTDESC.
8099         (Target_x86_64::Scan::global): Likewise.
8100         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8101         using TLSDESC GOT.
8102
8103 2010-08-02  Ian Lance Taylor  <iant@google.com>
8104
8105         * testsuite/final_layout.sh: Use dc to convert from hex to
8106         decimal.
8107
8108 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8109
8110         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8111         paramter to the call to gold::gc_process_relocs.
8112         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8113         paramter to the call to gold::gc_process_relocs.
8114         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8115         parameter to the call to gold::gc_process_relocs.
8116         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8117         template parameter to the call to gold::gc_process_relocs.
8118         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8119         paramter to the call to gold::gc_process_relocs.
8120         * gc.h (get_embedded_addend_size): New function.
8121         (gc_process_relocs): Save the size of the reloc for use by ICF.
8122         * icf.cc (get_section_contents): Get the addend from the text section
8123         for SHT_REL relocation sections.
8124         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8125         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8126         * int_encoding.h (read_from_pointer): New overloaded function.
8127         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8128         * testsuite/icf_sht_rel_addend_test.sh: New file.
8129         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8130         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8131
8132 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8133
8134         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8135         * Makefile.in: Regenerate.
8136         * testsuite/Makefile.in: Regenerate.
8137
8138 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8139
8140         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8141         * gold/testsuite/debug_msg.cc: Likewise.
8142         * gold/testsuite/odr_violation1.cc
8143         * gold/testsuite/odr_violation2.cc
8144
8145 2010-07-21  Cary Coutant  <ccoutant@google.com>
8146
8147         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8148         string, and length fields.
8149         (Output_merge_string::Merged_strings_list): New type.
8150         (Output_merge_string::Merged_strings_lists): New typedef.
8151         (Output_merge_string): Replace merged_strings_ with
8152         merged_strings_lists_.
8153         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8154         Merged_strings_list per input object and section.  Don't store pointer
8155         to the string.  Don't store length with each merged string entry.
8156         (Output_merge_string::finalize_merged_data): Loop over list of merged
8157         strings lists.  Recompute length of each merged string.
8158
8159 2010-07-15  Cary Coutant  <ccoutant@google.com>
8160
8161         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8162         here.
8163
8164 2010-07-14  Ian Lance Taylor  <iant@google.com>
8165
8166         * descriptors.cc (Descriptors::open): Report correct name in error
8167         message.
8168
8169 2010-07-13  Doug Kwan  <dougkwan@google.com>
8170
8171         * arm.cc (Arm_input_section::Arm_input_section): For a
8172         SHT_ARM_EXIDX section, always keeps the input sections.
8173         (Arm_input_section::set_exidx_section_link): New method.
8174         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8175         has_errors_ to false.
8176         (Arm_exidx_input_section::has_errors,
8177         Arm_exidx_input_section::set_has_errors): New methods.
8178         (Arm_exidx_input_section::has_errors_): New data member.
8179         (Arm_relobj::get_exidx_shndx_list): New method.
8180         (Arm_output_section::append_text_sections_to_list): Do not skip
8181         section without SHF_EXECINSTR.
8182         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8183         errors.
8184         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8185         section header.  Make error messages more verbose.  Check for
8186         a non-executable section linked to an EXIDX section.
8187         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8188         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8189         check that there is no deferred EXIDX section if we exit early.
8190         Instead of not making an EXIDX section in case of an error, make one
8191         and set the has_errors flag of it.
8192         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8193         in a relocatable link.
8194         (Target_arm::do_relax): Look for the EXIDX output section instead of
8195         assuming that it is called .ARM.exidx.
8196         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8197         section list.  Do not check for SHF_EXECINSTR section flags but
8198         skip any input section with errors.
8199         * output.cc (Output_section::Output_section): Initialize
8200         always_keeps_input_sections_ to false.
8201         (Output_section::add_input_section): Check for
8202         always_keeps_input_sections_.
8203         *  output.h (Output_section::always_keeps_input_sections,
8204         Output_section::set_always_keeps_input_sections): New methods.
8205         (Output_section::always_keeps_input_sections): New data member.
8206
8207 2010-07-13  Rafael Espindola  <espindola@google.com>
8208
8209         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8210         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8211
8212 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8213             Ian Lance Taylor  <iant@google.com>
8214
8215         * output.h (Output_section_lookup_maps::add_merge_section):
8216         Correct check of whether value was inserted.
8217         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8218         (Output_section_lookup_maps::add_relaxed_input_section):
8219         Likewise.
8220         * arm.cc (Target_arm::got_section): Remove used local os.
8221         * i386.cc (Target_i386::got_section): Likewise.
8222         * x86_64.cc (Target_x86_64::got_section): Likewise.
8223         * sparc.cc (Target_sparc::got_section): Likewise.
8224         (Target_sparc::relocate): Remove unused local have_got_offset.
8225         * powerpc.cc (Target_powerpc::relocate): Likewise.
8226
8227 2010-07-13  Ian Lance Taylor  <iant@google.com>
8228
8229         * compressed_output.cc (zlib_decompress): Fix signature in
8230         !HAVE_ZLIB_H case.
8231
8232         * archive.cc (Archive::include_member): Unlock an external member
8233         of a thin archive.  Don't bother to delete an object we know is
8234         NULL.
8235
8236 2010-07-12  Cary Coutant  <ccoutant@google.com>
8237
8238         * compressed_output.cc (zlib_decompress): New function.
8239         (get_uncompressed_size): New function.
8240         (decompress_input_section): New function.
8241         * compressed_output.h (get_uncompressed_size): New function.
8242         (decompress_input_section): New function.
8243         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8244         Handle compressed debug sections.
8245         * layout.cc (is_compressed_debug_section): New function.
8246         (Layout::output_section_name): Map compressed section names to
8247         canonical names.
8248         * layout.h (is_compressed_debug_section): New function.
8249         (is_debug_info_section): Recognize compressed debug sections.
8250         * merge.cc: Include compressed_output.h.
8251         (Output_merge_data::do_add_input_section): Handle compressed
8252         debug sections.
8253         (Output_merge_string::do_add_input_section): Handle compressed
8254         debug sections.
8255         * object.cc: Include compressed_output.h.
8256         (Sized_relobj::Sized_relobj): Initialize new data members.
8257         (build_compressed_section_map): New function.
8258         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8259         * object.h (Object::section_is_compressed): New method.
8260         (Object::do_section_is_compressed): New method.
8261         (Sized_relobj::Compressed_section_map): New type.
8262         (Sized_relobj::do_section_is_compressed): New method.
8263         (Sized_relobj::compressed_sections_): New data member.
8264         * output.cc (Output_section::add_input_section): Handle compressed
8265         debug sections.
8266         * reloc.cc: Include compressed_output.h.
8267         (Sized_relobj::write_sections): Handle compressed debug sections.
8268
8269 2010-07-08  Cary Coutant  <ccoutant@google.com>
8270
8271         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8272         weak when resolving to a dynamic def.
8273         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8274         for weak undef/dynamic def cases. Adjust callers.
8275         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8276         undef_binding_weak_.
8277         (Symbol_table::sized_write_globals): Adjust symbol binding.
8278         (Symbol_table::sized_write_symbol): Add binding parameter.
8279         * symtab.h (Symbol::set_undef_binding): New method.
8280         (Symbol::is_undef_binding_weak): New method.
8281         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8282         (Symbol_table::should_override): Add new parameter.
8283         (Symbol_table::sized_write_symbol): Add new parameter.
8284
8285         * testsuite/weak_undef_file1.cc: Add new test case.
8286         * testsuite/weak_undef_file2.cc: Fix header comment.
8287         * testsuite/weak_undef_test.cc: Add new test case.
8288
8289 2010-06-29  Doug Kwan  <dougkwan@google.com>
8290
8291         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8292         Initialize USE_SYMBOL_.
8293         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8294         definition.
8295         (Arm_reloc_property::uses_symbol_): New data member declaration.
8296         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8297         uses symbol value and symbol is undefined but not weakly undefined.
8298
8299 2010-06-28  Rafael Espindola  <espindola@google.com>
8300
8301         * plugin.cc (Plugin::load): Use dlerror.
8302
8303 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8304
8305         * symtab.cc (detect_odr_violations): When reporting an ODR
8306         violation, report an object where the symbol is defined.
8307
8308 2010-06-25  Doug Kwan  <dougkwan@google.com>
8309
8310         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8311         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8312         definition.
8313         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8314         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8315         target hook to detect function points.
8316         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8317         * icf.h (Icf::check_section_for_function_pointers): Change type of
8318         parameter SECTION_NAME to const reference to std::string.  Use
8319         target hook to determine if section may have unsafe pointers.
8320         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8321         method definition.
8322
8323 2010-06-21  Rafael Espindola  <espindola@google.com>
8324
8325         * fileread.cc (Input_file::find_fie): New
8326         (Input_file::open): Use Input_file::find_fie.
8327         * fileread.h (Input_file::find_fie): New
8328         * plugin.cc (set_extra_library_path): New.
8329         (Plugin::load): Add set_extra_library_path to the transfer vector.
8330         (Plugin_manager::set_extra_library_path): New.
8331         (Plugin_manager::add_input_file): Use the extra search path if set.
8332         (set_extra_library_path(): New.
8333         * plugin.h (Plugin_manager): Add set_extra_library_path and
8334         extra_search_path_.
8335
8336 2010-06-19  Cary Coutant  <ccoutant@google.com>
8337
8338         * layout.cc (gdb_sections): Add .debug_types.
8339         (lines_only_debug_sections): Likewise.
8340
8341 2010-06-18  Rafael Espindola  <espindola@google.com>
8342
8343         * plugin.cc (add_input_file,add_input_library)
8344         (Plugin_manager::add_input_file): Make filename arguments const.
8345         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8346         const.
8347
8348 2010-06-16  Doug Kwan  <dougkwan@google.com>
8349
8350         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8351         .ARM.attributes section if we have not merged any input
8352         attributes sections.
8353
8354 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8355
8356         * arm.cc: Allow combining objects with no EABI version
8357         information.
8358
8359 2010-06-15  Rafael Espindola  <espindola@google.com>
8360
8361         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8362
8363 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8364
8365         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8366         (struct iovec): Correct !HAVE_READV definition.
8367
8368 2010-06-10  Cary Coutant  <ccoutant@google.com>
8369
8370         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8371         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8372         reloc sections.
8373         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8374
8375         PR 11683
8376         * symtab.h (Symbol::is_placeholder): New member function.
8377         * target-reloc.h (relocate_section): Check for placeholder symbols.
8378
8379         * testsuite/Makefile.am (plugin_test_8): New test.
8380         (plugin_test_9): New test.
8381         * testsuite/Makefile.in: Regenerate.
8382
8383 2010-06-09  Nick Clifton  <nickc@redhat.com>
8384
8385         * yyscript.y (input_list_element): Allow strings prefixed with
8386         the '-' character.  Treat these as libraries.
8387         * script.cc (script_add_library): New function.  Adds a library
8388         specified by "-l<name>" found in an input script.
8389         * script-c.h: Add prototype for script_add_library.
8390
8391 2010-06-07  Doug Kwan  <dougkwan@google.com>
8392
8393         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8394         Restrict stub-group size to be within long conditional branch
8395         range when working around cortex-A8 erratum.
8396
8397 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8398
8399         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8400         #ifdef typo.
8401
8402 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8403
8404         PR gold/11658
8405         * output.cc
8406         (Output_section::Input_section_sort_entry::compare_section_ordering):
8407         Change to return non-zero correctly.
8408         (Output_section::Input_section_sort_section_order_index_compare
8409         ::operator()): Change to fix ambiguity in comparisons.
8410
8411 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8412
8413         * gold.h (is_wildcard_string): New function.
8414         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8415         (Layout::layout_eh_frame): Ditto.
8416         (Layout::find_section_order_index): New method.
8417         (Layout::read_layout_from_file): New method.
8418         * layout.h (Layout::find_section_order_index): New method.
8419         (Layout::read_layout_from_file): New method.
8420         (Layout::input_section_position_): New private member.
8421         (Layout::input_section_glob_): New private member.
8422         * main.cc (main): Call read_layout_from_file here.
8423         * options.h (--section-ordering-file): New option.
8424         * output.cc (Output_section::input_section_order_specified_): New
8425         member.
8426         (Output_section::Output_section): Initialize new member.
8427         (Output_section::add_input_section): Add new parameter.
8428         Keep input sections when --section-ordering-file is used.
8429         (Output_section::set_final_data_size): Sort input sections when
8430         section ordering file is specified.
8431         (Output_section::Input_section_sort_entry): Add new parameter.
8432         Check sorting type.
8433         (Output_section::Input_section_sort_entry::compare_section_ordering):
8434         New method.
8435         (Output_section::Input_section_sort_compare::operator()): Change to
8436         consider section_order_index.
8437         (Output_section::Input_section_sort_init_fini_compare::operator()):
8438         Change to consider section_order_index.
8439         (Output_section::Input_section_sort_section_order_index_compare
8440         ::operator()): New method.
8441         (Output_section::sort_attached_input_sections): Change to sort
8442         according to section order when specified.
8443         (Output_section::add_input_section<32, true>): Add new parameter.
8444         (Output_section::add_input_section<64, true>): Add new parameter.
8445         (Output_section::add_input_section<32, false>): Add new parameter.
8446         (Output_section::add_input_section<64, false>): Add new parameter.
8447         * output.h (Output_section::add_input_section): Add new parameter.
8448         (Output_section::input_section_order_specified): New
8449         method.
8450         (Output_section::set_input_section_order_specified): New method.
8451         (Input_section::Input_section): Initialize section_order_index_.
8452         (Input_section::section_order_index): New method.
8453         (Input_section::set_section_order_index): New method.
8454         (Input_section::section_order_index_): New member.
8455         (Input_section::Input_section_sort_section_order_index_compare): New
8456         struct.
8457         (Output_section::input_section_order_specified_): New member.
8458         * script-sections.cc (is_wildcard_string): Delete and move modified
8459         method to gold.h.
8460         (Output_section_element_input::Output_section_element_input): Modify
8461         call to is_wildcard_string.
8462         (Output_section_element_input::Input_section_pattern
8463         ::Input_section_pattern): Ditto.
8464         (Output_section_element_input::Output_section_element_input): Ditto.
8465         * testsuite/Makefile.am (final_layout): New test case.
8466         * testsuite/Makefile.in: Regenerate.
8467         * testsuite/final_layout.cc: New file.
8468         * testsuite/final_layout.sh: New file.
8469
8470 2010-06-01  Rafael Espindola  <espindola@google.com>
8471
8472         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8473
8474 2010-06-01  Rafael Espindola  <espindola@google.com>
8475
8476         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8477         visibility of symbols.
8478
8479 2010-05-27  Doug Kwan  <dougkwan@google.com>
8480
8481         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8482         from start of output section instead of address for a local symbol
8483         in a merged or relaxed section when doing a relocatable link.
8484
8485 2010-05-26  Rafael Espindola  <espindola@google.com>
8486
8487         PR 11604
8488         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8489         adding sections the garbage collector removed.
8490         * gold/testsuite/Makefile.am: Add test.
8491         * gold/testsuite/Makefile.in: Regenerate.
8492         * gold/testsuite/plugin_test_7.sh: New.
8493         * gold/testsuite/plugin_test_7_1.c: New.
8494         * gold/testsuite/plugin_test_7_2.c: New.
8495
8496 2010-05-26  Rafael Espindola  <espindola@google.com>
8497
8498         * script-sections.cc (Output_section_definition::set_section_addresses):
8499         Check for --section-start.
8500
8501 2010-05-26  Doug Kwan  <dougkwan@google.com>
8502
8503         * arm.cc (Arm_scan_relocatable_relocs): New class.
8504         (Target_arm::relocate_special_relocatable): New method.
8505         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8506         (Arm_relocate_functions::thumb_branch_common): Same.
8507         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8508         instead of Default_scan_relocatable_relocs.
8509         * target-reloc.h (relocate_for_relocatable): Let target handle
8510         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8511         * target.h (Sized_target::relocate_special_relocatable): New method.
8512
8513 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8514
8515         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8516
8517 2010-05-23  Doug Kwan  <dougkwan@google.com>
8518
8519         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8520         instead of a cast.
8521         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8522         with a direct branch, not a conditional branch, to a stub.
8523         * merge.cc (Output_merge_base::record_input_section): New method
8524         defintion.
8525         (Output_merge_data::do_add_input_section): Record input section if
8526         keeps-input-sections flag is set.
8527         (Output_merge_string::do_add_input_section): Ditto.
8528         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8529         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8530         INPUT_SECTIONS_.
8531         (Output_merge_base::keeps_input_sections,
8532         Output_merge_base::set_keeps_input_sections,
8533         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8534         method definitions.
8535         (Output_merge_base::Input_sections): New type declaration.
8536         (Output_merge_base::input_sections_begin,
8537         Output_merge_base::input_sections_end,
8538         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8539         (Output_merge_base::bool keeps_input_sections_,
8540         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8541         Output_merge_base::input_sections_): New data members.
8542         (Output_merge_data::do_set_keeps_input_sections): New method
8543         defintion.
8544         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8545         * output.cc (Output_section::Input_section::relobj): Move method
8546         defintion from class declaration to here and handle merge sections.
8547         (Output_section::Input_section::shndx): Ditto.
8548         (Output_section::Output_section): Remove initializations of removed
8549         data members and initialize new data member LOOKUP_MAPS_.
8550         (Output_section::add_input_section): Set keeps-input-sections flag
8551         for a newly created merge output section as appropriate.  Adjust code
8552         to use Output_section_lookup_maps class.
8553         (Output_section::add_relaxed_input_section): Adjst code for lookup
8554         maps code refactoring.
8555         (Output_section::add_merge_input_section): Add a new parameter
8556         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8557         class.  If adding input section to a newly created merge output
8558         section fails, remove the new merge section.
8559         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8560         Adjust code for use of the Output_section_lookup_maps class.
8561         (Output_section::find_merge_section): Ditto.
8562         (Output_section::build_lookup_maps): New method defintion.
8563         (Output_section::find_relaxed_input_section): Adjust code to use
8564         Output_section_lookup_maps class.
8565         (Output_section::get_input_sections): Export merge sections.  Adjust
8566         code to use Output_section_lookup_maps class.
8567         (Output_section:::add_script_input_section): Adjust code to use
8568         Output_section_lookup_maps class.  Update lookup maps for merge
8569         sections also.
8570         (Output_section::discard_states): Use Output_section_lookup_maps.
8571         (Output_section::restore_states): Same.
8572         * output.h (Merge_section_properties): Move class defintion out of
8573         Output_section.
8574         (Output_section_lookup_maps): New class.
8575         (Output_section::Input_section::is_merge_section): New method
8576         defintion.
8577         (Output_section::Input_section::relobj): Move defintion out of class
8578         defintion.  Declare method only.
8579         (Output_section::Input_section::shndx): Ditto.
8580         (Output_section::Input_section::output_merge_base): New method defintion.
8581         (Output_section::Input_section::u2_.pomb): New union field.
8582         (Output_section::Merge_section_by_properties_map,
8583         Output_section::Output_section_data_by_input_section_map,
8584         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8585         Remove types.
8586         (Output_section::add_merge_input_section): Add new parameter
8587         KEEPS_INPUT_SECTIONS.
8588         (Output_section::build_lookup_maps): New method declaration.
8589         (Output_section::merge_section_map_,
8590         Output_section::merge_section_by_properties_map_,
8591         Output_section::relaxed_input_section_map_,
8592         Output_section::is_relaxed_input_section_map_valid_): Remove data
8593         members.
8594         (Output_section::lookup_maps_): New data member.
8595
8596 2010-05-21  Doug Kwan  <dougkwan@google.com>
8597
8598         PR gold/11619
8599         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8600         avoid a compilation error.
8601
8602 2010-05-19  Rafael Espindola  <espindola@google.com>
8603
8604         * script-sections.cc (Output_section_definition::allocate_to_segment):
8605         Update the phdrs_list even when the output section is NULL.
8606         * testsuite/Makefile.am: Add test.
8607         * testsuite/Makefile.in: Regenerate.
8608         * testsuite/script_test_9.cc: New.
8609         * testsuite/script_test_9.sh: New.
8610         * testsuite/script_test_9.t: New.
8611
8612 2010-05-19  Doug Kwan  <dougkwan@google.com>
8613
8614         * arm.cc (Arm_input_section::original_size): New method.
8615         (Arm_input_section::do_addralign): Add a cast.
8616         (Arm_input_section::do_output_offset): Remove static cast.
8617         (Arm_input_section::original_addralign,
8618          Arm_input_section::original_size_): Change type to uint32_t.
8619         (Arm_input_section::init): Add safe casts for section alignment
8620         and size.
8621         (Arm_input_section::set_final_data_size): Do not set address and
8622         offset of stub table.
8623         (Arm_output_section::fix_exidx_coverage): Change use of of
8624         Output_section::Simple_input_section to that of
8625         Output_section::Input_section.
8626         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8627         except for the first pass.
8628         * output.cc (Output_section::get_input_sections): Change type of
8629         input_sections to std::list<Input_section>.
8630         (Output_section::add_script_input_section): Rename from
8631         Output_section::add_simple_input_section.  Change type of SIS
8632         parameter from Simple_input_section to Input_section.
8633         * output.h (Output_section::Simple_input_section): Remove class.
8634         (Output_section::Input_section): Change class visibility to public.
8635         (Output_section::Input_section::addralign): Use stored alignments
8636         for special input sections if set.
8637         (Output_section::Input_section::set_addralign): New method.
8638         (Output_section::get_input_sections): Change parameter type from
8639         list of Simple_input_section to list of Input_section.
8640         (Output_section::add_script_input_section): Rename from
8641         Output_section::add_simple_input_section. Change first parameter's
8642         type from Simple_input_section to Input_section and remove the
8643         second and third parameters.
8644         * script-sections.cc (Input_section::Input_section_list): Change
8645         type to list of Output_section::Input_section/
8646         (Input_section_info::Input_section_info): Change parameter type of
8647         INPUT_SECTION to Output_section::Input_section.
8648         (Input_section_info::input_section): Change return type.
8649         (Input_section_info::input_section_): Change type to
8650         Output_section::Input_section.
8651         (Output_section_element_input::set_section_addresses): Adjust code
8652         to use Output_section::Input_section instead of
8653         Output_section::Simple_input_section.  Adjust code for renaming
8654         of Output_section::add_simple_input_section.
8655         (Orphan_output_section::set_section_addresses): Ditto.
8656
8657 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8658
8659         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8660         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8661
8662 2010-05-18  Rafael Espindola  <espindola@google.com>
8663
8664         * options.cc (General_options::finalize): Handle -nostdlib.
8665         * options.h (nostdlib): New option.
8666         * script.cc (script_add_search_dir): Handle -nostdlib.
8667
8668 2010-05-12  Doug Kwan  <dougkwan@google.com>
8669
8670         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8671         attributes section only if there no attributes section after merging.
8672         (Target_arm::merge_object_attributes): Move value of
8673         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8674         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8675         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8676         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8677         and arm_attr_merge_7.stdout.
8678         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8679         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8680         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8681         arm_attr_merge_7b.o): New rules.
8682         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8683         arm_attr_merge_7
8684         * testsuite/Makefile.in: Regenerate.
8685         * testsuite/arm_attr_merge.sh: New file.
8686         * testsuite/arm_attr_merge_[67][ab].s: Same.
8687
8688 2010-05-05  Nick Clifton  <nickc@redhat.com>
8689
8690         * po/es.po: Updated Spanish translation.
8691
8692 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8693
8694         * Makefile.am (install-exec-local): Properly install gold as
8695         default cross linker.
8696         * Makefile.in: Regenerated.
8697
8698 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8699             Nick Clifton  <nickc@redhat.com>
8700
8701         * configure.ac (install_as_default): Define and set to false
8702         unless --enable-gold or --enable-gold=both/gold has been
8703         specified.
8704         * configure: Regenerate.
8705
8706         * Makefile.am (install-exec-local): Install the executable as
8707         'ld.gold'.  If install_as_default is true then also install it as
8708         'ld'.
8709         * Makefile.in: Regenerated.
8710
8711 2010-04-24  Ian Lance Taylor  <iant@google.com>
8712
8713         * layout.cc (Layout::layout_reloc): In relocatable link don't
8714         combine reloc sections for grouped sections.
8715
8716 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8717
8718         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8719         sections that are not ordinary to icf.
8720         * icf.cc (get_section_contents): Handle relocation pointing to section
8721         with no object or shndx information.
8722         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8723         * testsuite/Makefile.in: Regenerate.
8724         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8725         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8726
8727 2010-04-22  Ian Lance Taylor  <iant@google.com>
8728
8729         * expression.cc (Expression::Expression_eval_info): Add
8730         result_alignment_pointer field.
8731         (Expression::eval_with_dot): Add result_alignment_pointer
8732         parameter.  Change all callers.
8733         (Expression::eval_maybe_dot): Likewise.
8734         (class Binary_expression): Add alignment_pointer parameter to
8735         left_value and right_value.  Change all callers.
8736         (BINARY_EXPRESSION): Set result alignment.
8737         (class Trinary_expression): Add alignment_pointer parameter to
8738         arg2_value and arg3_value.  Change all callers.
8739         (Trinary_cond::value): Set result alignment.
8740         (Max_expression::value, Min_expression::value): Likewise.
8741         (Align_expression::value): Likewise.
8742         * script-sections.cc (class Sections_element): Add dot_alignment
8743         parameter to set_section_addresses virtual function.  Update
8744         instantiations.
8745         (class Output_section_element): Likewise.
8746         (Script_sections::create_segments): Add dot_alignment parameter.
8747         Change all callers.
8748         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8749         (Script_sections::set_phdrs_clause_addresses): Likewise.
8750         * script-sections.h: Update declarations.
8751         * script.h: Update declarations.
8752         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8753         min_p_align.
8754         * testsuite/script_test_3.t: Set large alignment.
8755         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8756         segment has expected alignment.
8757
8758 2010-04-22  Nick Clifton  <nickc@redhat.com>
8759
8760         * po/gold.pot: Updated by the Translation project.
8761         * po/vi.po: Updated Vietnamese translation.
8762
8763 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8764
8765         * testsuite/Makefile.am (check_PROGRAMS): Add
8766         icf_virtual_function_folding_test.
8767         * testsuite/Makefile.in: Regenerated.
8768
8769 2010-04-15  Andrew Haley  <aph@redhat.com>
8770
8771         * options.h (merge_exidx_entries): New option.
8772         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8773         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8774         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8775         (Target_arm::merge_exidx_entries): New function.
8776         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8777         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8778         to Arm_exidx_fixup constructor.
8779         Add new arg, merge_exidx_entries.
8780         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8781         Arm_output_section::fix_exidx_coverage.
8782
8783 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8784
8785         * icf.cc (get_section_contents): Check for preemptible functions.
8786         Ignore addend when appropriate.
8787         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8788         section folded.
8789         (add_from_relobj): Check for section folded.
8790         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8791         * symtab.h (should_add_dynsym_entry): Add new parameter.
8792         * target-reloc.h (scan_relocs): Check for section folded.
8793         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8794         Check reloc types for function pointers in shared objects.
8795         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8796         case.
8797         (icf_preemptible_functions_test): New test case.
8798         (icf_string_merge_test): New test case.
8799         * testsuite.Makefile.in: Regenerate.
8800         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8801         bar_glob.  Refactor code.
8802         * testsuite/icf_preemptible_functions_test.cc: New file.
8803         * testsuite/icf_preemptible_functions_test.sh: New file.
8804         * testsuite/icf_string_merge_test.cc: New file.
8805         * testsuite/icf_string_merge_test.sh: New file.
8806         * testsuite/icf_virtual_function_folding_test.cc: New file.
8807         * testsuite/icf_virtual_function_folding_test.sh: New file.
8808
8809 2010-04-14  Doug Kwan  <dougkwan@google.com>
8810
8811         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8812         for local symbol recounting if we remove a section due to ICF.
8813         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8814         there are no regular objects in input.
8815
8816 2010-04-13  Doug Kwan  <dougkwan@google.com>
8817
8818         * arm.cc (Arm_input_section::set_final_data_size): Compute
8819         accurate final data size instead of using current data size.
8820
8821 2010-04-09  Doug Kwan  <dougkwan@google.com>
8822
8823         * layout.cc (Layout::choose_output_section): Handle script section
8824         types.
8825         (Layout::make_output_section_for_script): Add section type parameter.
8826         Handle script section types.
8827         * layout.h (Layout::make_output_section_for_script): Add section
8828         type parameter.
8829         * output.cc (Output_section::Output_section): Initialize data member
8830         is_noload_.
8831         (Output_section::do_reset_address_and_file_offset): Do not set address
8832         to 0 if section is a NOLOAD section.
8833         * output.h (Output_section::is_noload): New method.
8834         (Output_section::set_is_noload): Ditto.
8835         (Output_section::is_noload_): New data member.
8836         * script-c.h (Script_section_type): New enum type.
8837         (struct Parser_output_section_header): Add new file section_type.
8838         * script-sections.cc (Sections_element::output_section_name): Add
8839         parameter for returning script section type.
8840         (Output_section_definition::output_section_name): Ditto.
8841         (Output_section_definition::section_type)P; New method.
8842         (Output_section_definiton::script_section_type_name): Ditto.
8843         (Output_section_definition::script_section_type_): New data member.
8844         (Output_section_definition::Output_section_definition): Initialize
8845         data member Output_section_definition::script_section_type_.
8846         (Output_section_definition::create_sections): Pass script section type
8847         to Layout::make_output_section_for_script.
8848         (Output_section_definition::output_section_name): Return script
8849         section type to caller.
8850         (Output_section_definition::set_section_address): Do not advance
8851         dot value and load address if section type is NOLOAD.  Set address
8852         of NOLOAD sections regardless of section flags.
8853         (Output_section_definition::print): Print section type if it is
8854         not SCRIPT_SECTION_TYPE_NONE.
8855         (Output_section_definition::section_type): New method.
8856         (Output_section_definition::script_section_type_name): Ditto.
8857         (Script_sections::output_section_name): Add new parameter
8858         PSECTION_TYPE for returning script section type.  Pass it to
8859         section elements.  Handle discard sections.
8860         (Sort_output_sections::operator()): Handle NOLOAD sections.
8861         * script-sections.h (Script_sections::Section_type): New enum type.
8862         (Script_sections::output_section_name): Add a new parameter for
8863         returning script section type.
8864         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8865         INFO and NOLOAD.
8866         * yyscript.y (union): Add new field SECTION_TYPE.
8867         (COPY, DSECT, INFO, NOLOAD): New tokens.
8868         (opt_address_and_section_type): Change type to output_section_header.
8869         (section_type): New non-terminal
8870         (section_header): Handle section type.
8871         (opt_address_and_section_type): Return section type value.
8872
8873 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8874
8875         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8876         * testsuite/plugin_common_test_2.c (foo): Likewise.
8877
8878 2010-04-08  Doug Kwan  <dougkwan@google.com>
8879
8880         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8881         Output_merge_data.
8882         * output.cc (Output_section::add_merge_input_section): Simplify
8883         code and return status of Output_merge_base::add_input_section.
8884         Update merge section map only if Output_merge_base::add_input_section
8885         returns true.
8886
8887 2010-04-07  Doug Kwan  <dougkwan@google.com>
8888
8889         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8890         if section is marked as containing instructions but has no mapping
8891         symbols.
8892         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8893         correct section index.
8894         (Arm_relobj::find_linked_text_section): Ditto.
8895
8896 2010-04-07  Cary Coutant  <ccoutant@google.com>
8897
8898         * archive.cc (include_member): Destroy Read_symbols_data object before
8899         releasing file.
8900         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8901         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8902         (Read_symbols_data::~Read_symbols_data) New destructor.
8903         (Section_relocs::Section_relocs) New constructor.
8904         (Section_relocs::~Section_relocs) New destructor.
8905         (Read_relocs_data::Read_relocs_data) New constructor.
8906         (Read_relocs_data::~Read_relocs_data) New destructor.
8907         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8908         pointers to NULL after deleting.
8909
8910 2010-04-07  Doug Kwan  <dougkwan@google.com>
8911
8912         * arm.cc: Replace "endianity" with "endianness" in comments.
8913         (Arm_exidx_cantunwind): Ditto.
8914         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8915         (Arm_relobj::merge_flags_and_attributes): New method.
8916         (Arm_relobj::merge_flags_and_attributes_): New data member.
8917         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8918         (Arm_relobj::scan_sections_for_stubs): Ditto.
8919         (Arm_relobj::do_read_symbols): Check to see if we really want to
8920         merge processor-specific flags and attributes.  Exit early if
8921         an object is empty except for section names and the undefined symbol.
8922         (Target_arm::do_finalize_sections): Move check for ELF format to
8923         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8924         attributes from a regular object only when we have determined that
8925         it is aapropriate.  Do not create an .ARM.attributes section in
8926         output if there is no regular input object.
8927         (Target_arm::merge_processor_specific_flags): Check
8928         --warn-mismatch before printing any error.
8929         (Target_arm::merge_object_attributes): Ditto.
8930         * gold.cc (queue_middle_tasks): Handle the case in which there is
8931         no regular object in input.
8932         * options.cc (General_options::parse_EB): New method.
8933         (General_options::parse_EL): Same.
8934         (General_options::General_options): Initialize endianness_.
8935         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8936         New options.
8937         (General_options::Endianness): New enum.
8938         (General_options::endianness): New method.
8939         (General_options::endianness_): New data member.
8940         * parameters.cc (Parameters::set_options): Check target endianness.
8941         (Parameters::set_target_once): Ditto.
8942         (Parameters::check_target_endianness): New method.
8943         (parameters_force_valid_target): If either -EL or -EB is specified,
8944         use it to define endianness of default target.
8945         * parameters.h (Parameters::check_target_endianness): New method
8946         declaration.
8947         * target.h (class Target): Change "endianity" to "endianness"
8948         in comments.
8949
8950 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8951
8952         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8953         * configure: Regenerate.
8954         * Makefile.in: Regenerate.
8955         * testsuite/Makefile.in: Regenerate.
8956
8957 2010-04-06  Cary Coutant  <ccoutant@google.com>
8958
8959         gcc PR lto/42757
8960         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8961         prevailing definitions of common symbols.
8962         * testsuite/plugin_test_6.sh: New test case.
8963         * testsuite/plugin_common_test_1.c: New test case.
8964         * testsuite/plugin_common_test_2.c: New test case.
8965         * testsuite/Makefile.am (plugin_test_6): New test case.
8966         * testsuite/Makefile.in: Regenerate.
8967
8968 2010-04-06  Nick Clifton  <nickc@redhat.com>
8969
8970         * po/vi.po: New Vietnamese translation.
8971
8972 2010-03-30  Doug Kwan  <dougkwan@google.com>
8973
8974         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8975
8976 2010-03-25  Doug Kwan  <dougkwan@google.com>
8977
8978         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8979         to avoid a conversion warning on a 32-bit host.
8980
8981 2010-03-24  Ian Lance Taylor  <iant@google.com>
8982
8983         * testsuite/script_test_3.t: Add a TLS segment.
8984         * testsuite/Makefile.am (check_PROGRAMS): Add
8985         tls_phdrs_script_test.
8986         (tls_phdrs_script_test_SOURCES): Define.
8987         (tls_phdrs_script_test_DEPENDENCIES): Define.
8988         (tls_phdrs_script_test_LDFLAGS): Define.
8989         (tls_phdrs_script_test_LDADD): Define.
8990         * testsuite/Makefile.in: Rebuild.
8991
8992 2010-03-23  Cary Coutant  <ccoutant@google.com>
8993
8994         * fileread.cc (find_or_make_view): Fix comment.
8995
8996 2010-03-23  Ian Lance Taylor  <iant@google.com>
8997
8998         * script-sections.cc (class Orphan_section_placement): Define
8999         PLACE_TLS and PLACE_TLS_BSS.
9000         (Orphan_section_placement::Orphan_section_placement): Initialize
9001         new places.
9002         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9003         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9004         (tls_script_test_SOURCES): Define.
9005         (tls_script_test_DEPENDENCIES): Define.
9006         (tls_script_test_LDFLAGS): Define.
9007         (tls_script_test_LDADD): Define.
9008         * testsuite/Makefile.in: Rebuild.
9009
9010 2010-03-22  Doug Kwan  <dougkwan@google.com>
9011
9012         * arm.cc (Arm_relocate_functions::abs8,
9013         Arm_relocate_functions::abs16): Use correct check for overflow
9014         specified in the ARM ELF specs.
9015         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9016         target of a BLX instruction specially.
9017         (Reloc_stub::stub_type_for_reloc): Ditto.
9018         (Relocate::relocate): Use symbolic names instead of numeric relocation
9019         codes to report error.
9020         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9021         workaround.
9022         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9023         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9024         thumb2_blx_out_of_range.stdout
9025         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9026         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9027         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9028         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9029         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9030         thumb2_blx_in_range, thumb2_blx_in_range.o,
9031         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9032         thumb2_blx_out_of_range.o): New rules.
9033         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9034         thumb2_blx_in_range and thumb2_blx_out_of_range.
9035         * testsuite/Makefile.in: Regenerate.
9036         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9037         * testsuite/thumb_blx_in_range.s: New file.
9038         * testsuite/thumb_blx_out_of_range.s: New file.
9039
9040 2010-03-22  Rafael Espindola  <espindola@google.com>
9041
9042         * archive.cc (Should_include): Move to archive.h.
9043         (should_include_member): Make it a member of Archive.
9044         (Lib_group): New.
9045         (Add_lib_group_symbols): New.
9046         * archive.h: Include options.h.
9047         (Archive_member): Moved from Archive.
9048         (Should_include): Moved from archive.cc.
9049         (Lib_group): New.
9050         (Add_lib_group_symbols): New.
9051         * dynobj.cc (do_should_include_member): New.
9052         * dynobj.h (do_should_include_member): New.
9053         * gold.cc (queue_initial_tasks): Update call to queue.
9054         * main.cc (main): Print lib group stats.
9055         * object.cc (do_should_include_member): New.
9056         * object.h: Include archive.h.
9057         (Object::should_include_member): New.
9058         (Object::do_should_include_member): New.
9059         (Sized_relobj::do_should_include_member): New.
9060         * options.cc (General_options::parse_start_lib): New.
9061         (General_options::parse_end_lib): New.
9062         (Input_arguments::add_file): Handle lib groups.
9063         (Input_arguments::start_group): Check we are not in a lib.
9064         (Input_arguments::start_lib): New.
9065         (Input_arguments::end_lib): New.
9066         * options.h (General_options): Add start_lib and end_lib.
9067         (Input_argument::lib_): New.
9068         (Input_argument::lib): New.
9069         (Input_argument::is_lib): New.
9070         (Input_file_lib): New.
9071         (Input_arguments::in_lib_): New.
9072         (Input_arguments::in_lib): New.
9073         (Input_arguments::start_lib): New.
9074         (Input_arguments::end_lib_): New.
9075         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9076         in unused members as preempted.
9077         (Sized_pluginobj::do_should_include_member): New.
9078         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9079         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9080         return the blocker.
9081         (Read_symbols::do_whole_lib_group): New.
9082         (Read_symbols::do_lib_group): New.
9083         (Read_symbols::do_read_symbols): Handle lib groups.
9084         (Read_symbols::get_name): Handle lib groups.
9085         * readsyms.h (Read_symbols): Add an archive member pointer.
9086         (Read_symbols::do_whole_lib_group): New.
9087         (Read_symbols::do_lib_group): New.
9088         (Read_symbols::member_): New.
9089         * script.cc (read_input_script): Update call to queue_soon.
9090
9091 2010-03-19  Doug Kwan  <dougkwan@google.com>
9092
9093         * arm.cc (Stub_table::Stub_table): Initialize new data members
9094         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9095         (Stub_table::add_reloc_stub): Assign stub offset and update
9096         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9097         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9098         New data members.
9099         (Stub_table::update_data_size_and_addralign): Use
9100         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9101         instead of going over all reloc stubs.
9102         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9103         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9104         Stringpool_template::offset_ to size of Stringpool_char.
9105         (Stringpool_template::new_key_offset): Remove code to initialize
9106         Stringpool_template::offset_.
9107         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9108         Stringpool_template::offset_ to zero.
9109
9110 2010-03-15  Doug Kwan  <dougkwan@google.com>
9111
9112         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9113         offset_.
9114         (Stringpool_template::new_key_offset): New method.
9115         (Stringpool_template::add_string): Assign offsets when adding new
9116         strings.
9117         (Stringpool_template::set_string_offsets): Do not set string offsets
9118         when not optimizing.
9119         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9120         member size_.
9121         (Chunked_vector::clear): Clear size_.
9122         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9123         (Chunked_vector::size): Return size_.
9124         (Chunked_vector::push_back): Use size_ to find insert position.
9125         (Chunked_vector::size_): New data member.
9126         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9127         (Stringpool_template::new_key_offset): New method declaration.
9128         (Stringpool_template::offset_): New data member.
9129
9130 2010-03-15   Rafael Espindola  <espindola@google.com>
9131
9132         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9133         Add_symbols' constructor.
9134         * readsyms.h (Add_symbols): Remove the input_group member.
9135
9136 2010-03-10  Ian Lance Taylor  <iant@google.com>
9137
9138         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9139         target to ask whether a reference to a symbol requires a stack
9140         split.
9141         * target.h (Target::is_call_to_non_split): New function.
9142         (Target::do_is_call_to_non_split): Declare virtual function.
9143         * target.cc: Include "symtab.h".
9144         (Target::do_is_call_to_non_split): New function.
9145         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9146
9147 2010-03-10  Cary Coutant  <ccoutant@google.com>
9148
9149         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9150         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9151         (File_read::open[2]): Add whole_file_view_ to list of views.
9152         (File_read::make_view): Remove test of whole_file_view_.
9153         (File_read::find_or_make_view): Create whole_file_view_ if
9154         necessary.
9155         (File_read::clear_views): Replace bool parameter with enum;
9156         adjust all callers.  Don't delete views with permanent data;
9157         do delete cached views and views from archives if
9158         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9159         if clearing the corresponding view.
9160         * fileread.h (File_read::Clear_views_mode): New enum.
9161         (File_read::View::is_permanent_view): New method.
9162         (File_read::clear_views): Replace bool parameter
9163         with enum; adjust all callers.
9164         * options.h (General_options): Change keep_files_mapped option;
9165         add map_whole_files.
9166         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9167         releasing the file.
9168         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9169         the file.
9170
9171 2010-03-10  David S. Miller  <davem@davemloft.net>
9172
9173         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9174
9175 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9176
9177         * icf.cc (get_section_contents): Add '@' marker after processing the
9178         merge reloc.
9179
9180 2010-03-08  Doug Kwan  <dougkwan@google.com>
9181
9182         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9183         due to a conversion warning.
9184         (Arm_relobj::update_output_local_symbol_count): Check for local
9185         symbol with unset output index.
9186
9187 2010-03-05  Ian Lance Taylor  <iant@google.com>
9188
9189         * options.h (class General_options): Add --spare-dynamic-tags.
9190         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9191         --spare-dynamic-tags.
9192
9193 2010-03-05  Ian Lance Taylor  <iant@google.com>
9194
9195         * incremental.cc: Include "libiberty.h".
9196
9197 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9198
9199         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9200         function, is_info_ member.
9201         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9202         (Versions::Versions): Update caller.
9203         (Versions::define_base_version): Likewise.
9204         (Versions::add_def): Likewise.
9205
9206 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9207
9208         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9209         (Scan::possible_function_pointer_reloc): New function.
9210         (Scan::local_reloc_may_be_function_pointer): Change to call
9211         possible_function_pointer_reloc.
9212         (Scan::global_reloc_may_be_function_pointer): Ditto.
9213         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9214         relocations in ".data.rel.ro._ZTV" section.
9215         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9216         * testsuite/icf_safe_so_test.cc: Ditto.
9217         * testsuite/icf_safe_test.cc: Ditto.
9218         * testsuite/icf_safe_test.sh: Ditto.
9219
9220 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9221             Ian Lance Taylor  <iant@google.com>
9222
9223         * target-reloc.h (relocate_section): Check the symbol table index
9224         for -1U before setting the local symbol index.
9225         (scan_relocatable_relocs): If copying the relocation, record that
9226         the local symbol is required.
9227         * object.h (Symbol_value::is_output_symtab_index_set): New
9228         function.
9229         (Symbol_value::may_be_discarded_from_output_symtab): New
9230         function.
9231         (Symbol_value::has_output_symtab_entry): New function.
9232         (Symbol_value::needs_output_symtab_entry): Remove.
9233         (Symbol_value::output_symtab_index): Make sure the symbol index is
9234         set.
9235         (Symbol_value::set_output_symtab_index): Make sure the symbol
9236         index is not set.  Make sure the new index is valid.
9237         (Symbol_value::set_must_have_output_symtab_entry): New function.
9238         (Symbol_value::has_output_dynsym_entry): New function.
9239         (Symbol_value::set_output_dynsym_index): Make sure the new index
9240         is valid.
9241         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9242         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9243         local symbol if permitted.
9244         (Sized_relobj::do_finalize_local_symbols): Call
9245         is_output_symtab_index_set rather than needs_output_symtab_entry.
9246         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9247         rather than needs_output_symtab_entry.  Call
9248         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9249         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9250         is_output_symtab_index_set rather than needs_output_symtab_entry.
9251         * testsuite/discard_locals_relocatable_test.c: New file.
9252         * testsuite/discard_locals_test.sh: Test -r.
9253         * testsuite/Makefile.am (check_DATA): Add
9254         discard_locals_relocatable_test1.syms,
9255         discard_local_relocatable_test2.syms.
9256         (MOSTLYCLEANFILES): Likewise.  Also add
9257         discard_locals_relocatable_test1.lout and
9258         discard_locals_relocatable_test2.out.
9259         (discard_locals_relocatable_test1.syms): New target.
9260         (discard_locals_relocatable_test.o): New target.
9261         (discard_locals_relocatable_test1.out): New target.
9262         (discard_locals_relocatable_test2.syms): New target.
9263         (discard_locals_relocatable_test2.out): New target.
9264         (various): Add missing ../ld-new dependencies.
9265         * testsuite/Makefile.in: Rebuild.
9266
9267 2010-03-03  Nick Clifton  <nickc@redhat.com>
9268
9269         * po/fi.po: New Finnish translation.
9270
9271 2010-03-01  Doug Kwan  <dougkwan@google.com>
9272
9273         * layout.cc (Layout::Layout): Force section types of .init_array*,
9274         .preinit_array* and .fini_array* sections.
9275         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9276         Fix check of return value of std::string::find.().
9277         (Output_section::Input_section_sort_compare::operator()): Remove
9278         comment about .init_array.
9279         (Output_section::Input_section_sort_init_fini_compare::operator()):
9280         New method.
9281         (Output_section::sort_attached_input_sections): Handle .init_array
9282         and .fini_array specially.
9283         * output.h (Output_section::Inut_section_sort_compare): Update
9284         comment.
9285         (Output_section::Input_section_sort_init_fini_compare): New struct.
9286
9287 2010-02-26  Doug Kwan  <dougkwan@google.com>
9288
9289         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9290         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9291         * testsuite/debug_msg.sh: Avoid matching source line number for
9292         use of global variable undef_int.
9293
9294 2010-02-26  Doug Kwan  <dougkwan@google.com>
9295
9296         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9297         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9298         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9299         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9300         * options.cc (General_options::General_options): Initialize member
9301         fix_v4bx_.
9302         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9303         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9304         and rm_no_fix_v4bx.stdout
9305         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9306         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9307         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9308         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9309         and arm_no_fix_v4bx.
9310         * Makefile.in: Regenerate.
9311         * testsuite/arm_fix_v4bx.s: New file.
9312         * testsuite/arm_fix_v4bx.sh: Ditto.
9313
9314 2010-02-24  Doug Kwan  <dougkwan@google.com>
9315
9316         * arm.cc (Target_arm::got_section): Make the .got section the first
9317         non RELRO section in the data segment.
9318         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9319         suffixes of section names.
9320
9321 2010-02-24  Doug Kwan  <dougkwan@google.com>
9322
9323         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9324         flags and attributes merging if an input file is a binary file.
9325         * fileread.cc (Input_file::open): Record format of original file.
9326         * fileread.h (Input_file::Format): New enum type.
9327         (Input_file::Input_file): Initialize data member format_.
9328         (Input_file::format): New method definition.
9329         (Input_file::format_):: New data member.
9330
9331 2010-02-24  Doug Kwan  <dougkwan@google.com>
9332
9333         * arm.cc (Arm_output_data_got): New class.
9334         (ARM_TCB_SIZE): New constant
9335         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9336         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9337         If user uses a script with a SECTIONS clause, issue only a warning
9338         for a misplaced EXIDX input section.  Otherwise, issue an error.
9339         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9340         garbage collection.
9341         (Target_arm::got_mode_index_entry): Handle static linking.
9342         (Target_arm::Scan::local): Ditto.
9343         (Target_arm::Scan::global): Ditto.
9344         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9345         all incorrectly implemented relocations.
9346         (Target_arm::fix_exidx_coverage): Pass layout to
9347         Arm_output_section::fix_exidx_coverage.
9348         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9349         from ".ARM.exidx." and ".ARM.extab.".
9350
9351 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9352
9353         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9354         section if it does not already exist.
9355         * attributes.cc (Attributes_section_data::Attributes_section_data):
9356         Don't crash if size is zero.
9357
9358 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9359             Ian Lance Taylor  <iant@google.com>
9360
9361         * gold.cc (queue_middle_tasks): If no input files were opened,
9362         exit.
9363         * workqueue.h (Task_function::Task_function): Assert that there is
9364         a blocker.
9365
9366 2010-02-22  Doug Kwan  <dougkwan@google.com>
9367
9368         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9369         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9370         types to avoid warnings due to different uint64_t implementations
9371         on different hosts.
9372
9373 2010-02-21  Doug Kwan  <dougkwan@google.com>
9374
9375         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9376         handling of the maximum backward branch offset.
9377         (Arm_relocate_functions::thumb_branch_common): Ditto.
9378         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9379         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9380         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9381         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9382         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9383         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9384         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9385         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9386         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9387         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9388         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9389         thumb2_bl_out_of_range.o): New rules.
9390         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9391         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9392         thumb2_bl_out_of_range
9393         * testsuite/Makefile.in: Regenerate.
9394         * testsuite/arm_bl_in_range.s: New file.
9395         * testsuite/arm_bl_out_of_range.s: Ditto.
9396         * testsuite/arm_branch_in_range.sh: Ditto.
9397         * testsuite/arm_branch_range.t: Ditto.
9398         * testsuite/thumb2_branch_range.t: Ditto.
9399         * testsuite/thumb_bl_in_range.s: Ditto.
9400         * testsuite/thumb_bl_out_of_range.s: Ditto.
9401         * testsuite/thumb_branch_range.t: Ditto.
9402
9403 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9404
9405         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9406         Add reloc offset information.
9407         * icf.cc (get_section_contents): Change iterators to point to the new
9408         vectors. Add reloc offset information to the contents.
9409         * icf.h (Icf::Sections_reachable_info): New typedef.
9410         (Icf::Sections_reachable_list): New typedef.
9411         (Icf::Offset_info): New typedef.
9412         (Icf::Reloc_info): New struct typedef.
9413         (Icf::Reloc_info_list): New typedef.
9414         (Icf::symbol_reloc_list): Delete method.
9415         (Icf::addend_reloc_list): Delete method.
9416         (Icf::section_reloc_list): Delete method.
9417         (Icf::reloc_info_list): New method.
9418         (Icf::reloc_info_list_): New member.
9419
9420 2010-02-19  Doug Kwan  <dougkwan@google.com>
9421
9422         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9423         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9424         * arm.cc (Arm_relocation_functions): New forward declaration.
9425         (Target_arm::Target_arm): Initialize new data members
9426         got_mod_index_offset_ and tls_base_symbol_defined_.
9427         (Target_arm::Relocate::relocate_tls): New method.
9428         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9429          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9430         New methods.
9431         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9432         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9433         (Target_arm::got_mod_index_offset_,
9434         Target_arm::tls_base_symbol_defined_): New data members.
9435         (Target_arm::Scan::local, Target::Scan::global,
9436         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9437         relocations.
9438
9439 2010-02-18  Doug Kwan  <dougkwan@google.com>
9440
9441         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9442         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9443         text section as a parameter becuase some broken tools may not set
9444         the link in section header.
9445         (Target_arm::has_got_section): New method.
9446         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9447         without any mapping symbol as data only.  Remove warning.
9448         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9449         link in its section header, try to discover the link by inspecting the
9450         REL31 relocation at the beginning of the section.
9451         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9452         in error message.
9453         (Target_arm::Scan::global): Treat any reference to the symbol
9454         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9455
9456 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9457
9458         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9459         (Scan::global_reloc_may_be_function_pointer): New function.
9460         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9461         (Scan::global_reloc_may_be_function_pointer): New function.
9462         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9463         (Scan::global_reloc_may_be_function_pointer): New function.
9464         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9465         (Scan::global_reloc_may_be_function_pointer): New function.
9466         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9467         (Scan::global_reloc_may_be_function_pointer): New function.
9468         (Scan::possible_function_pointer_reloc): New function.
9469         (Target_x86_64::can_check_for_function_pointers): New function.
9470         * gc.h (gc_process_relocs): Scan relocation types to determine if
9471         function pointers were taken for targets that support it.
9472         * icf.cc (Icf::find_identical_sections): Include functions for
9473         folding in safe ICF whose pointer is not taken.
9474         * icf.h (Secn_fptr_taken_set): New typedef.
9475         (fptr_section_id_): New member.
9476         (section_has_function_pointers): New function.
9477         (set_section_has_function_pointers): New function.
9478         (check_section_for_function_pointers): New function.
9479         * options.h: Fix comment for safe ICF option.
9480         * target.h (can_check_for_function_pointers): New function.
9481         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9482         Modify icf_safe_test for X86-64.
9483         * testsuite/Makefile.in: Regenerate.
9484         * testsuite/icf_safe_so_test.cc: New file.
9485         * testsuite/icf_safe_so_test.sh: New file.
9486         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9487         (main): Change to take pointer to function kept_func_3.
9488         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9489         folding is done correctly for X86-64.
9490
9491 2010-02-12  David S. Miller  <davem@davemloft.net>
9492
9493         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9494         is_symbolless parameter.
9495         (Output_reloc<SHT_REL>::is_symbolless): New.
9496         (Output_reloc<SHT_REL>::is_symbolless_): New.
9497         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9498         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9499         (Output_reloc<SHT_RELA>::is_symbolless): New.
9500         (Output_data_reloc::add_global): Handle is_symbolless.
9501         (Output_data_reloc::add_global_relative): Likewise.
9502         (Output_data_reloc::add_local): Likewise.
9503         (Output_data_reloc::add_local_relative): Likewise.
9504         (Output_data_reloc::add_symbolless_global_addend): New.
9505         (Output_data_reloc::add_symbolless_local_addend): New.
9506         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9507         is_symbolless.
9508         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9509         instead of ->is_relative_
9510         (Output_reloc::write): Likewise.
9511         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9512         (Output_reloc::write_rel): Simplify.
9513
9514         * sparc.cc (Target_sparc::Scan::local): Use
9515         ->add_symbolless_local_addend as needed.
9516         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9517         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9518         based upon relocation offset.
9519
9520 2010-02-11  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9523         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9524         beginning of function.
9525         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9526         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9527         parameter is_32bit in calls to should_apply_static_reloc.
9528         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9529         (check_DATA): Add arm_abs_global.stdout.
9530         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9531         arm_abs_global.stdout): New rules.
9532         (MOSTLLYCLEANFILES): Add arm_abs_global
9533         * Makefile.in: Regenerate.
9534         * testsuite/arm_abs_global.s: New file.
9535         * testsuite/arm_abs_global.sh: Ditto.
9536         * testsuite/arm_abs_lib.s: Ditto.
9537
9538 2010-02-11  Ian Lance Taylor  <iant@google.com>
9539
9540         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9541         Read_relocs task.
9542         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9543         Allocate_commons_task first.
9544         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9545         task, rather than symtab_lock_.
9546         (Gc_process_relocs::~Gc_process_relocs): New function.
9547         (Gc_process_relocs::is_runnable): Check this_blocker_.
9548         (Gc_process_relocs::locks): Use next_blocker_ rather than
9549         blocker_.
9550         (Scan_relocs::~Scan_relocs): New function.
9551         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9552         symtab_lock_.
9553         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9554         next_blocker_.
9555         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9556         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9557         constructor accordingly.
9558         (class Gc_process_relocs): Likewise.
9559         (class Scan_relocs): Likewise.
9560         * common.h (class Allocate_commons_task): Remove symtab_lock_
9561         field, and corresponding constructor parameter.
9562         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9563         symtab_lock_.
9564         (Allocate_commons_task::locks): Likewise.
9565
9566 2010-02-11  Ian Lance Taylor  <iant@google.com>
9567
9568         * gold-threads.h (class Once): Define.
9569         (class Initialize_lock): Rewrite as child of Once.
9570         * gold-threads.cc (class Once_initialize): Define.
9571         (once_pointer_control): New static variable.
9572         (once_pointer, once_arg): New static variables.
9573         (c_run_once): New static function.
9574         (Once::Once, Once::run_once, Once::internal_run): New functions.
9575         (class Initialize_lock_once): Remove.
9576         (initialize_lock_control): Remove.
9577         (initialize_lock_pointer): Remove.
9578         (initialize_lock_once): Remove.
9579         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9580         (Initialize_lock::initialize): Rewrite.
9581         (Initialize_lock::do_run_once): New function.
9582         * archive.cc (Archive::interpret_header): Only clear name if it is
9583         not already empty.
9584         * fileread.cc: Include "gold-threads.h"
9585         (file_counts_lock): New static variable.
9586         (file_counts_initialize_lock): Likewise.
9587         (File_read::release): Only increment counts when using --stats.
9588         Use a lock around the increment.
9589         * parameters.cc (class Set_parameters_target_once): Define.
9590         (set_parameters_target_once): New static variable.
9591         (Parameters::Parameters): Move here from parameters.h.
9592         (Parameters::set_target): Rewrite.
9593         (Parameters::set_target_once): New function.
9594         (Parameters::clear_target): Move here and rewrite.
9595         * parameters.h (class Parameters): Update declarations.  Add
9596         set_parameters_target_once_ field.
9597         (Parameters::Parameters): Move to parameters.cc.
9598         (Parameters::clear_target): Likewise.
9599         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9600         task.
9601         (Start_group::~Start_group): New function.
9602         (Start_group::is_runnable): New function.
9603         (Start_group::locks, Start_group::run): New functions.
9604         (Finish_group::run): Change saw_undefined to size_t.
9605         * readsyms.h (class Start_group): Define.
9606         (class Finish_group): Change saw_undefined_ field to size_t.
9607         (Finish_group::Finish_group): Remove saw_undefined and
9608         this_blocker parameters.  Change all callers.
9609         (Finish_group::set_saw_undefined): New function.
9610         (Finish_group::set_blocker): New function.
9611         * symtab.h (class Symbol_table): Change saw_undefined to return
9612         size_t.  Change saw_undefined_ field to size_t.
9613         * target-select.cc (Set_target_once::do_run_once): New function.
9614         (Target_selector::Target_selector): Initialize set_target_once_
9615         field.  Don't initialize lock_ and initialize_lock_ fields.
9616         (Target_selector::instantiate_target): Rewrite.
9617         (Target_selector::set_target): New function.
9618         * target-select.h (class Set_target_once): Define.
9619         (class Target_selector): Update declarations.  Make
9620         Set_target_once a friend.  Remove lock_ and initialize_lock_
9621         fields.  Add set_target_once_ field.
9622
9623 2010-02-10  Ian Lance Taylor  <iant@google.com>
9624
9625         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9626         queueing any tasks.
9627         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9628         (queue_middle_tasks): Add all blockers before queueing any tasks.
9629         (queue_final_tasks): Likewise.
9630         * token.h (Task_token::add_blockers): New function.
9631         * object.h (Input_objects::number_of_relobjs): New function.
9632
9633 2010-02-10  Ian Lance Taylor  <iant@google.com>
9634
9635         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9636         shared, not if not position independent.
9637         * x86_64.cc (Relocate::relocate_tls): Likewise.
9638         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9639         (tls_pie_pic_test): New target.
9640         * testsuite/Makefile.in: Rebuild.
9641
9642         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9643         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9644         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9645         * testsuite/Makefile.in: Rebuild.
9646
9647 2010-02-09  David S. Miller  <davem@davemloft.net>
9648
9649         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9650         R_SPARC_RELATIVE using ->add_local_relative().
9651         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9652
9653         * output.h (Output_data_dynamic::add_section_size): New method
9654         that takes two Output_data objects.
9655         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9656         entry param.  Handle it in initializers.
9657         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9658         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9659         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9660         arg.
9661         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9662         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9663         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9664         for dynrel_includes_plt.
9665         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9666         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9667         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9668         before .rela.plt
9669         (Target_sparc::do_finalize_sections): Update to pass true for
9670         dynrel_includes_plt.
9671         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9672         output before .rela.plt
9673         (Target_powerpc::do_finalize_sections): Update to pass true for
9674         dynrel_includes_plt when 32-bit.
9675
9676 2010-02-08  Doug Kwan  <dougkwan@google.com>
9677
9678         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9679         method.
9680         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9681         Arm_relobj::scan_section_for_cortex_a8_stubs,
9682         Arm_relobj::do_relocation_section): Instead of calling
9683         Output_section::output_address, use faster
9684         Arm_relobj::simple_input_section_output_address.
9685
9686 2010-02-08  David S. Miller  <davem@davemloft.net>
9687
9688         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9689         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9690         relocation helper function.
9691
9692         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9693         just like R_SPARC_GOT{10,13,22}.
9694         (Target_sparc::Scan::local): Likewise.
9695         (Target_sparc::Relocate:relocate): Likewise.
9696
9697 2010-02-06  Ian Lance Taylor  <iant@google.com>
9698
9699         * configure.ac: Rewrite targetobjs duplicate removal code to use
9700         only shell constructs.
9701         * configure: Rebuild.
9702
9703 2010-02-05  Doug Kwan  <dougkwan@google.com>
9704
9705         PR 11247
9706         * arm.cc (Arm_relobj::section_is_scannable): New method.
9707         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9708         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9709
9710 2010-02-04  Doug Kwan  <dougkwan@google.com>
9711
9712         PR 11247
9713         * arm-reloc-property.cc (cstdio): Include.
9714         * configure.ac (targetobjs): Remove duplicates.
9715         * configure: Regenerate.
9716         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9717         big and little endian version for a given address size.
9718
9719 2010-02-03  Doug Kwan  <dougkwan@google.com>
9720
9721         * arm-reloc-property.cc
9722         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9723         definition.
9724         * arm-reloc-property.h
9725         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9726         New method definition.
9727         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9728         declaration.
9729         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9730         overflow to N.
9731         (GOT_PREL): Change implemented to Y.
9732         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9733         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9734         (Arm_relocate_functions::movw_abs_nc): Remove method.
9735         (Arm_relocate_functions::movt_abs): Ditto.
9736         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9737         (Arm_relocate_functions::thm_movt_abs): Ditto.
9738         (Arm_relocate_functions::movw_rel_nc): Ditto.
9739         (Arm_relocate_functions::movw_rel): Ditto.
9740         (Arm_relocate_functions::movt_rel): Ditto.
9741         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9742         (Arm_relocate_functions:thm_movw_rel): Ditto.
9743         (Arm_relocate_functions:thm_movt_rel): Ditto.
9744         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9745         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9746         New method definitions.
9747         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9748         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9749         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9750         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9751         (Target_arm::Relocate::relocate): Check for non-static or
9752         unimplemented relocation code and exit early.  Change calls to
9753         Target_arm::reloc_uses_thumb_bit and
9754         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9755         instead.  Refactor code to handle similar relocations to increase
9756         code sharing.  Remove check for unsupported relocation code in switch
9757         statement.
9758         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9759         relocation property table to find out size.  Change error message to
9760         print out the name of a relocation code instead of the numeric value.
9761         (Target_arm::scan_reloc_for_stub): Use relocation property table
9762         instead of calling Target_arm::reloc_uses_thumb_bit().
9763
9764 2010-02-02  Doug Kwan  <dougkwan@google.com>
9765
9766         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9767         types of relaxed input section.
9768
9769 2010-02-02  Doug Kwan  <dougkwan@google.com>
9770
9771         * Makefile.am (HFILES): Add arm-reloc-property.h.
9772         (DEFFILES): New.
9773         (TARGETSOURCES): Add arm-reloc-property.cc
9774         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9775         (libgold_a_SOURCES): $(DEFFILES)
9776         * Makefile.in: Regenerate.
9777         * arm-reloc-property.cc: New file.
9778         * arm-reloc-property.h: New file.
9779         * arm-reloc.def: New file.
9780         * arm.cc: Update comments.
9781         (arm-reloc-property.h): New included header.
9782         (arm_reloc_property_table): New global variable.
9783         (Target_arm::do_select_as_default_target): New method definition.
9784         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9785         arm-reloc-property to targ_extra_obj.
9786         * parameters.cc (set_parameters_target): Call
9787         Target::select_as_default_target().
9788         * target.h (Target::select_as_default_target): New method definition.
9789         (Target::do_select_as_default_target): Same.
9790
9791 2010-02-01  Doug Kwan  <dougkwan@google.com>
9792
9793         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9794         first_output_text_section_.
9795         (Arm_exidx_fixup::first_output_text_section): New method definition.
9796         (Arm_exidx_fixup::first_output_text_section_): New data member.
9797         (Arm_exidx_fixup::process_exidx_section): Record the first text
9798         output section seen.
9799         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9800         and entsize in output section header.
9801
9802 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9803
9804         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9805         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9806         (Arm_relocate_functions::thm_alu11): New Method.
9807         (Arm_relocate_functions::thm_pc8): New Method.
9808         (Arm_relocate_functions::thm_pc12): New Method.
9809         (Target_arm::Scan::local): Handle the relocations.
9810         (Target_arm::Scan::global): Likewise.
9811         (Target_arm::Relocate::relocate): Likewise.
9812         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9813
9814 2010-01-29  Doug Kwan  <dougkwan@google.com>
9815
9816         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9817         of relocation types as ld.
9818
9819 2010-01-29  Doug Kwan  <dougkwan@google.com>
9820
9821         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9822         to public.
9823         (Arm_relocate_functions::thumb_branch_common): Ditto.
9824         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9825         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9826         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9827         Arm_relocate_functions::jump24): Remove.
9828         (Target_arm::Relocate::relocate): Adjust code to call
9829         Arm_relocation_functions::arm_branch_common and
9830         Arm_relocation_functions::thumb_branch_common instead of their removed
9831         wrappers.  Merge switch-cases together to reduce source code size.
9832
9833 2010-01-29  Doug Kwan  <dougkwan@google.com>
9834
9835         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9836         output_local_symbol_count_needs_update_.
9837         (Arm_relobj::output_local_symbol_count_needs_update,
9838          Arm_relobj::set_output_local_symbol_count_needs_update,
9839          Arm_relobj::update_output_local_symbol_count): New methods.
9840         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9841         member.
9842         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9843         of pointed function as in a R_ARM_PREL31 relocation.
9844         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9845         for output local symbol count updating.
9846         (Target_arm::do_relax): Update output local symbol counts in objects
9847         if necessary.
9848         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9849
9850 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9851
9852         * arm.cc: Added support for the ARM relocations:
9853         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9854         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9855         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9856         movw_prel_nc).
9857         (Arm_relocate_functions::movw_rel): New method.
9858         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9859         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9860         thm_movw_prel_nc).
9861         (Arm_relocate_functions::thm_movw_rel): New method.
9862         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9863         thm_movt_prel).
9864         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9865         relocations.
9866         (Target_arm::Scan::global): Likewise.
9867         (Target_arm::Relocate::relocate): Likewise.
9868         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9869         Likewise.
9870
9871 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9872
9873         * arm.cc: Added support for ARM group relocations.
9874         (Target_arm::reloc_needs_sym_origin): New method.
9875         (Arm_relocate_functions::calc_grp_kn): New method.
9876         (Arm_relocate_functions::calc_grp_residual): New method.
9877         (Arm_relocate_functions::calc_grp_gn): New method.
9878         (Arm_relocate_functions::arm_grp_alu): New Method.
9879         (Arm_relocate_functions::arm_grp_ldr): New Method.
9880         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9881         (Arm_relocate_functions::arm_grp_ldc): New Method.
9882         (Target_arm::Scan::local): Handle the ARM group relocations.
9883         (Target_arm::Scan::global): Likewise.
9884         (Target_arm::Relocate::relocate): Likewise.
9885         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9886         Likewise.
9887
9888 2010-01-26  Doug Kwan  <dougkwan@google.com>
9889
9890         * arm.cc (set): Include.
9891         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9892         pointer type.
9893         (Arm_output_section::Text_section_list): New type.
9894         (Arm_output_section::append_text_sections_to_list): New method.
9895         (Arm_output_section::fix_exidx_coverage): Ditto.
9896         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9897         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9898         Relobj::set_section_offset() instead of
9899         Sized_relobj::invalidate_section_offset().
9900         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9901         parameter for section headers. Ignore relocation sections for
9902         unallocated sections and EXIDX sections.
9903         (Target_arm::fix_exidx_coverage): New method.
9904         (Target_arm::output_section_address_less_than): New type.
9905         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9906         linked text section instead of the EXIDX section.
9907         (Arm_output_section::create_stub_group): Add an assertion to check
9908         that this is not an EXIDX output section.
9909         (Arm_output_section::append_text_sections_to_list): New method.
9910         (Arm_output_section::fix_exidx_coverage): Ditto.
9911         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9912         Arm_relobj::section_needs_reloc_stub_scanning.
9913         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9914         first pass.
9915         (Target_arm::fix_exidx_coverage): New method.
9916         * object.h (Relobj::set_output_section): New method.
9917         (Sized_relobj::invalidate_section_offset): Remove method.
9918         (Sized_relobj::do_invalidate_section_offset): Remove method.
9919         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9920
9921 2010-01-25  Doug Kwan  <dougkwan@google.com>
9922
9923         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9924         Fix warning due to signed and unsigned comparison on a 32-bit host.
9925
9926 2010-01-22  Doug Kwan  <dougkwan@google.com>
9927
9928         * arm.cc (Target_arm::do_relax): Record an output section for section
9929         offset adjustment it contains any stub table that has changed.
9930         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9931         offsets in an output section if necessary.
9932         * output.cc (Output_section::Output_section): Initialize
9933         section_offsets_need_adjustments_.
9934         (Output_section::add_input_section_for_script): Renamed to
9935         Output_section::add_simple_input_section.
9936         (Output_section::save_states): Add a comment.
9937         (Output_section::discard_states): New method defintion.
9938         (Output_section::adjust_section_offsets): Same.
9939         * output.h (Output_section::add_input_section_for_script): Renamed to
9940         Output_section::add_simple_input_section.
9941         (Output_section::discard_states): New method declaration.
9942         (Output_section::adjust_section_offsets): Same.
9943         (Output_section::section_offsets_need_adjustment,
9944         Output_section::set_section_offsets_need_adjustment): New method
9945         definitions.
9946         (Output_section::section_offsets_need_adjustment_): New data member.
9947         * script-sections.cc
9948         (Output_section_element_input::set_section_address): Adjust code for
9949         renaming of Output_section::add_input_section_for_script.
9950         (Orphan_output_section::set_section_address): Same.
9951
9952 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9953
9954         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9955         Fix_v4bx enum values .
9956         * gold/options.h (General_options): New option definitions.
9957         (General_options::fix_v4bx): New method.
9958         (General_options::Fix_v4bx): New enum.
9959         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9960         (General_options::parse_fix_v4bx_interworking): New method.
9961
9962 2010-01-22  Doug Kwan  <dougkwan@google.com>
9963
9964         * arm.cc (Arm_exidx_fixup): New class.
9965
9966 2010-01-21  Doug Kwan  <dougkwan@google.com>
9967
9968         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9969         classes.
9970         (Arm_exidx_section_offset_map): New type.
9971
9972 2010-01-21  Doug Kwan  <dougkwan@google.com>
9973
9974         * arm.cc (Arm_exidx_input_section): New class.
9975         (Arm_relobj::exidx_input_section_by_link,
9976         Arm_relobj::exidx_input_section_by_shndx,
9977         Arm_relobj::make_exidx_input_section): New methods.
9978         (read_arm_attributes_section): Remove.
9979         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9980         information about them.
9981         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9982         to here.
9983
9984 2010-01-20  Doug Kwan  <dougkwan@google.com>
9985
9986         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9987         Input_section_specifier to Section_id.
9988         (Target_arm::new_arm_input_section: Adjust code for change of key
9989         type.
9990         (Target_arm::find_arm_input_section): Ditto.
9991         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9992         (Section_id): Remove.
9993         (Garbage_collection::Section_id_hash): Remove.
9994         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9995         (Section_id): Remove.
9996         (Icf::Section_id_hash): Remove.
9997         * object.h (Section_id, Const_section_id, Section_id_hash,
9998         Const_section_id_hash): New type definitions.
9999         * output.cc (Output_section::add_relaxed_input_section): Change to
10000         use Const_section_id instead of Input_section_specifier as key type.
10001         (Output_section::add_merge_input_section): Ditto.
10002         (Output_section::build_relaxation_map): Change to use Section_id
10003         instead of Input_section_specifier as key type.
10004         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10005         Ditto.
10006         (Output_section::convert_input_sections_to_relaxed_sections): Change
10007         to use Const_section_id instead of Input_section_specifier as key type.
10008         (Output_section::find_merge_section): Ditto.
10009         (Output_section::find_relaxed_input_section): Ditto.
10010         * output.h (Input_section_specifier): Remove class.
10011         (Output_section::Output_section_data_by_input_section_map): Change
10012         key type to Const_section_id.
10013         (Output_section::Output_relaxed_input_section_by_input_section_map):
10014         Ditto.
10015         (Output_section::Relaxation_map): Change key type to Section_id.
10016
10017 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10018
10019         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10020         (class Arm_v4bx_stub): New class.
10021         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10022         (Stub_factory::make_arm_v4bx_stub): New method.
10023         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10024         (Stub_table::empty): Handle v4bx stubs.
10025         (Stub_table::add_arm_v4bx_stub): New method.
10026         (Stub_table::find_arm_v4bx_stub): New method.
10027         (Arm_relocate_functions::v4bx): New method.
10028         (Target_arm::fix_v4bx): New method.
10029         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10030         (Stub_table::relocate_stubs): Likewise.
10031         (Stub_table::do_write): Likewise.
10032         (Stub_table::update_data_size_and_addralign): Likewise.
10033         (Stub_table::finalize_stubs):  Likewise.
10034         (Target_arm::Scan::local): Likewise.
10035         (Target_arm::Scan::global): Likewise.
10036         (Target_arm::do_finalize_sections): Likewise.
10037         (Target_arm::Relocate::relocate): Likewise.
10038         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10039         Likewise.
10040         (Target_arm::scan_reloc_for_stub): Likewise.
10041         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10042
10043 2010-01-19  Ian Lance Taylor  <iant@google.com>
10044
10045         * output.cc (Output_section_headers::do_sized_write): Write large
10046         segment count to sh_info field.
10047         (Output_file_header::do_sized_write): For large segment count,
10048         write PN_XNUM to e_phnum field.
10049
10050 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10051
10052         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10053         (Arm_relocate_functions::thm_jump8): New function.
10054         (Arm_relocate_functions::thm_jump11): New function.
10055         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10056         R_ARM_THM_JUMP11.
10057         (Target_arm::Scan::global): Likewise.
10058         (Target_arm::Relocate::relocate): Likewise.
10059         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10060         Likewise.
10061
10062 2010-01-14  Doug Kwan  <dougkwan@google.com>
10063
10064         * arm.cc (map, utility): Include headers.
10065         (Target_arm::apply_cortex_a8_workaround): New method.
10066         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10067         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10068         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10069         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10070         the --[no-]fix-cortex-a8 command line options.
10071         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10072         (Target_arm::relocate_stub): Use addend in instruction template.
10073         * options.h (DEFINE_bool): Set the user-set flag.
10074         (General_options): Add --[no-]-fix-cortex options.
10075         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10076         : Update fast look-up map after conversion.
10077
10078 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10079
10080         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10081         in the first pass of do_layout.
10082
10083 2010-01-13  Doug Kwan  <dougkwan@google.com>
10084
10085         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10086         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10087         apparent compiler problem of not folding static constant integral
10088         data members of elfcpp::Elf_sizes<32>.
10089
10090 2010-01-13  Doug Kwan  <dougkwan@google.com>
10091
10092         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10093         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10094         Arm_relobj::scan_section_for_cortex_a8_erratum,
10095         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10096         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10097         sections to scan for relocation stubs into a new method
10098         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10099         relocation and Cortex-A8 stub scanning.
10100         (Target_arm::do_relax): Force stubs to be after stubbed sections
10101         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10102         the beginning of a new relaxation pass.  Update a comment.
10103         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10104
10105 2010-01-12  Ian Lance Taylor  <iant@google.com>
10106
10107         * target-reloc.h (visibility_error): New inline function.
10108         (relocate_section): Call visibility_error.
10109         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10110         (MOSTLYCLEANFILES): Likewise.
10111         (protected_4_pic.o, protected_3.err): New targets.
10112         * testsuite/protected_4.cc: New file.
10113
10114 2010-01-12  Doug Kwan  <dougkwan@google.com>
10115
10116         * arm.cc (Cortex_a8_reloc): New class.
10117         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10118         and cortex_a8_relocs_info_.
10119         (Target_arm::fix_cortex_a8): New method definition.
10120         (Target_arm::Cortex_a8_relocs_info): New type.
10121         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10122         New data member declarations.
10123         (Target_arm::scan_reloc_for_stub): Record information about
10124         relocations for THUMB branches that might be exempted from the
10125         Cortex-A8 workaround.
10126         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10127         at the beginning of a relaxation pass.
10128
10129 2010-01-12  Doug Kwan  <dougkwan@google.com>
10130
10131         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10132         (Arm_relobj::Mapping_symbol_position,
10133          Arm_reloj::Mapping_symbol_position_less,
10134          Arm_relobj::Mapping_symbols_info): New types.
10135         (Target_arm::is_mapping_symbol_name): New method definition.
10136         (Arm_relobj::do_count_local_symbols): Save information about mapping
10137         symbols.
10138
10139 2010-01-11  Doug Kwan  <dougkwan@google.com>
10140
10141         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10142         Arm_relocate_functions::thumb32_branch_upper,
10143         Arm_relocate_functions::thumb32_branch_lower,
10144         Arm_relocate_functions::thumb32_cond_branch_offset,
10145         Arm_relocate_functions::thumb32_cond_branch_upper,
10146         Arm_relocate_functions::thumb32_cond_branch_lower,
10147         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10148         branch offset encoding.
10149         (Arm_relocate_functions::thumb_branch_common): Use new branch
10150         offset encoding methods to avoid code duplication.
10151         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10152         (Stub_addend_reader::operator()): Use new branch encoding method
10153         to avoid code duplication.
10154
10155 2010-01-11  Doug Kwan  <dougkwan@google.com>
10156
10157         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10158         (Target_arm::do_finalize_sections): Define special EXIDX section
10159         symbols only if referenced.
10160         * gc.h (Garbage_collection::add_reference): New method.
10161         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10162         code duplication.
10163
10164 2010-01-11  Ian Lance Taylor  <iant@google.com>
10165
10166         * script.cc (Version_script_info::build_expression_list_lookup):
10167         Change complaing about duplicate wildcard match from error to
10168         warning.
10169
10170         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10171         of 2009-12-30.
10172         (Version_script_info::Version_script_info): Initialize globs_,
10173         default_version_, default_is_global_, and exact_.  Don't
10174         initialize globals_ or locals_.
10175         (Version_script_info::build_lookup_tables): Build local symbols
10176         first.
10177         (Version_script_info::unquote): New function.
10178         (Version_script_info::add_exact_match): New function.
10179         (Version_script_info::build_expression_list_lookup): Remove lookup
10180         parameter.  Add is_global parameter.  Change all callers.  Handle
10181         wildcard pattern specially.  Unquote pattern.  Call
10182         add_exact_match.
10183         (Version_script_info::get_name_to_match): New function.
10184         (Version_script_info::get_symbol_version): New function.
10185         (Version_script_info::get_symbol_version_helper): Remove.
10186         (Version_script_info::check_unmatched_names): Call unquote.
10187         * script.h (class Version_script_info): Change get_symbol_version
10188         to be non-inline and add is_global parameter; change all callers.
10189         Rewrite symbol_is_local.  Update declarations.  Define struct
10190         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10191         Remove globals_ and locals_ members.  Add exact_, globs_,
10192         default_version_, is_global_.
10193         (Version_script_info::Glob): Remove pattern, add expression and
10194         is_global.  Update constructor.  Change all callers.
10195         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10196         default version.
10197         (Versions::symbol_section_contents): If a symbol is undefined, or
10198         defined in a dynamic object, set the version index to
10199         VER_NDX_LOCAL.
10200         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10201         symbol_is_local.
10202         (Symbol_table::add_from_pluginobj): Likewise.
10203         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10204
10205 2010-01-11  Doug Kwan  <dougkwan@google.com>
10206
10207         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10208         (incremental_dump_LDADD): Add linking option for libintl.
10209         * Makefile.in: Regenerate.
10210
10211 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10212
10213         PR gold/11144
10214         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10215         instead of -Ds.
10216         * testsuite/Makefile.in: Regenerated.
10217
10218 2010-01-10  Doug Kwan  <dougkwan@google.com>
10219
10220         * options.h (DEFINE_var): Use parentheses around argument varname__
10221         in macro body to avoid any unintended subsequent substitutions.
10222
10223 2010-01-10  Ian Lance Taylor  <iant@google.com>
10224
10225         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10226         candidates before doing symbol resolution.
10227
10228         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10229         ODR candidates if only one is weak.
10230
10231 2010-01-08  Ian Lance Taylor  <iant@google.com>
10232
10233         * script.cc (Version_script_info::build_expression_list_lookup):
10234         Don't warn about ambiguous version, just record the ambiguity.
10235         (Version_script_info::get_symbol_version_helper): Give error if
10236         version is ambiguous.
10237
10238 2010-01-08  Doug Kwan  <dougkwan@google.com>
10239
10240         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10241         prev_data_size_ and prev_addralign_.  Remove initializer for
10242         deleted data member has_been_changed_.
10243         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10244         to determine if the table is empty.
10245         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10246         Remove.
10247         (Stub_table::add_reloc_stub): Define method in class definition
10248         instead of just declaring it there.
10249         (Stub_table::add_cortex_a8_stub): New method definition.
10250         (Stub_table::update_data_size_and_addralign): Ditto.
10251         (Stub_table::finalize_stubs): Ditto.
10252         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10253         (Stub_table::do_addralign_): Return address alignment in the
10254         (Stub_table::do_reset_address_and_file_offset): Define method in
10255         class definition instead of declaring it there.  Set current data
10256         size to be the data size of the previous pass.
10257         (Stub_table::set_final_data_size): Use current data size as the
10258         final data size.
10259         (Stub_table::relocate_stub): Change parameter type of stub from
10260         Reloc_stub pointer to Stub pointer.
10261         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10262         (Stub_table::Cortex_a8_stub_list): New typedef.
10263         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10264          Stub_table::prev_addralign_): New data member.
10265         (Arm_relobj::Arm_relobj): Initialize data member
10266         section_has_cortex_a8_workaround_.
10267         (Arm_relobj::section_has_cortex_a8_workaround,
10268          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10269          definitions.
10270         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10271         declarations.
10272         (Target_arm::relocate_stub): Change parameter type of stub from
10273         Reloc_stub pointer to Stub pointer.
10274         (Insn_template::size, Insn_template::alignment): Handle
10275         THUMB16_SPECIAL_TYPE.
10276         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10277          Stub_table::update_data_size_and_addralign,
10278          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10279         definitions.
10280         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10281         (Stub_table::do_write): Ditto.
10282         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10283
10284 2010-01-08  Ian Lance Taylor  <iant@google.com>
10285
10286         PR 11108
10287         * symtab.h (class Symbol): Remove fields is_target_special_ and
10288         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10289         (Symbol::is_defined_in_discarded_section): New function.
10290         (Symbol::set_is_defined_in_discarded_section): New function.
10291         (Symbol::has_plt_offset): Rewrite.
10292         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10293         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10294         Don't initialize is_target_special_ or has_plt_offset_.
10295         Initialize is_defined_in_discarded_section_.
10296         (Symbol_table::add_from_relobj): If appropriate, set
10297         is_defined_in_discarded_section.
10298         * resolve.cc (Symbol::override_base_with_special): Don't test
10299         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10300         * target-reloc.h (relocate_section): Do special handling for
10301         symbols defined in discarded sections for global symbols as well
10302         as local symbols.
10303
10304 2010-01-08  Ian Lance Taylor  <iant@google.com>
10305
10306         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10307         the SHT_SYMTAB case.
10308
10309 2010-01-08  Ian Lance Taylor  <iant@google.com>
10310
10311         * object.cc (Sized_relobj::do_layout): Don't get confused if
10312         layout_eh_frame returns NULL.
10313
10314 2010-01-08  Ian Lance Taylor  <iant@google.com>
10315
10316         PR 11084
10317         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10318         dynamic symbol table, use the normal symbol table.
10319         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10320         symbol table.
10321
10322 2010-01-08  Ian Lance Taylor  <iant@google.com>
10323
10324         PR 11072
10325         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10326         sections.
10327
10328 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10329
10330         * version.cc (print_version): Change to "Copyright 2010".
10331
10332 2010-01-08  Ian Lance Taylor  <iant@google.com>
10333
10334         PR 10287
10335         PR 11063
10336         * i386.cc (class Target_i386): Change return type of plt_section
10337         to be non-const.
10338         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10339         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10340         tls_desc_rel_ field.
10341         (Output_data_plt_i386::rel_tls_desc): New function.
10342         (Target_i386::rel_tls_desc_section): New function.
10343         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10344         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10345         R_386_TLS_DESC reloc in rel_tls_desc_section.
10346         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10347         Define struct Tlsdesc_info.
10348         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10349         (Target_x86_64::do_reloc_symbol_index): New function.
10350         (Target_x86_64::add_tlsdesc_info): New function.
10351         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10352         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10353         tlsdesc_rel_ field.
10354         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10355         all callers.
10356         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10357         (Target_x86_64::rela_tlsdesc_section): New function.
10358         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10359         handling.
10360         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10361         (Target_x86_64::do_reloc_addend): New function.
10362         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10363         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10364         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10365         (Output_reloc::type): New function.
10366         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10367         (Output_reloc::is_target_specific): New function.
10368         (Output_reloc::target_arg): New function.
10369         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10370         absolute relocs and target specific relocs.
10371         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10372         add_target_specific.
10373         (class Output_data_reloc) [SHT_RELA]: Likewise.
10374         * output.cc (Output_reloc::Output_reloc): Add four new versions
10375         for absolute relocs and target specific relocs.
10376         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10377         (Output_reloc::get_symbol_index): Likewise.
10378         (Output_reloc::local_section_offset): Check that local_sym_index_
10379         is not TARGET_CODE or 0.
10380         (Output_reloc::symbol_value): Likewise.
10381         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10382         reloc.
10383         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10384         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10385         functions.
10386         * layout.cc (add_target_dynamic_tags): Use output section for
10387         DT_PLTRELSZ and DT_JMPREL.
10388
10389 2010-01-07  Ian Lance Taylor  <iant@google.com>
10390
10391         PR 11061
10392         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10393         function.
10394         (class Output_data_reloc_generic): Define.
10395         (class Output_data_reloc_base): Change base class to
10396         Output_data_reloc_generic.  Change add() method to call
10397         bump_relative_reloc_count for a relative reloc.  Remove
10398         sort_relocs_ field.
10399         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10400         to sort_relocs().
10401         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10402         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10403         appropriate.
10404         * layout.h (class Layout): Update declaration.
10405
10406 2010-01-07  Ian Lance Taylor  <iant@google.com>
10407
10408         * output.h (class Output_data): Add const version of
10409         output_section and do_output_section.
10410         (class Output_section_data): Add const version of
10411         do_output_section.
10412         (class Output_section): Likewise.
10413         * layout.cc (Layout::add_target_dynamic_tags): New function.
10414         * layout.h (class Layout): Update declarations.
10415         * arm.cc (Target_arm::do_finalize_sections): Use
10416         add_target_dynamic_tags.
10417         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10418         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10419         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10420         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10421
10422 2010-01-07  Ian Lance Taylor  <iant@google.com>
10423
10424         PR 11042
10425         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10426         object as needed.
10427
10428 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10429             Ian Lance Taylor  <iant@google.com>
10430
10431         PR 11019
10432         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10433         Xindex::read_symtab_xindex.
10434
10435 2010-01-07  Doug Kwan  <dougkwan@google.com>
10436
10437         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10438         (Insn_template::thumb16_bcond_insn): New method declaration.
10439         (Insn_template): Fix spelling.
10440         (Stub::thumb16_special): New method declaration.
10441         (Stub::do_write): Define virtual method which was previously pure
10442         virtual.
10443         (Stub::do_thumb16_special): New method declaration.
10444         (Stub::do_fixed_endian_write): New template member.
10445         (Reloc_stub::do_write): Remove.
10446         (Reloc_stub::do_fixed_endian_write): Remove.
10447         (Cortex_a8_stub): New class definition.
10448         (Stub_factory::make_cortex_a8_stub): New method definition.
10449         (Stub_factory::Stub_factory): Add missing static storage class
10450         qualifier for elf32_arm_stub_a8_veneer_blx.
10451
10452 2010-01-07  Ian Lance Taylor  <iant@google.com>
10453
10454         PR 10980
10455         * options.h (class General_options): Add --warn-unresolved-symbols
10456         and --error-unresolved-symbols.
10457         * errors.cc (Errors::undefined_symbol): Implement
10458         --warn-unresolved-symbols.
10459
10460         * options.h (class General_options): Add -z text and -z textoff.
10461         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10462
10463 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10464
10465         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10466         (Garbage_collection::cident_sections): New function.
10467         (Garbage_collection::add_cident_section): New function.
10468         (Garbage_collection::cident_sections_): New member.
10469         (gc_process_relocs): Add references to sections whose names are C
10470         identifiers.
10471         * gold.h (cident_section_start_prefix): New constant.
10472         (cident_section_stop_prefix): New constant.
10473         (is_cident): New function.
10474         * layout.cc (Layout::define_section_symbols): Replace string constants
10475         with the newly defined constants.
10476         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10477         C identifiers.
10478         * testsuite/Makefile.am: Add gc_orphan_section_test.
10479         * testsuite/Makefile.in: Regenerate.
10480         * testsuite/gc_orphan_section_test.cc: New file.
10481         * testsuite/gc_orphan_section_test.sh: New file.
10482
10483 2010-01-06  Ian Lance Taylor  <iant@google.com>
10484
10485         PR 10980
10486         * options.h (class General_options): Add --warn-shared-textrel.
10487         * layout.cc (Layout::finish_dynamic_section): Implement
10488         --warn-shared-textrel.
10489
10490         PR 10980
10491         * options.h (class General_options): Add --warn-multiple-gp.
10492
10493 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10494
10495         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10496         $(THREADSLIB) and $(LIBDL).
10497         * Makefile.in: Rebuild.
10498
10499 2010-01-06  Ian Lance Taylor  <iant@google.com>
10500
10501         PR 10980
10502         * options.cc (General_options::parse_section_start): New function.
10503         (General_options::section_start): New function.
10504         (General_options::General_options): Initialize all members.
10505         * options.h: Include <map>
10506         (class General_options): Add --section-start.  Add section_starts_
10507         member.
10508         * layout.cc (Layout::attach_allocated_section_to_segment): If
10509         --section-start was used, set the address of the segment.  Remove
10510         local sort_sections.
10511         (Layout::relaxation_loop_body): If the address of the load segment
10512         has been set by --section-start, don't use it.
10513         * output.h (Output_segment::update_flags_for_output_section): New
10514         function.
10515         * output.cc (Output_segment::add_output_section): Call
10516         update_flags_for_output_section.
10517
10518 2010-01-05  Ian Lance Taylor  <iant@google.com>
10519
10520         PR 10980
10521         * options.h (class General_options): Add --undefined-version.
10522         * script.cc (struct Version_expression): Add was_matched_by_symbol
10523         field.
10524         (Version_script_info::matched_symbol): New function.
10525         (Version_script_info::get_symbol_version_helper): Call
10526         matched_symbol.
10527         (Version_script_info::check_unmatched_names): New function.
10528         * script.h (class Version_script_info): Update declarations.
10529         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10530
10531         * options.h (class General_options): Use DEFINE_bool_alias for
10532         allow_multiple_definition.
10533         * resolve.cc (Symbol_table::should_override): Don't test
10534         allow_multiple_definition.
10535
10536         PR 10980
10537         * options.h (class General_options): Add --cref.
10538         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10539         until after printing cref table.
10540         * cref.cc: Include "symtab.h".
10541         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10542         (Cref_table_compare::operator()): New function.
10543         (Cref_inputs::gather_cref): New function.
10544         (filecol): New static const.
10545         (Cref_inputs::print_cref): New function.
10546         (Cref::print_cref): New function.
10547         * cref.h: Include <cstdio>.
10548         (class Cref): Update declarations.
10549         * mapfile.h (Mapfile::file): New function.
10550         * object.h (class Object): Define Symbols.  Declare virtual
10551         do_get_global_symbols.
10552         (Object::get_global_symbols): New function.
10553         * object.cc (Input_objects::add_object): Pass object to cref_ if
10554         --cref.
10555         (Input_objects::archive_start): Likewise.
10556         (Input_objects::archive_stop): Likewise.
10557         (Input_objects::print_cref): New function.
10558         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10559         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10560         --cref.
10561         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10562         function.
10563         * plugin.h (class Sized_pluginobj): Update declarations.
10564
10565 2010-01-05  Ian Lance Taylor  <iant@google.com>
10566
10567         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10568         to is_default_version.  Rename insdef to insdefault.
10569         (Symbol_table::add_from_relobj): Rename def to is_default_version
10570         and local to is_forced_local.
10571         (Symbol_table::add_from_pluginobj): Likewise.
10572         (Symbol_table::add_from_dynobj): Likewise.
10573         (Symbol_table::define_special_symbol): Rename insdef to
10574         insdefault.
10575
10576 2010-01-04  Ian Lance Taylor  <iant@google.com>
10577
10578         PR 10980
10579         * options.h (class General_options): Add
10580         --allow-multiple-definition and -z muldefs.
10581         * resolve.cc (Symbol_table::should_override): Don't warn about a
10582         multiple symbol definition if --allow-multiple-definition or -z
10583         muldefs.
10584
10585         PR 10980
10586         * options.h (class General_options): Add --add-needed and
10587         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10588         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10589         error if --copy-dt-needed-entries aka --add-needed is used and
10590         would cause a change in behaviour.
10591
10592         PR 10980
10593         * options.h (class General_options): Add -G as a short version of
10594         --shared.  Add no-op options -assert, -g, and -i.
10595
10596 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10597
10598         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10599         check for .text or .gnu.linkonce.t sections.
10600         * icf.cc (Icf::find_identical_sections): Ditto.
10601         Change the detection for mangled function name within the section
10602         name.
10603         * icf.h (is_section_foldable_candidate): New function.
10604
10605 2009-12-30  Ian Lance Taylor  <iant@google.com>
10606
10607         PR 10980
10608         * options.h (class General_options): Permit two dashes with
10609         --retain-symbols-file.
10610
10611 2009-12-30  Ian Lance Taylor  <iant@google.com>
10612
10613         PR 10979
10614         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10615         don't put the file header and segment headers in the text
10616         segment.
10617
10618         PR 10979
10619         * common.cc (Sort_commons::operator()): Stabilize sort when both
10620         entries are NULL.
10621         (Symbol_table::do_allocate_commons_list): When allocating common
10622         symbols, skip a symbol which is no longer common.
10623         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10624         an object before checking its type.
10625         * testsuite/common_test_2.c: New file.
10626         * testsuite/common_test_3.c: New file.
10627         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10628         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10629         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10630         (common_test_2_pic.o, common_test_2.so): New targets.
10631         (common_test_3_pic.o, common_test_3.so): New targets.
10632         * testsuite/Makefile.in: Rebuild.
10633
10634         PR 10979
10635         * script.cc (read_input_script): If we see a new SECTIONS clause,
10636         and we have added an input section, give an error.
10637         * layout.h (class Layout): Add have_added_input_section function.
10638         Add have_added_input_section_ field.
10639         * layout.cc (Layout::Layout): Initialize
10640         have_added_input_section_.
10641         (Layout::layout): Set have_added_input_section_.
10642         (Layout::layout_eh_frame): Likewise.
10643
10644 2009-12-30  Ian Lance Taylor  <iant@google.com>
10645
10646         PR 10931
10647         * options.h (class General_options): Add --sort-common option.
10648         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10649         * common.cc (Sort_common): Add sort_order parameter to
10650         constructor.  Add sort_order_ field.
10651         (Sort_commons::operator): Check sort_order_.
10652         (Symbol_table::allocate_commons): Determine the sort order.
10653         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10654         Change all callers.
10655         (Symbol_table::do_allocate_commons_list): Likewise.
10656
10657 2009-12-30  Ian Lance Taylor  <iant@google.com>
10658
10659         PR 10916
10660         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10661         symbols from this object, don't change the visibility of an
10662         undefined symbol.
10663         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10664
10665 2009-12-30  Ian Lance Taylor  <iant@google.com>
10666
10667         PR 10861
10668         * script.h (class Version_script_info): Define Language enum.
10669         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10670         new fields globals_, locals_, and is_finalized_.
10671         * script.cc: Various formatting fixes.
10672         (class Parser_closure): Change language_stack_ from a vector of
10673         std::string to one of Version_script_info::Language.  Adjust all
10674         uses accordingly.
10675         (class Lazy_demangler): Remove.
10676         (struct Version_expression): Change language from std::string to
10677         Version_script_info::Language.
10678         (Version_script_info::Version_script_info): New function.
10679         (Version_script_info::~Version_script_info): Don't call clear.
10680         (Version_script_info::finalize): New function.
10681         (Version_script_info::build_lookup_tables): New function.
10682         (Version_script_info::build_expression_list_lookup): New
10683         function.
10684         (Version_script_info::get_symbol_version_helper): Rewrite to use
10685         lookup tables.
10686         (Version_script_info::print_expression_list): Adjust to use
10687         Version_script_info::Language.
10688         (script_push_lex_into_version_mode): Check that the version script
10689         has not been finalized.
10690         (version_script_push_lang): Change language string to
10691         Version_script_info::Language.
10692         * options.cc (Command_line::version_script): New function.
10693         * options.h (class General_options): Add finalize_dynamic_list
10694         function.  Change version_script from declaration to definition.
10695         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10696         * testsuite/version_script.map: Remove duplicate def of foo.
10697         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10698         version_script.map.
10699         * testsuite/Makefile.in: Rebuild.
10700
10701 2009-12-30  Ian Lance Taylor  <iant@google.com>
10702
10703         PR 10843
10704         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10705         if the input symbol index is 0, make the output symbol index 0.
10706
10707 2009-12-30  Ian Lance Taylor  <iant@google.com>
10708
10709         PR 10670
10710         * options.h (class General_options): Add -x/--discard-all.
10711         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10712         --discard-all.  If the local symbol needs a dynamic entry, check
10713         that before handling --discard-locals.
10714
10715 2009-12-30  Ian Lance Taylor  <iant@google.com>
10716
10717         PR 10450
10718         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10719         flags to PF_R.
10720         (Output_segment::add_output_section): Don't change the flags if
10721         the type is PT_TLS.
10722
10723         PR 10450
10724         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10725         GNU hash table if they need a dynamic value.  Otherwise, don't add
10726         them if they are defined in a dynamic object or are forced local.
10727
10728 2009-12-29  Ian Lance Taylor  <iant@google.com>
10729
10730         PR 10450
10731         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10732         .gnu.hash table for a 32-bit target.
10733
10734         PR 10450
10735         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10736         regular and a dynamic object only needs a dynamic symbol table
10737         entry if it is externally visible.
10738
10739         PR 10450
10740         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10741         constructor.  Add global_offset_table_ field.
10742         (Target_i386::got_section): Set global_offset_table_.
10743         (Target_i386::do_finalize_sections): Set global_offset_table_
10744         size.
10745         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10746         in constructor.  Add global_offset_table_ field.
10747         (Target_x86_64::got_section): Set global_offset_table_.
10748         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10749         size.
10750
10751         * layout.cc (Layout::Layout): Initialize increase_relro_.
10752         (Layout::get_output_section): Add is_relro, is_last_relro, and
10753         is_first_non_relro parameters.  Change all callers.
10754         (Layout::choose_output_section): Likewise.
10755         (Layout::add_output_section_data): Likewise.
10756         (Layout::make_output_section): Likewise.
10757         (Layout::set_segment_offsets): Clear increase_relro when using a
10758         linker script.
10759         * layout.h (class Layout): Add increase_relro method.  Add
10760         increase_relro_ field.  Update declarations.
10761         * output.cc (Output_section::Output_section): Initialize
10762         is_last_relro_ and is_first_non_relro_.
10763         (Output_segment::add_output_section): Group relro sections is
10764         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10765         (Output_segment::maximum_alignment): Remove relro handling.
10766         (Output_segment::set_section_addresses): Add increase_relro
10767         parameter.  Change all callers.  Add initial alignment to align
10768         relro sections on separate page.  Remove old relro handling.
10769         (Output_segment::set_section_list_addresses): Remove in_relro
10770         parameter.  Change all callers.
10771         (Output_segment::set_offset): Add increase parameter.  Change all
10772         callers.  Remove old relro handling.
10773         * output.h (class Output_section): Add new methods: is_last_relro,
10774         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10775         Add is_last_relro_ and is_first_non_relro_ fields.
10776         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10777         Create separate .got.plt section.  Call increase_relro.
10778         * x86_64.cc (Target_x86_64::got_section): Likewise.
10779         * testsuite/relro_script_test.t: Add .got.plt.
10780
10781         PR 10450
10782         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10783         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10784         (Layout::finalize): Call set_dynamic_symbol_size.
10785         (Layout::set_dynamic_symbol_size): New function.
10786         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10787         set_dynamic_symbol_size.
10788
10789         PR 10450
10790         * output.h (class Output_section): Add is_entsize_zero_ field.
10791         * output.cc (Output_section::Output_section): Initialize
10792         is_entsize_zero_.
10793         (Output_section::set_entsize): If two different entsizes are
10794         requested, force it to zero.
10795         (Output_section::add_input_section): Set flags for .debug_str
10796         before updating section flags.  Set entsize.
10797         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10798         and SHF_STRING if all input sections have those flags.
10799
10800 2009-12-29   Rafael Espindola  <espindola@google.com>
10801
10802         * main.cc (main): Fix the sys time reporting.
10803         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10804         reporting.
10805
10806 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10807
10808         * options.cc (General_options::parse_version): Allow -v to exit
10809         without an error if there is nothing to link.
10810
10811 2009-12-29  Ian Lance Taylor  <iant@google.com>
10812
10813         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10814         using a version of gcc before 4.1.
10815         * configure: Rebuild.
10816
10817 2009-12-28  Chris Demetriou  <cgd@google.com>
10818
10819         * attributes.cc (Output_attributes_section_data::do_write): Use
10820         std::vector::front rather than std::vector::data.
10821
10822 2009-12-28  Ian Lance Taylor  <iant@google.com>
10823
10824         * symtab.h (class Symbol_table): Add enum Defined.
10825         * resolve.cc (Symbol_table::should_override): Add defined
10826         parameter.  Change all callers.  Test whether object is NULL
10827         before calling a method on it.
10828         (Symbol_table::report_resolve_problem): Add defined parameter.
10829         Change all callers.
10830         (Symbol_table::should_override_with_special): Likewise.
10831         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10832         parameter.  Change all callers.
10833         (Symbol_table::do_define_in_output_data): Likewise.
10834         (Symbol_table::define_in_output_segment): Likewise.
10835         (Symbol_table::do_define_in_output_segment): Likewise.
10836         (Symbol_table::define_as_constant): Likewise.
10837         (Symbol_table::do_define_as_constant): Likewise.
10838         * script.h (class Symbol_assignment): Add is_defsym parameter to
10839         constructor; change all callers.
10840         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10841         parameter.  Change all callers.  Add is_defsym_ field.
10842         (class Parser_closure): Add parsing_defsym parameter to
10843         constructor; change all callers.  Add parsing_defsym accessor
10844         function.  Add parsing_defsym_ field.
10845
10846 2009-12-28  Ian Lance Taylor  <iant@google.com>
10847
10848         * gold.cc (queue_middle_tasks): Fix formatting.
10849         * object.cc (Relobj::is_section_name_included): Likewise.
10850
10851 2009-12-23  Ian Lance Taylor  <iant@google.com>
10852
10853         * i386.cc (Target_i386::do_calls_non_split): Recognize
10854         -fsplit-stack prologue for a function with a static chain.
10855         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10856         -fsplit-stack prologue when using %r11.
10857
10858 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10859
10860         * options.cc (General_options::parse_version): Make -v continue and do
10861         the link like GNU ld does.
10862
10863 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10864
10865         * Makefile.am (CCFILES): Add timer.cc.
10866         (HFILES): Add timer.h.
10867         * configure.ac: Check for sysconf and times.
10868         * main.cc: include timer.h.
10869         (main): Use Timer instead of get_run_time.
10870         * timer.cc: New.
10871         * timer.h: New.
10872         * workqueue.cc: include timer.h.
10873         (Workqueue::find_and_run_task):
10874         Report user, sys and wall time.
10875         * Makefile.in: Regenerate.
10876         * config.in: Regenerate.
10877         * configure: Regenerate.
10878
10879 2009-12-16  Doug Kwan  <dougkwan@google.com>
10880
10881         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10882         sections.
10883         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10884         relaxed input sections.
10885         * output.cc (Output_section::find_relaxed_input_section): Change
10886         return type to Output_relaxed_input_section pointer.  Adjust code
10887         for new type of relaxed_input_section_map_.
10888         * output.h (Output_section::find_relaxed_input_section): Change
10889         return type to Output_relaxed_input_section pointer.
10890         (Output_section::Output_relaxed_input_section_by_input_section_map):
10891         New type.
10892         (Output_section::relaxed_input_section_map_): Change type to
10893         Output_section::Output_relaxed_input_section_by_input_section_map.
10894         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10895         input section.
10896
10897 2009-12-15  Ian Lance Taylor  <iant@google.com>
10898
10899         * layout.cc (Layout::create_shstrtab): Only write out after input
10900         sections if we are compressing debug sections.
10901
10902 2009-12-15  Ian Lance Taylor  <iant@google.com>
10903
10904         * archive.cc (Archive::add_symbols): Only look up a symbol without
10905         a version if there is, in fact, a version.
10906
10907 2009-12-14  Ian Lance Taylor  <iant@google.com>
10908
10909         Revert -Wshadow changes, all changes from:
10910         2009-12-11  Doug Kwan  <dougkwan@google.com>
10911         2009-12-11  Nick Clifton  <nickc@redhat.com>
10912         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10913
10914 2009-12-11  Doug Kwan  <dougkwan@google.com>
10915
10916         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10917         due to -Wshadow.
10918         * attributes.cc (Object_attribute::size): Ditto.
10919         (Attributes_section_data::size): Ditto.
10920         (Attributes_section_data::Attributes_section_data): Ditto.
10921         (Output_attributes_section_data::do_write): Ditto.
10922         * attributes.h (Object_attribute::set_type): Ditto.
10923         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10924
10925 2009-12-11  Nick Clifton  <nickc@redhat.com>
10926
10927         * archive.cc: Fix shadowed variable warnings.
10928         * arm.cc: Likewise.
10929         * compressed_output.cc: Likewise.
10930         * compressed_output.h: Likewise.
10931         * configure: Likewise.
10932         * dwarf_reader.cc: Likewise.
10933         * dynobj.cc: Likewise.
10934         * dynobj.h: Likewise.
10935         * ehframe.cc: Likewise.
10936         * ehframe.h: Likewise.
10937         * errors.cc: Likewise.
10938         * expression.cc: Likewise.
10939         * fileread.cc: Likewise.
10940         * fileread.h: Likewise.
10941         * freebsd.h: Likewise.
10942         * i386.cc: Likewise.
10943         * icf.cc: Likewise.
10944         * incremental.h: Likewise.
10945         * layout.cc: Likewise.
10946         * layout.h: Likewise.
10947         * mapfile.cc: Likewise.
10948         * merge.cc: Likewise.
10949         * merge.h: Likewise.
10950         * object.cc: Likewise.
10951         * object.h: Likewise.
10952         * options.h: Likewise.
10953         * output.cc: Likewise.
10954         * output.h: Likewise.
10955         * parameters.cc: Likewise.
10956         * plugin.cc: Likewise.
10957         * powerpc.cc: Likewise.
10958         * reduced_debug_output.cc: Likewise.
10959         * reduced_debug_output.h: Likewise.
10960         * reloc.cc: Likewise.
10961         * reloc.h: Likewise.
10962         * resolve.cc: Likewise.
10963         * script-sections.cc: Likewise.
10964         * script.cc: Likewise.
10965         * script.h: Likewise.
10966         * sparc.cc: Likewise.
10967         * symtab.cc: Likewise.
10968         * symtab.h: Likewise.
10969         * target-select.cc: Likewise.
10970         * target-select.h: Likewise.
10971         * token.h: Likewise.
10972         * workqueue.cc: Likewise.
10973         * workqueue.h: Likewise.
10974         * x86_64.cc: Likewise.
10975
10976 2009-12-10  Doug Kwan  <dougkwan@google.com>
10977
10978         * arm.cc (attributes.h): New include.
10979         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10980         (Arm_relobj::~Arm_relobj): Delete object pointed by
10981         attributes_section_data_.
10982         (Arm_relobj::attributes_section_data): New method definition.
10983         (Arm_relobj::attributes_section_data_): New data member declaration.
10984         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10985         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10986         attributes_section_data_.
10987         (Arm_dynobj::attributes_section_data): New method definition.
10988         (Arm_dynobj::attributes_section_data_): New data member declaration.
10989         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10990         initialization value of may_use_blx_ to false.
10991         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10992         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10993         object attributes to compute results instead of hard-coding.
10994         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10995         Target_arm::get_secondary_compatible_arch,
10996         Target_arm::set_secondary_compatible_arch
10997         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10998         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10999         New method declarations.
11000         (Target_arm::get_aeabi_object_attribute): New method definition.
11001         (Target_arm::attributes_section_data_): New data member declaration.
11002         (read_arm_attributes_section): New template definition.
11003         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11004         (Arm_dynobj::do_read_symbols): Ditto.
11005         (Target_arm::do_finalize_sections): Merge attributes sections from
11006         input.  Check for BLX use after attributes section merging.
11007         Fix __exidx_start and __exidx_end visibility.  Create an
11008         .ARM.attributes section if necessary.
11009         (Target_arm::get_secondary_compatible_arch,
11010         Target_arm::set_secondary_compatible_arch,
11011         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11012         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11013         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11014         New method definitions.
11015
11016 2009-12-09  Ian Lance Taylor  <iant@google.com>
11017
11018         * plugin.cc (Plugin::load): Don't cast from void* to a function
11019         pointer.
11020
11021 2009-12-09  Ian Lance Taylor  <iant@google.com>
11022
11023         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11024         information fields.
11025
11026 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11027
11028         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11029         Replace two_file_shared_1.so with two_file_shared_2.so.
11030         * testsuite/Makefile.in: Regenerated.
11031
11032 2009-12-08  Doug Kwan  <dougkwan@google.com>
11033
11034         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11035         (HFILES): Add attributes.h and int_encoding.h.
11036         * Makefile.in: Regenerate.
11037         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11038         function definitions to int_encoding.cc
11039         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11040         prototypes to int_encoding.h
11041         * reduced_debug_output.cc (int_encoding.h): New include.
11042         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11043         function definitions to int_encoding.cc
11044         (insert_into_vector, read_from_pointer): Move template definitions to
11045         int_encoding.h
11046         * attributes.cc: New file.
11047         * attributes.h: New file.
11048         * int_encoding.cc: New file.
11049         * int_encoding.h: New file.
11050
11051 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11052
11053         PR gold/11055
11054         * incremental-dump.cc (dump_incremental_inputs): New.
11055         (main): Use dump_incremental_inputs.
11056
11057 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11058
11059         PR gold/10893
11060         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11061         checking elfcpp::STT_FUNC.
11062         (Target_i386::Relocate::relocate): Likewise.
11063         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11064
11065         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11066         symbols from shared libraries into normal FUNC symbols.
11067
11068         * symtab.h (Symbol): Add is_func and use it.
11069
11070 2009-12-05  Doug Kwan  <dougkwan@google.com>
11071
11072         * arm.cc (Target_arm::arm_info): Initialize new fields
11073         attributes_section and attributes_vendor.
11074         * i386.cc (Target_i386::i386_info): Same.
11075         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11076         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11077         fields attributes_section and attributes_vendor.
11078         * sparc.cc (Target_sparc::sparc_info): Same.
11079         * target.h (Target::attributes_section, Target::attributes_vendor,
11080         Target::is_attributes_section, Target::attribute_arg_type,
11081         Target::attributes_order): New method definitions.
11082         (Target::Target_info::attributes_section,
11083         Target::Target_info::attributes_vendor): New fields.
11084         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11085         virtual method definitions.
11086         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11087         attributes_section and attributes_vendor.
11088         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11089
11090 2009-12-05  Doug Kwan  <dougkwan@google.com>
11091
11092         * arm.cc: Update comments about interworking and stub generation.
11093         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11094         considered as non-PIC.
11095         (Arm_relocate_functions::base_abs): Fix formatting.
11096         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11097         of function to use GOT entry address instead of offset.
11098         (Target_arm::Scan::global): Issue an error if a symbol would need a
11099         PLT does not get one because it is untyped.  Remove code to create
11100         dynamic symbols for relative branches.
11101         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11102         takes unsigned integer instead of boolean.
11103
11104 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11105
11106         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11107         (two_file_test_LDADD): Likewise.
11108         (common_test_1_LDADD): Likewise.
11109         (exception_test_LDADD) Likewise.
11110         (weak_test_LDADD): Likewise.
11111         (many_sections_test_LDADD): Likewise.
11112         (initpri1_LDADD): Likewise.
11113         (script_test_1_LDADD): Likewise.
11114         (script_test_2_LDADD): Likewise.
11115         (justsyms_LDADD): Likewise.
11116         (binary_test_LDADD): Likewise.
11117         (large_LDADD): Likewise.
11118         * testsuite/Makefile.in: Regenerated.
11119
11120 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11121
11122         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11123         (Symbol_table::override_with_special): Likewise.
11124         (Symbol_table::add_from_object): Likewise.
11125
11126 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11127
11128         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11129         Don't set the data_offset twice.
11130
11131 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11132
11133         * testsuite/Makefile.in: Regenerate.
11134
11135 2009-12-03  Doug Kwan  <dougkwan@google.com>
11136
11137         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11138         (Target_arm::do_finalize_sections): Add parameter for symbol table
11139         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11140         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11141         parameter for symbol table pointer.
11142         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11143         an additional parameter for a pointer to symbol table.
11144         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11145         parameter for a symbol table pointer.
11146         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11147         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11148         Ditto.
11149         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11150         parameter for a symbol table pointer.
11151
11152 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11153
11154         * incremental.cc (Incremental_inputs_header)
11155         (Incremental_inputs_header_write, Incremental_inputs_entry)
11156         (Incremental_inputs_entry_write): Move ...
11157         * incremental.h (Incremental_inputs_header)
11158         (Incremental_inputs_header_write, Incremental_inputs_entry)
11159         (Incremental_inputs_entry_write): here.
11160
11161 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11162
11163         * incremental.cc (make_sized_incremental_binary): Set the target.
11164         Error if it is incompatible.
11165         * output.h (Output_file): Add filename method.
11166
11167 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11168
11169         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11170         from the get_* methods.
11171
11172 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11173
11174         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11175         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11176         Write 0 for the data_offset of scripts.
11177
11178 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11179
11180         * testsuite/Makefile.am: Add the incremental_test.sh test.
11181         * testsuite/incremental_test.sh: New.
11182         * testsuite/incremental_test_1.c: New.
11183         * testsuite/incremental_test_2.c: New.
11184
11185 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11186
11187         * incremental-dump.cc (main): Fix typos.
11188
11189 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11190
11191         PR gold/11025
11192         * incremental-dump.cc (main): Use llu to print 64 bit values.
11193
11194 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11195             H.J. Lu  <hongjiu.lu@intel.com>
11196
11197         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11198         $(LIBDL).
11199         (incremental_dump_LDADD): Likewise.
11200         * Makefile.in: Regenerated.
11201
11202 2009-11-25  Doug Kwan  <dougkwan@google.com>
11203
11204         Revert:
11205
11206         2009-11-25  Doug Kwan  <dougkwan@google.com>
11207
11208                 * arm.cc (Target_arm::Target_arm): Move method definition
11209                 outside of class definition.  Add code to handle
11210                 --target1-rel, --target1-abs and --target2= options.
11211                 (Target_arm::get_reloc_reloc_type): Change method to be
11212                 non-static and const.
11213                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11214                 New data member declaration.
11215                 (Target_arm::Scan::local, Target_arm::Scan::global,
11216                 Target_arm::Relocate::relocate,
11217                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11218                 Adjust call to Target_arm::get_real_reloc_type.
11219                 (Target_arm::get_real_reloc_type): Use command line options
11220                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11221                 * options.h (--target1-rel, --target1-abs, --target2): New
11222                 ARM-only options.
11223
11224 2009-11-25  Doug Kwan  <dougkwan@google.com>
11225
11226         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11227         class definition.  Add code to handle --target1-rel, --target1-abs
11228         and --target2= options.
11229         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11230         and const.
11231         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11232         member declaration.
11233         (Target_arm::Scan::local, Target_arm::Scan::global,
11234         Target_arm::Relocate::relocate,
11235         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11236         call to Target_arm::get_real_reloc_type.
11237         (Target_arm::get_real_reloc_type): Use command line options to
11238         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11239         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11240         options.
11241
11242 2009-11-25  Doug Kwan  <dougkwan@google.com>
11243
11244         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11245         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11246         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11247         formatting.
11248         (Arm_relocate_functions::thm_call): Replace body with a call to
11249         Arm_relocate_functions::thumb_branch_common.
11250         (Arm_relocate_functions::thm_jump24,
11251         Arm_relocate_functions::thm_xpc22): New method definitions.
11252         (Arm_relocate_functions::thumb_branch_common): New method definition.
11253         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11254         operator.
11255         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11256         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11257
11258 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11259
11260         * Makefile.am: Build incremental-dump
11261         * Makefile.in: Regenerate.
11262         * incremental-dump.cc: New.
11263         * incremental.cc (Incremental_inputs_header_data,
11264         Incremental_inputs_entry_data): Move to incremental.h
11265         * incremental.h: (Incremental_inputs_header_data,
11266         Incremental_inputs_entry_data): Move from incremental.cc
11267
11268 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11269
11270         * incremental.cc (Incremental_inputs_header,
11271         Incremental_inputs_header_write, Incremental_inputs_entry,
11272         Incremental_inputs_entry_write): Add a typedef with the data type.
11273
11274 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11275
11276         * incremental.cc (Incremental_inputs_header,
11277         Incremental_inputs_header_write, Incremental_inputs_entry,
11278         Incremental_inputs_entry_write): Update comment about which
11279         type has the filed descriptions.
11280
11281 2009-11-15  Doug Kwan  <dougkwan@google.com>
11282
11283         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11284         (Arm_relocate_functions::arm_branch_common): Change method defintion
11285         in class definition to a method declaration and update list of formal
11286         parameters.
11287         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11288         Arm_relocation_functions::jump24): Adjust call to
11289         Arm_relocate_functions::arm_branch_common.  Update list of formal
11290         parameters.
11291         (Arm_relocate_functions::xpc25): New method definition.
11292         (Arm_relocate_functions::arm_branch_common): Move method defintion
11293         out from class definition.  Use stubs for mode-switching and extending
11294         branch ranges.
11295         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11296         specially.  Change code to enable use of stubs in ARM branches.
11297
11298 2009-11-10  Doug Kwan  <dougkwan@google.com>
11299
11300         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11301         in method declaration.
11302         (Target_arm::relocate_stub): New method declaration.
11303         (Target_arm::default_target): Change to return a pointer instead of
11304         a const reference.
11305         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11306         Target_arm::default_target.
11307         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11308         method definition.
11309         (Target_arm::relocate_section): Adjust view.
11310         (Target_arm::relocate_stub): New method definition.
11311
11312 2009-11-10  Doug Kwan  <dougkwan@google.com>
11313
11314         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11315         a format warning.
11316         * incremental.cc (open_incremental_binary): Initialized local
11317         variables to avoid warnings.
11318         * object.cc (make_elf_object): Ditto.
11319         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11320         a format warning.
11321
11322 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11323
11324         PR gold/10930
11325         * testsuite/plugin_test.c: Include "config.h".
11326
11327 2009-11-09  Doug Kwan  <dougkwan@google.com>
11328
11329         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11330         (arm_symbol_value): Remove.
11331         (Arm_relocate_functions::arm_branch_common,
11332         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11333         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11334         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11335         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11336         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11337         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11338         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11339         Arm_relocate_functions::thm_mobw_abs_nc,
11340         Arm_relocate_functions::thm_mov_abs,
11341         Arm_relocate_functions::movw_prel_nc,
11342         Arm_relocate_functions::thm_movt_abs,
11343         Arm_relocate_functions::movt_prel,
11344         Arm_relocate_functions::thm_movw_prel_nc,
11345         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11346         (Target_arm::Relocate::relocate): Only decompose address into two
11347         parts if relocation type uses the thumb-bit and pass the actual
11348         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11349         calls to methods in Arm_relocate_functions for this change.
11350
11351 2009-11-08  Ian Lance Taylor  <iant@google.com>
11352
11353         PR 10925
11354         * reloc.cc: Instantiate
11355         Sized_relobj::initialize_input_to_output_maps and
11356         Sized_relobj:free_input_to_output_maps.
11357
11358 2009-11-06  Ian Lance Taylor  <iant@google.com>
11359
11360         PR 10876
11361         * defstd.cc (in_segment): Set only_if_ref true for "end".
11362
11363 2009-11-06  Doug Kwan  <dougkwan@google.com>
11364
11365         * arm.cc (class Reloc_stub): Correct a comment.
11366         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11367         (Target_arm::scan_section_for_stubs): New method declaration.
11368         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11369         Change methods from private to protected.
11370         (Target_arm::do_may_relax): New method definition.
11371         (Target_arm::do_relax, Target_arm::group_sections,
11372         Target_arm::scan_reloc_for_stub,
11373         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11374         (Target_arm::arm_input_section_map_): New data member declaration.
11375         (Target_arm::scan_reloc_for_stub,
11376         Target_arm::scan_reloc_section_for_stubs,
11377         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11378         Target_arm::do_relax): New method definitions.
11379
11380 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11381
11382         * configure.ac: Check for (struct stat)::st_mtim
11383         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11384         * config.in: Regenerate.
11385         * configure: Regenerate.
11386
11387 2009-11-05  Ian Lance Taylor  <iant@google.com>
11388
11389         PR 10910
11390         * output.cc (Output_segment::add_output_section): Add missing
11391         return statement.
11392
11393 2009-11-04  Ian Lance Taylor  <iant@google.com>
11394
11395         PR 10880
11396         * object.h (class Object): Add is_needed and set_is_needed
11397         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11398         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11399         defined in a dynamic object and referenced by a regular object,
11400         set is_needed for the dynamic object.
11401         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11402         if the file is marked with as_needed and it is not needed.
11403
11404 2009-11-04  Ian Lance Taylor  <iant@google.com>
11405
11406         PR 10887
11407         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11408         tags if data is discarded by linker script.
11409         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11410         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11411         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11412         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11413
11414 2009-11-04  Ian Lance Taylor  <iant@google.com>
11415
11416         * layout.cc (Layout::get_output_section): Add is_interp and
11417         is_dynamic_linker_section parameters.  Change all callers.
11418         (Layout::choose_output_section): Likewise.
11419         (Layout::make_output_section): Likewise.
11420         (Layout::add_output_section_data): Add is_dynamic_linker_section
11421         parameter.  Change all callers.
11422         * layout.h (class Layout): Update declarations.
11423         * output.h (class Output_section): Add is_interp, set_is_interp,
11424         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11425         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11426         generate_code_fills_at_write_ to a bitfield.
11427         * output.cc (Output_section::Output_sections): Initialize new
11428         fields.
11429         (Output_segment::add_output_section): Add do_sort parameter.
11430         Change all callers.
11431
11432 2009-11-03  Ian Lance Taylor  <iant@google.com>
11433
11434         PR 10860
11435         * options.h (class General_options): Add --warn-common.
11436         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11437         merging two common symbols.
11438         (Symbol_table::should_override): Handle --warn-common when merging
11439         a common symbol with a defined symbol.  Use report_resolve_problem
11440         for multiple definitions.
11441         (Symbol_table::report_resolve_problem): New function.
11442         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11443
11444 2009-11-03  Doug Kwan  <dougkwan@google.com>
11445
11446         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11447         stub_factory_.
11448         (Target_arm::stub_factory): New method definition.
11449         (Target_arm::new_arm_input_section,
11450         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11451         Target_arm::reloc_uses_thumb_bit): New method declarations.
11452         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11453         New type definitions.
11454         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11455         member declarations.
11456         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11457         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11458         New method definitions.
11459
11460 2009-11-03  Ian Lance Taylor  <iant@google.com>
11461
11462         * options.h (class General_options): Add --warn_constructors.
11463
11464 2009-11-03  Ian Lance Taylor  <iant@google.com>
11465
11466         PR 10893
11467         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11468         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11469
11470 2009-11-03  Ian Lance Taylor  <iant@google.com>
11471
11472         PR 10895
11473         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11474         --msgid-bugs-address.
11475         (install-pdf): New target.
11476         (install-data_yes): Look up one directory to find mkinstalldirs.
11477
11478 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11479
11480         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11481         tree.
11482
11483 2009-10-30  Doug Kwan  <dougkwan@google.com>
11484
11485         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11486
11487 2009-10-30  Doug Kwan  <dougkwan@google.com>
11488
11489         * arm.cc (Stub_addend_reader): New struct template definition
11490         and partial specializations.
11491         (Stub_addend_reader::operator()): New method definition for a
11492         partially specialized template.
11493
11494 2009-10-30  Doug Kwan  <dougkwan@google.com>
11495
11496         * arm.cc (Arm_relobj::processor_specific_flags): New method
11497         definition.
11498         (Arm_relobj::do_read_symbols): New method declaration.
11499         (Arm_relobj::processor_specific_flags_): New data member declaration.
11500         (Arm_dynobj): New class definition.
11501         (Target_arm::do_finalize_sections): Add input_objects parameter.
11502         (Target_arm::do_adjust_elf_header): New method declaration.
11503         (Target_arm::are_eabi_versions_compatible,
11504         (Target_arm::merge_processor_specific_flags): New method declaration.
11505         (Target_arm::do_make_elf_object): New overloaded method definitions
11506         and declaration.
11507         (Arm_relobj::do_read_symbols): New method definition.
11508         (Arm_dynobj::do_read_symbols): Ditto.
11509         (Target_arm::do_finalize_sections): Add input_objects parameters.
11510         Merge processor-specific flags from all input objects.
11511         (Target_arm::are_eabi_versions_compatible,
11512         Target_arm::merge_processor_specific_flags,
11513         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11514         New method definitions.
11515         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11516         Input_objects pointer type parameter.
11517         * layout.cc (Layout::finalize): Pass input objects to target's.
11518         finalize_sections function.
11519         * output.cc (Output_file_header::do_sized_write): Set ELF file
11520         header's processor-specific flags.
11521         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11522         Input_objects pointer type parameter.
11523         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11524         * target.h (Input_objects): New forward class declaration.
11525         (Target::processor_specific_flags,
11526         Target::are_processor_specific_flags_sect): New method definitions.
11527         (Target::finalize_sections): Add input_objects parameter.
11528         (Target::Target): Initialize processor_specific_flags_ and
11529         are_processor_specific_flags_set_.
11530         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11531         parameter.
11532         (Target::set_processor_specific_flags): New method definition.
11533         (Target::processor_specific_flags_,
11534         Target::are_processor_specific_flags_set_): New data member
11535         declarations.
11536         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11537         Input_objects pointer type parameter.
11538
11539 2009-10-30  Doug Kwan  <dougkwan@google.com>
11540
11541         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11542
11543 2009-10-28  Ian Lance Taylor  <iant@google.com>
11544
11545         * object.h (class Relobj): Drop options parameter from
11546         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11547         do_scan_relocs, do_relocate.  Change all callers.
11548         (class Sized_relobj): Drop options parameters from
11549         do_gc_process_relocs, do_scan_relocs, do_relocate,
11550         do_relocate_sections, relocate_sections, emit_relocs_scan,
11551         emit_relocs_scan_reltype.  Change all callers.
11552         (struct Relocate_info): Remove options field and all references to
11553         it.
11554         * reloc.h (class Read_relocs): Remove options constructor
11555         parameter and options_ field.  Change all callers.
11556         (class Gc_process_relocs, class Scan_relocs): Likewise.
11557         (class Relocate_task): Likewise.
11558         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11559         all callers.
11560         (scan_relocatable_relocs): Likewise.
11561         * target.h (class Sized_target): Remove options parameter from
11562         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11563         all callers.
11564         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11565         callers.
11566         * arm.cc: Update functions to remove options parameters.
11567         * i386.cc: Likewise.
11568         * powerpc.cc: Likewise.
11569         * sparc.cc: Likewise.
11570         * x86_64.cc: Likewise.
11571         * testsuite/testfile.cc: Likewise.
11572
11573 2009-10-28  Doug Kwan  <dougkwan@google.com>
11574
11575         * arm.cc (Arm_relobj): New class definition.
11576         (Arm_relobj::scan_sections_for_stubs,
11577         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11578         New method definitions.
11579
11580 2009-10-28  Cary Coutant  <ccoutant@google.com>
11581
11582         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11583         (Plugin::cleanup_done_): New member.
11584         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11585         (Plugin_manager::cleanup_done_): Remove.
11586         (Plugin_manager::add_input_file): Edit error message.
11587         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11588         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11589
11590 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11591
11592         * fileread.cc: (File_read::View::~View): Use the new
11593         data_ownership_ filed.
11594         (File_read::~File_read): Dispose the new whole_file_view_.
11595         (File_read::open): Mmap the whole file if needed.
11596         (File_read::open): Use whole_file_view_ instead of contents_.
11597         (File_read::find_view): Use whole_file_view_ if applicable.
11598         (File_read::do_read): Use whole_file_view_ instead of contents_.
11599         (File_read::make_view): Use whole_file_view_ instead of contents_,
11600         update File_read::View::View call.
11601         (File_read::find_or_make_view): Update File_read::View::View
11602         call.
11603         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11604         remove contents_
11605         (File_read::View::Data_ownership): New enum.
11606         (File_read::View::View): Replace bool mapped_ with Data_ownership
11607         argument.
11608         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11609         (File_read::View::data_ownership_): New field.
11610         (File_read::contents_): Remove (replaced by whole_file_view_).
11611         (File_read::whole_file_view_): New field.
11612         * options.h (class General_options): Add --keep-files-mapped.
11613
11614 2009-10-27  Cary Coutant  <ccoutant@google.com>
11615
11616         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11617         * testsuite/Makefile.am (plugin_test_5): New test case.
11618         * testsuite/Makefile.in: Regenerate.
11619
11620 2009-10-25  Doug Kwan  <dougkwan@google.com>
11621
11622         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11623         from private to protected to allow access by child class.
11624         (Sized_relobj::do_relocate_sections): New method declaration.
11625         (Sized_relobj::relocate_sections): Virtualize.
11626         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11627         Sized_relobj::relocate_sections.  Instantiate template explicitly
11628         for different target sizes and endianity.
11629
11630 2009-10-24  Doug Kwan  <dougkwan@google.com>
11631
11632         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11633         (Arm_input_section::as_arm_input_section): New method.
11634         (Arm_output_section): New class definition.
11635         (Arm_output_section::create_stub_group,
11636         Arm_output_section::group_sections): New method definitions.
11637
11638 2009-10-22  Doug Kwan  <dougkwan@google.com>
11639
11640         * arm.cc (Arm_input_section): New class definition.
11641         (Arm_input_section::init, Arm_input_section:do_write,
11642         Arm_input_section::set_final_data_size,
11643         Arm_input_section::do_reset_address_and_file_offset): New method
11644         definitions.
11645
11646 2009-10-21  Doug Kwan  <dougkwan@google.com>
11647
11648         * arm.cc (Stub_table, Arm_input_section): New forward class
11649         declarations.
11650         (Stub_table): New class defintion.
11651         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11652         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11653         New method definition.
11654
11655 2009-10-21  Doug Kwan  <dougkwan@google.com>
11656
11657         * arm.cc: Update copyright comments.
11658         (Target_arm): New forward class template declaration.
11659         (Arm_address): New type.
11660         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11661         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11662         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11663         constants.
11664         (Insn_template): Same.
11665         (DEF_STUBS): New macro.
11666         (Stub_type): New enum type.
11667         (Stub_template): New class definition.
11668         (Stub): Same.
11669         (Reloc_stub): Same.
11670         (Stub_factory): Same.
11671         (Target_arm::Target_arm): Initialize may_use_blx_ and
11672         should_force_pic_veneer_.
11673         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11674         Target_arm::should_force_pic_veneer,
11675         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11676         Target_arm::using_thumb_only, Target_arm:;default_target): New
11677         method defintions.
11678         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11679         New data member declarations.
11680         (Insn_template::size, Insn_template::alignment): New method defintions.
11681         (Stub_template::Stub_template): New method definition.
11682         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11683         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11684         (Stub_factory::Stub_factory): New method definition.
11685         * gold.h (string_hash): New template.
11686         * output.h (Input_section_specifier::hash_value): Use
11687         gold::string_hash.
11688         (Input_section_specifier::string_hash): Remove.
11689         * stringpool.cc (Stringpool_template::string_hash): Use
11690         gold::string_hash.
11691
11692 2009-10-20  Doug Kwan  <dougkwan@google.com>
11693
11694         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11695         symbols of relaxed input sections.
11696         * output.h (Output_section::find_relaxed_input_section): Make
11697         method public.
11698
11699 2009-10-16  Doug Kwan  <dougkwan@google.com>
11700
11701         * dynobj.cc (Versions::Versions): Initialize version_script_.
11702         Only insert base version symbol definition for a shared object
11703         if version script defines any version versions.
11704         (Versions::define_base_version): New method definition.
11705         (Versions::add_def): Check that base version is not needed.
11706         (Versions::add_need): Define base version lazily.
11707         * dynobj.h (Versions::define_base_version): New method declaration.
11708         (Versions::needs_base_version_): New data member declaration.
11709         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11710         (check_DATA): Add no_version_test.stdout.
11711         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11712         New make rules.
11713         * testsuite/Makefile.in: Regenerate.
11714         * testsuite/no_version_test.c: New file.
11715         * testsuite/no_version_test.sh: Ditto.
11716
11717 2009-10-16  Doug Kwan  <dougkwan@google.com>
11718
11719         * expression.cc (class Segment_start_expression): New class definition.
11720         (Segment_start_expression::value): New method definition.
11721         (script_exp_function_segment_start): Return a new
11722         Segment_start_expression.
11723         * gold/script-c.h (script_saw_segment_start_expression): New function
11724         prototype.
11725         * script-sections.cc (Script_sections::Script_sections): Initialize
11726         SAW_SEGMENT_START_EXPRESSION_ to false.
11727         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11728         and -Tbbs options to specify section addresses if given in
11729         command line and no SEGMENT_START expression is seen in a script.
11730         * script-sections.h (Script_sections::saw_segment_start_expression,
11731         Script_sections::set_saw_segment_start_expression): New method
11732         definition.
11733         (Script_sections::saw_segment_start_expression_): New data member
11734         declaration.
11735         * script.cc (script_saw_segment_start_expression): New function.
11736         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11737         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11738         script_test_7.sh and script_test_8.sh.
11739         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11740         script_test_8.stdout.
11741         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11742         (script_test_6, script_test_6.stdout, script_test_7,
11743         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11744         * Makefile.in: Regenerate.
11745         * testsuite/script_test_6.sh: New file.
11746         * testsuite/script_test_6.t: Same.
11747         * testsuite/script_test_7.sh: Same.
11748         * testsuite/script_test_7.t: Same.
11749         * testsuite/script_test_8.sh: Same.
11750
11751 2009-10-16  Doug Kwan  <dougkwan@google.com>
11752
11753         * output.cc (Output_segment::set_section_list_address): Cast
11754         expressions to unsigned long long type to avoid format warnings.
11755
11756 2009-10-15  Ian Lance Taylor  <iant@google.com>
11757
11758         * script.cc (Script_options::add_symbol_assignment): Always add a
11759         dot assignment to script_sections_.
11760         * script-sections.cc (Script_sections::add_dot_assignment):
11761         Initialize if necessary.
11762
11763         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11764         program headers with no load segment if there is a linker script.
11765
11766         * layout.cc (Layout::set_segment_offsets): Align the file offset
11767         to the segment aligment for -N or -n with no load segment.
11768         * output.cc (Output_segment::add_output_section): Don't crash if
11769         the first section is a TLS section.
11770         (Output_segment::set_section_list_addresses): Print an error
11771         message if the address moves backward in a linker script.
11772         * script-sections.cc
11773         (Output_section_element_input::set_section_addresses): Don't
11774         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11775         (Orphan_output_section::set_section_addresses): Likewise.
11776
11777 2009-10-15  Doug Kwan  <dougkwan@google.com>
11778
11779         * layout.cc (Layout::finish_dynamic_section): Generate tags
11780         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11781         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11782         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11783
11784 2009-10-14  Ian Lance Taylor  <iant@google.com>
11785
11786         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11787         fields.
11788         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11789         data_shdr fields of relinfo.
11790         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11791         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11792         R_386_TLS_LDO_32, adjust based on section flags.
11793         (Target_i386::Relocate::fix_up_ldo): Remove.
11794
11795 2009-10-13  Ian Lance Taylor  <iant@google.com>
11796
11797         Add support for -pie.
11798         * options.h (class General_options): Add -pie and
11799         --pic-executable.
11800         (General_options::output_is_position_independent): Test -pie.
11801         (General_options::output_is_executable): Return true if not shared
11802         and not relocatable.
11803         (General_options::output_is_pie): Remove.
11804         * options.cc (General_options::finalize): Reject incompatible uses
11805         of -pie.
11806         * gold.cc (queue_middle_tasks): A -pie link is not static.
11807         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11808         * symtab.cc (Symbol::final_value_is_known): Return false if
11809         output_is_position_independent.
11810         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11811         output_is_position_independent.
11812         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11813         output_is_position_independent.
11814         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11815         output_is_position_independent.
11816         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11817         two_file_pie_test.
11818         (basic_pie_test.o, basic_pie_test): New targets.
11819         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11820         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11821         (two_file_pie_test): New target.
11822         * testsuite/Makefile.in: Rebuild.
11823         * README: Remove note saying that -pie is not supported.
11824
11825 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11826
11827         * options.h (class General_options): Add -init and -fini.
11828         * layout.cc (Layout::finish_dynamic_section): Emit
11829         given init and fini functions.
11830
11831 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11832
11833         * gc.h (gc_process_relocs): Check if icf is enabled using new
11834         function.
11835         * gold.cc (queue_initial_tasks): Likewise.
11836         (queue_middle_tasks): Likewise.
11837         * object.cc (do_layout): Likewise.
11838         * symtab.cc (is_section_folded): Likewise.
11839         * main.cc (main): Likewise.
11840         * reloc.cc (Read_relocs::run): Likewise.
11841         (Sized_relobj::do_scan_relocs): Likewise.
11842         * icf.cc (is_function_ctor_or_dtor): New function.
11843         (Icf::find_identical_sections): Check if function is ctor or dtor when
11844         safe icf is chosen.
11845         * options.h (General_options::icf): Change option to be an enum.
11846         (Icf_status): New enum.
11847         (icf_enabled): New method.
11848         (icf_safe_folding): New method.
11849         (set_icf_status): New method.
11850         (icf_status_): New variable.
11851         * (options.cc) (General_options::finalize): Set icf_status_.
11852         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11853         icf_test and icf_keep_unique_test to use the --icf enum flag.
11854         * testsuite/icf_safe_test.sh: New file.
11855         * testsuite/icf_safe_test.cc: New file.
11856
11857 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11858
11859         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11860         includes to gc.h and icf.h.
11861         * arm.cc: Include gc.h.
11862         * gold.cc: Likewise.
11863         * i386.cc: Likewise.
11864         * powerpc.cc: Likewise.
11865         * sparc.cc: Likewise.
11866         * x86_64.cc: Likewise.
11867         * gc.h: Include icf.h.
11868
11869 2009-10-11  Ian Lance Taylor  <iant@google.com>
11870
11871         * plugin.cc: Include "gold.h" before other header files.
11872
11873 2009-10-10  Chris Demetriou  <cgd@google.com>
11874
11875         * options.h (Input_file_argument::Input_file_type): New enum.
11876         (Input_file_argument::is_lib_): Replace with...
11877         (Input_file_argument::type_): New member.
11878         (Input_file_argument::Input_file_argument): Take Input_file_type
11879         'type' rather than boolean 'is_lib' as second argument.
11880         (Input_file_argument::is_lib): Use type_.
11881         (Input_file_argument::is_searched_file): New function.
11882         (Input_file_argument::may_need_search): Handle is_searched_file.
11883         * options.cc (General_options::parse_library): Support -l:filename.
11884         (General_options::parse_just_symbols): Update for Input_file_argument
11885         changes.
11886         (Command_line::process): Likewise.
11887         * archive.cc (Archive::get_file_and_offset): Likewise.
11888         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11889         * script.cc (read_script_file, script_add_file): Likewise.
11890         * fileread.cc (Input_file::Input_file): Likewise.
11891         (Input_file::will_search_for): Handle is_searched_file.
11892         (Input_file::open): Likewise.
11893         * readsyms.cc (Read_symbols::get_name): Likewise.
11894         * testsuite/Makefile.am (searched_file_test): New test.
11895         * testsuite/Makefile.in: Regenerate.
11896         * testsuite/searched_file_test.cc: New file.
11897         * testsuite/searched_file_test_lib.cc: New file.
11898
11899 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11900             Ian Lance Taylor  <iant@google.com>
11901
11902         * descriptor.cc: Include <cstdio> and "binary-io.h".
11903         (Descriptors::open): Open the files in binary mode always.
11904         * script.cc (Lex::get_token): Treat \r as whitespace.
11905
11906 2009-10-09  Ian Lance Taylor  <iant@google.com>
11907
11908         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11909
11910 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11911             Ian Lance Taylor  <iant@google.com>
11912
11913         * configure.ac: Check for readv function also.
11914         * fileread.cc (readv): Define if not HAVE_READV.
11915         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11916         does not exist.
11917         * config.in: Regenerate.
11918         * configure: Regenerate.
11919
11920 2009-10-09  Doug Kwan  <dougkwan@google.com>
11921
11922         * layout.cc (Layout::make_output_section): Call target hook to make
11923         ordinary output section.
11924         (Layout::finalize): Adjust parameter list of call the
11925         Target::may_relax().
11926         * layout.h (class Layout::section_list): New method.
11927         * merge.h (Output_merge_base::entsize): Change visibility to public.
11928         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11929         New methods.
11930         (Output_merge_string::do_is_string): New method.
11931         * object.cc (Sized_relobj::do_setup): renamed from
11932         Sized_relobj::set_up.
11933         * object.h (Sized_relobj::adjust_shndx,
11934         Sized_relobj::initializ_input_to_output_maps,
11935         Sized_relobj::free_input_to_output_maps): Change visibilities to
11936         protected.
11937         (Sized_relobj::setup): Virtualize.
11938         (Sized_relobj::do_setup): New method declaration.
11939         (Sized_relobj::invalidate_section_offset,
11940         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11941         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11942         * options.cc (parse_int): New function.
11943         * options.h (parse_int): New declaration.
11944         (DEFINE_int): New macro.
11945         (stub_group_size): New option.
11946         * output.cc (Output_section::Output_section): Initialize memebers
11947         merge_section_map_, merge_section_by_properties_map_,
11948         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11949         (Output_section::add_input_section): Handled deferred code-fill
11950         generation and remove an old comment.
11951         (Output_section::add_relaxed_input_section): New method definition.
11952         (Output_section::add_merge_input_section): Use merge section by
11953         properties map to speed to search.  Update merge section maps
11954         as appropriate.
11955         (Output_section::build_relaxation_map): New method definition.
11956         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11957         Same.
11958         (Output_section::relax_input_section): Renamed to
11959         Output_section::convert_input_sections_to_relaxed_sections and change
11960         interface to take a vector of pointers to relaxed sections.
11961         (Output_section::find_merge_section,
11962         Output_section::find_relaxed_input_section): New method definitions.
11963         (Output_section::is_input_address_mapped,
11964         Output_section::output_offset, Output_section::output_address):
11965         Use output section data maps to speed up searching.
11966         (Output_section::find_starting_output_address): Add comments.
11967         (Output_section::do_write,
11968         Output_section::write_to_postprocessing_buffer): Do code-fill
11969         generation as appropriate.
11970         (Output_section::get_input_sections): Invalidate relaxed input section
11971         map.
11972         (Output_section::restore_states): Adjust type of checkpoint .
11973         Invalidate relaxed input section map.
11974         * output.h (Output_merge_base): New class declaration.
11975         (Input_section_specifier): New class defintion.
11976         (class Output_relaxed_input_section) Change base class to
11977         Output_section_data_build.
11978         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11979         base class initializer.
11980         (Output_section::add_relaxed_input_section): New method declaration.
11981         (Output_section::Input_section): Change visibility to protected.
11982         (Output_section::Input_section::relobj,
11983         Output_section::Input_section::shndx): Handle relaxed input sections.
11984         Output_section::input_sections) Change visibility to protected.  Also
11985         define overload to return a non-const pointer.
11986         (Output_section::Merge_section_properties): New class defintion.
11987         (Output_section::Merge_section_by_properties_map,
11988         Output_section::Output_section_data_by_input_section_map,
11989         Output_section::Relaxation_map): New types.
11990         (Output_section::relax_input_section): Rename method to
11991         Output_section::convert_input_sections_to_relaxed_sections and change
11992         interface to take a vector of relaxed section pointers.
11993         (Output_section::find_merge_section,
11994         Output_section::find_relaxed_input_section,
11995         Output_section::build_relaxation_map,
11996         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11997         New method declarations.
11998         (Output_section::merge_section_map_
11999         Output_section::merge_section_by_properties_map_,
12000         Output_section::relaxed_input_section_map_,
12001         Output_section::is_relaxed_input_section_map_valid_,
12002         Output_section::generate_code_fills_at_write_): New data members.
12003         * script-sections.cc
12004         (Output_section_element_input::set_section_addresses): Call
12005         current_data_size and addralign methods of relaxed input sections.
12006         (Orphan_output_section::set_section_addresses): Call current_data_size
12007         and addralign methods of relaxed input sections.
12008         * symtab.cc (Symbol_table::compute_final_value): Extract template
12009         from the body of Symbol_table::sized_finalize_symbol.
12010         (Symbol_table::sized_finalized_symbol): Call
12011         Symbol_table::compute_final_value.
12012         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12013         (Symbol_table::compute_final_value): New templated method declaration.
12014         * target.cc (Target::do_make_output_section): New method defintion.
12015         * target.h (Target::make_output_section): New method declaration.
12016         (Target::relax): Add more parameters for input objects, symbol table
12017         and layout.  Adjust call to do_relax.
12018         (Target::do_make_output_section): New method declaration.
12019         (Target::do_relax): Add parameters for input objects, symbol table
12020         and layout.
12021
12022 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12023
12024         * pread.c: Include stdio.h.
12025
12026 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12027
12028         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12029         defined.
12030
12031 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12032
12033         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12034         Change read_shndx type to unsigned int.
12035         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12036         int.
12037         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12038         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12039         Change read_shndx type to unsigned int.
12040         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12041         int.
12042         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12043         * layout.cc (Layout::create_symtab_sections): Cast the result of
12044         local_symcount * symsize to off_t in the gold_assert.
12045
12046 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12047
12048         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12049         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12050         R_ARM_BASE_ABS.
12051         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12052         (Arm_relocate_functions::thm_abs5): New function.
12053         (Arm_relocate_functions::abs12): New function.
12054         (Arm_relocate_functions::abs16): New function.
12055         (Arm_relocate_functions::base_abs): New function.
12056         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12057         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12058         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12059         R_ARM_BASE_ABS.
12060         (Scan::global): Likewise.
12061         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12062         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12063         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12064         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12065         R_ARM_BASE_ABS.
12066
12067 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12068
12069         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12070         (Arm_relocate_functions::movt_prel): New function.
12071         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12072         (Arm_relocate_functions::thm_movt_prel): New function.
12073         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12074         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12075         (Scan::global, Relocate::relocate): Likewise.
12076         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12077
12078 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12079
12080         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12081         Incremental_checker.
12082         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12083         unsigned int.
12084         (class Incremental_inputs_header): New class.
12085         (Incremental_inputs_header_writer): Edit comment.
12086         (Incremental_inputs_entry): New class.
12087         (Incremental_inputs_entry_writer): Edit comment.
12088         (Sized_incremental_binary::do_find_incremental_inputs_section):
12089         Add *strtab_shndx parameter, fill it.
12090         (Sized_incremental_binary::do_check_inputs): New method.
12091         (Incremental_checker::can_incrementally_link_output_file): Use
12092         Sized_incremental_binary::check_inputs.
12093         (Incremental_inputs::report_command_line): Save command line in
12094         command_line_.
12095         * incremental.h:
12096         (Incremental_binary::find_incremental_inputs_section): New
12097         method.
12098         (Incremental_binary::do_find_incremental_inputs_section): Add
12099         strtab_shndx parameter.
12100         (Incremental_binary::do_check_inputs): New pure virtual method.
12101         (Sized_incremental_binary::do_check_inputs): Declare.
12102         (Incremental_checker::Incremental_checker): Add incremental_inputs
12103         parameter, use it to initialize incremental_inputs_.
12104         (Incremental_checker::incremental_inputs_): New field.
12105         (Incremental_checker::command_line): New method.
12106         (Incremental_checker::inputs): New method.
12107         (Incremental_checker::command_line_): New field.
12108
12109 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12110
12111         * incremental.cc: Include <cstdarg> and "target-select.h".
12112         (vexplain_no_incremental): New function.
12113         (explain_no_incremental): New function.
12114         (Incremental_binary::error): New method.
12115         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12116         method.
12117         (make_sized_incremental_binary): New function.
12118         (open_incremental_binary): New function.
12119         (can_incrementally_link_file): Add checks if output is ELF and has
12120         inputs section.
12121         * incremental.h: Include "elfcpp_file.h" and "output.h".
12122         (Incremental_binary): New class.
12123         (Sized_incremental_binary): New class.
12124         (open_incremental_binary): Declare.
12125         * object.cc (is_elf_object): Use
12126         elfcpp::Elf_recognizer::is_elf_file.
12127         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12128         * output.h (Output_file::filesize): New method.
12129
12130 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12131
12132         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12133         New function.
12134         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12135         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12136         function.
12137         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12138         function.
12139         (Arm_relocate_functions::movw_abs_nc): New function.
12140         (Arm_relocate_functions::movt_abs): New function.
12141         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12142         (Arm_relocate_functions::thm_movt_abs): New function.
12143         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12144         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12145         (Scan::global): Likewise.
12146         (Relocate::relocate): Likewise.
12147         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12148
12149 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12150
12151         * arm.cc (Arm_relocate_functions::got_prel) New function.
12152         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12153         (Relocate::relocate): Likewise.
12154         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12155
12156 2009-10-06  Ian Lance Taylor  <iant@google.com>
12157
12158         * options.h (class General_options): Define
12159         split_stack_adjust_size parameter.
12160         * object.h (class Object): Add uses_split_stack_ and
12161         has_no_split_stack_ fields.  Add uses_split_stack and
12162         has_no_split_stack accessor functions.  Declare
12163         handle_split_stack_section.
12164         (class Reloc_symbol_changes): Define.
12165         (class Sized_relobj): Define Function_offsets.  Declare
12166         split_stack_adjust, split_stack_adjust_reltype, and
12167         find_functions.
12168         * object.cc (Object::handle_split_stack_section): New function.
12169         (Sized_relobj::do_layout): Call handle_split_stack_section.
12170         * dynobj.cc (Sized_dynobj::do_layout): Call
12171         handle_split_stack_section.
12172         * reloc.cc (Sized_relobj::relocate_sections): Call
12173         split_stack_adjust for executable sections in split_stack
12174         objects.  Pass reloc_map to relocate_section.
12175         (Sized_relobj::split_stack_adjust): New function.
12176         (Sized_relobj::split_stack_adjust_reltype): New function.
12177         (Sized_relobj::find_functions): New function.
12178         * target-reloc.h: Include "object.h".
12179         (relocate_section): Add reloc_symbol_changes parameter.  Change
12180         all callers.
12181         * target.h (class Target): Add calls_non_split method.  Declare
12182         do_calls_non_split virtual method.  Declare match_view and
12183         set_view_to_nop.
12184         * target.cc: Include "elfcpp.h".
12185         (Target::do_calls_non_split): New function.
12186         (Target::match_view): New function.
12187         (Target::set_view_to_nop): New function.
12188         * gold.cc (queue_middle_tasks): Give an error if mixing
12189         split-stack and non-split-stack objects with -r.
12190         * i386.cc (Target_i386::relocate_section): Add
12191         reloc_symbol_changes parameter.
12192         (Target_i386::do_calls_non_split): New function.
12193         * x86_64.cc (Target_x86_64::relocate_section): Add
12194         reloc_symbol_changes parameter.
12195         (Target_x86_64::do_calls_non_split): New function.
12196         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12197         parameter.
12198         * powerpc.cc (Target_powerpc::relocate_section): Add
12199         reloc_symbol_changes parameter.
12200         * sparc.cc (Target_sparc::relocate_section): Add
12201         reloc_symbol_changes parameter.
12202         * configure.ac: Call AM_CONDITIONAL for the default target.
12203         * configure: Rebuild.
12204         * testsuite/Makefile.am (TEST_AS): New variable.
12205         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12206         (check_DATA): Add split_i386 and split_x86_64 files.
12207         (SPLIT_DEFSYMS): Define.
12208         (split_i386_[1234n].o): New targets.
12209         (split_i386_[124]): New targets.
12210         (split_i386_[1234r].stdout): New targets.
12211         (split_x86_64_[1234n].o): New targets.
12212         (split_x86_64_[124]): New targets.
12213         (split_x86_64_[1234r].stdout): New targets.
12214         (MOSTLYCLEANFILES): Add new executables.
12215         * testsuite/split_i386.sh: New file.
12216         * testsuite/split_x86_64.sh: New file.
12217         * testsuite/split_i386_1.s: New file.
12218         * testsuite/split_i386_2.s: New file.
12219         * testsuite/split_i386_3.s: New file.
12220         * testsuite/split_i386_4.s: New file.
12221         * testsuite/split_i386_n.s: New file.
12222         * testsuite/split_x86_64_1.s: New file.
12223         * testsuite/split_x86_64_2.s: New file.
12224         * testsuite/split_x86_64_3.s: New file.
12225         * testsuite/split_x86_64_4.s: New file.
12226         * testsuite/split_x86_64_n.s: New file.
12227         * testsuite/testfile.cc (Target_test): Update relocation_section
12228         function.
12229         * testsuite/Makefile.in: Rebuild.
12230
12231 2009-10-06  Ian Lance Taylor  <iant@google.com>
12232
12233         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12234         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12235         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12236         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12237         the address on ldo_addrs_.
12238         (Target_i386::Relocate::fix_up_ldo): New function.
12239
12240 2009-10-06   Rafael Espindola  <espindola@google.com>
12241
12242         * plugin.cc (add_input_library): New.
12243         (Plugin::load): Add add_input_library to tv.
12244         (Plugin_manager::add_input_file): Add the is_lib argument.
12245         (add_input_file): Update call to Plugin_manager::add_input_file.
12246         (add_input_library): New.
12247         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12248
12249 2009-09-30  Doug Kwan  <dougkwan@google.com>
12250
12251         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12252         symbol and call Symbol::may_need_copy_reloc to determine if
12253         a copy reloc is needed.
12254         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12255         nocopyreloc is given in command line.
12256         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12257         given in command line.
12258         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12259         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12260         of the removed Target_i386::may_need_copy_reloc.
12261         * options.h (copyreloc): New option with default value false.
12262         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12263         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12264         instead of the removed Target_powerpc::may_need_copy_reloc.
12265         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12266         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12267         instead of the removed Target_sparc::may_need_copy_reloc.
12268         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12269         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12270         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12271         instead of the removed Target_x86_64::may_need_copy_reloc.
12272
12273 2009-09-30  Ian Lance Taylor  <iant@google.com>
12274
12275         * object.h (class Object): Remove target_ field, and target,
12276         sized_target, and set_target methods.
12277         (Object::sized_target): Remove.
12278         (class Sized_relobj): Update declarations.  Remove sized_target.
12279         * object.cc (Sized_relobj::setup): Remove target parameter.
12280         Change all callers.
12281         (Input_objects::add_object): Don't do anything with the target.
12282         (make_elf_sized_object): Add punconfigured parameter.  Change all
12283         callers.  Set or test parameter target.
12284         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12285         Change all callers.
12286         * parameters.cc (Parameters::set_target): Change parameter type to
12287         be non-const.
12288         (Parameters::default_target): Remove.
12289         (set_parameters_target): Change parameter type to be non-const.
12290         (parameters_force_valid_target): New function.
12291         (parameters_clear_target): New function.
12292         * parameters.h (class Parameters): Update declarations.  Remove
12293         default_target method.  Add sized_target and clear_target
12294         methods.  Change target_ to be non-const.
12295         (set_parameters_target): Update declaration.
12296         (parameters_force_valid_target): Declare.
12297         (parameters_clear_target): Declare.
12298         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12299         as NULL if we aren't searching.
12300         (Add_symbols::run): Don't check for compatible target.
12301         * fileread.cc (Input_file::open_binary): Call
12302         parameters_force_valid_target.
12303         * gold.cc (queue_middle_tasks): Likewise.
12304         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12305         set_target on object.
12306         * dynobj.h (class Sized_dynobj): Update declarations.
12307         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12308         make_elf_object returns NULL.
12309         (Archive::include_member): Don't check whether object target is
12310         compatible.
12311         * output.cc (Output_section::add_input_section): Get target from
12312         parameters.
12313         (Output_section::relax_input_section): Likewise.
12314         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12315         parameters.
12316         (Sized_relobj::do_scan_relocs): Likewise.
12317         (Sized_relobj::relocate_sections): Likewise.
12318         * resolve.cc (Symbol_table::resolve): Likewise.
12319         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12320         parameter.  Change all callers.
12321         (Symbol_table::add_from_object): Get target from parameters.
12322         (Symbol_table::add_from_relobj): Don't check object target.
12323         (Symbol_table::add_from_dynobj): Likewise.
12324         (Symbol_table::define_special_symbol): Get target from
12325         parameters.
12326         * symtab.h (class Symbol_table): Update declaration.
12327         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12328         parameter.  Change all callers.  Clear parameter target.
12329         (Binary_test): Test target here.
12330         * testsuite/object_unittest.cc (gold_testsuite): Remove
12331         target_test_pointer parameter.  Change all callers.
12332         (Object_test): Test target here.
12333
12334 2009-09-26  Ian Lance Taylor  <iant@google.com>
12335
12336         * testsuite/initpri1.c: Don't try to use constructor priorities if
12337         compiling with gcc before 4.3.
12338
12339 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12340
12341         * testsuite/retain_symbols_file_test.sh (check_present): Change
12342         output file name to retain_symbols_file_test.stdout.
12343         (check_absent): Likewise.
12344
12345 2009-09-18  Craig Silverstein  <csilvers@google.com>
12346
12347         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12348         * options.cc: Include <cerrno> and <fstream>.
12349         (General_options::finalize): Parse -retain-symbols-file tag.
12350         * options.h: New flag.
12351         (General_options): New method should_retain_symbol, new
12352         variable symbols_to_retain.
12353         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12354         should_retain_symbol map.
12355         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12356         * testsuite/Makefile.in: Regenerate.
12357         * testsuite/retain_symbols_file_test.sh: New file.
12358
12359 2009-09-18  Nick Clifton  <nickc@redhat.com>
12360
12361         * po/es.po: Updated Spanish translation.
12362
12363 2009-09-17  Doug Kwan  <dougkwan@google.com>
12364
12365         * debug.h (DEBUG_RELAXATION): New constant.
12366         (DEBUG_ALL): Add DEBUG_RELAXATION.
12367         (debug_string_to_enum): Add relaxation debug option.
12368         * layout.cc
12369         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12370         Layout::Relaxation_debug_check::read_sections,
12371         Layout::Relaxation_debug_check::read_sections): New method definitions.
12372         (Layout::Layout): Initialize data members
12373         record_output_section_data_from_scrips_,
12374         script_output_section_data_list_ and relaxation_debug_check_.
12375         (Layout::save_segments, Layout::restore_segments,
12376         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12377         Layout::relaxation_loop_body): New method definitions.
12378         (Layout::finalize): Support relaxation.  Move section layout code to
12379         Layout::relaxation_loop_body.
12380         (Layout::set_asection_address_from_script): Move code for orphan
12381         section placement out.
12382         (Layout::place_orphan_sections_in_script): New method definition.
12383         * layout.h (Output_segment_headers, Output_file_header):
12384         New forward class declarations.
12385         (Layout::~Layout): Define.
12386         (Layout::new_output_section_data_from_script): New method definition.
12387         (Layout::place_orphan_sections_in_script): New method declaration.
12388         (Layout::Segment_states): New type declaration.
12389         (Layout::save_segments, Layout::restore_segments,
12390         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12391         Layout::relaxation_loop_body): New method declarations.
12392         (Layout::Output_section_data_list): New type declaration.
12393         (Layout::Relaxation_debug_check): New class definition.
12394         (Layout::record_output_section_data_from_script_,
12395         Layout::script_output_section_data_list_, Layout::segment_states_,
12396         Layout::relaxation_debug_check_): New data members.
12397         * output.cc: (Output_section_headers::do_size): New method definition.
12398         (Output_section_headers::Output_section_headers): Move size
12399         computation to Output_section_headers::do_size.
12400         (Output_segment_headers::do_size): New method definition.
12401         (Output_file_header::Output_file_header): Move size computation to
12402         Output_file_header::do_size and call it.
12403         (Output_file_header::do_size): New method definition.
12404         (Output_data_group::Output_data_group): Adjust call to
12405         Output_section_data.
12406         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12407         (Output_symtab_xindex::do_write): Add array bound check.
12408         (Output_section::Input_section::print_to_mapfile): Handle
12409         RELAXED_INPUT_SECTION_CODE.
12410         (Output_section::Output_section): Initialize data member checkpoint_.
12411         (Output_section::~Output_section): Delete checkpoint object pointed
12412         by checkpoint_.
12413         (Output_section::add_input_section): Always add an Input_section if
12414         relaxing.
12415         (Output_section::add_merge_input_section): Add assert.
12416         (Output_section::relax_input_section): New method definition.
12417         (Output_section::set_final_data_size): Set load address to zero for
12418         an unallocated section.
12419         (Output_section::do_address_and_file_offset_have_reset_values):
12420         New method definition.
12421         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12422         Handle relaxed input section.
12423         (Output_section::sort_attached_input_sections): Checkpoint input
12424         section list lazily.
12425         (Output_section::get_input_sections): Change type of input_sections to
12426         list of Simple_input_section pointers.  Checkpoint input section list
12427         lazily.  Also handle relaxed input sections.
12428         (Output_section::add_input_section_for_script): Take a reference to
12429         a Simple_input_section object instead of Relobj pointer and section
12430         index as parameter.  Handle relaxed input sections.
12431         (Output_section::save_states, Output_section::restore_states): New
12432         method definitions.
12433         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12434         (Output_data::is_data_size_fixed): New method definition.
12435         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12436         if it is fixed.
12437         (Output_data::address_and_file_offset_have_reset_values): New method
12438         definition.
12439         (Output_data::do_address_and_file_offset_have_reset_values): New method
12440         definition.
12441         (Output_data::set_data_size): Check that data size is not fixed.
12442         (Output_data::fix_data_size): New method definition.
12443         (Output_data::is_data_size_fixed_): New data member.
12444         (Output_section_headers::set_final_data_size): New method definition.
12445         (Output_section_headers::do_size): New method declaration.
12446         (Output_segment_headers::set_final_data_size): New method definition.
12447         (Output_segment_headers::do_size): New method declaration.
12448         (Output_file_header::set_final_data_size)::New method definition.
12449         (Output_file_header::do_size)::New method declaration.
12450         (Output_section_data::Output_section_data): Add new parameter
12451         is_data_size_fixed and use it to fix data size.
12452         (Output_data_const::Output_data_const): Adjust call to base class
12453         constructor and fix data size.
12454         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12455         base class constructor and fix data size.
12456         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12457         base class constructor and fix data size.
12458         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12459         class constructor and fix data size.
12460         (Output_data_group::set_final_data_size): New method definition.
12461         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12462         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12463         class constructor and fix data size.
12464         (Output_relaxed_input_section): New class definition.
12465         (Output_section::Simple_input_section): New class definition.
12466         (Output_section::get_input_sections): Adjust parameter list.
12467         (Output_section::add_input_section_for_script): Same.
12468         (Output_section::save_states, Output_section::restore_states,
12469         Output_section::do_address_and_file_offset_have_reset_values,
12470         (Output_section::Input_section::Input_section): Handle
12471         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12472         Output_relaxed_input_section.
12473         (Output_section::Input_section::is_input_section,
12474         Output_section::Input_section::set_output_section): Handle relaxed
12475         input section.
12476         (Output_section::Input_section::is_relaxed_input_section,
12477         Output_section::Input_section::output_section_data,
12478         Output_section::Input_section::relaxed_input_section): New method
12479         definitions.
12480         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12481         value.
12482         (Output_section::Input_section::u1_): Update comments.
12483         (Output_section::Input_section::u2_): Add new union member poris.
12484         (Output_section::Checkpoint_output_section): New classs definition.
12485         (Output_section::relax_input_section): New method declaration.
12486         (Output_section::checkpoint_): New data member.
12487         (Output_segment): Update comments.
12488         (Output_segment::Output_segment): Un-privatize copy constructor.
12489         (Output_segment::operator=): Un-privatize.
12490         * script-sections.cc (Output_section_element::Input_section_list):
12491         Change element type to Output_section::Simple_input_section.
12492         (Output_section_element_dot_assignment::set_section_addresses):
12493         Register output section data for relaxation clean up.
12494         (Output_data_exression::Output_data_expression): Adjust call to base
12495         constructor to fix data size.
12496         (Output_section_element_data::set_section_addresses): Register
12497         Output_data_expression object for relaxation clean up.
12498         (struct Input_section_info): Replace Relobj pointer and section index
12499         pair with Output_section::Simple_input_section and Convert struct to a
12500         class.
12501         (Input_section_sorter::operator()): Adjust access to
12502         Input_section_info data member to use accessors.
12503         (Output_section_element_input::set_section_addresses): Use layout
12504         parameter.  Adjust code to use Output_section::Simple_input_section
12505         and Input_secction_info classes.  Register filler for relaxation
12506         clean up.
12507         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12508         and section index pair with Output_section::Simple_input_section
12509         class.  Adjust code accordingly.
12510         (Phdrs_element::release_segment): New method definition.
12511         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12512         segment list.
12513         (Script_sections::release_segments): New method definition.
12514         * gold/script-sections.h (Script_sections::release_segments): New
12515         method declaration.
12516         * gold/target.h (Target::may_relax, Target::relax,
12517         Target::do_may_relax, Target::do_relax): New method definitions.
12518
12519 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12520
12521         * arm.cc (has_signed_unsigned_overflow): New function.
12522         (Arm_relocate_functions::abs8): New function.
12523         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12524         (Target_arm::Scan::global): Likewise.
12525         (Target_arm::relocate::relocate): Likewise.
12526         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12527         Likewise.
12528
12529 2009-09-16  Cary Coutant  <ccoutant@google.com>
12530
12531         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12532         * testsuite/Makefile.in: Regenerate.
12533
12534 2009-09-11  Nick Clifton  <nickc@redhat.com>
12535
12536         * po/gold.pot: Updated by the Translation project.
12537
12538 2009-09-08  Cary Coutant  <ccoutant@google.com>
12539
12540         * output.cc (Output_file::open): Add execute permission to empty file.
12541         * testsuite/Makefile.am (permission_test): New test.
12542         * testsuite/Makefile.in: Regenerate.
12543
12544 2009-09-02  Ian Lance Taylor  <iant@google.com>
12545
12546         * output.cc (Output_file::resize): Call map_no_anonymous rather
12547         than map.
12548
12549 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12550
12551         * gold.cc: Include "incremental.h".
12552         (queue_initial_tasks): Call Incremental_checker methods.
12553         * incremental.cc: Include "output.h".
12554         (Incremental_checker::can_incrementally_link_output_file): New
12555         method.
12556         * incremental.h (Incremental_checker): New class.
12557
12558         * output.cc (Output_file::open_for_modification): New method.
12559         (Output_file::map_anonymous): Changed return type to bool.  Record
12560         map in base_ field.
12561         (Output_file::map_no_anonymous): New method, broken out of map.
12562         (Output_file::map): Use map_no_anonymous and map_anonymous.
12563         * output.h (class Output_file): Update declarations.
12564
12565 2009-08-24  Cary Coutant  <ccoutant@google.com>
12566
12567         * options.h (Command_line::Pre_options): New class.
12568         (Command_line::pre_options): New member.
12569         * options.cc (gold::options::ready_to_register): New variable.
12570         (One_option::register_option): Do nothing if not registering options.
12571         Assert if same short option registered twice.
12572         (General_options::General_options): Turn off option registration when
12573         done constructing.
12574         (Command_line::Pre_options::Pre_options): New constructor.
12575
12576 2009-08-24  Cary Coutant  <ccoutant@google.com>
12577
12578         * options.h (General_options::no_keep_memory): Remove incorrect
12579         short option.
12580
12581 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12582
12583         * Makefile.am (am__skiplex, am__skipyacc): New.
12584         * Makefile.in: Regenerate.
12585
12586 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12587
12588         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12589         (INCLUDES): ... this.
12590         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12591         (AM_CPPFLAGS): Renamed from ...
12592         (INCLUDE): ... this.
12593         * Makefile.in, testsuite/Makefile.in: Regenerate.
12594
12595         * Makefile.in: Regenerate.
12596         * aclocal.m4: Likewise.
12597         * config.in: Likewise.
12598         * configure: Likewise.
12599         * testsuite/Makefile.in: Likewise.
12600
12601         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12602         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12603         * Makefile.in: Regenerate.
12604         * testsuite/Makefile.in: Regenerate.
12605
12606 2009-08-19  Cary Coutant  <ccoutant@google.com>
12607
12608         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12609         symbols in shared libraries overridden by hidden or internal symbols
12610         in the main program.
12611
12612 2009-08-19  Chris Demetriou  <cgd@google.com>
12613
12614         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12615         checking source file names in error messages.
12616
12617 2009-08-18  Doug Kwan  <dougkwan@google.com>
12618
12619         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12620         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12621         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12622         an elfcpp::Ehdr as parameter.
12623         * object.cc (Object::set_target): Remove the version that looks up
12624         a target and sets it.
12625         (Sized_relobj::setup): Take a Target object instead of
12626         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12627         (make_elf_sized_object): Find target and ask target to
12628         make an ELF object.
12629         * object.h: (Object::set_target): Remove the version that looks up
12630         a target and sets it.
12631         (Sized_relobj::setup): Take a Target object instead of
12632         an elfcpp:Ehdr as parameter.
12633         * target.cc: Include dynobj.h.
12634         (Target::do_make_elf_object_implementation): New.
12635         (Target::do_make_elf_object): New.
12636         * target.h (Target::make_elf_object): New template declaration.
12637         (Target::do_make_elf_object): New method declarations.
12638         (Target::do_make_elf_object_implementation): New template declaration.
12639
12640 2009-08-14  Ian Lance Taylor  <iant@google.com>
12641
12642         * gold.h (FUNCTION_NAME): Define.
12643         (gold_unreachable): Use FUNCTION_NAME.
12644
12645 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12646
12647         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12648         symbol in the --keep-unique list is not found.
12649
12650 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12651
12652         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12653         been maked as --keep-unique.
12654         (Icf::unfold_section): New function.
12655         * icf.h (Icf::unfold_section): New function.
12656         * options.h (General_options::keep_unique): New option.
12657         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12658         * testsuite/Makefile.in: Regenerate.
12659         * testsuite/icf_keep_unique_test.sh: New file.
12660         * testsuite/icf_keep_unique_test.cc: New file.
12661
12662 2009-08-12  Cary Coutant  <ccoutant@google.com>
12663
12664         PR 10471
12665         * resolve.cc (Symbol_table::resolve): Check for references from
12666         dynamic objects to hidden and internal symbols.
12667         * testsuite/Makefile.am (hidden_test.sh): New test.
12668         * testsuite/Makefile.in: Regenerate.
12669         * testsuite/hidden_test.sh: New script.
12670         * testsuite/hidden_test_1.c: New test source.
12671         * testsuite/hidden_test_main.c: New test source.
12672
12673 2009-08-11  Doug Kwan  <dougkwan@google.com>
12674
12675         * arm.cc: Update comments.
12676         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12677         segment to locate the .ARM.exidx section if present.
12678
12679 2009-08-09  Doug Kwan  <dougkwan@google.com>
12680
12681         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12682         patch.
12683
12684 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12685         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12686         compiler warnings.
12687
12688 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12689
12690         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12691         valid tls_segment only for non-debug-section relocations.
12692         * testsuite/Makefile.am: Add gc_tls_test.
12693         * testsuite/Makefile.in: Regenerate.
12694         * testsuite/gc_tls_test.cc: New file.
12695         * testsuite/gc_tls_test.sh: New file.
12696
12697 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12698
12699         * icf.cc: New file.
12700         * icf.h: New file.
12701         * Makefile.am (CCFILES): Add icf.cc.
12702         (HFILES): Add icf.h
12703         * Makefile.in: Regenerate.
12704         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12705         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12706         section, symbol and addend information for the relocs.
12707         * gold.cc (queue_middle_tasks): Call identical code folding.
12708         * gold.h: Add defines for multimap.
12709         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12710         to the call of finalize_local_symbols.
12711         * main.cc (main): Create object of class Icf.
12712         * object.cc (Sized_relobj::do_layout): Allow this function to be
12713         called twice during icf.
12714         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12715         to sections marked as identical by icf.
12716         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12717         when available.
12718         (Sized_relobj::do_section_entsize): New function.
12719         * object.h (Object::section_entsize): New function.
12720         (Object::do_section_entsize): New pure virtual function.
12721         (Relobj::finalize_local_symbols): Add new parameter.
12722         (Relobj::do_section_entsize): New function.
12723         * options.h (General_options::icf): New option.
12724         (General_options::icf_iterations): New option.
12725         (General_options::print_icf_sections): New option.
12726         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12727         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12728         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12729         icf.
12730         * symtab.cc (Symbol_table::is_section_folded): New function.
12731         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12732         to sections marked as identical by icf.
12733         * symtab.h (Symbol_table::set_icf): New function.
12734         (Symbol_table::icf): New function.
12735         (Symbol_table::is_section_folded): New function.
12736         (Symbol_table::icf_): New data member.
12737         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12738         * testsuite/Makefile.am: Add commands to build icf_test.
12739         * testsuite/Makefile.in: Regenerate.
12740         * testsuite/icf_test.sh: New file.
12741         * testsuite/icf_test.cc: New file.
12742
12743 2009-07-24  Chris Demetriou  <cgd@google.com>
12744
12745         * layout.cc (is_compressible_debug_section): Fix incorrect
12746         comment about compressed section names.
12747
12748 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12749
12750         PR 10419
12751         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12752
12753 2009-07-16  Ian Lance Taylor  <iant@google.com>
12754
12755         PR 10400
12756         * layout.h: #include <map>.
12757         (class Kept_section): Change from struct to class.  Add accessors
12758         and setters.  Add section size to Comdat_group mapping.  Change
12759         Comdat_group to std::map.  Add is_comdat_ field.  Add
12760         linkonce_size field in union.
12761         (class Layout): Update declaration of find_or_add_kept_section.
12762         Don't declare find_kept_object.
12763         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12764         parameter.  Add object, shndx, is_comdat, and is_group_name
12765         parameters.  Change all callers.  Adjust for new Kept_section.
12766         (Layout::find_kept_object): Remove.
12767         * object.cc (Sized_relobj::include_section_group): Update use of
12768         Kept_section.  Rename secnum to shndx.  Only record
12769         Kept_comdat_section if sections are the same size.
12770         (Sized_relobj::include_linkonce_section): Update use of
12771         Kept_section.  Only record Kept_comdat_section if sections are the
12772         same size.  Set size of linkonce section.
12773         (Sized_relobj::map_to_kept_section): Update call to
12774         get_kept_comdat_section.
12775         * object.h (class Sized_relobj): Rename fields in
12776         Kept_comdat_section to drop trailing underscores; change object
12777         field to Relobj*.  Change Kept_comdat_section_table to store
12778         struct rather than pointer.
12779         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12780         Add kept_object and kept_shndx parameters.  Change all callers.
12781         (Sized_relobj::get_kept_comdat_section): Change return type to
12782         bool.  Add kept_object and kept_shndx parameters.  Change all
12783         callers.
12784         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12785         Layout::find_or_add_kept_section.
12786
12787 2009-07-09  Ian Lance Taylor  <iant@google.com>
12788
12789         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12790         Reserve space in the hash table.
12791
12792 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12793
12794         * fileread.cc (File_read::get_mtime): New method.
12795         * fileread.h (Timespec): New structure.
12796         (File_read::get_mtime): New method.
12797         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12798         Renamed from timestamp_nsec.
12799         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12800         Elf_Xword.
12801         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12802         timestamp_nsec.
12803         (Incremental_inputs::report_archive): Save mtime; style fix.
12804         (Incremental_inputs::report_obejct): Save mtime; style fix.
12805         (Incremental_inputs::report_script): Save mtime; style fix.
12806         (Incremental_inputs::finalize_inputs): Style fix.
12807         (Incremental_inputs::finalize): Style fix.
12808         (Incremental_inputs::create_input_section_data): Store inputs
12809         mtime.
12810         * incremental.h (Incremental_inputs::report_script): Add mtime
12811         argument.
12812         (Incremental_inputs::Input_info::Input_info): Intialize only one
12813         union member.
12814         (Incremental_inputs::Input_info::archive): Move to nameless
12815         union.
12816         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12817         (Incremental_inputs::Input_info::script): Move to nameless union.
12818         (Incremental_inputs::mtime): New field.
12819         * script.cc (read_input_script): Pass file mtime to
12820         Incremental_input.
12821         * script.h (Script_info::inputs): Style fix.
12822
12823 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12824
12825         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12826         instead of 32.
12827
12828 2009-06-24  Ian Lance Taylor  <iant@google.com>
12829
12830         PR 10156
12831         * layout.cc (Layout::choose_output_section): If we find an
12832         existing section, update the flags.
12833         (Layout::create_notes): New function, broken out of
12834         Layout::finalize.
12835         (Layout::finalize): Don't create note sections.
12836         (Layout::create_note): Don't crash if linker script discards
12837         section.
12838         (Layout::create_gold_note): Likewise.
12839         (Layout::create_build_id): Likewise.  Don't set
12840         after_input_sections on the section.
12841         (Layout::create_executable_stack_info): Remove target parameter.
12842         Change caller.
12843         * layout.h (class Layout): Declare create_notes.  Update
12844         declaration of create_executable_stack_info.
12845         * gold.cc (queue_middle_tasks): Call create_notes.
12846         * output.cc (Output_section::update_flags_for_input_section): Move
12847         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12848         invalid.
12849         * output.h (Output_data::mark_address_invalid): New function.
12850         (class Output_section): Only declare, not define,
12851         update_flags_for_input_section.  Remove set_flags.
12852
12853 2009-06-24  Ian Lance Taylor  <iant@google.com>
12854
12855         * script-sections.cc (Output_section_definition::
12856         set_section_addresses): Rename shadowing local load_address to
12857         laddr.
12858
12859 2009-06-24  Ian Lance Taylor  <iant@google.com>
12860
12861         PR 10244
12862         * reloc.cc (relocate_sections): Skip empty relocation sections.
12863
12864 2009-06-23  Ian Lance Taylor  <iant@google.com>
12865
12866         PR 10156
12867         * layout.cc (Layout::create_note): Use choose_output_section
12868         rather than make_output_section.
12869
12870 2009-06-23  Ian Lance Taylor  <iant@google.com>
12871
12872         PR 10237
12873         * options.cc (General_options::parse_V): Set printed_version_.
12874         (General_options::General_options): Initialize printed_version_.
12875         * options.h (class General_options): Add printed_version_ field.
12876         * gold.cc (queue_initial_tasks): If there are no input files,
12877         don't give a fatal error if we printed the version information.
12878         (queue_middle_tasks): If using -r with a shared object, give a
12879         fatal error rather than an ordinary error.
12880
12881 2009-06-23  Ian Lance Taylor  <iant@google.com>
12882
12883         PR 10219
12884         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12885         (Layout::make_output_section): Set have_stabstr_section_ if we see
12886         a .stab*str section.
12887         (Layout::finalize): Call link_stabs_sections.
12888         (Layout::link_stabs_sections): New file.
12889         * layout.h (class Layout): Add have_stabstr_section_ field.
12890         Declare link_stabs_sections.
12891
12892 2009-06-23  Doug Kwan  <dougkwan@google.com>
12893
12894         * Makefile.am (libgold_a_LIBADD): New.
12895         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12896         * Makefile.in: Regenerate.
12897         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12898         * configure: Regenerate.
12899         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12900         * fileread.cc: Include sys/state.h
12901         * gold.h: Declare memmem and strndup if found missing.
12902         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12903
12904 2009-06-23  Ian Lance Taylor  <iant@google.com>
12905
12906         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12907         * configure: Rebuild.
12908
12909 2009-06-23  Ian Lance Taylor  <iant@google.com>
12910
12911         PR 10147
12912         * object.cc (Object::section_contents): Don't try to get a view if
12913         the section has length zero.
12914         (Object::handle_gnu_warning_section): If the section is empty, use
12915         the name of the section as the warning.
12916
12917 2009-06-23  Ian Lance Taylor  <iant@google.com>
12918
12919         PR 10133
12920         * stringpool.h (class Stringpool_template): Add optimize_ field.
12921         (Stringpool_template::set_optimize): New function.
12922         * stringpool.cc (Stringpool_template::Stringpool_template):
12923         Initialize optimize_ field.
12924         (Stringpool_template::set_string_offsets): Test local optimize
12925         fild rather than parameter.
12926         * layout.cc (Layout::Layout): Call set_optimize on the section
12927         name stringpool.
12928
12929 2009-06-22  Ian Lance Taylor  <iant@google.com>
12930
12931         PR 10030
12932         * yyscript.y: Parse TARGET.
12933         * script.cc (script_set_target): New function.
12934         * script-c.h (script_set_target): Declare.
12935         * options.cc (General_options::string_to_object_format): Rename
12936         from string_to_object_format in anonymous namespace.  Change
12937         callers.
12938         * options.h (class General_options): Declare
12939         string_to_object_format.
12940
12941 2009-06-22  Ian Lance Taylor  <iant@google.com>
12942
12943         * script-sections.cc (Script_sections::create_segments): Don't put
12944         program headers in a PT_LOAD segment if -n or -N.
12945
12946 2009-06-22  Ian Lance Taylor  <iant@google.com>
12947
12948         PR 10141
12949         * options.h (class General_options): Add -z lazy and -z now.  Sort
12950         -z options into alphabetical order.
12951         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12952
12953 2009-06-21  Ian Lance Taylor  <iant@google.com>
12954
12955         * layout.cc (Layout::make_output_section): Call
12956         Target::new_output_section.
12957         (Layout::attach_allocated_section_to_segment): Put large section
12958         sections in a separate load segment with the large segment flag
12959         set.
12960         (Layout::segment_precedes): Sort large data segments after other
12961         load segments.
12962         (align_file_offset): New static function.
12963         (Layout::set_segment_offsets): Use align_file_offset.
12964         * output.h (class Output_section): Add is_small_section_ and
12965         is_large_section_ fields.
12966         (Output_section::is_small_section): New function.
12967         (Output_section::set_is_small_section):  New function.
12968         (Output_section::is_large_section): New function.
12969         (Output_section::set_is_large_section): New function.
12970         (Output_section::is_large_data_section): New function.
12971         (class Output_segment): Add is_large_data_segment_ field.
12972         (Output_segment::is_large_data_segment): New function.
12973         (Output_segment::set_is_large_data_segment): New function.
12974         * output.cc (Output_section::Output_section): Initialize new
12975         fields.
12976         (Output_segment::Output_segment): Likewise.
12977         (Output_segment::add_output_section): Add assertion that large
12978         data sections always go in large data segments.  Force small data
12979         sections to the end of the list of data sections.  Force small BSS
12980         sections to the start of the list of BSS sections.  For large BSS
12981         sections to the end of the list of BSS sections.
12982         * symtab.h (class Symbol): Declare is_common_shndx.
12983         (Symbol::is_defined): Check Symbol::is_common_shndx.
12984         (Symbol::is_common): Likewise.
12985         (class Symbol_table): Define enum Commons_section_type.  Update
12986         declarations.  Add small_commons_ and large_commons_ fields.
12987         * symtab.cc (Symbol::is_common_shndx): New function.
12988         (Symbol_table::Symbol_table): Initialize new fields.
12989         (Symbol_table::add_from_object): Put small and large common
12990         symbols in the right list.
12991         (Symbol_table::sized_finalized_symbol): Check
12992         Symbol::is_common_shndx.
12993         (Symbol_table::sized_write_globals): Likewise.
12994         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12995         common symbol lists.  Don't call do_allocate_commons_list if the
12996         list is empty.
12997         (Symbol_table::do_allocate_commons_list): Remove is_tls
12998         parameter.  Add comons_section_type parameter.  Change all
12999         callers.  Handle small and large common symbols.
13000         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13001         Symbol::is_common_shndx.
13002         * resolve.cc (symbol_to_bits): Likewise.
13003         * target.h (Target::small_common_shndx): New function.
13004         (Target::small_common_section_flags): New function.
13005         (Target::large_common_shndx): New function.
13006         (Target::large_common_section_flags): New function.
13007         (Target::new_output_section): New function.
13008         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13009         small_common_section_flags, and large_common_section_flags
13010         fields.
13011         (Target::do_new_output_section): New virtual function.
13012         * arm.cc (Target_arm::arm_info): Initialize new fields.
13013         * i386.cc (Target_i386::i386_info): Likewise.
13014         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13015         Likewise.
13016         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13017         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13018         (Target_x86_64::do_new_output_section): New function.
13019         * configure.ac: Define conditional MCMODEL_MEDIUM.
13020         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13021         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13022         (large_LDFLAGS): Define.
13023         * testsuite/large.c: New file.
13024         * testsuite/testfile.cc (Target_test::test_target_info):
13025         Initialize new fields.
13026         * configure, testsuite/Makefile.in: Rebuild.
13027
13028 2009-06-05  Doug Kwan  <dougkwan@google.com>
13029
13030         * Makefile.am (CCFILES): Add target.cc.
13031         * Makefile.in: Regenerate.
13032         * i386.cc (class Target_i386): Define new virtual method to
13033         override do_is_local_label_name in parent.
13034         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13035         local symbols if --discard-locals or -X is given.
13036         * options.h (class General_options): Declare new options
13037         '--discard-locals' and '-X' for discarding locals.
13038         * target.h (class Target): Define new methods is_local_label_name.
13039         Declare new virtual method do_is_local_label_name.
13040         * target.cc: New file.
13041         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13042         (check_SCRIPTS): Add discard_locals_test.sh.
13043         (check_DATA): Add discard_local_tests.syms.
13044         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13045         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13046         * testsuite/Makefile.in: Regenerate.
13047         * testsuite/discard_locals_test.c: New file.
13048         * testsuite/discard_locals_test.sh: Same.
13049
13050 2009-06-05  Doug Kwan  <dougkwan@google.com>
13051
13052         * object.cc (Sized_relobj::Sized_relobj): Initialize
13053         discarded_eh_frame_shndx_ to -1U.
13054         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13055         section.
13056         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13057         a discarded .eh_frame section.
13058         (Sized_relobj::do_finalize_local_symbols): Ditto.
13059         * object.h (class Sized_relobj): Declare new member
13060         discarded_eh_frame_shndx_.
13061         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13062         (local_labels_test.o, local_labels_test): New rules.
13063         * testsuite/Makefile.in: Regenerate.
13064
13065 2009-06-04  Doug Kwan  <dougkwan@google.com>
13066
13067         * layout.cc (Layout::section_name_mapping): Add mapping for
13068         special ARM sections.
13069
13070 2009-06-03  Doug Kwan  <dougkwan@google.com>
13071
13072         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13073         (utils::has_overflow): Same.
13074
13075 2009-06-03  Ian Lance Taylor  <iant@google.com>
13076
13077         * layout.cc (Layout::section_name_mapping): New array, replacing
13078         Layout::linkonce_mapping.
13079         (Layout::section_name_mapping_count): New variable, replacing
13080         Layout::linkonce_mapping_count.
13081         (Layout::linkonce_output_name): Remove.
13082         (Layout::output_section_name): Rewrite.
13083         * layout.h (class Layout): Rename Linkonce_mapping to
13084         Section_name_mapping, linkonce_mapping to section_name_mapping,
13085         linkonce_mapping_count to section_name_mapping_count.  Don't
13086         declare linkonce_output_name.
13087
13088 2009-06-03  Doug Kwan  <dougkwan@google.com>
13089
13090         * gold/arm.cc (namespace utils): New.
13091         (Target_arm::reloc_is_non_pic): Define new method.
13092         (class Arm_relocate_functions): New.
13093         (Target_arm::Relocate::relocate): Handle relocation types used by
13094         Android.
13095
13096 2009-06-03  Ian Lance Taylor  <iant@google.com>
13097
13098         * arm.cc (Target_arm::scan::global): Use || instead of |.
13099
13100 2009-06-02  Doug Kwan  <dougkwan@google.com>
13101
13102         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13103         issued_non_pic_error_.
13104         (class Target_arm::Scan): Declare new method check_non_pic.
13105         Define new method symbol_needs_plt_entry.
13106         Declare new data member issued_non_pic_error_.
13107         (class Target_arm::Relocate): Declare new method
13108         should_apply_static_reloc.
13109         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13110         (Target_arm::Scan::check_non_pic): Define new method.
13111         (Target_arm::Scan::local): Handle a small subset of reloc types used
13112         by Android.
13113         (Target_arm::Scan::local): Same.
13114         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13115
13116 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13117
13118         * incremental.cc (Incremental_inputs::report_command_line): Filter
13119         out --incremental-* options.
13120
13121 2009-05-29  Doug Kwan  <dougkwan@google.com>
13122
13123         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13124         template class.
13125         (class Target_arm): Update comment.
13126         (Target_arm::Target_arm): Initialize new data members GOT_,
13127         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13128         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13129         and Target_arm::rel_dyn_section.
13130         Declare new_enum Target_arm::Got_type.
13131         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13132         and DYNBSS_.
13133         Update commments for member do_dynsym_value.
13134         (Target_arm::got_size, Target_arm::plt_section,
13135         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13136         new methods inside class defintion.
13137         (Target_arm::got_section): Define new method.
13138         (Target_arm::rel_dyn_section): Same.
13139         (Output_data_plt_arm): New template class.
13140         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13141         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13142         (Output_data_plt_arm::add_entry): Same.
13143         (Output_data_plt_arm::first_plt_entry): Define new
13144         static data member for PLT instruction template.
13145         (Output_data_plt_arm::plt_entry): Same.
13146         (Output_data_plt_arm::do_write): Define new method.
13147         (Target_arm::make_plt_entry): Same.
13148         (Target_arm::do_finalize_sections): Same.
13149         (Target_arm::do_dynsym_value): Same.
13150
13151 2009-05-28  Doug Kwan  <dougkwan@google.com>
13152
13153         * Makefile.am (TARGETSOURCES): Add arm.cc.
13154         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13155         * Makefile.in: Regenerate.
13156         * arm.cc: New file.
13157         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13158
13159 2009-05-26  Doug Kwan  <dougkwan@google.com>
13160
13161         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13162         (General_options::check_excluded_libs): Strip off directories in
13163         archive name before matching like GNU ld does.
13164         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13165         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13166         (exclude_libs_test_LDFLAGS): Add linker option
13167         -Wl,--exclude-libs,libexclude_libs_test_3
13168         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13169         an explicit archive without using -l.
13170         (alt/libexclude_libs_test_3.a): New make rule.
13171         * testsuite/Makefile.in: Regenerate.
13172         * testsuite/exclude_libs_test.c : Declare lib3_default().
13173         (main): Call it.
13174         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13175         * exclude_libs_test_3.c: New file.
13176
13177 2009-05-26  Nick Clifton  <nickc@redhat.com>
13178
13179         * po/id.po: New Indonesian translation.
13180         * po/gold.pot: Updated template file.
13181
13182 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13183
13184         * testsuite/Makefile.am: Add -ffunction-sections to compile
13185         gc_comdat_test files.  Add -Wl,--gc-sections to build
13186         gc_comdat_test.
13187         * testsuite/Makefile.in: Regenerate.
13188         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13189
13190 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13191
13192         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13193         kept comdat section was garbage collected.
13194         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13195         * testsuite/Makefile.in: Regenerate.
13196         * testsuite/gc_comdat_test.sh: New file.
13197         * testsuite/gc_comdat_test_1.cc: New file.
13198         * testsuite/gc_comdat_test_2.cc: New file.
13199
13200 2009-05-19  Doug Kwan  <dougkwan@google.com>
13201
13202         * archive.cc (Archive::Archive): Move constructor from archive.h
13203         to here.  Initialize no_export_.
13204         (Archive::get_elf_object_for_member): Set no_export flag of object.
13205         * archive.h (Archive::Archive): Move constructor body to
13206         archive.cc.
13207         (Archive::no_export): New method.
13208         (Archive::no_export_): New field.
13209         * object.h (Object::Object): Initialize no_export_ to false.
13210         (Object::no_export, Object::set_no_export): New methods.
13211         (Object::no_export_): New field.
13212         * options.cc (General_options::parse_exclude_libs): New method.
13213         (General_options::check_excluded_libs) Same.
13214         * options.h (exclude_libs): New option.
13215         (General_options::check_excluded_libs): New method declaration.
13216         (General_options::excluded_libs_): New field.
13217         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13218         default or protected visibility if an object has no-export flag set.
13219         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13220         (check_SCRIPTS): Add exclude_libs_test.sh.
13221         (check_DATA): Add exclude_libs_test.syms.
13222         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13223         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13224         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13225         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13226         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13227         libexclude_libs_test_2.a): New rules.
13228         * testsuite/Makefile.in: Regenerate.
13229         * testsuite/exclude_libs_test.c: New file.
13230         * testsuite/exclude_libs_test.sh: Ditto.
13231         * testsuite/exclude_libs_test_1.c: Ditto.
13232         * testsuite/exclude_libs_test_2.c: Ditto.
13233
13234 2009-05-15  Ian Lance Taylor  <iant@google.com>
13235
13236         * configure.ac: Check for declarations for cases where libiberty.h
13237         checks HAVE_DECL_xxx.
13238         * configure, config.in: Rebuild.
13239
13240 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13241
13242         * gold.h (Incremental_argument_list): Remove (invalid) forward
13243         declaration.
13244         * incremental.cc (Incremental_inputs::report_achive): New method.
13245         (Incremental_inputs::report_object): New method.
13246         (Incremental_inputs::report_script): New method.
13247         (Incremental_inputs::finalize_inputs): New method.
13248         (Incremental_inputs::finalize): Call finalize_inputs().
13249         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13250         Create inputs entries.
13251         * incremental.h (Incremental_input_type): New enum.
13252         (Incremental_inputs::Incremental_input): Initialize new fields.
13253         (Incremental_inputs::report_inputs): New method.
13254         (Incremental_inputs::report_achive): New method.
13255         (Incremental_inputs::report_object): New method.
13256         (Incremental_inputs::report_script): New method.
13257         (Incremental_inputs::finalize_inputs): New method.
13258         (Incremental_inputs::Input_info): New struct.
13259         (Incremental_inputs::Input_info_map): New typedef.
13260         (Incremental_inputs::lock_): New field.
13261         (Incremental_inputs::Inputs_): New field.
13262         (Incremental_inputs::Inputs_map): New field.
13263         * main.cc (main): Call Incremental_input::report_inputs.
13264         * options.h (Input_argument_list): Typedef moved from
13265         Input_arguments.
13266         (Input_file_group::Files): Remove, use ::Input_argument_list.
13267         (Input_file_group::Input_argument_list): Remove, use
13268         ::Input_argument_list.
13269         * plugin.cc (Plugin_manager::add_input_file): Add error in
13270         incremental build.
13271         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13272         functions.
13273         * script.cc (read_input_script): Call
13274         Incremental_input::report_script.
13275         * script.h (Script_info): New class.
13276
13277 2009-04-27  Ian Lance Taylor  <iant@google.com>
13278
13279         * x86_64.cc (do_adjust_output_section): Set entsize to
13280         plt_entry_size.
13281
13282 2009-04-23  Elliott Hughes  <enh@google.com>
13283
13284         * output.cc (Output_file::close): After short writes, continue
13285         writing from the correct offset in the buffer being written.
13286
13287 2009-04-23  Chris Demetriou  <cgd@google.com>
13288
13289         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13290         * configure: Regenerate.
13291         * config.in: Regenerate.
13292         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13293         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13294
13295 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13296
13297         * incremental.cc (Incremental_inputs_header_data): Renamed from
13298         Incremental_input_header_data.
13299         (Incremental_inputs_header_data::data_size): New field.
13300         (Incremental_inputs_header_data::put_input_file_count): Renamed
13301         from input_file_count.
13302         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13303         from command_line_offset.
13304         (Incremental_inputs_header_data::put_reserved): Renamed from
13305         put_reserved.
13306         (Incremental_inputs_entry_data): Renamed from
13307         Incremental_input_entry_data.
13308         (Incremental_inputs_entry_data::data_size): New field.
13309         (Incremental_inputs::report_command_line): New method.
13310         (Incremental_inputs::finalize): New method.
13311         (Incremental_inputs::create_incremental_inputs_data): New method.
13312         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13313         * incremental.h: New file.
13314         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13315         (Layout::finalize): Create incremental inputs section in
13316         incremental builds.
13317         (Layout::create_incremental_info_sections): New method.
13318         * layout.h (Layout::incremental_inputs): New method.
13319         (Layout::create_incremental_info_sections): New method.
13320         (Layout::incremental_inputs_): New field.
13321         * main.cc (main): Notify Incremental_input of the command line.
13322
13323 2009-04-01  Ian Lance Taylor  <iant@google.com>
13324             Mikolaj Zalewski  <mikolajz@google.com>
13325
13326         * gold.h (reserve_unordered_map): Define, three versions, one for
13327         each version of Unordered_map.
13328         * layout.cc (Layout::Layout): Remove options parameter.  Add
13329         number_of_input_files parameter.  Don't initialize options_.
13330         Initialize number_of_input_files_ and resized_signatures_.  Move
13331         sections_are_attached_.
13332         (Layout::layout_group): Reserve space for group_signatures_.
13333         (Layout::find_or_add_kept_section): Change name parameter to be a
13334         reference.  Resize signatures_ map when it gets large enough.
13335         (Layout::layout_eh_frame): Use parameters->options() instead of
13336         this->options_.
13337         (Layout::make_output_section): Likewise.
13338         (Layout::attach_allocated_section_to_segment): Likewise.
13339         (Layout::finalize, Layout::create_executable_stack): Likewise.
13340         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13341         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13342         * layout.h (class Layout): Update declarations.  Remove options_
13343         field.  Add number_of_input_files_ and resized_signatures_
13344         fields.  Move sections_are_attached_ field.
13345         * main.cc (main): Pass number of input files to Layout
13346         constructor.  Don't pass options.
13347
13348 2009-03-30  Ian Lance Taylor  <iant@google.com>
13349
13350         * ffsll.c (ffsll): Correct implementation.
13351
13352 2009-03-27  Ian Lance Taylor  <iant@google.com>
13353
13354         * ffsll.c: New file.
13355         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13356         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13357         * ftruncate.c (ftruncate): Declare before definition.
13358         * mremap.c (mremap): Likewise.
13359         * pread.c (pread): Likewise.
13360         * configure, Makefile.in, config.in: Rebuild.
13361
13362         * mremap.c: New file.
13363         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13364         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13365         (mremap): Declare if HAVE_MREMAP is not defined.
13366         * configure, Makefile.in, config.in: Rebuild.
13367
13368 2009-03-27  Cary Coutant  <ccoutant@google.com>
13369
13370         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13371         position independent.
13372         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13373         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13374
13375 2009-03-24  Cary Coutant  <ccoutant@google.com>
13376
13377         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13378         an executable.
13379         (needs_dynamic_reloc): Likewise.
13380
13381 2009-03-24  Ian Lance Taylor  <iant@google.com>
13382
13383         * yyscript.y (file_cmd): Recognize EXTERN.
13384         (extern_name_list, extern_name_list_body): New nonterminals.
13385         * script.cc (script_add_extern): Define.
13386         * script-c.h (script_add_extern): Declare.
13387
13388 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13389
13390         * object.cc (is_elf_object): Define.
13391         * object.h (is_elf_object): Declare.
13392         * archive.cc (Archive::get_elf_object_for_member): Call
13393         is_elf_object.
13394         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13395
13396 2009-03-24  Elliott Hughes  <enh@google.com>
13397
13398         * output.cc (Output_file::map_anonymous): Define.
13399         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13400         try an anonymous one.  Report the size if the mmap fails.
13401         * output.h (class Output_file): Declare map_anonymous.
13402
13403 2009-03-24  Ian Lance Taylor  <iant@google.com>
13404
13405         * target-select.cc (instantiate_target): Don't acquire the lock if
13406         the instantiated_target_ field has already been set.
13407
13408 2009-03-23  Ian Lance Taylor  <iant@google.com>
13409
13410         * gold-threads.h (class Initialize_lock): Define.
13411         * gold-threads.cc (class Initialize_lock_once): Define.
13412         (initialize_lock_control): New static variable.
13413         (initialize_lock_pointer): New static variable.
13414         (initialize_lock_once): New static function.
13415         (Initialize_lock::Initialize_lock): Define.
13416         (Initialize_lock::initialize): Define.
13417         * target-select.h: Include "gold-threads.h".
13418         (class Target_selector): Add lock_ and initialize_lock_ fields.
13419         Don't define instantiate_target, just declare it.
13420         * target-select.cc (Target_selector::Target_selector): Initialize
13421         new fields.
13422         (Target_selector::instantiate_target): Define.
13423         * descriptors.h: Include "gold-threads.h".
13424         (class Descriptors): Add initialize_lock_ field.
13425         * descriptors.cc (Descriptors::Descriptors): Initialize new
13426         field.
13427         (Descriptors::open): Use initialize_lock_ field
13428         * errors.h (class Errors): Add initialize_lock_ field.
13429         * errors.cc (Errors::Errors): Initialize new field.
13430         (Errors::initialize_lock): Use initialize_lock_ field.
13431         * powerpc.cc (class Target_selector_powerpc): Remove
13432         instantiated_target_ field.  In do_recognize call
13433         instantiate_target rather than do_instantiate_target.  In
13434         do_instantiate_target just allocate a new target.
13435         * sparc.cc (class Target_selector_sparc): Likewise.
13436
13437         * freebsd.h: New file.
13438         * i386.cc: Include "freebsd.h".
13439         (Target_i386): Derive from Target_freebsd rather than
13440         Sized_target.
13441         (Target_selector_i386): Derive from Target_selector_freebsd rather
13442         than Target_selector.
13443         * x86_64.cc: Include "freebsd.h".
13444         (Target_x86_64): Derive from Target_freebsd rather than
13445         Sized_target.
13446         (Target_selector_x86_64): Derive from Target_selector_freebsd
13447         rather than Target_selector.
13448         * target.h (class Target): Add adjust_elf_header and
13449         do_adjust_elf_header.
13450         * output.cc (Output_file_header:: do_sized_write): Call target
13451         adjust_elf_header routine.
13452         * configure.tgt: Set targ_osabi.
13453         * configure.ac: Define GOLD_DEFAULT_OSABI.
13454         * parameters.cc (Parameters::default_target): Pass
13455         GOLD_DEFAULT_OSABI to select_target.
13456         * target-select.h (class Target_selector): Make instantiate_target
13457         protected rather than private.
13458         * Makefile.am (HFILES): Add freebsd.h.
13459         * configure, Makefile.in, config.in: Rebuild.
13460
13461         * merge.cc (do_add_input_section): Correct pend value.  Change
13462         message about last entry not being null terminated from error to
13463         warning.
13464
13465 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13466
13467         * incremental.cc: New file.
13468         * Makefile.am (CCFILES): Add incremental.cc.
13469         * Makefile.in: Rebuild.
13470
13471 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13472
13473         * layout.cc (Layout::output_section_name): Preserve names
13474         of '.note.' sections.
13475
13476 2009-03-19  Ian Lance Taylor  <iant@google.com>
13477
13478         * descriptors.cc (Descriptors::open): Check that the options are
13479         valid before using them.
13480
13481 2009-03-18  Ian Lance Taylor  <iant@google.com>
13482
13483         * script-sections.h: Include <list>.
13484         (class Script_sections): Change Sections_elements from std::vector
13485         to std::list.  Typedef public Elements_iterator.  Add
13486         orphan_section_placement_, data_segment_align_start_, and
13487         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13488         field.
13489         * script-sections.cc (class Orphan_section_placement): New class.
13490         (class Sections_element): Add virtual functions is_relro and
13491         orphan_section_init.  Remove virtual function place_orphan_here.
13492         (class Output_section_definition): Add is_relro and
13493         orphan_section_init.  Remove place_orphan_here.
13494         (class Orphan_output_section): Likewise.
13495         (Script_sections::Script_sections): Update for field changes.
13496         (Script_sections::data_segment_align): Set saw_data_segment_align_
13497         and data_segment_align_start_, not data_segment_align_index.
13498         (Script_sections::data_segment_relro_end): Check
13499         saw_data_segment_align_.  Use data_segment_align_start_ rather
13500         than data_segment_align_index_.
13501         (Script_sections::place_orphan): Rewrite to use
13502         Orphan_section_placement.
13503
13504 2009-03-17  Ian Lance Taylor  <iant@google.com>
13505
13506         * archive.cc (Archive::add_symbols): Check for a version attached
13507         to the symbol name in the archive map.
13508         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13509         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13510         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13511         (ver_test_11.a): New target.
13512         * testsuite/Makefile.in: Rebuild.
13513
13514         * configure.ac: Check for chsize and posix_fallocate.  Replace
13515         ftruncate.
13516         * ftruncate.c: New file, from gnulib.
13517         * output.cc (posix_fallocate): Define dummy version if not
13518         HAVE_POSIX_FALLOCATE.
13519         (Output_file::map): Call posix_fallocate rather than lseek and
13520         write.
13521         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13522         * configure, Makefile.in, config.in: Rebuild.
13523
13524 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13525
13526         * layout.h (Layout::create_note): Add section_name parameter.
13527         * layout.cc (Layout::create_note): Likewise.
13528         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13529
13530 2009-03-17  Ian Lance Taylor  <iant@google.com>
13531
13532         * descriptors.cc: Include "options.h".
13533         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13534         (Descriptors::open): Always use O_CLOEXEC when opening a new
13535         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13536         then set FD_CLOEXEC.
13537
13538         * sparc.cc (class Target_sparc): Add has_got_section.
13539         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13540         make sure we have a GOT section.
13541
13542         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13543         (Target_sparc::Scan::local): Likewise.
13544         (Target_sparc::Scan::global): Likewise.
13545         (Target_sparc::Relocate::relocate): Likewise.
13546         (Target_sparc::Relocate::relocate_tls): Likewise.
13547
13548         * symtab.cc (Symbol_table::define_default_version): New function,
13549         broken out of add_from_object.
13550         (Symbol_table::add_from_object): Call define_default_version.
13551         (Symbol_table::define_special_symbol): Add resolve_oldsym
13552         parameter.  Change all callers.  If the version for a symbol comes
13553         from a version script, resolve it with the symbol with the same
13554         name with no version.  Also add the symbol without a version if
13555         appropriate.
13556         (do_define_in_output_data): If resolving with oldsym, don't delete
13557         sym.
13558         (do_define_in_output_segment): Likewise.
13559         (do_define_as_constant): Likewise.
13560         * symtab.h (class Symbol_table): Update declarations.
13561
13562 2009-03-13  Ian Lance Taylor  <iant@google.com>
13563
13564         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13565         (Read_symbols::requeue): New function.
13566         (Read_symbols::do_read_symbols): If make_elf_object fails because
13567         the target type is not configured, and the file was searched for,
13568         issue a warning and retry with the next directory.
13569         (Add_symbols::run): If the file has an incompatible format, and
13570         it was searched for, requeue the Read_symbols task.  On error,
13571         release the object.
13572         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13573         dirindex parameter to constructor.  Change all callers.  Declare
13574         incompatible_warning and requeue.
13575         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13576         input_argument_ and input_group_ fields.  Add them to
13577         constructor.  Change all callers.
13578         (class Read_script): Add dirindex_ field.  Add it to constructor.
13579         Change all callers.
13580         * archive.cc (Archive::setup): Remove input_objects parameter.
13581         Change all callers.
13582         (Archive::get_file_and_offset): Likewise.
13583         (Archive::read_all_symbols): Likewise.
13584         (Archive::read_symbols): Likewise.
13585         (Archive::get_elf_object_for_member): Remove input_objects
13586         parameter.  Add punconfigured parameter.  Change all callers.
13587         (Archive::add_symbols): Change return type to bool.  Check return
13588         value of include_member.
13589         (Archive::include_all_members): Likewise.
13590         (Archive::include_member): Change return type to bool.  Return
13591         false if first included object has incompatible target.  Set
13592         included_member_ field.
13593         (Add_archive_symbols::run): If add_symbols returns false, requeue
13594         Read_symbols task.
13595         * archive.h (class Archive): Add included_member_ field.
13596         Initialize it in constructor.  Add input_file and searched_for
13597         methods.  Update declarations.
13598         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13599         input_argument_ fields.  Add them to constructor.  Change all
13600         callers.
13601         * script.cc: Include "target-select.h".
13602         (class Parser_closure): Add skip_on_incompatible_target_ and
13603         found_incompatible_target_ fields.  Add
13604         skip_on_incompatible_target parameter to constructor.  Change all
13605         callers.  Add methods skip_on_incompatible_target,
13606         clear_skip_on_incompatible_target, found_incompatible_target, and
13607         set_found_incompatible_target.
13608         (read_input_script): Add dirindex parameter.  Change all callers.
13609         If parser finds an incompatible target, requeue Read_symbols
13610         task.
13611         (script_set_symbol): Clear skip_on_incompatible_target in
13612         closure.
13613         (script_add_assertion, script_parse_option): Likewise.
13614         (script_start_sections, script_add_phdr): Likewise.
13615         (script_check_output_format): New function.
13616         * script.h (read_input_script): Update declaration.
13617         * script-c.h (script_check_output_format): Declare.
13618         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13619         (ignore_cmd): Remove OUTPUT_FORMAT.
13620         * fileread.cc (Input_file::Input_file): Add explicit this.
13621         (Input_file::will_search_for): New function.
13622         (Input_file::open): Add pindex parameter.  Change all callers.
13623         * fileread.h (class Input_file): Add input_file_argument method.
13624         Declare will_search_for.  Update declarations.
13625         * object.cc (make_elf_object): Add punconfigured parameter.
13626         Change all callers.
13627         * object.h (class Object): Make input_file public.  Add
13628         searched_for method.
13629         (make_elf_object): Update declaration.
13630         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13631         restart search.
13632         * dirsearch.h (class Dirsearch): Update declaration.
13633         * options.h (class General_options): Add --warn-search-mismatch.
13634         * parameters.cc (Parameters::is_compatible_target): New function.
13635         * parameters.h (class Parameters): Declare is_compatible_target.
13636         * workqueue.cc (Workqueue::add_blocker): New function.
13637         * workqueue.h (class Workqueue): Declare add_blocker.
13638
13639         * fileread.cc (Input_file::open): Remove options parameter.
13640         Change all callers.
13641         (Input_file::open_binary): Likewise.
13642         * script.cc (read_input_script): Likewise.
13643         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13644         options parameter from constructor.  Change all callers.
13645         (class Read_script): Likewise.
13646         * fileread.h (class Input_file): Update declarations.
13647         * script.h (read_input_script): Update declaration.
13648
13649 2009-03-10  Nick Clifton  <nickc@redhat.com>
13650
13651         * po/es.po: New Spanish translation.
13652
13653 2009-03-06  Cary Coutant  <ccoutant@google.com>
13654
13655         * options.cc (parse_short_option): Keep dash_z from registering itself.
13656
13657 2009-03-03  Ian Lance Taylor  <iant@google.com>
13658
13659         PR 9918
13660         * target-reloc.h (relocate_section): Pass output_section to
13661         relocate.
13662         * i386.cc (Target_i386::should_apply_static_reloc): Add
13663         output_section parameter.  Change all callers.
13664         (Target_i386::Relocate::relocate): Add output_section parameter.
13665         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13666         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13667         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13668         * testsuite/two_file_shared.sh: New script.
13669         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13670         (check_DATA): Add two_file_shared.dbg.
13671         (two_file_shared.dbg): New target.
13672         * testsuite/Makefile.in: Rebuild.
13673
13674 2009-03-01  Ian Lance Taylor  <iant@google.com>
13675
13676         * configure.ac: Check for byteswap.h.
13677         * configure: Rebuild.
13678         * config.in: Rebuild.
13679
13680 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13681
13682         * layout.cc (Layout::find_or_add_kept_section): New function.
13683         (Layout::add_comdat): Removed.
13684         * layout.h (struct Kept_section): Move out of class Layout.
13685         Remove trailing underscores from field names.  Add group_sections
13686         field.  Rename group_ field to is_group.  Change all uses.
13687         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13688         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13689         comdat_groups_ field.
13690         (Sized_relobj::include_section_group): Use
13691         find_or_add_kept_section and Kept_section::group_sections.
13692         (Sized_relobj::include_linkonce_section): Likewise.
13693         * object.cc (class Sized_relobj): Don't define Comdat_group or
13694         Comdat_group_table.  Remove find_comdat_group and
13695         add_comdat_group.  Remove comdat_groups_ field.
13696         * plugin.cc (include_comdat_group): Use
13697         Layout::find_or_add_kept_section.
13698
13699 2009-02-28  Ian Lance Taylor  <iant@google.com>
13700
13701         * README: --gc-sections and map files are now supported.  Document
13702         some build requirements.
13703
13704         PR 6992
13705         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13706         relocatable link set the value of the section symbol to zero.
13707         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13708         relocatable link don't include the section address in the local
13709         symbol value.
13710
13711 2009-02-27  Ian Lance Taylor  <iant@google.com>
13712
13713         PR 6811
13714         * options.h (class Search_directory): Add is_system_directory.
13715         (class General_options): Declare is_in_system_directory.
13716         * options.cc (get_relative_sysroot): Make static.
13717         (get_default_sysroot): Make static.
13718         (General_optoins::is_in_system_directory): New function.
13719         * fileread.cc (Input_file::is_in_system_directory): New function.
13720         * fileread.h (class Input_file): Declare is_in_system_directory.
13721         * object.h (class Object): Add is_in_system_directory.
13722         (class Input_objects): Remove system_library_directory_ field.
13723         * object.cc (Input_objects::add_object): Don't set
13724         system_library_directory_.
13725         (input_objects::found_in_system_library_directory): Remove.
13726         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13727         parameter.  Change all callers.
13728         (Symbol_table::sized_write_globals): Likewise.
13729         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13730         Call Object::is_in_system_directory.
13731         * symtab.h (class Symbol_table): Update declarations.
13732
13733         PR 5990
13734         * descriptors.h (Open_descriptor): Add is_on_stack field.
13735         * descriptors.cc (Descriptors::open): If the descriptor is on the
13736         top of the stack, remove it.  Initialize is_on_stack field.
13737         (Descriptors::release): Only add pod to stack if it is not on the
13738         stack already.
13739         (Descriptors::close_some_descriptor): Clear stack_next and
13740         is_on_stack fields.
13741
13742         PR 7091
13743         * output.cc (Output_section::find_starting_output_address): Rename
13744         from starting_output_address; add PADDR parameter; change return
13745         type.
13746         * output.h (class Output_section): Declare
13747         find_starting_output_address instead of starting_output_address.
13748         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13749         section symbol for which we can't find a merge section.
13750
13751         PR 9836
13752         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13753         hidden or internal, force the symbol to be local.
13754         * resolve.cc (Symbol::override_visibility): Define.
13755         (Symbol::override_base): Use override_visibility.
13756         (Symbol_table::resolve): Likewise.
13757         (Symbol::override_base_with_special): Likewise.
13758         (Symbol_table::override_with_special): If the visibility is hidden
13759         or internal, force the symbol to be local.
13760         * symtab.h (class Symbol): Add set_visibility and
13761         override_visibility.
13762         * testsuite/ver_test_1.sh: New file.
13763         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13764         (check_DATA): Add ver_test_1.syms.
13765         (ver_test_1.syms): New target.
13766         * testsuite/Makefile.in: Rebuild.
13767
13768 2009-02-25  Cary Coutant  <ccoutant@google.com>
13769
13770         * layout.cc (Layout::choose_output_section): Don't rename sections
13771         when using a linker script that has a SECTIONS clause.
13772         * Makefile.in: Regenerate.
13773
13774         * testsuite/Makefile.am (script_test_5.sh): New test case.
13775         * testsuite/Makefile.in: Regenerate.
13776         * testsuite/script_test_5.cc: New file.
13777         * testsuite/script_test_5.sh: New file.
13778         * testsuite/script_test_5.t: New file.
13779
13780 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13781
13782         * archive.cc (Archive::include_member): Update calls to add_symbols.
13783         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13784         the Layout argument.
13785         * dynobj.h (do_add_symbols): Add the Layout argument.
13786         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13787         Layout argument.
13788         * object.h (Object::add_symbols): Add the Layout argument.
13789         (Object::do_add_symbols): Add the Layout argument.
13790         (Sized_relobj::do_add_symbols): Add the Layout argument.
13791         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13792         Unify the two versions.
13793         (Add_plugin_symbols): Remove.
13794         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13795         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13796         (Add_plugin_symbols): Remove.
13797         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13798         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13799         (Add_symbols::run): Make it work with Pulginobj.
13800
13801 2009-02-06  Ian Lance Taylor  <iant@google.com>
13802
13803         * object.cc (Sized_relobj::do_layout): Make info message start
13804         with lower case letter.
13805
13806 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13807
13808         * binary.cc: Fix file comment.
13809
13810         * options.h (enum Incremental_disposition): Define.
13811         (class General_options): Add new options: --incremental,
13812         --incremental_changed, --incremental_unchanged,
13813         --incremental_unknown.  Add incremental_disposition_ and
13814         implicit_incremental_ fields.
13815         (General_options::incremental_disposition): New function.
13816         (class Position_dependent_options): Add incremental_disposition
13817         option.
13818         (Position_dependent_options::copy_from_options): Set incremental
13819         dispositions.
13820         * options.cc (General_options::parse_incremental_changed): New
13821         function.
13822         (General_options::parse_incremental_unchanged): New function.
13823         (General_options::parse_incremental_unknown): New function.
13824         (General_options::General_options): Initialize new fields
13825         incremental_disposition_ and implicit_incremental_.
13826         (General_options::finalize): Check for uasge of --incremental-*
13827         without --incremental.
13828
13829 2009-02-06  Chris Demetriou  <cgd@google.com>
13830
13831         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13832         pointer and to report location as the file name associated with
13833         the symbol.
13834         (gold_undefined_symbol_at_location): New function to replace the
13835         old gold_undefined_symbol functionality.
13836         * target-reloc.h (relocate_section): Update to use
13837         gold_undefined_symbol_at_location.
13838         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13839         Call gold_undefined_symbol function rather than gold_error.
13840         * errors.h (Errors::undefined_symbol): Take location as a
13841         string, rather than calculating it from a relocation.
13842         * errors.cc (Errors::fatal): Print "fatal error:" before the
13843         formatted message.
13844         (Errors::error, Errors::error_at_location): Print "error: "
13845         before the formatted message.
13846         (Errors::undefined_symbol): Take location as a string, rather
13847         than calculating it from a relocation.
13848         (gold_undefined_symbol_at_location): New function akin to
13849         old gold_undefined_symbol, calculates location from relocation.
13850         (gold_undefined_symbol): Change to take only a Symbol pointer
13851         and to report location as the file name associated with the symbol.
13852         * testsuite/debug_msg.sh: Update for changed error messages.
13853         * testsuite/undef_symbol.sh: Likewise.
13854
13855 2009-02-04  Duncan Sands  <baldrick@free.fr>
13856
13857         PR 9812
13858         * reduced_debug_output.h
13859         (Output_reduced_debug_abbrev_section::failed): Use format for
13860         gold_warning.
13861         (Output_reduced_debug_info_section::faild): Likewise.
13862
13863 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13864
13865         * script.cc (Lazy_demangler): New class.
13866         (Version_script_info::get_symbol_version_helper): Demangle a
13867         symbol only once.
13868
13869 2009-01-29  Cary Coutant  <ccoutant@google.com>
13870
13871         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13872         to __tls_get_addr.
13873         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13874
13875 2009-01-28  Ian Lance Taylor  <iant@google.com>
13876
13877         * version.cc (version_string): Bump to 1.9.
13878
13879         * gold.h: Include <cstring> and <stdint.h>.
13880         * version.cc: Include <cstdio>.
13881         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13882         warning.
13883         * reduced_debug_output.cc (insert_into_vector): Rename from
13884         Insert_into_vector; change all callers.  Use Swap_unaligned to
13885         avoid aliasing issue; remove union since it is unnecessary.
13886
13887 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13888
13889         * Makefile.am (CCFILES): Add gc.cc.
13890         (HFILES): Add gc.h.
13891         * Makefile.in: Regenerate.
13892         * gold.cc (Gc_runner): New class.
13893         (queue_initial_tasks): Call garbage collection related tasks
13894         when corresponding options are invoked.
13895         (queue_middle_gc_tasks): New function.
13896         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13897         processed early before laying out sections during garbage collection.
13898         * gold.h (queue_middle_gc_tasks): New function.
13899         (is_prefix_of): Move from "layout.cc".
13900         * i386.cc (Target_i386::gc_process_relocs): New function.
13901         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13902         * main.cc (main): Create object of class "Garbage_collection".
13903         * object.cc (Relobj::copy_symbols_data): New function.
13904         (Relobj::is_section_name_included): New function.
13905         (Sized_relobj::do_layout): Allow this function to be called twice
13906         during garbage collection and defer layout of section during the
13907         first call.
13908         * object.h (Relobj::get_symbols_data): New function.
13909         (Relobj::is_section_name_included): New function.
13910         (Relobj::copy_symbols_data): New function.
13911         (Relobj::set_symbols_data): New function.
13912         (Relobj::get_relocs_data): New function.
13913         (Relobj::set_relocs_data): New function.
13914         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13915         (Relobj::gc_process_relocs): New function.
13916         (Relobj::do_gc_process_relocs): New pure virtual function.
13917         (Relobj::sd_): New data member.
13918         (Sized_relobj::is_output_section_offset_invalid): New function.
13919         (Sized_relobj::do_gc_process_relocs): New function.
13920         * options.h (General_options::gc_sections): Modify to not be a no-op.
13921         (General_options::print_gc_sections): New option.
13922         * plugin.cc (Plugin_finish::run): Remove function call to
13923         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13924         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13925         * reloc.cc (Read_relocs::run): Add task to process relocs and
13926         determine unreferenced sections when doing garbage collection.
13927         (Gc_process_relocs): New class.
13928         (Sized_relobj::do_gc_process_relocs): New function.
13929         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13930         sections that are garbage collected.
13931         * reloc.h (Gc_process_relocs): New class.
13932         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13933         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13934         symbols whose corresponding sections are garbage collected.
13935         (Symbol_table::Symbol_table): Add new parameter for the garbage
13936         collection object.
13937         (Symbol_table::gc_mark_undef_symbols): New function.
13938         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13939         (Symbol_table::gc_mark_dyn_syms): New function.
13940         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13941         as garbage.
13942         (Symbol_table::add_from_object): Likewise.
13943         (Symbol_table::add_from_relobj): When building shared objects, do not
13944         treat externally visible symbols as garbage.
13945         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13946         table information for static and relocatable links.
13947         * symtab.h (Symbol_table::set_gc): New function.
13948         (Symbol_table::gc): New function.
13949         (Symbol_table::gc_mark_undef_symbols): New function.
13950         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13951         (Symbol_table::gc_mark_dyn_syms): New function.
13952         (Symbol_table::gc_): New data member.
13953         * target.h (Sized_target::gc_process_relocs): New pure virtual
13954         function.
13955         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13956         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13957
13958 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13959
13960         * options.h (General_options::gc_sections): Define as a no-op for now.
13961         (General_options::no_keep_memory): Ditto.
13962         (General_options::Bshareable): Define.
13963         * options.cc (General_options::finalize): Honor -Bshareable.
13964
13965 2009-01-20  Andreas Schwab  <schwab@suse.de>
13966
13967         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13968         read the value in the contents, since we don't use it.  Use the
13969         template endianness when writing.
13970         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13971
13972 2009-01-19  Andreas Schwab  <schwab@suse.de>
13973
13974         * configure.tgt (powerpc64-*): Fix targ_obj.
13975
13976 2009-01-15  Ian Lance Taylor  <iant@google.com>
13977
13978         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13979         local symbols when stripping all symbols.
13980
13981 2009-01-14  Cary Coutant  <ccoutant@google.com>
13982
13983         * output.cc (Output_reloc): Add explicit instantiations.
13984
13985 2009-01-14  Cary Coutant  <ccoutant@google.com>
13986
13987         * archive.cc (Archive::get_elf_object_for_member): Remove call
13988         to File_read::claim_for_plugin.
13989         * descriptors.cc (Descriptors::open): Remove reference to
13990         is_claimed.
13991         (Descriptors::claim_for_plugin): Remove.
13992         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13993         (Descriptors::is_claimed): Remove.
13994         (claim_descriptor_for_plugin): Remove.
13995         * fileread.cc (File_read::claim_for_plugin): Remove.
13996         * fileread.h (File_read::claim_for_plugin): Remove.
13997         (File_read::descriptor): Reopen descriptor if necessary.
13998         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13999         (Plugin_manager::all_symbols_read): Add task parameter. Change
14000         all callers.
14001         (Plugin_manager::get_input_file): New function.
14002         (Plugin_manager::release_input_file): New function.
14003         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14004         corresponding data member.
14005         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14006         and pass to base constructor. Change all callers.
14007         (get_input_file, release_input_file): New functions.
14008         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14009         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14010         (Plugin_manager::all_symbols_read): Add task parameter.
14011         (Plugin_manager::get_input_file): New function.
14012         (Plugin_manager::release_input_file): New function.
14013         (Plugin_manager::task_): New data member.
14014         (Pluginobj::Pluginobj): Add filesize parameter.
14015         (Pluginobj::filename): New function.
14016         (Pluginobj::descriptor): New function.
14017         (Pluginobj::filesize): New function.
14018         (Pluginobj::filesize_): New data member.
14019         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14020         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14021         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14022
14023         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14024         with archive libraries.
14025         * testsuite/Makefile.in: Regenerate.
14026         * testsuite/plugin_test.c (struct sym_info): New type.
14027         (get_input_file, release_input_file): New static variables.
14028         (onload): Capture new transfer vector entries.
14029         (claim_file_hook): Stop reading at end of file according to filesize.
14030         Factor out parsing of readelf output into separate function.
14031         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14032         APIs and get the source file name from the symbol table.  Convert
14033         source file name to corresponding object file name.  Print info
14034         message when adding new input files.
14035         (parse_readelf_line): New function.
14036         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14037         * testsuite/plugin_test_2.sh: Likewise.
14038         * testsuite/plugin_test_3.sh: Likewise.
14039         * testsuite/plugin_test_4.sh: New test case.
14040
14041 2009-01-07  Ian Lance Taylor  <iant@google.com>
14042
14043         * version.cc (version_string): Bump to 1.8.
14044
14045 2008-12-23  Cary Coutant  <ccoutant@google.com>
14046
14047         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14048         * plugin.cc (Plugin_manager::finish): Rename as
14049         layout_deferred_objects.  Move cleanup to separate function.
14050         (Plugin_manager::cleanup): New function.
14051         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14052         separately.
14053         * plugin.h (Plugin_manager::finish): Rename as
14054         layout_deferred_objects.
14055         (Plugin_manager::cleanup): New function.
14056         (Plugin_manager::cleanup_done): New field.
14057
14058 2008-12-23  Cary Coutant  <ccoutant@google.com>
14059
14060         * plugin.cc (is_visible_from_outside): New function.
14061         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14062         so we don't return "IR only" status for exported symbols or -r links.
14063
14064         * testsuite/Makefile.am (plugin_test_3): New test case.
14065         * testsuite/Makefile.in: Regenerate.
14066         * testsuite/plugin_test_3.sh: New file.
14067
14068 2008-12-22  Cary Coutant  <ccoutant@google.com>
14069
14070         * object.cc (Sized_relobj::layout_section): New function.
14071         (Sized_relobj::do_layout): Defer layout of input sections until after
14072         plugin has provided replacement files.
14073         (Sized_relobj::do_layout_deferred_sections): New function.
14074         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14075         (Relobj::layout_deferred_sections): New function.
14076         (Relobj::do_layout_deferred_sections): New function.
14077         (Sized_relobj::do_layout_deferred_sections): New function.
14078         (Sized_relobj::layout_section): New function.
14079         (Sized_relobj::Deferred_layout): New structure.
14080         (Sized_relobj::deferred_layout_): New field.
14081         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14082         Change all callers.  Layout deferred sections.
14083         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14084         references.
14085         (Plugin_hook::run): Move code from do_plugin_hook inline.
14086         (Plugin_hook::do_plugin_hook): Remove.
14087         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14088         (Plugin_manager::finish): Renamed, was cleanup.
14089         (Plugin_manager::should_defer_layout): New function.
14090         (Plugin_manager::add_deferred_layout_object): New function.
14091         (Plugin_manager::Deferred_layout_list): New type.
14092         (Plugin_manager::deferred_layout_objects_): New field.
14093         (Plugin_hook::do_plugin_hook): Remove.
14094
14095 2008-12-17  Ian Lance Taylor  <iant@google.com>
14096
14097         * options.h (class General_options): Add --no case for
14098         --export-dynamic.
14099
14100 2008-12-16  Cary Coutant  <ccoutant@google.com>
14101
14102         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14103         vector.
14104         (Plugin_manager::claim_file): Create plugin object even if
14105         plugin did not call the add_symbols callback.
14106         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14107         asking for more symbols than were added.
14108         * testsuite/Makefile.am (plugin_test_1): Add test case with
14109         no global symbols.
14110         (empty.syms): New target.
14111         * testsuite/Makefile.in: Regenerate.
14112         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14113         message. Don't call add_symbols if no globals.
14114         (all_symbols_read_hook): Don't provide replacement for empty
14115         claimed file.
14116
14117 2008-12-12  Ian Lance Taylor  <iant@google.com>
14118
14119         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14120         r_type == 0 for a local symbol with r_sym == 0.
14121         (scan_relocatable_relocs): Pass r_sym to
14122         local_non_section_strategy.
14123         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14124         r_sym parameter.
14125
14126         * configure.ac: Update test for TLS descriptors: they are
14127         supported as of glibc 2.9.
14128         * configure: Rebuild.
14129
14130 2008-12-11  Ian Lance Taylor  <iant@google.com>
14131
14132         PR 7091
14133         * target-reloc.h (Default_scan_relocatable_relocs): For each
14134         function, map r_type == 0 to RELOC_DISCARD.
14135
14136 2008-12-10  Cary Coutant  <ccoutant@google.com>
14137
14138         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14139         object to override a kept COMDAT group from a plugin object.
14140
14141 2008-12-09  Ian Lance Taylor  <iant@google.com>
14142
14143         PR 7088
14144         * yyscript.y (file_cmd): Handle INPUT.
14145
14146         * testsuite/initpri1.c: Change all declarations to be full
14147         prototypes by adding void, to avoid compiler warnings.
14148
14149 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14150
14151         * options.cc (General_options::parse_plugin_opt): New.
14152         (General_options::add_plugin): The argument now is just the filename.
14153         (General_options::add_plugin_option): New.
14154         * options.h (plugin_opt): New.
14155         (add_plugin): Change argument name.
14156         (add_plugin_option): New.
14157         * plugin.cc (Plugin::load): Don't parse the plugin option.
14158         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14159         (Plugin::add_option): New.
14160         (Plugin::args_): Change type.
14161         (Plugin::filename_): New.
14162         (Plugin_manager::add_plugin_option): New.
14163         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14164         * testsuite/Makefile.in: Regenerate.
14165
14166 2008-12-05  Cary Coutant  <ccoutant@google.com>
14167
14168         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14169         Handle --strip-lto-sections option.
14170         * options.h (strip_lto_sections): New option.
14171
14172 2008-12-01  Cary Coutant  <ccoutant@google.com>
14173
14174         * plugin.cc (ld_plugin_message): Change format parameter to const.
14175         Fix mismatch between new[] and delete.
14176
14177 2008-11-14  Cary Coutant  <ccoutant@google.com>
14178
14179         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14180         instead of -1U.
14181
14182 2008-11-05  Craig Silverstein  <csilvers@google.com>
14183
14184         * options.cc (General_options::parse_dynamic_list): New function.
14185         * options.h (General_options): New flags dynamic_list,
14186         dynamic_list_data, dynamic_list_cpp_new, and
14187         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14188         (General_options::in_dynamic_list): New function.
14189         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14190         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14191         (Lex::can_continue_name): Likewise.
14192         (yylex): Likewise.
14193         (read_script_file): New parameter script_options.
14194         (read_dynamic_list): New function.
14195         (Script_options::define_dynamic_list): New function.
14196         (dynamic_list_keyword_parsecodes): New variable.
14197         (dynamic_list_keywords): New variable.
14198         * script.h (Script_options::define_dynamic_list): New function
14199         prototype.
14200         (read_dynamic_list): New function prototype.
14201         * symtab.cc (strprefix): New macro.
14202         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14203         dynamic_list_data, dynamic_list_cpp_new, and
14204         dynamic_list_cpp_typeinfo.
14205         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14206         (dynamic_list_expr): New rule.
14207         (dynamic_list_nodes): Likewise.
14208         (dynamic_list_node): Likewise.
14209         * testsuite/Makefile.am (dynamic_list): New test.
14210         * testsuite/Makefile.in: Regenerated.
14211         * testsuite/dynamic_list.t: New file.
14212         * testsuite/dynamic_list.sh: New file.
14213
14214 2008-11-05  Craig Silverstein  <csilvers@google.com>
14215
14216         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14217         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14218         (t11_last): Likewise.
14219         * testsuite/ver_test_6.c (main): Likewise.
14220
14221 2008-10-07  Cary Coutant  <ccoutant@google.com>
14222
14223         * options.c (General_options::finalize): Add check for -static and
14224         -shared.
14225         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14226         is not empty.
14227
14228 2008-10-02  Cary Coutant  <ccoutant@google.com>
14229
14230         * plugin.cc (make_sized_plugin_object): Fix conditional
14231         compilation to work when not all targets are enabled.
14232
14233 2008-09-29  Cary Coutant  <ccoutant@google.com>
14234
14235         * archive.cc (Archive::get_file_and_offset): Use filename instead
14236         of name to get library path.
14237         (Archive::include_member): Unlock external member of a thin archive.
14238
14239         * testsuite/Makefile.am (TEST_AR): New variable.
14240         (thin_archive_test_1): New test.
14241         (thin_archive_test_2): New test.
14242         * testsuite/Makefile.in: Regenerate.
14243         * testsuite/thin_archive_main.cc: New file.
14244         * testsuite/thin_archive_test_1.cc: New file.
14245         * testsuite/thin_archive_test_2.cc: New file.
14246         * testsuite/thin_archive_test_3.cc: New file.
14247         * testsuite/thin_archive_test_4.cc: New file.
14248
14249 2008-09-29  Cary Coutant  <ccoutant@google.com>
14250
14251         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14252         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14253         instead of -1U.
14254         (Sized_relobj::do_finalize_local_symbols): Likewise.
14255         (Sized_relobj::map_to_kept_section): Likewise.
14256         * object.h (Sized_relobj::invalid_address): New constant.
14257         (Sized_relobj::do_output_section_offset): Check for invalid_address
14258         and return -1ULL.
14259         * output.cc (Output_reloc::local_section_offset): Use constant
14260         invalid_address instead of -1U.
14261         (Output_reloc::get_address): Likewise.
14262         (Output_section::output_address): Change -1U to -1ULL.
14263         * output.h (Output_reloc::invalid_address): New constant.
14264         * reloc.cc (Sized_relobj::write_sections): Use constant
14265         invalid_address instead of -1U.
14266         (Sized_relobj::relocate_sections): Likewise.
14267         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14268         values for merge sections.
14269         * target-reloc.h (relocate_for_relocatable): Use constant
14270         invalid_address instead of -1U.
14271
14272 2008-09-19  Cary Coutant  <ccoutant@google.com>
14273
14274         Add plugin functionality for link-time optimization (LTO).
14275         * configure.ac (plugins): Add --enable-plugins option.
14276         * configure: Regenerate.
14277         * config.in: Regenerate.
14278         * Makefile.am (LIBDL): New variable.
14279         (CCFILES): Add plugin.cc.
14280         (HFILES): Add plugin.h.
14281         (ldadd_var): Add LIBDL.
14282         * Makefile.in: Regenerate.
14283
14284         * archive.cc: Include "plugin.h".
14285         (Archive::setup): Don't preread archive symbols when using a plugin.
14286         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14287         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14288         files.
14289         (Archive::include_member): Add symbols from plugin objects.
14290         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14291         * descriptors.cc (Descriptors::open): Check for file descriptors
14292         abandoned by plugins.
14293         (Descriptors::claim_for_plugin): New function.
14294         * descriptors.h (Descriptors::claim_for_plugin): New function.
14295         (Open_descriptor::is_claimed): New field.
14296         (claim_descriptor_for_plugin): New function.
14297         * fileread.cc (File_read::claim_for_plugin): New function.
14298         * fileread.h (File_read::claim_for_plugin): New function.
14299         (File_read::descriptor): New function.
14300         * gold.cc: Include "plugin.h".
14301         (queue_initial_tasks): Add task to call plugin hooks for generating
14302         new object files.
14303         * main.cc: Include "plugin.h".
14304         (main): Load plugin libraries.
14305         * object.h (Pluginobj): Declare.
14306         (Object::pluginobj): New function.
14307         (Object::do_pluginobj): New function.
14308         (Object::set_target): New function.
14309         * options.cc: Include "plugin.h".
14310         (General_options::parse_plugin): New function.
14311         (General_options::General_options): Initialize plugins_ field.
14312         (General_options::add_plugin): New function.
14313         * options.h (Plugin_manager): Declare.
14314         (General_options): Add --plugin option.
14315         (General_options::has_plugins): New function.
14316         (General_options::plugins): New function.
14317         (General_options::add_plugin): New function.
14318         (General_options::plugins_): New field.
14319         * plugin.cc: New file.
14320         * plugin.h: New file.
14321         * readsyms.cc: Include "plugin.h".
14322         (Read_symbols::do_read_symbols): Check for archive before checking
14323         for ELF file.  Call plugin hooks to claim files.
14324         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14325         from a real object file; force override when processing replacement
14326         files.
14327         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14328         (Symbol::init_base_object): Likewise.
14329         (Symbol::init_base_output_data): Likewise.
14330         (Symbol::init_base_output_segment): Likewise.
14331         (Symbol::init_base_constant): Likewise.
14332         (Symbol::init_base_undefined): Likewise.
14333         (Symbol::output_section): Assert that object is not a plugin.
14334         (Symbol_table::add_from_pluginobj): New function.
14335         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14336         undefined.
14337         (Symbol_table::sized_write_globals): Likewise.
14338         (Symbol_table::add_from_pluginobj): Instantiate template.
14339         * symtab.h (Sized_pluginobj): Declare.
14340         (Symbol::in_real_elf): New function.
14341         (Symbol::set_in_real_elf): New function.
14342         (Symbol::in_real_elf_): New field.
14343         (Symbol_table::add_from_pluginobj): New function.
14344
14345         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14346         (LIBDL): New variable.
14347         (LDADD): Add LIBDL.
14348         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14349         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14350         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14351         (MOSTLYCLEANFILES): Likewise.
14352         * testsuite/Makefile.in: Regenerate.
14353         * testsuite/plugin_test.c: New file.
14354         * testsuite/plugin_test_1.sh: New file.
14355         * testsuite/plugin_test_2.sh: New file.
14356
14357 2008-09-16  Ian Lance Taylor  <iant@google.com>
14358
14359         * target-reloc.h (relocate_section): Check whether a symbol is
14360         defined by the ABI before reporting an undefined symbol error.
14361         * target.h (Target::is_defined_by_abi): Make parameter const.
14362         (Target::do_is_defined_by_abi): Likewise.
14363         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14364         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14365         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14366         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14367         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14368         * testsuite/Makefile.in: Rebuild.
14369
14370         * fileread.cc (make_view): Add casts to avoid warning.
14371
14372 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14373
14374         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14375         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14376
14377 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14378
14379         * options.h (General_options::output_is_executable): New.
14380         (General_options::output_is_pie): New.
14381         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14382         for shared libraries.
14383         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14384
14385 2008-09-11  Chris Demetriou  <cgd@google.com>
14386
14387         * options.h (origin): New -z option.
14388         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14389         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14390         in DT_FLAGS_1.
14391
14392 2008-09-05  Cary Coutant  <ccoutant@google.com>
14393
14394         * fileread.cc (File_read::make_view): Add check for attempt to map
14395         beyond end of file.
14396
14397 2008-09-05  Cary Coutant  <ccoutant@google.com>
14398
14399         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14400         explicit instantiations.
14401
14402 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14403
14404         PR gold/6858
14405         * options.cc (General_options::finalize): Allow undefined symbols
14406         in shlibs if linking -shared.
14407
14408         PR gold/6859
14409         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14410         symbols as not needing a dynsym entry.
14411
14412 2008-08-20  Craig Silverstein  <csilvers@google.com>
14413
14414         * fileread.cc (File_read::open): Do not lock the file unless it
14415         was successfully opened.
14416
14417 2008-08-14  Cary Coutant  <ccoutant@google.com>
14418
14419         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14420         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14421         * testsuite/tls_test.cc (struct int128): 128-bit struct
14422         for testing TLS relocs with non-zero addend.
14423         (v12): New TLS variable.
14424         (t12): New test.
14425         (t_last): Add check for v12.
14426         * testsuite/tls_test.h (t12): New function.
14427         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14428
14429 2008-08-13  Ian Lance Taylor  <iant@google.com>
14430
14431         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14432         set tls_segment_ or relro_segment_.
14433         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14434         when appropriate.
14435         * output.h (Output_section::clear_is_relro): New function.
14436         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14437         sections specially even when output_data_ is empty.
14438         (Output_segment::maximum_alignment): When first section is relro,
14439         only force alignment for PT_LOAD segments.
14440         * script.cc (script_data_segment_align): New function.
14441         (script_data_segment_relro_end): New function.
14442         * script-c.h (script_data_segment_align): Declare.
14443         (script_data_segment_relro_end): Declare.
14444         * script-sections.h (class Script_sections): Declare
14445         data_segment_align and data_segment_relro_end.  Add fields
14446         segment_align_index_ and saw_relro_end_.
14447         * script-sections.cc (class Sections_element): Add set_is_relro
14448         virtual function.  Add new bool* parameter to place_orphan_here.
14449         Add get_output_section virtual function.
14450         (class Output_section_definition): Add set_is_relro.  Add new
14451         bool* parameter to place_orphan_here.  Add get_output_section.
14452         Add is_relro_ field.
14453         (Output_section_definition::Output_section_definition): Initialize
14454         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14455         and is_relro_ fields.
14456         (Output_section_definition::place_orphan_here): Add is_relro
14457         parameter.
14458         (Output_section_definition::set_section_addresses): Set relro for
14459         output section.
14460         (Output_section_definition::alternate_constraint): Likewise.
14461         (class Orphan_output_section): Add new bool* parameter to
14462         place_orphan_here.  Add get_output_section.
14463         (Orphan_output_section::place_orphan_here): Add is_relro
14464         parameter.
14465         (Script_sections::Script_sections): Initialize
14466         data_segment_align_index_ and saw_relro_end_.
14467         (Script_sections::data_segment_align): New function.
14468         (Script_sections::data_segment_relro_end): New function.
14469         (Script_sections::place_orphan): Set or clear is_relro.
14470         (Script_sections::set_section_addresses): Force alignment of first
14471         TLS section.
14472         * yyscript.y (exp): Call script_data_segment_align and
14473         script_data_segment_relro_end.
14474         * testsuite/relro_script_test.t: New file.
14475         * testsuite/relro_test.cc (using_script): Declare.
14476         (t1, t2): Test using_script.
14477         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14478         (relro_script_test_SOURCES): Define.
14479         (relro_script_test_DEPENDENCIES): Define.
14480         (relro_script_test_LDFLAGS): Define.
14481         (relro_script_test_LDADD): Define.
14482         (relro_script_test.so): New target.
14483         * testsuite/Makefile.in: Rebuild.
14484
14485 2008-08-06  Cary Coutant <ccoutant@google.com>
14486
14487         * archive.cc (Archive::total_archives, Archive::total_members)
14488         (Archive::total_members_loaded): New variables.
14489         (Archive::setup): Add parameter.  Add option to preread
14490         archive symbols.
14491         (Archive::read_armap): Add counter.
14492         (Archive::get_file_and_offset): New function.
14493         (Archive::get_elf_object_for_member): New function.
14494         (Archive::read_all_symbols): New function.
14495         (Archive::read_symbols): New function.
14496         (Archive::add_symbols): Add counters.
14497         (Archive::include_all_members): Use armap to find members if it's
14498         already built.
14499         (Archive::include_member): Skip reading symbols if already read.
14500         Factored code into Archive::get_file_and_offset and
14501         Archive::get_elf_object_for_member.  Changed call to
14502         Mapfile::report_include_archive_member.
14503         (Archive::print_stats): New function.
14504         * archive.h: Declare Object and Read_symbols_data classes.
14505         (Archive::Archive): Add initializers for new members.
14506         (Archive::setup): Add parameter.
14507         (Archive::print_stats): New function.
14508         (Archive::total_archives, Archive::total_members)
14509         (Archive::total_members_loaded): New variables.
14510         (Archive::get_file_and_offset): New function.
14511         (Archive::get_elf_object_for_member): New function.
14512         (Archive::read_all_symbols): New function.
14513         (Archive::read_symbols): New function.
14514         (Archive::Archive_member): New class.
14515         (Archive::members_): New member.
14516         (Archive::num_members_): New member.
14517         * main.cc: Include archive.h.
14518         (main): Call Archive::print_stats.
14519         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14520         archive parameter; member_name is now the fully-decorated name.
14521         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14522         * options.h: (General_options): Add --preread-archive-symbols option.
14523         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14524         Archive::setup.
14525
14526 2008-08-04  Ian Lance Taylor  <iant@google.com>
14527
14528         * symtab.h (Symbol::use_plt_offset): New function.
14529         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14530         * powerpc.cc (Relocate::relocate): Likewise.
14531         * sparc.cc (Relocate::relocate): Likewise.
14532         * x86_64.cc (Relocate::relocate): Likewise.
14533         * testsuite/weak_plt.sh: New test.
14534         * testsuite/weak_plt_main.cc: New test.
14535         * testsuite/weak_plt_shared.cc: New test.
14536         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14537         (check_PROGRAMS): Add weak_plt.
14538         (check_DATA): Add weak_plt_shared.so.
14539         (weak_plt_main_pic.o, weak_plt): New targets.
14540         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14541         * testsuite/Makefile.in: Rebuild.
14542
14543         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14544         gcctestdir/ld.
14545         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14546         * testsuite/Makefile.in: Rebuild.
14547
14548 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14549
14550         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14551         * Makefile.in: Regenerate.
14552         * po/POTFILES.in: Regenerate.
14553
14554 2008-07-29  Ian Lance Taylor  <iant@google.com>
14555
14556         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14557         symbols before other symbols.
14558         * testsuite/script_test_2.cc (test_addr): Declare.
14559         (test_addr_alias): Declare.
14560         (main): Check that test_addr and test_addr_alias have the right
14561         values.
14562         * testsuite/script_test_2.t: Define test_addr_alias and
14563         test_addr.
14564
14565 2008-07-24  Ian Lance Taylor  <iant@google.com>
14566
14567         PR 5990
14568         * descriptors.cc: New file.
14569         * descriptors.h: New file.
14570         * gold-threads.h (class Hold_optional_lock): New class.
14571         * fileread.cc: Include "descriptors.h".
14572         (File_read::~File_read): Release descriptor rather than closing
14573         it.
14574         (File_read::open) [file]: Call open_descriptor rather than open.
14575         Set is_descriptor_opened_.
14576         (File_read::open) [memory]: Assert that descriptor is not open.
14577         (File_read::reopen_descriptor): New function.
14578         (File_read::release): Release descriptor.
14579         (File_read::do_read): Make non-const.  Reopen descriptor.
14580         (File_read::read): Make non-const.
14581         (File_read::make_view): Reopen descriptor.
14582         (File_read::do_readv): Likewise.
14583         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14584         Update declarations.
14585         * layout.cc: Include "descriptors.h".
14586         (Layout::create_build_id): Use open_descriptor rather than open.
14587         * output.cc: Include "descriptors.h".
14588         (Output_file::open): Use open_descriptor rather than open.
14589         * archive.cc (Archive::const_iterator): Change Archive to be
14590         non-const.
14591         (Archive::begin, Archive::end): Make non-const.
14592         (Archive::count_members): Likewise.
14593         * archive.h (class Archive): Update declarations.
14594         * object.h (Object::read): Make non-const.
14595         * Makefile.am (CCFILES): Add descriptors.cc.
14596         (HFILES): Add descriptors.h.
14597         * Makefile.in: Rebuild.
14598
14599         PR 6716
14600         * gold.h: Always include <clocale>.  Add Solaris workarounds
14601         following code in binutils/sysdep.h.
14602
14603         PR 6048
14604         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14605         this->eh_frame_hdr_ is NULL before using it.
14606
14607         * dynobj.cc (Versions::Versions): Update comment.
14608
14609         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14610         the base version name.
14611
14612         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14613         array size plus one.
14614         (Stringpool_template::set_string_offsets): Subtract one from key
14615         before using it as an array index.
14616         (Stringpool_template::get_offset_with_length): Likewise.
14617         (Stringpool_template::write_to_buffer): Likewise.
14618         * stringpool.h (Stringpool_template::get_offset_from_key):
14619         Likewise.
14620
14621 2008-07-23  Ian Lance Taylor  <iant@google.com>
14622
14623         PR 6658
14624         * object.h (Merged_symbol_value::value): Do our best to handle a
14625         negative addend.
14626
14627         PR 6647
14628         * script.cc (Version_script_info::get_versions): Don't add empty
14629         version tag to return value.
14630         (Version_script_info::get_symbol_version_helper): Change return
14631         type to bool.  Add pversion parameter.  Change all callers.
14632         (script_register_vers_node): Don't require a non-NULL tag.
14633         * script.h (class Version_script_info): Update declarations.
14634         (Version_script_info::get_symbol_version): Change return type to
14635         bool.  Add version parameter.  Change all callers.
14636         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14637         handling.  Handle an empty version from a version script.
14638         (Symbol_table::define_special_symbol): Likewise.
14639         * testsuite/ver_test_10.script: New file.
14640         * testsuite/ver_test_10.sh: New file.
14641         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14642         (check_DATA): Add ver_test_10.syms.
14643         (ver_test_10.syms, ver_test_10.so): New target.
14644         * testsuite/Makefile.in: Rebuild.
14645
14646 2008-07-23  Simon Baldwin  <simonb@google.com>
14647
14648         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14649         to zero for undefined symbols from dynamic libraries.
14650
14651 2008-07-23  Ian Lance Taylor  <iant@google.com>
14652
14653         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14654         Change all callers.
14655         * symtab.h (class Symbol_table): Update declaration.
14656         * testsuite/ver_test_9.cc: New file.
14657         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14658         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14659         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14660         (ver_test_9.so, ver_test_9.o): New targets.
14661         * testsuite/Makefile.in: Rebuild.
14662
14663 2008-07-22  Ian Lance Taylor  <iant@google.com>
14664
14665         * options.h (class General_options): Define --check-sections.
14666         * layout.cc (Layout::set_segment_offsets): Handle
14667         --check-sections.
14668
14669         * options.h (class General_options): Define -n/--nmagic and
14670         -N/--omagic.
14671         * options.cc (General_options::finalize): For -n/--nmagic or
14672         -N/--omagic, set -static.
14673         * layout.cc (Layout::attach_allocated_section_to_segment): If
14674         -N/--omagic, don't put read-only and read-write sections in
14675         different segments.
14676         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14677         finding a read-only segment.
14678         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14679         don't set the minimum segment alignment to the common page size,
14680         and don't set the file offset to the address modulo the page size.
14681         * script-sections.cc (Script_sections::create_segments): If
14682         -n/--omagic, don't put read-only and read-write sections in
14683         different segments.
14684
14685         * cref.cc: New file.
14686         * cref.h: New file.
14687         * options.h (class General_options): Add --print-symbol-counts.
14688         * main.cc (main): Issue defined symbol report if requested.
14689         * archive.cc (Archive::interpret_header): Make into a const member
14690         function.
14691         (Archive::add_symbols): Call Input_objects::archive_start and
14692         archive_stop.
14693         (Archive::const_iterator): Define new class.
14694         (Archive::begin, Archive::end): New functions.
14695         (Archive::include_all_members): Rewrite to use iterator.
14696         (Archive::count_members): New function.
14697         * archive.h (class Archive): Update declarations.
14698         (Archive::filename): New function.
14699         * object.cc: Include "cref.h".
14700         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14701         (Sized_relobj::do_get_global_symbol_counts): New function.
14702         (Input_objects::add_object): Add object to cross-referencer.
14703         (Input_objects::archive_start): New function.
14704         (Input_objects::archive_stop): New function.
14705         (Input_objects::print_symbol_counts): New function.
14706         * object.h: Declare Cref and Archive.
14707         (Object::get_global_symbol_counts): New function.
14708         (Object::do_get_global_symbol_counts): New pure virtual function.
14709         (class Sized_relobj): Add defined_count_ field.  Update
14710         declarations.
14711         (class Input_objects): Add cref_ field.  Update constructor.
14712         Update declarations.
14713         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14714         defined_count_.
14715         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14716         symbol counts.
14717         (Sized_dynobj::do_get_global_symbol_counts): New function.
14718         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14719         defined_count_.  Update declarations.  Define Symbols typedef.
14720         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14721         parameter.  Change all callers.
14722         (Symbol_table::add_from_dynobj): Add sympointers and defined
14723         parameters.  Change all callers.
14724         * symtab.h (class Symbol_table): Update declarations.
14725         * Makefile.am (CCFILES): Add cref.cc.
14726         (HFILES): Add cref.h.
14727         * Makefile.in: Rebuild.
14728
14729 2008-07-22  Simon Baldwin  <simonb@google.com>
14730
14731         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14732         to zero when writing undefined symbols.
14733
14734 2008-07-22  Ian Lance Taylor  <iant@google.com>
14735
14736         * output.cc (Output_section::add_input_section): Don't try to
14737         merge empty merge sections.
14738
14739 2008-07-21  Craig Silverstein  <csilvers@google.com>
14740
14741         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14742         Include symbol version in error message.
14743
14744 2008-07-20  Chris Demetriou  <cgd@google.com>
14745
14746         * configure.ac (gold_cv_c_random_seed): New configured variable.
14747         (RANDOM_SEED_CFLAGS): New substituted variable.
14748         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14749         * configure: Rebuild.
14750         * Makefile.in: Likewise.
14751         * testsuite/Makefile.in: Likewise.
14752
14753 2008-07-18  Ian Lance Taylor  <iant@google.com>
14754
14755         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14756         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14757         * testsuite/ver_test_main.cc (main): Call t4.
14758         (t4, t4_2a): Define.
14759         * testsuite/ver_test_2.cc (t4_2): Define.
14760         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14761         * testsuite/ver_test_4.cc (t4_2a): Define.
14762         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14763         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14764
14765 2008-07-17  Ian Lance Taylor  <iant@google.com>
14766
14767         * dynobj.cc (Versions::add_def): If we give an error about a
14768         missing version, go ahead and create the version anyhow.
14769
14770 2008-07-10  Ian Lance Taylor  <iant@google.com>
14771
14772         Handle output sections with more than 0x7fffffff bytes.
14773         * object.h (class Relobj): Change map_to_output_ to
14774         output_sections_, and just keep a section pointer.  Change all
14775         uses.  Move comdat group support to Sized_relobj.
14776         (Relobj::is_section_specially_mapped): Remove.
14777         (Relobj::output_section): Remove poff parameter.  Change all
14778         callers.
14779         (Relobj::output_section_offset): New function.
14780         (Relobj::set_section_offset): Rewrite.
14781         (Relobj::map_to_output): Remove.
14782         (Relobj::output_sections): New function.
14783         (Relobj::do_output_section_offset): New pure virtual function.
14784         (Relobj::do_set_section_offset): Likewise.
14785         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14786         group support from Relobj.  Update declarations.
14787         (Sized_relobj::get_output_section_offset): New function.
14788         (Sized_relobj::do_output_section_offset): New function.
14789         (Sized_relobj::do_set_section_offset): New function.
14790         * object.cc (Relobj::output_section_address): Remove.
14791         (Sized_relobj::Sized_relobj): Initialize new fields.
14792         (Sized_relobj::include_section_group): Cast find_kept_object to
14793         Sized_relobj.
14794         (Sized_relobj::include_linkonce_section): Likewise.
14795         (Sized_relobj::do_layout): Use separate arrays for output section
14796         and output offset.
14797         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14798         output_sections.
14799         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14800         output_sections and section_offsets.
14801         (Sized_relobj::write_local_symbols): Likewise.
14802         (map_to_kept_section): Compute output address directly.
14803         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14804         output_sections and section_offsets.
14805         (Sized_relobj::write_sections): Likewise.
14806         (Sized_relobj::relocate_sections): Likewise.
14807         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14808         * output.h (class Output_reloc): Update declarations.  Change
14809         u2_.relobj to Sized_relobj*.
14810         (class Output_data_reloc): Change add functions to use
14811         Sized_relobj*.
14812         * output.cc (Output_reloc::Output_reloc): Change relobj to
14813         Sized_relobj*.
14814         (Output_reloc::local_section_offset): Change return type to
14815         Elf_Addr.  Use get_output_section_offset.
14816         (Output_reloc::get_address): Likewise.
14817         (Output_section::is_input_address_mapped): Don't call
14818         is_section_specially_mapped.
14819         (Output_section::output_offset): Likewise.
14820         (Output_section::output_address): Likewise.
14821         (Output_section::starting_output_address): Likewise.
14822         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14823         parameter to Sized_relobj*.
14824         (Copy_relocs::need_copy_reloc): Likewise.
14825         (Copy_relocs::save): Likewise.
14826         * copy-relocs.h (class Copy_relocs): Update declarations.
14827         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14828         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14829         * target-reloc.h (relocate_for_relocatable): Change
14830         offset_in_output_section type to Elf_Addr.  Change code that uses
14831         it as well.
14832         * layout.cc (Layout::layout): Always set *off.
14833         * mapfile.cc (Mapfile::print_input_section): Use
14834         output_section_offset.
14835         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14836         Sized_relobj*.
14837         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14838         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14839         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14840
14841 2008-07-03  Ian Lance Taylor  <iant@google.com>
14842
14843         * layout.cc (Layout::include_section): Do not discard unrecognized
14844         SHT_STRTAB sections.
14845
14846 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14847
14848         * script.cc (Lex::can_continue_name): Make '?' allowable in
14849         version-script names.
14850         * testsuite/version_script.map: Change glob pattern to use '?'
14851
14852 2008-06-30  Manish Singh  <yosh@gimp.org>
14853
14854         PR 6585
14855         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14856         Correct typo.
14857
14858 2008-06-30  Ian Lance Taylor  <iant@google.com>
14859
14860         PR 6660
14861         PR 6682
14862         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14863         versions]: Don't try to read the value in the contents, since we
14864         don't use it.  Use the template endianness when writing.
14865
14866 2008-06-25  Cary Coutant  <ccoutant@google.com>
14867
14868         * fileread.cc (File_read::make_view): Assert on zero-length view.
14869         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14870         symbol table when there are no symbols to read.
14871
14872 2008-06-23  Craig Silverstein  <csilvers@google.com>
14873
14874         * version.cc (version_string): Bump to 1.7
14875
14876 2008-06-18  Craig Silverstein  <csilvers@google.com>
14877
14878         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14879         constant 0xFFFF to type Valtype.
14880         (Powerpc_relocate_functions::rel16_ha): Likewise.
14881
14882 2008-06-17  Ian Lance Taylor  <iant@google.com>
14883
14884         * output.h (Output_section::Input_section): Initialize p2align_ to
14885         zero for Output_section_data constructors.
14886         (Output_section::Input_section::addralign): If not an input
14887         section, return the alignment of the Output_section_data.
14888         * testsuite/copy_test.cc: New file.
14889         * testsuite/copy_test_1.cc: New file.
14890         * testsuite/copy_test_2.cc: New file.
14891         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14892         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14893         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14894         (copy_test_1_pic.o, copy_test_1.so): New targets.
14895         (copy_test_2_pic.o, copy_test_2.so): New targets.
14896         * testsuite/Makefile.in: Rebuild.
14897
14898         * script-sections.cc (Script_sections::place_orphan): Initialize
14899         local variable exact.
14900
14901 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14902
14903         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14904
14905 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14906             David S. Miller  <davem@davemloft.net>
14907
14908         * powerpc.cc: New file.
14909         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14910         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14911         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14912         * Makefile.in: Rebuild.
14913
14914 2008-06-09  Ian Lance Taylor  <iant@google.com>
14915
14916         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14917         <exception>.
14918         (throwing, orig_terminate): New static variables.
14919         (terminate_handler): New static function.
14920         (t2): Set terminate handler.
14921
14922 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14923
14924         PR 6584
14925         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14926         alignment.
14927
14928 2008-05-30  Cary Coutant  <ccoutant@google.com>
14929
14930         * archive.cc (Archive::include_all_members) Correct to step
14931         over symbol table and extended name table in thin archives.
14932
14933 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14934
14935         PR 6407
14936         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14937         calculation.
14938
14939 2008-05-28  Caleb Howe  <cshowe@google.com>
14940
14941         * reduced_debug_output.cc: New file.
14942         * reduced_debug_output.h: New file.
14943         * options.h (class General_options): Add --strip-debug-non-line.
14944         * options.cc (General_options::finalize): Add strip_debug_non_line
14945         to the strip heirarchy.
14946         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14947         fields.
14948         * layout.cc: Include "reduced_debug_output.h".
14949         (Layout::Layout): Initialize new fields.
14950         (line_only_debug_sections): New static array.
14951         (is_lines_only_debug_sections): New static inline function.
14952         (Layout::include_section): Handle --strip-debug-non-line.
14953         (Layout::make_output_section): If --strip-debug-non-line, build
14954         new output sections for .debug_abbrev and .debug_info.
14955         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14956         gold.  Warn about possible overflow.
14957         (read_signed_LEB_128): Likewise.
14958         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14959         (read_signed_LEB_128): Declare.
14960         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14961         (HFILES): Add reduced_debug_output.h.
14962         * Makefile.in: Rebuild.
14963
14964 2008-05-21  Ian Lance Taylor  <iant@google.com>
14965
14966         * mapfile.cc: New file.
14967         * mapfile.h: New file.
14968         * options.h (class General_options): Add -M/--print-map and -Map.
14969         * options.cc (General_options::finalize): Make -M equivalent to
14970         -Map -.
14971         * main.cc: Include <cstdio> and "mapfile.h".
14972         (main): Open mapfile if requested.
14973         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14974         constructor.  Change caller.
14975         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14976         (queue_middle_tasks): Likewise.
14977         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14978         declarations.
14979         * archive.cc: Include "mapfile.h".
14980         (Archive::add_symbols): Add mapfile parameter.  Change all
14981         callers.  Pass mapfile, symbol, and reason to include_member.
14982         (Archive::include_all_members): Add mapfile parameter.  Change all
14983         callers.
14984         (Archive::include_member): Add mapfile, sym, and why parameters.
14985         Change all callers.  Report inclusion to map file.
14986         * archive.h: Include "fileread.h".
14987         (class Archive): Update declarations.
14988         (Archive::file): New const method.
14989         (class Add_archive_symbols): Add mapfile_ field.  Update
14990         constructor.  Change all callers.
14991         * readsyms.h (class Read_symbols): Likewise.
14992         (class Finish_group): Likewise.
14993         (class Read_script): Likewise.
14994         * common.cc: Include "mapfile.h".
14995         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14996         all callers.
14997         (Symbol_table::do_allocate_commons): Likewise.
14998         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14999         symbol allocation to mapfile.
15000         * common.h (class Allocate_commons_task): Add mapfile_ field.
15001         Update constructor.  Change all callers.
15002         * symtab.h (class Symbol_table): Update declarations.
15003         * layout.cc: Include "mapfile.h".
15004         (Layout_task_runner::run): Print information to mapfile.
15005         (Layout::create_gold_note): Change Output_data_fixed_space to
15006         Output_data_zero_fill.
15007         (Layout::create_build_id): Likewise.
15008         (Layout::print_to_mapfile): New function.
15009         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15010         constructor.  Change caller.
15011         (class Layout): Declare print_to_mapfile.
15012         * output.cc (Output_section::Input_section::print_to_mapfile): New
15013         function.
15014         (Output_section::add_input_section): If producing a map, always
15015         add to input_sections_ list.
15016         (Output_section::do_print_to_mapfile): New function.
15017         (Output_segment::print_sections_to_mapfile): New function.
15018         (Output_segment::print_section_list_to_mapfile): New function.
15019         * output.h: Include "mapfile.h".
15020         (Output_data::print_to_mapfile): New function.
15021         (Output_data::do_print_to_mapfile): New virtual function.
15022         (Output_segment_headers::do_print_to_mapfile): New function.
15023         (Output_file_header::do_print_to_mapfile): New function.
15024         (Output_data_const::do_print_to_mapfile): New function.
15025         (class Output_data_const_buffer): Add map_name_ field.  Update
15026         constructor.  Change all callers.  Add do_print_to_mapfile
15027         function.
15028         (class Output_data_fixed_space): Likewise.
15029         (class Output_data_space): Likewise.
15030         (class Output_data_zero_fill): New class.
15031         (Output_data_strtab::do_print_to_mapfile): New function.
15032         (Output_data_reloc_base::do_print_to_mapfile): New function.
15033         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15034         (Output_data_group::do_print_to_mapfile): New function.
15035         (Output_data_got::do_print_to_mapfile): New function.
15036         (Output_data_dynamic::do_print_to_mapfile): New function.
15037         (Output_symtab_xindex::do_print_to_mapfile): New function.
15038         (class Output_section): Declare do_print_to_mapflie.  Declare
15039         print_to_mapfile in Input_section.
15040         (class Output_segment): Declare new functions.
15041         * object.h (Sized_relobj::symbol_count): New function.
15042         * script-sections.cc
15043         (Output_section_element_dot_assignment::set_section_addresses):
15044         Change Output_data_fixed_space to Output_data_zero_fill.
15045         (Output_data_expression::do_print_to_mapfile): New function.
15046         * script.cc (read_input_script): Add mapfile parameter.  Change
15047         all callers.
15048         * script.h (read_input_script): Update declaration.
15049         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15050         (Eh_frame::do_print_to_mapfile): New function.
15051         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15052         (Output_merge_string::do_print_to_mapfile): New function.
15053         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15054         function.
15055         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15056         function.
15057         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15058         function.
15059         * Makefile.am (CCFILES): Add mapfile.cc.
15060         (HFILES): Add mapfile.h.
15061         * Makefile.in: Rebuild.
15062
15063 2008-05-19  Ian Lance Taylor  <iant@google.com>
15064
15065         * options.h (class General_options): Add -z relro.
15066         * layout.cc (Layout::Layout): Initialize relro_segment_.
15067         (Layout::add_output_section_data): Return the output section.
15068         (Layout::make_output_section): Rcognize relro sections and mark
15069         them appropriately.
15070         (Layout::attach_allocated_section_to_segment): Put relro sections
15071         in a PT_GNU_RELRO segment.
15072         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15073         section as relro.
15074         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15075         PT_TLS segments.
15076         (Layout::linkonce_mapping): Map d.rel.ro.local to
15077         .data.rel.ro.local.
15078         (Layout::output_section_name): Us .data.rel.ro.local for any
15079         section which begins with that.
15080         * layout.h (class Layout): Update add_output_section_data
15081         declaration.  Add relro_segment_ field.
15082         * output.cc (Output_section::Output_section): Initialize is_relro_
15083         and is_relro_local_ fields.
15084         (Output_segment::add_output_section): Group relro sections.
15085         (Output_segment::is_first_section_relro): New function.
15086         (Output_segment::maximum_alignment): If there is a relro section,
15087         align the segment to the common page size.
15088         (Output_segment::set_section_addresses): Track whether we are
15089         looking at relro sections.  If the last section is a relro
15090         section, align to the common page size.
15091         (Output_segment::set_section_list_addresses): Add in_relro
15092         parameter.  Change all callers.  Align to the page size when
15093         moving from relro to non-relro section.
15094         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15095         segment.
15096         * output.h (class Output_section): Add is_relro_ and
15097         is_relro_local_ fields.
15098         (Output_section::is_relro): New function.
15099         (Output_section::set_is_relro): New function.
15100         (Output_section::is_relro_local): New function.
15101         (Output_section::set_is_relro_local): New function.
15102         (class Output_segment): Update declarations.
15103         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15104         * sparc.cc (Target_sparc::got_section): Likewise.
15105         * x86_64.cc (Target_x86_64::got_section): Likewise.
15106         * testsuite/relro_test_main.cc: New file.
15107         * testsuite/relro_test.cc: New file.
15108         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15109         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15110         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15111         (relro_test.so, relro_test_pic.o): New targets.
15112         * testsuite/Makefile.in: Rebuild.
15113
15114 2008-05-16  Ian Lance Taylor  <iant@google.com>
15115
15116         * output.cc (Output_segment::add_output_section): Remove front
15117         parameter.
15118         * output.h (class Output_segment): Remove
15119         add_initial_output_section and overloaded add_output_section.
15120         Update declaration of remaining add_output_section.
15121         * layout.cc (Layout::create_interp): Call add_output_section
15122         rather than add_initial_output_section.
15123         (Layout::finish_dynamic_section): Likewise.
15124
15125         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15126         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15127         know the dynamic type.
15128         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15129         field.  Initialize it in constructor.
15130         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15131         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15132         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15133         reloc.
15134
15135         * output.cc (Output_reloc::get_address): Change return type to
15136         Elf_Addr.
15137         * output.h (class Output_reloc): Update get_address declaration.
15138         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15139         for section addresses.
15140
15141 2008-05-09  Ian Lance Taylor  <iant@google.com>
15142
15143         PR 6493
15144         * gold.cc (gold_nomem): Use return value of write.
15145
15146 2008-05-08  Ian Lance Taylor  <iant@google.com>
15147
15148         * symtab.c (Symbol::init_base_output_data): Add version
15149         parameter.  Change all callers.
15150         (Symbol::init_base_output_segment): Likewise.
15151         (Symbol::init_base_constant): Likewise.
15152         (Symbol::init_base_undefined): Likewise.
15153         (Sized_symbol::init_output_data): Likewise.
15154         (Sized_symbol::init_output_segment): Likewise.
15155         (Sized_symbol::init_constant): Likewise.
15156         (Sized_symbol::init_undefined): Likewise.
15157         (Symbol_table::do_define_in_output_data): If the new symbol has a
15158         version, mark it as the default.
15159         (Symbol_table::do_define_in_output_segment): Likewise.
15160         (Symbol_table::do_define_as_constant): Likewise.
15161         * symtab.h (class Symbol): Update declarations.
15162         (class Sized_symbol): Likewise.
15163         * resolve.cc (Symbol::override_version): New function.
15164         (Symbol::override_base): Call override_version.
15165         (Symbol::override_base_with_special): Likewise.
15166         * testsuite/ver_script_8.script: New file.
15167         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15168         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15169         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15170         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15171
15172 2008-05-06  Ian Lance Taylor  <iant@google.com>
15173
15174         PR 6049
15175         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15176         functions.
15177         (class General_options): Remove existing --undefined, and add
15178         --no-undefined instead.  Add new --undefined as synonym for -u.
15179         * archive.cc (Archive::add_symbols): Check whether symbol was
15180         named with -u.
15181         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15182         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15183         all uses.  Add IS_UNDEFINED.  Update declarations to split
15184         different versions of init_base.  Declare init_base_undefined.
15185         (Symbol::is_defined): Handle IS_UNDEFINED.
15186         (Symbol::is_undefined): Likewise.
15187         (Symbol::is_weak_undefined): Call is_undefined.
15188         (Symbol::is_absolute): Handle IS_CONSTANT.
15189         (class Sized_symbol): Update declarations to split different
15190         versions of init.  Declare init_undefined.
15191         (class Symbol_table): Declare new functions.
15192         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15193         Change all callers.
15194         (Symbol::init_base_output_data): Likewise.
15195         (Symbol::init_base_output_segment): Likewise.
15196         (Symbol::init_base_constant): Likewise.
15197         (Symbol::init_base_undefined): New function.
15198         (Sized_symbol::init_object): Rename from init.  Change all
15199         callers.
15200         (Sized_symbol::init_output_data): Likewise.
15201         (Sized_symbol::init_output_segment): Likewise.
15202         (Sized_symbol::init_constant): Likewise.
15203         (Sized_symbol::init_undefined): New function.
15204         (Symbol_table::add_undefined_symbols_from_command_line): New
15205         function.
15206         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15207         function.
15208         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15209         (Symbol::output_section): Likewise.
15210         (Symbol::set_output_section): Likewise.
15211         (Symbol_table::sized_finalize_symbol): Likewise.
15212         (Symbol_table::sized_write_globals): Likewise.
15213         * resolve.cc (Symbol_table::should_override): Likewise.
15214         (Symbol::override_base_with_special): Likewise.
15215
15216         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15217         symbol, change it to have default visibility.
15218         * testsuite/protected_1.cc: New file.
15219         * testsuite/protected_2.cc: New file.
15220         * testsuite/protected_3.cc: New file.
15221         * testsuite/protected_main_1.cc: New file.
15222         * testsuite/protected_main_2.cc: New file.
15223         * testsuite/protected_main_3.cc: New file.
15224         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15225         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15226         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15227         (protected_1.so): New target.
15228         (protected_1_pic.o, protected_2_pic.o): New targets.
15229         (protected_3_pic.o): New target.
15230         (check_PROGRAMS): Add protected_2.
15231         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15232         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15233         * testsuite/Makefile.in: Rebuild.
15234
15235         * options.h (DEFINE_var): Add set_user_set_##varname__.
15236         (DEFINE_bool_alias): New macro.
15237         (class General_options): Define -Bstatic using DEFINE_bool_alias
15238         rather than DEFINE_special.  Add --undefined as an alias for -z
15239         defs.
15240         * options.cc (General_options::parse_Bstatic): Remove.
15241
15242         * options.h (class General_options): Add --fatal-warnings.
15243         * main.cc (main): Implement --fatal-warnings.
15244         * errors.h (Errors::warning_count): New function.
15245
15246         * options.h (class General_options): Add -Bsymbolic-functions.
15247         * symtab.h (Symbol::is_preemptible): Check for
15248         -Bsymbolic-functions.
15249
15250 2008-05-05  Ian Lance Taylor  <iant@google.com>
15251
15252         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15253         as noVARNAME rather than no-VARNAME.
15254         (class General_options): Add option -z combreloc.
15255         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15256         get_address.
15257         (Output_reloc::sort_before) [SHT_REL]: New function.
15258         (Output_reloc::sort_before) [SHT_RELA]: New function.
15259         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15260         Sort_relocs_comparison.
15261         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15262         parameter.  Change all callers.
15263         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15264         sort_relocs parameter.  Change all callers.
15265         * output.cc (Output_reloc::get_address): New function, broken out
15266         of write_rel.
15267         (Output_reloc::write_rel): Call it.
15268         (Output_reloc::compare): New function.
15269         (Output_data_reloc_base::do_write): Optionally sort relocs.
15270
15271         * configure.ac: If targ_extra_obj is set, link it in.
15272         * configure.tgt: Initialize all variables.
15273         (x86_64*): Set targ_extra_obj and targ_extra_size.
15274         * configure: Rebuild.
15275
15276         * object.cc (Sized_relobj::include_section_group): Adjust section
15277         indexes read from group data.  Build vector to pass to
15278         layout_group.
15279         * layout.cc (Layout::layout_group): Add flags and shndxes
15280         parameters.  Remove contents parameter.  Change caller.  Update
15281         explicit instantiations.
15282         * layout.h (class Layout): Update layout_group declaration.
15283         * output.cc (Output_data_group::Output_data_group): Add flags and
15284         input_shndxes parameters.  Remove contents parameter.  Change
15285         caller.
15286         (Output_data_group::do_write): Change input_sections_ to
15287         input_shndxes_.
15288         * output.h (class Output_data_group): Update constructor
15289         declaration.  Rename input_sections_ to input_shndxes_.
15290         * testsuite/many_sections_test.cc: Add template.
15291
15292 2008-04-30  Cary Coutant  <ccoutant@google.com>
15293
15294         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15295
15296         * layout.cc (Layout::include_section): Refactored check for debug
15297         info section.
15298         (Layout::add_comdat): Add new parameters.  Change type
15299         of signature parameter.  Add object and shndx to signatures table.
15300         (Layout::find_kept_object): New function.
15301         * layout.h: Include <cstring>.
15302         (Layout::is_debug_info_section): New function.
15303         (Layout::add_comdat): Add new parameters.
15304         (Layout::find_kept_object): New function.
15305         (Layout::Kept_section): New struct.
15306         (Layout::Signatures): Change type of map range.
15307         * object.cc (Relobj::output_section_address): New function.
15308         (Sized_relobj::include_section_group): Add new parameters.  Change
15309         calls to Layout::add_comdat.  Change to build table of kept comdat
15310         groups and table mapping discarded sections to kept sections.
15311         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15312         (Sized_relobj::do_layout): Change calls to include_section_group and
15313         include_linkonce_section.
15314         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15315         value to zero when section is discarded.
15316         (Sized_relobj::map_to_kept_section): New function.
15317         * object.h (Relobj::output_section_address): New function.
15318         (Relobj::Comdat_group): New type.
15319         (Relobj::find_comdat_group): New function.
15320         (Relobj::Comdat_group_table): New type.
15321         (Relobj::Kept_comdat_section): New type.
15322         (Relobj::Kept_comdat_section_table): New type.
15323         (Relobj::add_comdat_group): New function.
15324         (Relobj::set_kept_comdat_section): New function.
15325         (Relobj::get_kept_comdat_section): New function.
15326         (Relobj::comdat_groups_): New field.
15327         (Relobj::kept_comdat_sections_): New field.
15328         (Symbol_value::input_value): Update comment.
15329         (Sized_relobj::map_to_kept_section) New function.
15330         (Sized_relobj::include_linkonce_section): Add new parameter.
15331         * target-reloc.h (Comdat_behavior): New type.
15332         (get_comdat_behavior): New function.
15333         (relocate_section): Add code to map a discarded section to the
15334         corresponding kept section when applying a relocation.
15335
15336 2008-04-30  Craig Silverstein  <csilvers@google.com>
15337
15338         * dwarf_reader.cc (next_generation_count): New static var.
15339         (Addr2line_cache_entry): New struct.
15340         (addr2line_cache): New static var.
15341         (Dwarf_line_info::one_addr2line): Added caching.
15342         (Dwarf_line_info::clear_addr2line_cache): New function.
15343         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15344         cache-size parameter.
15345         (Dwarf_line_info::one_addr2line_cache): New function.
15346         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15347         new cache-size argument to one_addr2line(), and clear cache.
15348
15349 2008-04-28  Cary Coutant  <ccoutant@google.com>
15350
15351         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15352         R_386_PC8 relocations.
15353
15354 2008-04-23  Ian Lance Taylor  <iant@google.com>
15355
15356         * object.cc (Sized_relobj::include_section_group): Check for
15357         invalid section group.
15358
15359         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15360         header size.
15361
15362         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15363         than read for file header.
15364         * archive.cc (Archive::include_member): Likewise.
15365
15366 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15367
15368         * aclocal.m4: Regenerate.
15369         * configure: Regenerate.
15370
15371 2008-04-19  Ian Lance Taylor  <iant@google.com>
15372
15373         * version.cc (version_string): Bump to 1.6.
15374
15375         * testsuite/Makefile.am (many_sections_r_test): New target.
15376         (many_sections_r_test_SOURCES): Remove.
15377         (many_sections_r_test_DEPENDENCIES): Remove.
15378         (many_sections_r_test_LDFLAGS): Remove.
15379         (many_sections_r_test_LDADD): Remove.
15380
15381         * object.cc (Sized_relobj::do_add_symbols): Always pass
15382         local_symbol_count_ to add_from_relobj.
15383
15384         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15385         every thousand variables.
15386         * testsuite/Makefile.in: Rebuild.
15387
15388         * object.cc (Xindex::initialize_symtab_xindex): New function.
15389         (Xindex::read_symtab_xindex): New function.
15390         (Xindex::sym_xindex_to_shndx): New function.
15391         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15392         available.
15393         (Sized_relobj::do_initialize_xindex): New function.
15394         (Sized_relobj::do_read_symbols): Adjust section links.
15395         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15396         parameter.  Change all callers.
15397         (Sized_relobj::include_section_group): Adjust section links and
15398         symbol section indexes.
15399         (Sized_relobj::do_layout): Adjust section links.
15400         (Sized_relobj::do_count_local_symbols): Adjust section links and
15401         symbol section indexes.
15402         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15403         ordinary and special symbols.
15404         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15405         dynsym_xindex parameters.  Change all callers.  Adjust section
15406         links.  Use SHN_XINDEX when needed.
15407         (Sized_relobj::get_symbol_location_info): Adjust section links.
15408         Don't get fooled by special symbols.
15409         * object.h (class Xindex): Define.
15410         (class Object): Add xindex_ parameter.  Declare virtual functoin
15411         do_initialize_xindex.
15412         (Object::adjust_sym_shndx): New function.
15413         (Object::set_xindex): New protected function.
15414         (class Symbol_value): Add is_ordinary_shndx_ field.
15415         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15416         (Symbol_value::value): Assert ordinary section.
15417         (Symbol_value::initialize_input_to_output_map): Likewise.
15418         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15419         Change all callers.
15420         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15421         all callers.
15422         (class Sized_relobj): Update declarations.
15423         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15424         parameter.  Change all callers.
15425         (Sized_relobj::adjust_shndx): New function.
15426         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15427         field.
15428         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15429         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15430         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15431         (Sized_dynobj::read_dynsym_section): Adjust section links.
15432         (Sized_dynobj::read_dynamic): Likewise.
15433         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15434         section links.
15435         (Sized_dynobj::do_initialize_xindex): New function.
15436         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15437         do_initialize_xindex.
15438         (Sized_dynobj::adjust_shndx): New function.
15439         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15440         dynsym_xindex_ fields.
15441         (Layout::finalize): Add a call to set_section_indexes before
15442         creating the symtab sections.
15443         (Layout::set_section_indexes): Don't do anything if the section
15444         already has a section index.
15445         (Layout::create_symtab_sections): Add shnum parameter.  Change
15446         caller.  Create .symtab_shndx section if needed.
15447         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15448         caller.
15449         (Layout::allocated_output_section_count): New function.
15450         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15451         needed.
15452         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15453         fields.  Update declarations.
15454         (Layout::symtab_xindex): New function.
15455         (Layout::dynsym_xindex): New function.
15456         (class Write_symbols_task): Add layout_ field.
15457         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15458         Change caller.
15459         * output.cc (Output_section_headers::Output_section_headers): Add
15460         shstrtab_section parameter.  Change all callers.
15461         (Output_section_headers::do_sized_write): Store overflow values
15462         for section count and section string table section index in
15463         section header zero.
15464         (Output_file_header::do_sized_write): Check for overflow of
15465         section count and section string table section index.
15466         (Output_symtab_xindex::do_write): New function.
15467         (Output_symtab_xindex::endian_do_write): New function.
15468         * output.h (class Output_section_headers): Add shstrtab_section_.
15469         Update declarations.
15470         (class Output_symtab_xindex): Define.
15471         (Output_section::has_out_shndx): New function.
15472         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15473         field.
15474         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15475         Change all callers.
15476         (Sized_symbol::init): Likewise.
15477         (Symbol::output_section): Check for ordinary symbol.
15478         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15479         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15480         callers.
15481         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15482         Change all callers.  Simplify handling of symbols from sections
15483         not included in the link.
15484         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15485         distinction.
15486         (Weak_alias_sorter::operator()): Assert that symbols are
15487         ordinary.
15488         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15489         distinction.
15490         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15491         parameters.  Change all callers.
15492         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15493         symbol distinction.  Use SHN_XINDEX when needed.
15494         (Symbol_table::write_section_symbol): Add symtab_xindex
15495         parameter.  Change all callers.
15496         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15497         SHN_XINDEX when needed.
15498         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15499         declarations.
15500         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15501         (Symbol::is_defined): Check is_ordinary.
15502         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15503         (Symbol::is_absolute, Symbol::is_common): Likewise.
15504         (class Sized_symbol): Update declarations.
15505         (class Symbol_table): Update declarations.
15506         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15507         parameters.  Change all callers.
15508         (Sized_symbol::override): Likewise.
15509         (Symbol_table::override): Likewise.
15510         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15511         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15512         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15513         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15514         to be in an ordinary section.
15515         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15516         object and is_ordinary parameters.  Change all callers.
15517         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15518         Change all callers.  Don't add undefined or non-ordinary symbols
15519         to reloc_map_.
15520         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15521         Change all callers.
15522         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15523         declarations.
15524         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15525         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15526         (Sized_relobj::relocate_sections): Likewise.
15527         * target-reloc.h (scan_relocs): Adjust section symbol index.
15528         (scan_relocatable_relocs): Likewise.
15529         * i386.cc (Scan::local): Check for ordinary symbols.
15530         * sparc.cc (Scan::local): Likewise.
15531         * x86_64.cc (Scan::local): Likewise.
15532         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15533         to symbol_section_and_value.
15534         * testsuite/many_sections_test.cc: New file.
15535         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15536         (check_PROGRAMS): Add many_sections_test.
15537         (many_sections_test_SOURCES): Define.
15538         (many_sections_test_DEPENDENCIES): Define.
15539         (many_sections_test_LDFLAGS): Define.
15540         (BUILT_SOURCES): Add many_sections_define.h.
15541         (many_sections_define.h): New target.
15542         (BUILT_SOURCES): Add many_sections_check.h.
15543         (many_sections_check.h): New target.
15544         (check_PROGRAMS): Add many_sections_r_test.
15545         (many_sections_r_test_SOURCES): Define.
15546         (many_sections_r_test_DEPENDENCIES): Define.
15547         (many_sections_r_test_LDFLAGS): Define.
15548         (many_sections_r_test_LDADD): Define.
15549         (many_sections_r_test.o): New target.
15550         * testsuite/Makefile.in: Rebuild.
15551
15552 2008-04-17  Cary Coutant  <ccoutant@google.com>
15553
15554         * errors.cc (Errors::info): New function.
15555         (gold_info): New function.
15556         * errors.h (Errors::info): New function.
15557         * gold.h (gold_info): New function.
15558         * object.cc (Input_objects::add_object): Print trace output.
15559         * options.cc (options::parse_set): New function.
15560         (General_options::parse_wrap): Deleted.
15561         (General_options::General_options): Deleted initializer.
15562         * options.h (options::String_set): New typedef.
15563         (options::parse_set): New function.
15564         (DEFINE_set): New macro.
15565         (General_options::wrap): Changed to use DEFINE_set. Changed
15566         callers of any_wrap_symbols and is_wrap_symbol.
15567         (General_options::trace, General_options::trace_symbol):
15568         New options.
15569         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15570         (General_options::wrap_symbols_): Deleted.
15571         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15572
15573 2008-04-17  David S. Miller  <davem@davemloft.net>
15574
15575         * options.cc (General_options::parse_V): New function.
15576         * options.h: Add entries for -V and -Qy.
15577
15578 2008-04-17  Ian Lance Taylor  <iant@google.com>
15579
15580         * common.cc (Symbol_table::allocate_commons): Remove options
15581         parameter.  Change caller.
15582         (Symbol_table::do_allocate_commons): Remove options parameter.
15583         Change caller.  Just call do_allocate_commons_list twice.
15584         (Symbol_table::do_allocate_commons_list): New function, broken out
15585         of do_allocate_commons.
15586         * common.h (class Allocate_commons_task): Remove options_ field.
15587         Update constructor.
15588         * symtab.cc (Symbol_table::Symbol_table): Initialize
15589         tls_commons_.
15590         (Symbol_table::add_from_object): Put TLS common symbols on
15591         tls_commons_ list.
15592         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15593         which are IN_OUTPUT_DATA.
15594         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15595         allocate_commons and do_allocate_commons declarations.  Declare
15596         do_allocate_commons_list.
15597         * gold.cc (queue_middle_tasks): Update creation of
15598         Allocate_commons_task to not pass options.
15599         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15600         (TLS_TEST_C_FLAGS): New variable.
15601         (tls_test_c_pic.o): New target.
15602         (tls_test_shared.so): Link in tls_test_c_pic.o.
15603         (tls_test_c_pic_ie.o): New target.
15604         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15605         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15606         (tls_test_c.o): New target.
15607         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15608         (tls_pic_test_LDADD): Likewise.
15609         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15610         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15611         (tls_test_c_gnu2.o): New target.
15612         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15613         tls_test_c_gnu2.o.
15614         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15615         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15616         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15617         * testsuite/tls_test.cc: Include "config.h".
15618         (t_last): Call t11_last.
15619         * testsuite/tls_test.h (t11, t11_last): Declare.
15620         * testsuite/tls_test_c.c: New file.
15621         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15622         * configure.ac: Check for OpenMP support.
15623         * configure, config.in, Makefile.in: Rebuild.
15624         * testsuite/Makefile.in: Rebuild.
15625
15626 2008-04-16  Cary Coutant  <ccoutant@google.com>
15627
15628         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15629         (Target_i386::tls_base_symbol_defined_): New field.
15630         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15631         (Target_i386::Scan::global): Likewise.
15632         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15633         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15634         (Target_x86_64::tls_base_symbol_defined_): New field.
15635         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15636         (Target_x86_64::Scan::global): Likewise.
15637
15638 2008-04-16  Cary Coutant  <ccoutant@google.com>
15639
15640         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15641         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15642         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15643         building shared libraries.
15644         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15645         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15646         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15647         * testsuite/Makefile.in: Rebuild.
15648         * testsuite/weak_undef.h: New file.
15649         * testsuite/weak_undef_file1.cc: Add extra test cases.
15650         * testsuite/weak_undef_file2.cc: Likewise.
15651         * testsuite/weak_undef_test.cc: Likewise.
15652
15653 2008-04-16  David S. Miller  <davem@davemloft.net>
15654
15655         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15656         Add issued_non_pic_error_ field.  Declare check_non_pic.
15657         (Target_sparc::Scan::check_non_pic): New function.
15658         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15659         (Target_sparc::Scan::global): Likewise.
15660
15661         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15662         * configure: Rebuild.
15663
15664         * options.h (DEFINE_enable): New macro.
15665         (new_dtags): New enable option.
15666         (initfirst, interpose, loadfltr, nodefaultlib,
15667         nodelete, nodlopen, nodump): New -z options.
15668         * layout.cc (Layout:finish_dynamic_section): If new
15669         dtags enabled, emit DT_RUNPATH.  Also, emit a
15670         DT_FLAGS_1 containing any specified -z flags.
15671
15672 2008-04-16  Ian Lance Taylor  <iant@google.com>
15673
15674         * copy-relocs.cc: New file.
15675         * copy-relocs.h: New file.
15676         * reloc.cc: Remove Copy_relocs code.
15677         * reloc.h: Likewise.
15678         * reloc-types.h (struct Reloc_types) [both versions]: Add
15679         get_reloc_addend_noerror.
15680         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15681         variants of add_global which take an addend which must be zero.
15682         * i386.cc: Include "copy-relocs.h".
15683         (class Target_i386): Change type of copy_relocs_ to variable,
15684         update initializer.
15685         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15686         Change all callers.
15687         (Target_i386::do_finalize_sections): Change handling of
15688         copy_relocs_.
15689         * sparc.cc: Include "copy-relocs.h".
15690         (class Target_sparc): Change type of copy_relocs_ to variable,
15691         update initializer.
15692         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15693         Change all callers.
15694         (Target_sparc::do_finalize_sections): Change handling of
15695         copy_relocs_.
15696         * x86_64.cc: Include "copy-relocs.h".
15697         (class Target_x86_64): Change type of copy_relocs_ to variable,
15698         update initializer.
15699         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15700         class.  Change all callers.
15701         (Target_x86_64::do_finalize_sections): Change handling of
15702         copy_relocs_.
15703         * Makefile.am (CCFILES): Add copy-relocs.cc.
15704         (HFILES): Add copy-relocs.h.
15705
15706         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15707
15708         * testsuite/script_test_4.sh: Permit leading zeroes.
15709
15710 2008-04-15  Ian Lance Taylor  <iant@google.com>
15711
15712         * script-sections.cc (Script_sections::create_segments): Use
15713         header_size_adjustment even when there is enough room for the
15714         headers.
15715         * testsuite/script_test_4.sh: New file.
15716         * testsuite/script_test_4.t: New file.
15717         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15718         (check_DATA): Add script_test_4.stdout.
15719         (MOSTLYCLEANFILES): Likewise.
15720         (script_test_4): New target.
15721         (script_test_4.stdout): New target.
15722         * testsuite/Makefile.in: Rebuild.
15723
15724         * sparc.cc: Add definitions for Output_data_plt_sparc class
15725         constants.
15726
15727 2008-04-14  David S. Miller  <davem@davemloft.net>
15728
15729         * sparc.cc: New file.
15730         * Makefile.am (TARGETSOURCES): Add sparc.cc
15731         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15732         * configure.tgt: Document targ_extra_size and
15733         targ_extra_big_endian.  Add entries for sparc-* and
15734         sparc64-*.
15735         * configure.ac: Handle targ_extra_size and
15736         targ_extra_big_endian.
15737         * Makefile.in: Rebuild.
15738         * configure: Likewise.
15739         * po/POTFILES.in: Likewise.
15740         * po/gold.pot: Likewise.
15741
15742 2008-04-14  Ian Lance Taylor  <iant@google.com>
15743
15744         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15745         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15746         in the name/type/flags to section mapping.  Don't call
15747         allocate_output_section.
15748         (Layout::choose_output_section): Change parameter from adjust_name
15749         to is_input_section.  Don't permit input sections after sections
15750         are attached to segments.  Don't call allocate_output_section.
15751         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15752         not write_enable_output_section.
15753         (Layout::make_output_section): Don't push to
15754         unattached_section_list_ nor call attach_to_segment.  Call
15755         attach_section_to_segment if sections are attached.
15756         (Layout::attach_sections_to_segments): New function.
15757         (Layout::attach_section_to_segment): New function.
15758         (Layout::attach_allocated_section_to_segment): Rename from
15759         attach_to_segment.  Remove flags parameter.
15760         (Layout::allocate_output_section): Remove function.
15761         (Layout::write_enable_output_section): Remove function.
15762         * layout.h (class Layout): Update for above changes.  Add new
15763         field sections_are_attached_.
15764         * output.h (Output_section::update_flags_for_input_section): New
15765         function.
15766         * output.cc (Output_section::add_input_section): Call
15767         update_flags_for_input_section.
15768         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15769
15770 2008-04-11  Cary Coutant  <ccoutant@google.com>
15771
15772         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15773         thought unnecessary.
15774         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15775
15776 2008-04-11  Ian Lance Taylor  <iant@google.com>
15777
15778         * output.h (class Output_section_data): Remove inline definition
15779         of set_addralign.
15780         * output.cc (Output_section_data::set_addralign): New function.
15781
15782 2008-04-11  Cary Coutant  <ccoutant@google.com>
15783
15784         Add support for TLS descriptors for i386 and x86_64.
15785         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15786         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15787         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15788         GOT_TYPE_TLS_DESC.
15789         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15790         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15791         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15792         relocations.
15793         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15794         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15795         Fix problem with initial-exec relocations.
15796         (Target_i386::Relocate::relocate_tls): Likewise.
15797         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15798         relaxation.
15799         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15800         support for section-plus-offset dynamic table entries.
15801         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15802         (Output_data_dynamic::Dynamic_entry): Add support for
15803         section-plus-offset dynamic table entries.
15804         (Output_data_dynamic::Classification): Likewise.
15805         (Output_data_dynamic::classification_): Renamed offset_.
15806         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15807         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15808         (Target_x86_64::make_plt_section): New function.
15809         (Target_x86_64::reserve_tlsdesc_entries): New function.
15810         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15811         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15812         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15813         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15814         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15815         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15816         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15817         add extra PLT entry for TLS descriptors.
15818         (Output_data_plt_x86_64::got_): New field.
15819         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15820         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15821         fields.
15822         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15823         descriptors.
15824         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15825         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15826         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15827         R_386_TLS_DESC_CALL relocations.
15828         (Target_x86_64::Scan::global): Likewise.
15829         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15830         for TLS descriptors.
15831         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15832         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15833         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15834         GD-to-IE relaxation.
15835         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15836         and TLS_DESCRIPTORS.
15837         * Makefile.in: Rebuild.
15838         * configure: Rebuild.
15839         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15840         (tls_test_shared2.so): New target.
15841         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15842         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15843         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15844         (tls_shared_gd_to_ie_test_LDADD): New variable.
15845         (tls_shared_gnu2_gd_to_ie_test): New target.
15846         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15847         New targets.
15848         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15849         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15850         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15851         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15852         (tls_shared_gnu2_test): New target.
15853         (tls_test_gnu2_shared.so): New target.
15854         (tls_shared_gnu2_test_SOURCES): New variable.
15855         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15856         (tls_shared_gnu2_test_LDFLAGS): New variable.
15857         (tls_shared_gnu2_test_LDADD): New variable.
15858         * testsuite/Makefile.in: Rebuild.
15859         * testsuite/Makefile.
15860
15861 2008-04-11  Ian Lance Taylor  <iant@google.com>
15862
15863         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15864         justsyms.t.
15865         * testsuite/Makefile.in: Rebuild.
15866
15867         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15868         long.
15869         * testsuite/script_test_2.cc (main): Adjust test.
15870
15871 2008-04-11  David S. Miller  <davem@davemloft.net>
15872             Ian Lance Taylor  <iant@google.com>
15873
15874         * options.h (General_options): Add entries for '-Y' and
15875         '-relax'.
15876         * options.cc (General_options:finalize): If -Y was used, add those
15877         entries to the library path instead of the default "/lib" and
15878         "/usr/lib".
15879
15880 2008-04-11  David S. Miller  <davem@davemloft.net>
15881
15882         * testsuite/justsyms.t: Start at 0x100.
15883         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15884         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15885         long.
15886         * testsuite/script_test_2.cc: Adjust string and section length
15887         checks.
15888
15889 2008-04-09  Ian Lance Taylor  <iant@google.com>
15890
15891         PR gold/5996
15892         * script-sections.cc (Sections_element::allocate_to_segment): Add
15893         orphan parameter.
15894         (Output_section_definition::allocate_to_segment): Likewise.
15895         (Orphan_output_section::allocate_to_segment): Likewise.
15896         (Script_sections::attach_sections_using_phdrs_clause): Don't
15897         propagate non-PT_LOAD segments to orphan sections.
15898         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15899         readelf rather than objdump.
15900         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15901         .interp section and PT_INTERP segment are the same size.
15902         * testsuite/Makefile.in: Rebuild.
15903
15904         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15905         aliases for symbols defined in the same object.
15906         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15907         (weak_alias_test_SOURCES): New variable.
15908         (weak_alias_test_DEPENDENCIES): New variable.
15909         (weak_alias_test_LDFLAGS): New variable.
15910         (weak_alias_test_LDADD): New variable.
15911         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15912         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15913         (weak_alias_test_3.o): New target.
15914         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15915         * testsuite/weak_alias_test_main.cc: New file.
15916         * testsuite/weak_alias_test_1.cc: New file.
15917         * testsuite/weak_alias_test_2.cc: New file.
15918         * testsuite/weak_alias_test_3.cc: New file.
15919
15920 2008-04-08  Ian Lance Taylor  <iant@google.com>
15921
15922         * options.h (class General_options): Add --noinhibit-exec option.
15923         * main.cc (main): Check --noinhibit-exec.
15924
15925         * options.h (class General_options): Define --wrap as a special
15926         option.  Add wrap_symbols_ field.
15927         (General_options::any_wrap_symbols): New function.
15928         (General_options::is_wrap_symbol): New function.
15929         * options.cc (General_options::parse_wrap): New function.
15930         (General_options::General_options): Initialize wrap_symbols_.
15931         * symtab.cc (Symbol_table::wrap_symbol): New function.
15932         (Symbol_table::add_from_object): Handle --wrap.
15933         * symtab.h (class Symbol_table): Declare wrap_symbol.
15934         * target.h (Target::wrap_char): New function.
15935         (Target::Target_info): Add wrap_char field.
15936         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15937         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15938         * testsuite/testfile.cc (Target_test::test_target_info):
15939         Likewise.
15940
15941         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15942         there is one.
15943
15944         * layout.h (class Layout): Add added_eh_frame_data_ field.
15945         * layout.cc (Layout::Layout): Initialize new field.
15946         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15947         output section until we find a section we merged successfully.
15948         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15949         that the size be non-zero.
15950
15951         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15952         qualifier.
15953
15954 2008-04-08  Craig Silverstein  <csilvers@google.com>
15955
15956         * configure.ac: Export new conditional variable HAVE_ZLIB.
15957         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15958         on HAVE_ZLIB.
15959         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15960         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15961
15962 2008-04-07  Ian Lance Taylor  <iant@google.com>
15963
15964         * version.cc (version_string): Set to "1.5".
15965
15966         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15967         Add issued_non_pic_error_ field.  Declare check_non_pic.
15968         (Target_x86_64::Scan::check_non_pic): New function.
15969         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15970         (Target_x86_64::Scan::global): Likewise.
15971
15972         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15973         addend parameter.  Change caller.  Handle merge sections.
15974         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15975         Address to Addend.  Don't add in the result of
15976         local_section_offset, pass down the addend and use the returned
15977         value.
15978         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15979         Update declarations of local_section_offset and symbol_value.
15980         * testsuite/two_file_test_1.cc (t18): New function.
15981         * testsuite/two_file_test_2.cc (f18): New function.
15982         * testsuite/two_file_test_main.cc (main): Call t18.
15983         * testsuite/two_file_test.h (t18, f18): Declare.
15984
15985         * configure.ac: Don't test for objdump, c++filt, or readelf.
15986         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15987         conditionals.
15988         (TEST_READELF): New variable.
15989         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15990         (check_PROGRAMS): Add two_file_strip_test.
15991         (two_file_strip_test): New target.
15992         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15993         (two_file_same_shared_strip_test_SOURCES): New variable.
15994         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15995         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15996         (two_file_same_shared_strip_test_LDADD): New variable.
15997         (two_file_shared_strip.so): New target.
15998         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15999         (ver_test_5.syms, ver_test_7.syms): Likewise.
16000         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16001         (strip_test_3.stdout): Use TEST_OBJDUMP.
16002         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16003
16004 2008-04-04  Cary Coutant  <ccoutant@google.com>
16005
16006         * symtab.h (Symbol::is_weak_undefined): New function.
16007         (Symbol::is_strong_undefined): New function.
16008         (Symbol::is_absolute): New function.
16009         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16010         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16011         absolute symbols.
16012         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16013         (weak_undef_test): New target.
16014         * testsuite/Makefile.in: Rebuild.
16015         * testsuite/weak_undef_file1.cc: New file.
16016         * testsuite/weak_undef_file2.cc: New file.
16017         * testsuite/weak_undef_test.cc: New file.
16018
16019 2008-04-03  Craig Silverstein  <csilvers@google.com>
16020
16021         * compressed_output.h (class Output_compressed_section): Use
16022         unsigned buffer.
16023         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16024         add zlib header.
16025         (zlib_compressed_suffix): Removed.
16026         (Output_compressed_section::set_final_data_size): Use unsigned
16027         buffers.
16028         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16029         Fix linker invocation.
16030         (flagstest_o_specialfile_and_compress_debug_sections):
16031         Likewise.
16032         * testsuite/Makefile.in: Regenerated.
16033
16034 2008-04-02  David S. Miller  <davem@davemloft.net>
16035
16036         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16037         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16038
16039 2008-04-02  Craig Silverstein  <csilvers@google.com>
16040
16041         * TODO: New file.
16042
16043 2008-04-02  Ian Lance Taylor  <iant@google.com>
16044
16045         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16046         parameters.  Update for new key type to views_.  Change all
16047         callers.
16048         (File_read::read): Adjust for byteshift in returned view.
16049         (File_read::add_view): New function, broken out of
16050         find_and_make_view.
16051         (File_read::make_view): New function, broken out of
16052         find_and_make_view.
16053         (File_read::find_or_make_view): Add offset and aligned
16054         parameters.  Rewrite accordingly.  Change all callers.
16055         (File_read::get_view): Add offset and aligned parameters.  Adjust
16056         for byteshift in return value.
16057         (File_read::get_lasting_view): Likewise.
16058         * fileread.h (class File_read): Update declarations.
16059         (class File_read::View): Add byteshift_ field.  Add byteshift to
16060         constructor.  Add byteshift method.
16061         * archive.h (Archive::clear_uncached_views): New function.
16062         (Archive::get_view): Add aligned parameter.  Change all callers.
16063         * object.h (Object::get_view): Add aligned parameter.  Change all
16064         callers.
16065         (Object::get_lasting_view): Likewise.
16066
16067         * fileread.cc (File_read::release): Don't call clear_views if
16068         there are multiple objects.
16069         * fileread.h (File_read::clear_uncached_views): New function.
16070         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16071         on the archive.
16072
16073 2008-03-31  Cary Coutant  <ccoutant@google.com>
16074
16075         Add thin archive support.
16076         * archive.cc (Archive::armagt): New const.
16077         (Archive::setup): Remove task parameter and calls to unlock.
16078         (Archive::unlock_nested_archives): New function.
16079         (Archive::read_header): Add nested_off parameter. Change
16080         all callers.
16081         (Archive::interpret_header): Likewise.
16082         (Archive::include_all_members): Change to handle thin
16083         archives.
16084         (Archive::include_member): Likewise.
16085         * archive.h (Archive::Archive): Add new parameters and
16086         initializers.
16087         (Archive::armagt): New const.
16088         (Archive::setup): Remove task parameter.
16089         (Archive::unlock_nested_archives): New function.
16090         (Archive::read_header): Add nested_off parameter.
16091         (Archive::interpret_header): Likewise.
16092         (Archive::Nested_archive_table): New typedef.
16093         (Archive::is_thin_archive_): New field.
16094         (Archive::nested_archives_): New field.
16095         (Archive::options_): New field.
16096         (Archive::dirpath_): New field.
16097         (Archive::task_): New field.
16098         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16099         for thin archives.  Pass additional parameters to
16100         Archive::Archive.  Unlock the archive file after calling
16101         Archive::setup.
16102
16103 2008-03-29  Ian Lance Taylor  <iant@google.com>
16104
16105         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16106         version symbol to be local.
16107         * testsuite/ver_test_4.sh: New file.
16108         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16109         (check_DATA): Add ver_test_4.syms.
16110         (ver_test_4.syms): New target.
16111         * testsuite/Makefile.in: Rebuild.
16112
16113         * output.cc
16114         (Output_section::Input_section_sort_entry::has_priority): New
16115         function.
16116         (Output_section::Input_section_sort_entry::match_file_name): New
16117         function.
16118         (Output_section::Input_section_sort_entry::match_section_name):
16119         Remove.
16120         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16121         Remove.
16122         (Output_section::Input_section_sort_entry::match_section_file):
16123         Remove.
16124         (Output_section::Input_section_sort_compare::operator()): Rewrite
16125         using new Input_section_sort_entry functions.  Sort crtbegin and
16126         crtend first.  Sort sections with no priority before sections with
16127         a priority.
16128         * testsuite/initpri1.c (d3): Check j != 4.
16129         (cd5): New constructor/destructor function.
16130         (main): Check j != 2.
16131
16132         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16133         new symbol when resolving, don't call set_is_default.
16134         * testsuite/ver_test_7.cc: New file.
16135         * testsuite/ver_test_7.sh: New file.
16136         * testsuite/Makefile.am (ver_test_7.so): New target.
16137         (ver_test_7.o): New target.
16138         (check_SCRIPTS): Add ver_test_7.sh.
16139         (check_DATA): Add ver_test_7.syms.
16140         (ver_test_7.syms): New target.
16141
16142 2008-03-28  Ian Lance Taylor  <iant@google.com>
16143
16144         * layout.cc (Layout::layout): If we see an input section with a
16145         name that needs sorting, set the must_sort flag for the output
16146         section.
16147         (Layout::make_output_section): If the name of the output section
16148         indicates that it might require sorting, set the may_sort flag.
16149         * output.h (Output_section::may_sort_attached_input_sections): New
16150         function.
16151         (Output_section::set_may_sort_attached_input_sections): New
16152         function.
16153         (Output_section::must_sort_attached_input_sections): New
16154         function.
16155         (Output_section::set_must_sort_attached_input_sections): New
16156         function.
16157         (class Output_section): Declare Input_section_sort_entry.  Define
16158         Input_section_sort_compare.  Declare
16159         sort_attached_input_sections.  Add new fields:
16160         may_sort_attached_input_sections_,
16161         must_sort_attached_input_sections_,
16162         attached_input_sections_are_sorted_.
16163         * output.cc (Output_section::Output_section): Initialize new
16164         fields.
16165         (Output_section::add_input_section): Add an entry to
16166         input_sections_ if may_sort or must_sort are true.
16167         (Output_section::set_final_data_size): Call
16168         sort_attached_input_sections if necessary.
16169         (Output_section::Input_section_sort_entry): Define new class.
16170         (Output_section::Input_section_sort_compare::operator()): New
16171         function.
16172         (Output_section::sort_attached_input_sections): New function.
16173         * configure.ac: Check whether the compiler supports constructor
16174         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16175         * testsuite/initpri1.c: New file.
16176         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16177         CONSTRUCTOR_PRIORITY.
16178         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16179         (initpri1_LDFLAGS): New variable.
16180         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16181
16182 2008-03-27  Ian Lance Taylor  <iant@google.com>
16183
16184         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16185         * testsuite/common_test_1.c: New file.
16186         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16187         (common_test_1_SOURCES): New variable.
16188         (common_test_1_DEPENDENCIES): New variable.
16189         (common_test_1_LDFLAGS): New variable.
16190
16191         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16192         and commons_ correctly when NAME/VERSION does not override
16193         NAME/NULL.
16194         * testsuite/ver_test_6.c: New file.
16195         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16196         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16197         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16198
16199 2008-03-26  Ian Lance Taylor  <iant@google.com>
16200
16201         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16202         of an undefined symbol from a version script.
16203         * testsuite/Makefile.am (ver_test_5.so): New target.
16204         (ver_test_5.o): New target.
16205         (check_SCRIPTS): Add ver_test_5.sh.
16206         (check_DATA): Add ver_test_5.syms.
16207         (ver_test_5.syms): New target.
16208         * testsuite/ver_test_5.cc: New file.
16209         * testsuite/ver_test_5.script: New file.
16210         * testsuite/ver_test_5.sh: New file.
16211         * Makefile.in, testsuite/Makefile.in: Rebuild.
16212
16213         PR gold/5986
16214         Fix problems building gold with gcc 4.3.0.
16215         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16216         (gold_error_at_location, gold_warning_at_location): Use it.
16217         * configure.ac: Check whether we can compile and use a template
16218         function with a printf attribute.
16219         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16220         when jumping over bytes.
16221         * object.cc: Instantiate Object::read_section_data.
16222         * debug.h: Include <cstring>
16223         * dwarf_reader.cc: Include <algorithm>
16224         * main.cc: Include <cstring>.
16225         * options.cc: Include <cstring>.
16226         * output.cc: Include <cstring>.
16227         * script.cc: Include <cstring>.
16228         * script.h: Include <string>.
16229         * symtab.cc: Include <cstring> and <algorithm>.
16230         * target-select.cc: Include <cstring>.
16231         * version.cc: Include <string>.
16232         * testsuite/testmain.cc: Include <cstdlib>.
16233         * configure, config.in: Rebuild.
16234
16235 2008-03-25  Ian Lance Taylor  <iant@google.com>
16236
16237         * options.cc: Include "../bfd/bfdver.h".
16238         (options::help): Print bug reporting address.
16239
16240         * version.cc (print_version): Adjust output for current value of
16241         BFD_VERSION_STRING.
16242
16243         * NEWS: New file.
16244
16245         * options.cc (options::help): Print list of supported targets.
16246         * target-select.h: Include <vector>.
16247         (class Target_selector): Make machine_, size_, and is_big_endian_
16248         fields const.  Add bfd_name_ and instantiated_target_ fields.
16249         (Target_selector::Target_selector): Add bfd_name parameter.
16250         (Target_selector::recognize): Make non-virtual, call
16251         do_recognize.
16252         (Target_selector::recognize_by_name): Make non-virtual, call
16253         do_recognize_by_name.
16254         (Target_selector::supported_names): New function.
16255         (Target_selector::bfd_name): New function.
16256         (Target_selector::do_instantiate_target): New pure virtual
16257         function.
16258         (Target_selector::do_recognize): New virtual function.
16259         (Target_selector::do_recognize_by_name): New virtual function.
16260         (Target_selector::instantiate_target): New private function.
16261         (supported_target_names): Declare.
16262         * target-select.cc (Target_selector::Target_selector): Update for
16263         new parameter and fields.
16264         (select_target_by_name): Check that the name matches before
16265         calling recognize_by_name.
16266         (supported_target_names): New function.
16267         * i386.cc (class Target_selector_i386): Update Target_selector
16268         constructor call.  Remove recognize and recognize_by_name.  Add
16269         do_instantiate_target.
16270         * x86_64.cc (class Target_selector_x86_64): Likewise.
16271         * testsuite/testfile.cc (class Target_selector_test): Update for
16272         changes to Target_selector.
16273
16274         * README: Rewrite, with some notes on unsupported features.
16275
16276 2008-03-24  Cary Coutant  <ccoutant@google.com>
16277
16278         * i386.cc (Target_i386::Got_type): New enum declaration.
16279         (Target_i386::Scan::local): Updated callers of Output_data_got
16280         member functions.
16281         (Target_i386::Scan::global): Likewise.
16282         (Target_i386::Relocate::relocate): Likewise.
16283         (Target_i386::Relocate::relocate_tls): Likewise.
16284         * object.h (Got_offset_list): New class.
16285         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16286         (Sized_relobj::local_got_offset): Likewise.
16287         (Sized_relobj::set_local_got_offset): Likewise.
16288         (Sized_relobj::local_has_tls_got_offset): Removed.
16289         (Sized_relobj::local_tls_got_offset): Removed.
16290         (Sized_relobj::set_local_tls_got_offset): Removed.
16291         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16292         * output.cc (Output_data_got::add_global): Added got_type parameter.
16293         (Output_data_got::add_global_with_rel): Likewise.
16294         (Output_data_got::add_global_with_rela): Likewise.
16295         (Output_data_got::add_global_pair_with_rel): New function.
16296         (Output_data_got::add_global_pair_with_rela): New function.
16297         (Output_data_got::add_local): Added got_type parameter.
16298         (Output_data_got::add_local_with_rel): Likewise.
16299         (Output_data_got::add_local_with_rela): Likewise.
16300         (Output_data_got::add_local_pair_with_rel): New function.
16301         (Output_data_got::add_local_pair_with_rela): New function.
16302         (Output_data_got::add_global_tls): Removed.
16303         (Output_data_got::add_global_tls_with_rel): Removed.
16304         (Output_data_got::add_global_tls_with_rela): Removed.
16305         (Output_data_got::add_local_tls): Removed.
16306         (Output_data_got::add_local_tls_with_rel): Removed.
16307         (Output_data_got::add_local_tls_with_rela): Removed.
16308         * output.h (Output_data_got::add_global): Added got_type parameter.
16309         (Output_data_got::add_global_with_rel): Likewise.
16310         (Output_data_got::add_global_with_rela): Likewise.
16311         (Output_data_got::add_global_pair_with_rel): New function.
16312         (Output_data_got::add_global_pair_with_rela): New function.
16313         (Output_data_got::add_local): Added got_type parameter.
16314         (Output_data_got::add_local_with_rel): Likewise.
16315         (Output_data_got::add_local_with_rela): Likewise.
16316         (Output_data_got::add_local_pair_with_rel): New function.
16317         (Output_data_got::add_local_pair_with_rela): New function.
16318         (Output_data_got::add_global_tls): Removed.
16319         (Output_data_got::add_global_tls_with_rel): Removed.
16320         (Output_data_got::add_global_tls_with_rela): Removed.
16321         (Output_data_got::add_local_tls): Removed.
16322         (Output_data_got::add_local_tls_with_rel): Removed.
16323         (Output_data_got::add_local_tls_with_rela): Removed.
16324         * resolve.cc (Symbol::override_base_with_special): Removed
16325         reference to has_got_offset_ field.
16326         * symtab.cc (Symbol::init_fields): Replaced initialization
16327         of got_offset_ with got_offsets_.  Removed initialization
16328         of has_got_offset_
16329         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16330         (Symbol::got_offset): Likewise.
16331         (Symbol::set_got_offset): Likewise.
16332         (Symbol::has_tls_got_offset): Removed.
16333         (Symbol::tls_got_offset): Removed.
16334         (Symbol::set_tls_got_offset): Removed.
16335         (Symbol::got_offset_): Removed.
16336         (Symbol::tls_mod_got_offset_): Removed.
16337         (Symbol::tls_pair_got_offset_): Removed.
16338         (Symbol::got_offsets_): New field.
16339         (Symbol::has_got_offset): Removed.
16340         (Symbol::has_tls_mod_got_offset): Removed.
16341         (Symbol::has_tls_pair_got_offset): Removed.
16342         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16343         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16344         member functions.
16345         (Target_x86_64::Scan::global): Likewise.
16346         (Target_x86_64::Relocate::relocate): Likewise.
16347         (Target_x86_64::Relocate::relocate_tls): Likewise.
16348
16349 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16350
16351         * yyscript.y: Fix spelling error in comment.
16352
16353 2008-03-24  Ian Lance Taylor  <iant@google.com>
16354
16355         * options.h (class General_options): Define build_id option.
16356         * layout.h (class Layout): Declare write_build_id, create_note,
16357         create_build_id.  Add build_id_note_ member.
16358         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16359         "libiberty.h", "md5.h", "sha1.h".
16360         (Layout::Layout): Initialize eh_frame_data_,
16361         eh_frame_hdr_section_, and build_id_note_.
16362         (Layout::finalize): Call create_build_id.
16363         (Layout::create_note): New function, broken out of
16364         Layout::create_gold_note.
16365         (Layout::create_gold_note): Call create_note.
16366         (Layout::create_build_id): New function.
16367         (Layout::write_build_id): New function.
16368         (Close_task_runner::run): Call write_build_id.
16369
16370         * x86_64.cc: Correct license to GPLv3.
16371
16372 2008-03-23  Ian Lance Taylor  <iant@google.com>
16373
16374         * options.cc: Include "demangle.h".
16375         (parse_optional_string): New function.
16376         (parse_long_option): Handle takes_optional_argument.
16377         (parse_short_option): Update dash_z initializer.  Handle
16378         takes_optional_argument.
16379         (General_options::General_options): Initialize do_demangle_.
16380         (General_options::finalize): Set do_demangle_.  Handle demangling
16381         style.
16382         * options.h (parse_optional_string): Declare.
16383         (struct One_option): Add optional_arg field.  Update constructor.
16384         Update call constructor calls.  Add takes_optional_argument
16385         function.
16386         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16387         (DEFINE_optional_string): Define.
16388         (General_options::demangle): Change from DEFINE_bool to
16389         DEFINE_optional_string.
16390         (General_options::no_demangle): New function.
16391         (General_options::do_demangle): New function.
16392         (General_options::set_do_demangle): New function.
16393         (General_options::execstack_status_): Move definition to end of
16394         class definition.
16395         (General_options::static_): Likewise.
16396         (General_options::do_demangle_): New field.
16397         * object.cc (big_endian>::get_symbol_location_info): Call
16398         Options::do_demangle, not Options::demangle.
16399         * symtab.cc (demangle): Likewise.
16400
16401 2008-03-22  Ian Lance Taylor  <iant@google.com>
16402
16403         * gold.h: Include <cstddef> and <sys/types.h>
16404         * options.h: Include <cstring>.
16405
16406 2008-03-21  Ian Lance Taylor  <iant@google.com>
16407
16408         * Added source code to GNU binutils.
16409 \f
16410 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16411
16412 Copying and distribution of this file, with or without modification,
16413 are permitted in any medium without royalty provided the copyright
16414 notice and this notice are preserved.
16415
16416 Local Variables:
16417 mode: change-log
16418 left-margin: 8
16419 fill-column: 74
16420 version-control: never
16421 End: