PPC gold doesn't check for overflow properly
[external/binutils.git] / gold / ChangeLog
1 2014-11-20  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
4         from --stub-group-size parameter divided by 1024.
5         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
6         template parameter.  Update all uses.
7         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
8         has_stub_value.  Set for long branches.  Don't report overflow for
9         branch to undefined weak symbols.  Print info message on
10         overflowing branch to stub.
11
12 2014-11-20  Alan Modra  <amodra@gmail.com>
13
14         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
15
16 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
17
18         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
19         entry for R_X86_64_GOTPLT64.
20         (Target_x86_64<size>::Relocate::relocate): Update comments for
21         R_X86_64_GOTPLT64.
22
23 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
24
25         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
26         * plugin.h: add lock definition
27
28 2014-10-29  Han Shen  <shenhan@google.com>
29             Jing Yu   <jingyu@google.com>
30
31         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
32         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
33         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
34         Symbol::TLS_REF.
35         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
36         method.
37         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
38         (Target_aarch64::tls_ld_to_le): New method.
39         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
40         for 64bit targets.
41         (Output_data_plt_aarch64::irelative_rel_): New data member.
42         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
43         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
44         (Output_data_plt_aarch64::add_relocation): New method.
45         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
46         offset. Add got_irelative size to got size.
47         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
48         type string with the new typename.
49         (AArch64_relocate_functions::update_adr): Replace parameter x with
50         immed.
51         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
52         (AArch64_relocate_functions::reloc_common): New method.
53         (AArch64_relocate_funcsions::rela_general): Extract common part out
54         into reloc_common method.
55         (AArch64_relocate_functions::rela_general): Likewise.
56         (AArch64_relocate_functions::pcrela_general): Likewise.
57         (AArch64_relocate_functions::adr): New method.
58         (AArch64_relocate_functions::adrp): Calculate immed before calling
59         update_adr.
60         (AArch64_relocate_functions::adrp): Likewise.
61         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
62         comparing x to 0. Calculate immed from ~x when x < 0.
63         (Target_aarch64::optimize_tls_reloc): Add new cases for
64         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
65         TLSLD_MOVW_DTPREL_G0_NC.
66         (Target_aarch64::possible_function_pointer_reloc): Implement this
67         method.
68         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
69         comment.
70         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
71         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
72         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
73         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
74         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
75         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
76         (Target_aarch64::make_plt_entry): Call add_entry with two more
77         parameters.
78         (Target_aarch64::make_local_ifunc_plt_entry): New method.
79         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
80         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
81         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
82         (Target_aarch64::Relocate::relocate_tls): Add cases for
83         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
84         TLSLD_MOVW_DTPREL_G0_NC.
85         * testsuite/icf_safe_so_test.cc: Correct test comment.
86         * testsuite/icf_safe_test.sh: Add AArch64 arch.
87
88 2014-10-22  Alan Modra  <amodra@gmail.com>
89
90         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
91         thread_starter.
92
93 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
94
95         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
96
97 2014-10-17  Cary Coutant  <ccoutant@google.com>
98
99         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
100         Add "typename" keyword.
101
102 2014-09-22  Han Shen  <shenhan@google.com>
103             Jing Yu   <jingyu@google.com>
104
105         Patch for gold aarch64 backend to support relaxation.
106         * aarch64-reloc.def: Change format.
107         * aarch64.cc (class Reloc_stub): New class.
108         (class Stub_table): New class.
109         (class AArch64_relobj): New class.
110         (class AArch64_input_section): New class.
111         (class AArch64_output_section): New class.
112         (Target_aarch64::new_stub_table): New method.
113         (Target_aarch64::new_aarch64_input_section): New method.
114         (Target_aarch64::find_aarch64_input_section): New method.
115         (Target_aarch64::scan_section_for_stubs): New method.
116         (Target_aarch64::scan_reloc_section_for_stubs): New method.
117         (Target_aarch64::relocate_stub): New method.
118         (Target_aarch64::current_target): New method.
119         (Target_aarch64::do_make_elf_object): New method.
120         (Target_aarch64::do_may_relax): New method.
121         (Target_aarch64::do_relax): New method.
122         (Target_aarch64::group_sections): New method.
123         (Target_aarch64::scan_reloc_for_stub): New method.
124         (Target_aarch64::do_make_output_section): New method.
125         (Target_aarch64::stub_tables_): New data member.
126         (Target_aarch64::aarch64_input_section_map_): New data member.
127         (AArch64_relocate_functions::maybe_apply_stub): New method.
128
129 2014-09-30  Cary Coutant  <ccoutant@google.com>
130
131         PR gold/17432
132         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
133
134 2014-09-30  Kito Cheng  <kito@0xlab.org>
135
136         PR gold/13597
137         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
138         hash table before sysv-style hash table.
139
140 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
141
142         * options.h (--pic-executable): Add negative to alias to -no-pie.
143
144 2014-09-26  Cary Coutant  <ccoutant@google.com>
145
146         PR gold/16773
147         * object.cc (Sized_relobj_file): Compute value of section symbols
148         for TLS sections the same as TLS symbols.
149
150 2014-09-25  Cary Coutant  <ccoutant@google.com>
151
152         PR gold/17432
153         * resolve.cc (Symbol_table::resolve): Override common placeholder
154         symbols, but adjust sizes.
155         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
156         symbols to common lists.
157
158 2014-09-24  Alan Modra  <amodra@gmail.com>
159
160         * po/POTFILES.in: Regenerate.
161
162 2014-09-23  Taiju Tsuiki  <tzik@google.com>
163             Cary Coutant  <ccoutant@google.com>
164
165         PR gold/14860
166         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
167         on input_sections_blocker.
168         * layout.cc (Write_sections_task::locks): Unblock
169         input_sections_blocker_.
170         * layout.h (Write_sections_task::Write_sections_task): Add
171         input_sections_blocker.
172         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
173         to DEPENDENCIES.
174         * testsuite/Makefile.in: Regenerate.
175
176 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
177
178         * testsuite/Makefile.am (plugin_test_10): New test.
179         * testsuite/Makefile.in: Regenerate
180         * testsuite/plugin_common_test_2.c (c1): Align to 8.
181         * testsuite/plugin_test_10.sh: New file.
182
183 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
184
185         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
186         * resolve.cc (Symbol_table::resolve): Don't override common symbols
187         during the replacement phase.
188
189 2014-09-17  Han Shen  <shenhan@google.com>
190             Jing Yu  <jingyu@google.com>
191
192         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
193         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
194         * aarch64.cc (Target_aarch64): Add data members
195         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
196         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
197         constructor.
198         (Target_aarch64::do_reloc_symbol_index): New method.
199         (Target_aarch64::do_reloc_addend): New method.
200         (Target_aarch64::add_tlsdesc_info): New method.
201         (Target_aarch64::do_dynsym_value): New method.
202         (Target_aarch64::do_make_data_plt): Add new parameters: got,
203         got_irelative. Pass them to Output_data_plt_aarch64_standard.
204         (Target_aarch64::make_data_plt): Add new parameters: got,
205         got_irelative. Pass them to do_make_data_plt.
206         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
207         (Target_aarch64::Relocate:tls_gd_to_le): New method.
208         (Target_aarch64::Relocate:tls_ie_to_le): New method.
209         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
210         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
211         (Target_aarch64::got_tlsdesc_section): New method.
212         (Target_aarch64::make_local_ifunc_plt_entry): New method.
213         (Target_aarch64::define_tls_base_symbol): New method.
214         (Target_aarch64::reserve_tlsdesc_entries): New method.
215         (Target_aarch64::got_mod_index_entry): New method.
216         (Target_aarch64::rela_tlsdesc_section): New method.
217         (Target_aarch64::rela_irelative_section): New method.
218         (Target_aarch64::Tlsdesc_info): New struct.
219         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
220         relocations and tlsdesc relocations.
221         (Target_aarch64::optimize_tls_reloc): Implement method.
222         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
223         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
224         in constructor.
225         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
226         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
227         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
228         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
229         (Output_data_plt_aarch64::rela_tlsdesc): New method.
230         (Output_data_plt_aarch64::rela_irelative): New method.
231         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
232         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
233         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
234         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
235         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
236         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
237         (Output_data_plt_aarch64_standard): New member variables:
238         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
239         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
240         New parameter: got, got_irelative.
241         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
242         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
243         (Output_data_plt_aarch64::do_write): Replace got_address with
244         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
245         (AArch64_relocate_functions::update_movnz): New method.
246         (AArch64_relocate_functions): Correct format.
247         (AArch64_relocate_functions::movnz): New method.
248         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
249         before the switch. Add new cases to switch.
250         Check ie_to_le relaxation on tlsie relocations. Add code handling
251         tlsgd tlsdesc cases.
252         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
253         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
254         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
255         Call reloc_name_in_error_message to print unsupported reloc.
256         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
257         make_data_plt.
258         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
259         relocs. Fill in some more dynamic tags.
260         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
261         Skip call tls_get_addr when tlsgd is relaxed.
262         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
263         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
264         tlsdesc->ie relaxation.
265
266 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
267
268         * mips.cc (Target_mips_nacl): New class.
269         (Target_selector_mips_nacl): New class.
270         (target_selector_mips32): Rename from target_selector_mips32be and use
271         Target_selector_mips_nacl instead of Target_selector_mips.
272         (target_selector_mips32el): Rename from target_selector_mips32 and use
273         Target_selector_mips_nacl instead of Target_selector_mips.
274         (target_selector_mips64): Rename from target_selector_mips64be and use
275         Target_selector_mips_nacl instead of Target_selector_mips.
276         (target_selector_mips64el): Rename from target_selector_mips64 and use
277         Target_selector_mips_nacl instead of Target_selector_mips.
278         (Target_mips::mips_info): Add const attribute.
279
280 2014-09-02  Cary Coutant  <ccoutant@google.com>
281
282         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
283         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
284         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
285         (Sized_incr_dynobj::do_section_name): Likewise.
286         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
287         (Sized_incr_dynobj::do_section_name): Likewise.
288         * object.h (Object::section_name): Likewise.
289         (Object::do_section_name): Likewise.
290         (Sized_relobj_file::do_section_name): Likewise.
291         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
292         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
293
294 2014-09-02  Cary Coutant  <ccoutant@google.com>
295
296         PR gold/17005
297         * ehframe.cc (Fde::write): Add output_offset parameter.
298         (Cie::write): Likewise.
299         (Eh_frame::set_final_data_size): Account for offset within output
300         section.
301         (Eh_frame::do_sized_write): Likewise.
302         * ehframe.h (Fde::write): Add output_offset parameter.
303         (Cie::write): Likewise.
304         * output.cc (Output_section::Input_section_sort_entry): Remove
305         section_has_name_; add output_section_name parameter. Use
306         output section name for non-input sections.
307         (Output_section::Input_section_sort_entry::section_has_name): Remove.
308         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
309         (Output_section::Input_section_sort_compare): Remove logic for
310         sections without names.
311         (Output_section::Input_section_sort_init_fini_compare): Likewise.
312         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
313         Likewise.
314         (Output_section::Input_section_sort_section_name_compare): Likewise.
315
316 2014-08-29 Han Shen <shenhan@google.com>
317            Jing Yu <jingyu@google.com>
318
319         * aarch64-reloc-property.cc
320         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
321         reference reloc property in the table.
322         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
323         3 other entries.
324         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
325         2 new overloaded methods.
326         (Output_data_got_aarch64::do_write): Add code to write out
327         static relocs.
328         (class Output_data_got_aarch64::Static_reloc): New class to wrap
329         static relocs.
330         (Output_data_got_aarch64::static_relocs): New vector to
331         hold static relocs.
332         (Target_aarch64::TCB_SIZE): New const static memeber.
333         (Target_aarch64::tcb_size): New method.
334         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
335         (Target_aarch64::Relocate::relocate_tls): New method.
336         (Target_aarch64::Scan::local): Add code handling new reloc types.
337         (Target_aarch64::Scan::global): Add code handling new reloc types.
338
339 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
340
341         * options.h (-no-pie): Add option.
342
343 2014-08-08  Jing Yu  <jingyu@google.com>
344             Han Shen  <shenhan@google.com>
345
346         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
347         (DEFFILES): add aarch64-reloc.def.
348         (TARGETSOURCES): Add aarch64-reloc-property.cc.
349         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
350         * Makefile.in: Regenerate.
351         * aarch64-reloc-property.cc: New file.
352         * aarch64-reloc-property.h: New file.
353         * aarch64-reloc.def: New file.
354         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
355         with tab to make the format consistent.
356         (Output_data_got_aarch64::symbol_table_): New method.
357         (Target_aarch64::do_plt_address_for_global): New method.
358         (Target_aarch64::do_plt_address_for_local): New method.
359         (Target_aarch64::do_select_as_default_target): New method.
360         (Target_aarch64::do_make_data_plt): New method.
361         (Target_aarch64::make_data_plt): New method.
362         (Output_data_plt_aarch64::has_irelative_section): New method.
363         (Output_data_plt_aarch64::address_for_global): New method.
364         (Output_data_plt_aarch64::address_for_local): New method.
365         (Output_data_plt_aarch64::irelative_rel_): New parameter.
366         (Output_data_plt_aarch64::add_entry): Implement contents.
367         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
368         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
369         the got_pov entry to plt0.
370         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
371         Implement contents.
372         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
373         (AArch64_howto): New struct.
374         (aarch64_howto[]): New static const array.
375         (AArch64_relocate_functions): New class.
376         (Target_aarch64::Scan::get_reference_flags): Remove method.
377         (Target_aarch64::Scan::local): Implement to support a few relocations.
378         (Target_aarch64::Scan::global): Implement to support a few relocations.
379         (Target_aarch64::make_plt_section): Implement contents.
380         (Target_aarch64::make_plt_entry): Implement contents.
381         (Target_aarch64::do_finalize_sections): Implement contents.
382         (Target_aarch64::Relocate::relocate): Implement a few relocations.
383         (Target_aarch64::relocate_section): Implement contents.
384
385 2014-08-06  Alan Modra  <amodra@gmail.com>
386
387         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
388
389 2014-08-06  Alan Modra  <amodra@gmail.com>
390
391         PR 13227
392         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
393
394 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
395
396         * object.cc (Relobj::is_section_name_included): Add
397         ".rodata.nptl_version" to not garbage collect this section.
398
399 2014-07-08  Cary Coutant  <ccoutant@google.com>
400
401         * expression.cc (struct Expression::Expression_eval_info): Add
402         new fields type_pointer, vis_pointer, and nonvis_pointer.
403         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
404         nonvis_pointer parameters. Adjust all calls.
405         (Symbol_expression::value): Update type, visibility, and nonvis bits
406         in caller.
407         * script.cc (Symbol_assignment::sized_finalize): Update type,
408         visibility, and remaining st_other bits for new symbol.
409         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
410         vis_pointer, and nonvis_pointer parameters.
411         * symtab.h (Symbol::set_type): New method.
412
413         * testsuite/Makefile.am (defsym_test): New test.
414         * testsuite/Makefile.in: Regenerate.
415         * testsuite/defsym_test.c: New file.
416         * testsuite/defsym_test.sh: New file.
417
418 2014-07-08  Cary Coutant  <ccoutant@google.com>
419
420         PR gold/15639
421         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
422         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
423         (Sized_dynobj::base_read_symbols): ...new method.
424         * object.h (Sized_relobj_file::base_read_symbols): New method.
425         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
426         (Sized_relobj_file::base_read_symbols): ...new method.
427         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
428         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
429         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
430
431 2014-07-04  Alan Modra  <amodra@gmail.com>
432
433         * po/POTFILES.in: Regenerate.
434
435 2014-07-02  Jing Yu  <jingyu@google.com>
436
437         * aarch64.cc: New file
438         * Makefile.am (TARGETSOURCES): Add aarch64.cc
439         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
440         * Makefile.in: Regenerate.
441         * configure.tgt: Add entries for aarch64*.
442         * configure.ac:  Likewise.
443         * configure: Likewise.
444
445 2014-06-27  Alan Modra  <amodra@gmail.com>
446
447         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
448
449 2014-06-24  Cary Coutant  <ccoutant@google.com>
450
451         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
452         sections.
453         (Dwo_file::sized_read_unit_index): Likewise.
454
455 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
456
457         * mips.cc: New file.
458         * Makefile.am (TARGETSOURCES): Add mips.cc
459         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
460         * configure.tgt: Add entries for mips*.
461         * configure.ac: Likewise.
462         * Makefile.in: Regenerate.
463         * configure: Likewise.
464
465 2014-06-09  Cary Coutant  <ccoutant@google.com>
466
467         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
468         unit_length is within section bounds.
469
470 2014-06-09  Cary Coutant  <ccoutant@google.com>
471
472         PR gold/16980
473         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
474         map.
475
476 2014-06-07  Alan Modra  <amodra@gmail.com>
477
478         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
479
480 2014-06-06  Cary Coutant  <ccoutant@google.com>
481
482         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
483         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
484         (Dwarf_pubnames_table::read_header): Likewise.
485         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
486         .debug_gnu_pubtypes.
487
488 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
489
490         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
491         * Makefile.in, configure: Regenerate.
492
493 2014-06-03  Alan Modra  <amodra@gmail.com>
494
495         * powerpc.cc (addis_12_2): Define.
496         (Stub_table::do_write): Support fusion on ELFv2 stubs.
497
498 2014-06-03  Alan Modra  <amodra@gmail.com>
499
500         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
501         st_other output.
502
503 2014-06-02  Alan Modra  <amodra@gmail.com>
504
505         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
506         Only ignore relocs on ELFv1.
507         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
508
509 2014-05-30  Cary Coutant  <ccoutant@google.com>
510
511         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
512         * testsuite/Makefile.in: Regenerate.
513         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
514
515 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
516
517         PR gold/16945
518         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
519         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
520
521 2014-05-15  Alan Modra  <amodra@gmail.com>
522
523         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
524         Compare FDE contents with DW_CFA_nop rather than 0.
525
526 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
527
528         * symtab.h (may_need_copy_reloc): Remove check for position independent
529         code.
530         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
531         position independence before pc absolute may_need_copy_reloc call.
532         Add check for executable output befor pc relative may_need_copy_reloc
533         call.
534         * i386.cc: Ditto.
535         * arm.cc: Ditto.
536         * sparc.cc: Ditto.
537         * tilegx.cc: Ditto.
538         * powerpc.cc: Add check for no position independence before
539         may_need_copy_reloc calls.
540         * testsuite/pie_copyrelocs_test.cc: New file.
541         * testsuite/pie_copyrelocs_shared_test.cc: New file.
542         * Makefile.am (pie_copyrelocs_test): New test.
543         * Makefile.in: Regenerate.
544
545 2014-05-08  Martin Liška  <mliska@suse.cz>
546
547         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
548
549 2014-05-06  Cary Coutant  <ccoutant@google.com>
550
551         PR gold/16900
552         * i386.cc (Output_data_got_plt_i386): New class.
553         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
554         parameter. Change all callers.
555         (Output_data_plt_i386::layout_): Remove.
556         (Output_data_plt_i386::got_plt_): Change type.
557         (Target_i386::got_plt_): Change type. Change all references.
558         (Target_i386::got_section): Create instance of new class.
559         (Output_data_got_plt_i386::do_write): New function.
560         * x86_64.cc (Output_data_got_plt_x86_64): New class.
561         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
562         parameter. Change all callers.
563         (Output_data_plt_x86_64::layout_): Remove.
564         (Output_data_plt_x86_64::got_plt_): Change type.
565         (Target_x86_64::got_plt_): Change type. Change all references.
566         (Target_x86_64::got_section): Create instance of new class.
567         (Output_data_got_plt_x86_64::do_write): New function.
568         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
569         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
570         class.
571
572 2014-05-05  Cary Coutant  <ccoutant@google.com>
573
574         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
575         if we have pubnames/pubtypes.
576
577 2014-05-02  Cary Coutant  <ccoutant@google.com>
578
579         * defstd.cc (in_segment): Define __ehdr_start here...
580         * layout.cc (Layout::finalize): ...Instead of here.  Set the
581         output segment when known.
582         * resolve.cc (Symbol::override_base_with_special): Remember
583         the original binding.
584         * symtab.cc (Symbol::set_output_segment): New function.
585         (Symbol::set_undefined): New function.
586         * symtab.h (Symbol::is_weak_undefined): Check original undef
587         binding.
588         (Symbol::is_strong_undefined): New function.
589         (Symbol::set_output_segment): New function.
590         (Symbol::set_undefined): New function.
591         * target-reloc.h (is_strong_undefined): Remove.
592         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
593         Check for hidden undefs.
594         (relocate_section): Call Symbol::is_strong_undefined.
595
596         * testsuite/Makefile.am (ehdr_start_test_1)
597         (ehdr_start_test_2, ehdr_start_test_3)
598         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
599         * testsuite/Makefile.in: Regenerate.
600         * testsuite/ehdr_start_def.cc: New source file.
601         * testsuite/ehdr_start_test.cc: New source file.
602         * testsuite/ehdr_start_test.t: New linker script.
603         * testsuite/ehdr_start_test_4.sh: New shell script.
604
605 2014-04-23  Cary Coutant  <ccoutant@google.com>
606
607         PR gold/16870
608         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
609
610 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
611
612         * layout.cc (Layout::include_section): Allow a target to decide
613         whether to include a section.
614         * target.h (Target::should_include_section): New function.
615         (Target::do_should_include_section): New function.
616
617 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
618
619         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
620         inline into ...
621         (Copy_relocs::emit): ... here.
622         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
623         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
624         (Copy_reloc_entry::entries_): Change from private to protected.
625
626 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
627
628         * icf.cc (get_section_contents): Replace copies of reloc
629         vectors with const references.
630
631 2014-04-02  Cary Coutant  <ccoutant@google.com>
632
633         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
634         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
635         * configure: Regenerate.
636         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
637         -fno-use-linker-plugin.
638         (LINK1, CXXLINK1): Add it to the link command.
639         * testsuite/Makefile.in: Regenerate.
640
641 2014-03-12  Alan Modra  <amodra@gmail.com>
642
643         * Makefile.in: Regenerate.
644
645 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
646
647         * symtab.h (Symbol::set_nonvis): New function.
648
649 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
650
651         * symtab.cc (Sized_symbol<32>::init_output_data):
652         Instantiate the template.
653         (Sized_symbol<64>::init_output_data): Likewise.
654
655 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
656
657         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
658         adjust dynamic symbol value.
659         * target.h (Target::adjust_dyn_symbol): New function.
660         (Target::do_adjust_dyn_symbol): New function.
661
662 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
663
664         * output.cc (Output_data_dynamic::Dynamic_entry::write):
665         Get the value of DYNAMIC_CUSTOM dynamic entry.
666         * output.h (Output_data_dynamic::add_custom): New function.
667         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
668         dynamic entry.
669         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
670         * target.h (Target::dynamic_tag_custom_value): New function.
671         (Target::do_dynamic_tag_custom_value): New function.
672
673 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
674
675         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
676         dynsym indexes.
677         * target.h (Target::has_custom_set_dynsym_indexes): New function.
678         (Target::do_has_custom_set_dynsym_indexes): New function.
679         (Target::set_dynsym_indexes): New function.
680         (Target::do_set_dynsym_indexes): New function.
681
682 2014-03-07  Alan Modra  <amodra@gmail.com>
683
684         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
685         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
686         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
687         (Powerpc_relocate_functions::has_overflow_bitfield,
688         overflowed): Use the above.
689         (Target_powerpc::Relocate::relocate): Correct overflow checking
690         for a number of relocations.  Modify overflow test for 16-bit
691         fields in instructions to signed/unsigned according to whether
692         the field takes a signed or unsigned value.
693
694 2014-03-05  Alan Modra  <amodra@gmail.com>
695
696         Update copyright years.
697
698 2014-03-05  Alan Modra  <amodra@gmail.com>
699
700         * powerpc.cc (Target_powerpc::Scan::local, global): Support
701         R_PPC64_ADDR64_LOCAL.
702         (Target_powerpc::Relocate::relocate): Likewise.
703
704 2014-03-03  Alan Modra  <amodra@gmail.com>
705
706         * dwp.cc (print_version): Update copyright year to current.
707
708 2014-02-10  Alan Modra  <amodra@gmail.com>
709
710         * po/gold.pot: Regenerate.
711
712 2014-02-06  Cary Coutant  <ccoutant@google.com>
713
714         Fix problem where -u is ignored when a weak undef is seen.
715
716         * archive.cc (Library_base::should_include_member): Reorder
717         code to check for -u option if a weak undef has already been seen.
718         * testsuite/Makefile.am (weak_undef_test_2): New test case.
719         * testsuite/Makefile.in: Regenerate.
720         * testsuite/weak_undef_file3.cc: New file.
721         * testsuite/weak_undef_file4.cc: New file.
722         * testsuite/weak_undef_test_2.cc: New file.
723
724 2014-02-05  Cary Coutant  <ccoutant@google.com>
725
726         Fix issues with gold undefined symbol diagnostics.
727
728         PR binutils/15435
729         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
730         check to here.
731         * target-reloc.h (is_strong_undefined): New function.
732         (relocate_section): Move undef vtable symbol check from here.
733         Check for is_strong_undefined.
734
735 2014-02-05  Cary Coutant  <ccoutant@google.com>
736
737         Fix problems with the --dynamic-list option.
738
739         PR gold/13577
740         * options.cc (General_options::parse_dynamic_list):
741         Set have_dynamic_list_.
742         (General_options::General_options): Initialize have_dynamic_list_.
743         (General_options::finalize): Turn off -Bsymbolic and
744         -Bsymbolic-functions if --dynamic-list provided.
745         * options.h (General_options::have_dynamic_list): New function.
746         (General_options::have_dynamic_list_): New data member.
747         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
748         correctly.
749
750         PR gold/16530
751         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
752         in --dynamic-list, mark it.
753
754         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
755         (dynamic_list_2): New test case.
756         * testsuite/Makefile.in: Regenerate.
757         * testsuite/dynamic_list_2.cc: New file.
758         * testsuite/dynamic_list_2.t: New file.
759         * testsuite/dynamic_list_lib1.cc: New file.
760         * testsuite/dynamic_list_lib2.cc: New file.
761         * testsuite/gc_dynamic_list_test.c: New file.
762         * testsuite/gc_dynamic_list_test.sh: New file.
763         * testsuite/gc_dynamic_list_test.t: New file.
764
765 2014-01-28  Cary Coutant  <ccoutant@google.com>
766
767         Add .gdb_index version 7 support.
768
769         * gold/dwarf_reader.cc: include <utility> (for make_pair).
770         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
771         debug sections.
772         (Dwarf_ranges_table::read_ranges_table): Likewise.
773         (Dwarf_pubnames_table::read_section): Check for GNU-style
774         sections, and for compressed debug sections.
775         (Dwarf_pubnames_table::read_header): Compute end address of table.
776         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
777         for end of list by offset, not by offset == 0.
778         (Dwarf_info_reader::do_read_string_table): Check for compressed
779         debug sections.
780         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
781         Initialize new data members.
782         (Dwarf_pubnames_table::next_name): return flag_byte.
783         (Dwarf_pubnames_table::end_of_table_): New data member.
784         (Dwarf_pubnames_table::is_gnu_style_): New data member.
785         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
786         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
787         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
788         read skeleton type unit DIEs.
789         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
790         (Gdb_index::do_write): Write flag_byte.
791         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
792         (Gdb_index::Cu_vector): Store flags along with cu indexes.
793         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
794         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
795
796 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
797
798         * version.cc (print_version): Update copyright year to 2014.
799
800 2013-12-19  Dimitry Andric  <dimitry@andric.com>
801
802         * stringpool.cc (Stringpool_template::reserve): Add
803         HAVE_UNORDERED_MAP case.
804         * stringpool.cc (Stringpool_template::print_stats): Likewise.
805
806 2013-12-18  Cary Coutant  <ccoutant@google.com>
807
808         * configure.ac: Check for <unordered_set> and <unordered_map>.
809         * config.in: Regenerate.
810         * configure: Regenerate.
811         * system.h: Use <unordered_set> and <unordered_map> if available.
812
813 2013-12-10  Roland McGrath  <mcgrathr@google.com>
814
815         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
816         with $(INSTALL_PROGRAM_ENV).
817         * Makefile.in: Regenerate.
818
819 2013-11-22  Cary Coutant  <ccoutant@google.com>
820
821         * configure.ac: Add check for which library is needed for
822         dlopen.
823         * configure: Regenerate.
824
825 2013-11-22  Cary Coutant  <ccoutant@google.com>
826
827         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
828         assembler.
829         * testsuite/Makefile.in: Regenerate.
830
831 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
832
833         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
834         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
835         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
836         (Target_x86_64<size>::Scan::local): Likewise.
837         (Target_x86_64<size>::Scan::global): Likewise.
838         (Target_x86_64<size>::Relocate::relocate): Likewise.
839         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
840         Likewise.
841         (Target_x86_64<size>::Scan::check_non_pic(): Handle
842         R_X86_64_PC32_BND.
843
844         * testsuite/Makefile.am (check_PROGRAMS): Add
845         exception_x86_64_bnd_test.
846         (exception_x86_64_bnd_test_SOURCES): New macro.
847         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
848         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
849         (exception_x86_64_bnd_test_LDADD): Likewise.
850         (exception_x86_64_bnd_1.o): New rule.
851         (exception_x86_64_bnd_2.o): Likewise.
852         * testsuite/Makefile.in: Regenerated.
853
854 2013-11-15  Alan Modra  <amodra@gmail.com>
855
856         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
857         accessor.
858         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
859         Only call ppc64_local_entry_offset for 64-bit.  Restrict
860         symval_for_branch lookup to ELFv1.
861         (Stub_table::add_plt_call_entry): Use unsigned int off.
862         (Output_data_glink::Address, invalid_address): New.
863         (Output_data_glink::add_eh_frame): Move out of line.  Add
864         support for ELFv2.
865         (Output_data_glink::add_global_entry, find_global_entry,
866         global_entry_address): New functions.
867         (Output_data_glink::global_entry_stubs_, end_branch_table_,
868         ge_size): New variables.
869         (Output_data_glink::set_final_data_size): Add global entry
870         stub sizing.
871         (Output_data_glink::do_write): Write global entry stubs.
872         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
873         parameter.  Return true for ELFv2.  Adjust callers.
874         (Target_powerpc::Scan::local, global): Restrict opd lookup to
875         ELFv1.  Similarly for ifunc and dynamic relocation processing
876         specific to ELFv1.  Recognize that symbols are defined on
877         their plt entries for ELFv2.
878         (Target_powerpc::symval_for_branch): Assert if called for
879         ELFv2 or ppc32.
880         (Target_powerpc::Relocate::relocate): Use global entry plt
881         stub for symbol value if such exists on ELFv2.
882         (Target_powerpc::Relocate::relocate): Don't call
883         symval_for_branch when ELFv2.  Do adjust for local entry
884         offset when ELFv2.
885         (Target_powerpc::do_dynsym_value): Set symbols to global entry
886         plt stub for ELFv2.
887         (Target_powerpc::do_plt_address_for_global): Similarly.
888
889 2013-11-14  Cary Coutant  <ccoutant@google.com>
890
891         Revert patch -- this did not fix the problem, and there is
892         no race there.
893
894         2013-11-14  Cary Coutant  <ccoutant@google.com>
895
896             PR gold/14860
897             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
898             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
899             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
900             updating fde_offsets_.
901             (Eh_frame_hdr::lock_): New data member.
902
903 2013-11-14  Cary Coutant  <ccoutant@google.com>
904
905         * dwp.cc (Dwo_file_entry): New type.
906         (File_list): Use Dwo_file_entry.
907         (Dwo_file::verify): New function.
908         (Dwo_file::verify_dwo_list): New function.
909         (Dwo_file::sized_verify_dwo_list): New function.
910         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
911         list.
912         (Dwp_options): New enum type.
913         (dwp_options): Add --verify-only.
914         (usage): Likewise.
915         (main): Likewise.
916         * dwp.h (gold_info): Add declaration.
917
918 2013-11-14  Cary Coutant  <ccoutant@google.com>
919
920         PR gold/14860
921         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
922         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
923         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
924         updating fde_offsets_.
925         (Eh_frame_hdr::lock_): New data member.
926
927 2013-11-06  Cary Coutant  <ccoutant@google.com>
928
929         PR gold/15758
930         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
931         before reloc sections.
932
933 2013-11-04  Alan Modra  <amodra@gmail.com>
934
935         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
936         (Symbol::needs_dynamic_reloc): Test new flag.
937         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
938         (Target_powerpc::Scan::get_reference_flags): Add target param.
939         Return FUNC_DESC_ABI for 64-bit ELFv1.
940         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
941         call.
942         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
943         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
944
945 2013-10-31  Cary Coutant  <ccoutant@google.com>
946
947         Restore support for dwp v2 DWARF package file format.
948
949         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
950         tu_length parameter.  Adjust all callers.
951         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
952         * dwp.cc: Include dwarf.h.
953         (Section_bounds): New struct type.
954         (Unit_set): New struct type.
955         (Dwo_file::Dwo_file): Initialize new data member.
956         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
957         Combine and rename to...
958         (Dwo_file::read_unit_index): ...this.
959         (Dwo_file::sized_read_compunit_index)
960         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
961         (Dwo_file::sized_read_unit_index): ...this.
962         (Dwo_file::copy_section): Remove section_name, is_str_offsets
963         parameters; add section_id parameter.
964         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
965         (Dwo_file::add_unit_set): ...this.
966         (Dwo_file::shndx_map_): Remove.
967         (Dwo_file::sect_offsets_): New data member.
968         (Dwp_output_file::Dwp_output_file): Initialize new data members.
969         (Dwp_output_file::add_section): Rename to...
970         (Dwp_output_file::add_contribution): ...this.
971         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
972         (Dwp_output_file::add_tu_set): Likewise.
973         (Dwp_output_file::Contribution): New type.
974         (Dwp_output_file::Section::contributions): New data member.
975         (Dwp_output_file::Cu_or_tu_set): Remove.
976         (Dwp_output_file::Section::Section): New ctor.
977         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
978         (Dwp_output_file::Dwp_index::Section_table): New type.
979         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
980         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
981         parameter.
982         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
983         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
984         (Dwp_output_file::Dwp_index::section_table): New member function.
985         (Dwp_output_file::Dwp_index::section_table_end): New member function.
986         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
987         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
988         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
989         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
990         (Dwp_output_file::Dwp_index::section_table_): New data member.
991         (Dwp_output_file::Dwp_index::section_mask_): New data member.
992         (Dwp_output_file::add_output_section): New member function.
993         (Dwp_output_file::write_new_section): New member function.
994         (Dwp_output_file::write_contributions): New member function.
995         (Dwp_output_file::section_id_map_): New data member.
996         (class Dwo_id_info_reader): Remove.
997         (class Unit_reader): New class.
998         (get_dwarf_section_name): New function.
999         (Dwo_file::read_executable): Adjust initializations of class data.
1000         (Dwo_file::read): Add support for v2 package file format.
1001         (Dwo_file::read_unit_index): Likewise.
1002         (Dwo_file::sized_read_unit_index): Likewise.
1003         (Dwo_file::copy_section): Likewise.
1004         (Dwo_file::add_unit_set): Likewise.
1005         (Dwp_output_file::add_output_section): Likewise.
1006         (Dwp_output_file::add_contribution): Likewise.
1007         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1008         for empty slot.
1009         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1010         file format.
1011         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1012         slot.
1013         (Dwp_output_file::initialize): Remove unused function.
1014         (Dwp_output_file::finalize): Add support for v2 package file format.
1015         (Dwp_output_file::write_index): Likewise.
1016         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1017         function prototype.
1018
1019 2013-10-31  Cary Coutant  <ccoutant@google.com>
1020
1021         * configure.ac: Fix check for -fmerge-constants.
1022         * configure.ac: Regenerate.
1023
1024 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1025
1026         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1027         Correct 9-byte nop sequence to match what the assembler generates.
1028
1029 2013-10-30  Alan Modra  <amodra@gmail.com>
1030
1031         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1032         ppc64_local_entry_offset, ppc64_local_entry_offset,
1033         do_read_symbols): New functions.
1034         (Powerpc_relobj::e_flags_, st_other_): New vars.
1035         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1036         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1037         (Powerpc_relobj::e_flags_): New var.
1038         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1039         and adjust for ELFv2.
1040         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1041         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1042         (Powerpc_dynobj::do_find_special_sections): Likewise.
1043         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1044         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1045         to ELFv2 local entry.
1046         (Target_powerpc::do_relax): No thread safe barriers needed for
1047         ELFv2.
1048         (Output_data_plt_powerpc::initial_plt_entry_size_,
1049         plt_entry_size): Delete.  Replace all uses with
1050         first_plt_entry_offset() and plt_entry_size().
1051         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1052         reserved_size parm.  Update callers.
1053         (Output_data_plt_powerpc::entry_count): Update.
1054         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1055         and use Target_powerpc::first_plt_entry_offset().
1056         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1057         rename to plt_entry_size.
1058         (Output_data_plt_powerpc::add_ifunc_entry,
1059         add_local_ifunc_entry): Adjust reloc for ELFv2.
1060         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1061         (glink_eh_frame_fde_64v2): New.
1062         (Stub_table::plt_call_size): Support ELFv2 sizing.
1063         (Output_data_glink::add_eh_frame): Use the new FDE.
1064         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1065         (Stub_table::do_write): Write ELFv2 stubs and glink.
1066         (Target_powerpc::Relocate::relocate): Replaces nop after call
1067         with ld 2,24(1) and adjust local offset destination for ELFv2.
1068
1069 2013-10-30  Alan Modra  <amodra@gmail.com>
1070
1071         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1072         (Target_powerpc::Scan::global, local): Likewise.
1073         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1074         on all ppc64 @h and @ha relocs.
1075
1076 2013-10-14  Alan Modra  <amodra@gmail.com>
1077
1078         * output.h (Output_data_got::add_constant): Tidy.
1079         (Output_data_got::add_constant_pair): New function.
1080         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1081         methods used so as to first call reserve_ent().
1082
1083 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1084
1085         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1086         add_got_entry and add_got_entry_pair.
1087
1088         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1089         (HAVE_PUBNAMES): Likewise.
1090         * configure: Regenerate.
1091
1092         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1093         * testsuite/Makefile.in: Regenerate.
1094
1095         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1096         Remove const from declaration.
1097         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1098         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1099         * output.h (Output_file_header): Remove const from member target_
1100         and corresponding constructor argument.
1101         * output.cc (Output_file_header::Output_file_header): Update prototype.
1102         (Output_file_header::do_sized_write): Use this->target_ in place
1103         of parameters()->target().
1104
1105         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1106
1107         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1108         * configure: Regenerate.
1109         * Makefile.in: Regenerate.
1110         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1111         * testsuite/merge_string_literals_2.c: Likewise.
1112         * testsuite/Makefile.am
1113         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1114         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1115         literal -fmerge-constants.
1116         * testsuite/Makefile.in: Regenerate.
1117
1118         * i386.cc (Target_i386): Remove unused member dynbss_.
1119         * arm.cc (Target_arm): Likewise.
1120         * powerpc.cc (Target_powerpc): Likewise.
1121         * sparc.cc (Target_sparc): Likewise.
1122         * tilegx.cc (Target_tilegx): Likewise.
1123         * x86_64.cc (Target_x86_64): Likewise.
1124         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1125         type_signature_, type_offset_.
1126         * plugin.h (Plugin_hook): Remove unused member layout_.
1127         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1128         mapfile_.
1129         (Read_member): Remove unused members input_objects_, symtab_,
1130         mapfile_, layout_.
1131         (Check_library): Remove unused member symtab_.
1132         * archive.h (Lib_group): Remove unused member lib_.
1133         * archive.cc (Lib_group::Lib_group): Update initializer.
1134         * incremental.h (Incremental_binary): Remove unused member target_.
1135         (Incremental_script_entry): Removed unused member script_.
1136         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1137         * icf.h (Icf): Remove unused member num_tracked_relocs.
1138
1139         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1140         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1141         its only use.
1142         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1143
1144         * archive.h: Use struct rather than class for forward declaration
1145         of Read_symbols_data.
1146
1147 2013-10-07  Cary Coutant  <ccoutant@google.com>
1148
1149         PR gold/16010
1150         * testsuite/Makefile.am (icf_test): Fix dependencies.
1151         (icf_safe_test): Likewise.
1152         (icf_safe_so_test): Likewise.
1153         (large_symbol_alignment): Add empty _LDADD rule.
1154         * testsuite/Makefile.in: Regenerate.
1155
1156 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1157
1158         PR gold/15927
1159         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1160         relocation for R_X86_64_32 on x32.
1161
1162 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1163
1164         * output.cc (Output_segment::set_section_addresses): Take new
1165         Target* argument.  If target->isolate_execinstr() and the segment
1166         is executable and starts at a target->abi_pagesize() boundary,
1167         pad its end out to a target->abi_pagesize() boundary with code fill.
1168         * output.h (Output_segment::set_section_addresses): Update decl.
1169         * layout.h (Layout::check_output_data_for_reset_values): Take new
1170         argument RELAX_OUTPUTS.
1171         (Layout): New member relax_output_list_.
1172         (Layout::add_relax_output): New method.
1173         * layout.cc (Layout::Layout): Update constructor.
1174         (Layout::reset_relax_output): New method.
1175         (Layout::clean_up_after_relaxation): Call it.
1176         (Layout::prepare_for_relaxation): Update caller.
1177         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1178         Call reset_relax_output before re-processing segments for
1179         isolate_execinstr case.
1180         (Layout::write_data): Handle relax_output_list_.
1181         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1182         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1183
1184 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1185
1186         PR binutils/15834
1187         * object.h: Fix typos.
1188
1189 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1190
1191         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1192         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1193
1194 2013-08-07  Cary Coutant  <ccoutant@google.com>
1195
1196         Revert support for v2 DWP files:
1197
1198         2013-03-01  Cary Coutant  <ccoutant@google.com>
1199
1200             Add dwp support for v2 DWARF package file format.
1201             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1202             tu_length parameter.  Adjust all callers.
1203             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1204             * dwp.cc: Include dwarf.h.
1205             (Section_bounds): New struct type.
1206             (Unit_set): New struct type.
1207             (Dwo_file::Dwo_file): Initialize new data member.
1208             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1209             Combine and rename to...
1210             (Dwo_file::read_unit_index): ...this.
1211             (Dwo_file::sized_read_compunit_index)
1212             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1213             (Dwo_file::sized_read_unit_index): ...this.
1214             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1215             parameters; add section_id parameter.
1216             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1217             (Dwo_file::add_unit_set): ...this.
1218             (Dwo_file::shndx_map_): Remove.
1219             (Dwo_file::sect_offsets_): New data member.
1220             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1221             (Dwp_output_file::add_section): Rename to...
1222             (Dwp_output_file::add_contribution): ...this.
1223             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1224             (Dwp_output_file::add_tu_set): Likewise.
1225             (Dwp_output_file::Contribution): New type.
1226             (Dwp_output_file::Section::contributions): New data member.
1227             (Dwp_output_file::Cu_or_tu_set): Remove.
1228             (Dwp_output_file::Section::Section): New ctor.
1229             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1230             (Dwp_output_file::Dwp_index::Section_table): New type.
1231             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1232             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1233             parameter.
1234             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1235             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1236             (Dwp_output_file::Dwp_index::section_table): New member function.
1237             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1238             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1239             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1240             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1241             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1242             (Dwp_output_file::Dwp_index::section_table_): New data member.
1243             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1244             (Dwp_output_file::add_output_section): New member function.
1245             (Dwp_output_file::write_new_section): New member function.
1246             (Dwp_output_file::write_contributions): New member function.
1247             (Dwp_output_file::section_id_map_): New data member.
1248             (class Dwo_id_info_reader): Remove.
1249             (class Unit_reader): New class.
1250             (get_dwarf_section_name): New function.
1251             (Dwo_file::read_executable): Adjust initializations of class data.
1252             (Dwo_file::read): Add support for v2 package file format.
1253             (Dwo_file::read_unit_index): Likewise.
1254             (Dwo_file::sized_read_unit_index): Likewise.
1255             (Dwo_file::copy_section): Likewise.
1256             (Dwo_file::add_unit_set): Likewise.
1257             (Dwp_output_file::add_output_section): Likewise.
1258             (Dwp_output_file::add_contribution): Likewise.
1259             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1260             for empty slot.
1261             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1262             file format.
1263             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1264             slot.
1265             (Dwp_output_file::initialize): Remove unused function.
1266             (Dwp_output_file::finalize): Add support for v2 package file format.
1267             (Dwp_output_file::write_index): Likewise.
1268             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1269             function prototype.
1270
1271 2013-07-31  Cary Coutant  <ccoutant@google.com>
1272
1273         * object.cc (Sized_relobj::do_output_section_address): New function.
1274         (Sized_relobj): Instantiate explicitly.
1275         * object.h (Object::output_section_address): New function.
1276         (Object::do_output_section_address): New function.
1277         (Sized_relobj::do_output_section_address): New function.
1278         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1279
1280 2013-07-30  Cary Coutant  <ccoutant@google.com>
1281             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1282
1283         * parameters.cc (Parameters::entry): Return target-specific entry
1284         symbol name.
1285         * target.h (Target::entry_symbol_name): New function.
1286         (Target_info::entry_symbol_name): New data member.
1287
1288         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1289         * i386.cc (Target_i386::i386_info): Likewise.
1290         (Target_i386_nacl::i386_nacl_info): Likewise.
1291         * sparc.cc (Target_sparc::sparc_info): Likewise.
1292         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1293         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1294         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1295         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1296
1297 2013-07-22  Sterling Augustine  <saugustine@google.com>
1298
1299         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1300         Convert parameter shndx to local variable. Add parameters symtab
1301         and symtab_size.  Scan over section names.  Find relocation
1302         section corresponding to current section.  Create and initialize
1303         reloc_mapper_ and reloc_type_.
1304         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1305         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1306         cu_offset_.
1307         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1308         Initialize new fields unit_length_ and cu_offset_.
1309         (Dwarf_pubnames_table::read_section): Update prototype.
1310         (Dwarf_pubnames_table::cu_offset): New member function.
1311         (Dwarf_pubnames_table::subsection_size): Likewise.
1312         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1313         New fields.
1314         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1315         member functions public.
1316         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1317         Update comment.  Rework logic.  Move repeated parts to...
1318         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1319         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1320         pubtypes_table_, and stmt_list_offset.
1321         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1322         Gdb_index::find_pubtype_offset,
1323         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1324         (Gdb_index::pubnames_read): Update prototype and rework logic.
1325         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1326         Forward declare.
1327         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1328         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1329         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1330         Gdb_index::map_pubtable_to_dies):
1331         Declare functions.
1332         (Gdb_index::pubnames_read): Update declaration.
1333         (Gdb_index::Pubname_offset_map): New type.
1334         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1335         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1336         Gdb_index::stmt_list_offset): Declare.
1337         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1338         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1339         Gdb_index::pubtypes_offset_): Remove.
1340
1341 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1342
1343         * options.h (General_options): Add -Trodata-segment option.
1344         * parameters.cc (Parameters::check_rodata_segment): New function.
1345         (Parameters::set_target_once): Call it.
1346         * parameters.h (Parameters): Declare it (private member function).
1347         * layout.cc (load_seg_unusable_for_headers): New function, broken
1348         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1349         then validate rodata segment rather than text segment.
1350         (relaxation_loop_body): Call that.
1351         (is_text_segment): New function.  Don't admit a non-executable
1352         segment if TARGET->isolate_execinstr().
1353         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1354
1355 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1356
1357         PR gold/15070
1358         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1359         * nacl.h (Sniff_file::View::View): Request aligned view.
1360
1361 2013-07-11  Cary Coutant  <ccoutant@google.com>
1362
1363         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1364         correct BRLT entry size.
1365
1366 2013-07-03  Alan Modra  <amodra@gmail.com>
1367
1368         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1369         comment.
1370
1371 2013-07-01  Cary Coutant  <ccoutant@google.com>
1372
1373         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1374         reloc_type_.
1375         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1376         (Dwarf_ranges_table::lookup_reloc): New function.
1377         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1378         reloc_type_.
1379         (Dwarf_ranges_table::lookup_reloc): New function.
1380         (Dwarf_ranges_table::reloc_type_): New data member.
1381
1382 2013-06-27  Jing Yu  <jingyu@google.com>
1383
1384         PR gold/15662
1385         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1386         function.
1387         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1388         (Target_powerpc::do_relax): Call the above.
1389
1390 2013-06-27  Cary Coutant  <ccoutant@google.com>
1391
1392         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1393         on garbage collected .opd section.
1394
1395 2013-06-27  Alan Modra  <amodra@gmail.com>
1396
1397         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1398         is non-zero.
1399         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1400         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1401
1402 2013-06-14  Cary Coutant  <ccoutant@google.com>
1403
1404         * resolve.cc (Symbol::override_base): Don't override st_type
1405         from plugin placeholder symbols.
1406         (Symbol_table::resolve): Likewise.
1407         (Symbol_table::should_override): Don't complain about TLS mismatch
1408         if the TO symbol is a plugin placeholder.
1409         * testsuite/Makefile.am (plugin_test_tls): New test.
1410         * testsuite/Makefile.in: Regenerate.
1411         * testsuite/plugin_test_tls.sh: New test script.
1412         * testsuite/two_file_test_2_tls.cc: New test source.
1413         * testsuite/two_file_test_tls.cc: New test source.
1414
1415 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1416
1417         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1418         the maximum segment alignment is larger than the page size.
1419         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1420         correctly aligns the symbols with large alignemnt.
1421         * testsuite/Makefile.in: Regenerate.
1422         * testsuite/large_symbol_alignment.cc: New file.
1423
1424 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1425             Sriraman Tallam  <tmsriram@google.com>
1426
1427         * options.h (sort_section): New option.
1428         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1429         Rename from Input_section_sort_section_name_special_ordering_compare.
1430         (Input_section_sort_section_name_compare): New struct.
1431         * output.cc (Output_section::Input_section_sort_section_name_compare::
1432         operator()): New function.
1433         (Output_section::sort_attached_input_sections): Use new sort function
1434         for .text if --sort-section=name is specified.
1435         * layout.cc (Layout::make_output_section):
1436         Add sorting by name when --sort-section=name is specified.
1437         * testsuite/Makefile.am (text_section_grouping): Test option
1438         --sort-section=name.
1439         * testsuite/Makefile.in: Regenerate.
1440         * testsuite/section_sorting_name.cc: New file.
1441         * testsuite/section_sorting_name.sh: New file.
1442
1443 2013-05-21  Cary Coutant  <ccoutant@google.com>
1444
1445         * symtab.h (Symbol::is_cxx_vtable): New function.
1446         * target-reloc.h (relocate_section): Check for vtable symbol.
1447         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1448         * testsuite/Makefile.in: Regenerate.
1449         * testsuite/missing_key_func.cc: New test source.
1450         * testsuite/missing_key_func.sh: New test script.
1451
1452 2013-05-21  Cary Coutant  <ccoutant@google.com>
1453
1454         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1455         type of enclosing symbol.
1456         (Relocate_info::location): Check symbol type when describing symbol.
1457         * object.h (Symbol_location_info): Remove unused line_number;
1458         add enclosing_symbol_type.
1459         * testsuite/debug_msg.sh: Adjust expected output.
1460
1461 2013-05-13  Cary Coutant  <ccoutant@google.com>
1462
1463         * configure.ac: Export DEFAULT_TARGET.
1464         * configure: Regenerate.
1465         * Makefile.in: Regenerate.
1466         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1467         * testsuite/Makefile.in: Regenerate.
1468         * testsuite/debug_msg.sh: Delete duplicate tests.
1469         Don't check undef_int error message match for powerpc where the
1470         source file and line number aren't available.
1471
1472 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1473
1474         * options.h (General_options): Add --rosegment-gap option.
1475         * options.cc (finalize): --rosegment-gap implies --rosegment.
1476         * layout.cc (set_segment_offsets): Let user option override
1477         target->rosegment_gap().
1478
1479 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1480
1481         * options.h (General_options): Remove leading space from help
1482         messages for -nostdlib and --rosegment.
1483
1484 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1485
1486         PR ld/15365
1487         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1488
1489 2013-05-03  Alan Modra  <amodra@gmail.com>
1490
1491         * merge.cc (Output_merge_string::do_add_input_section): Correct
1492         scan for number of strings.  Rename vars to avoid shadowing.
1493         Include missing terminator in input_size_.
1494
1495 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1496
1497         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1498         Restore empty string handling.
1499
1500 2013-05-01  Cary Coutant  <ccoutant@google.com>
1501
1502         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1503         uninitialized warning.
1504
1505 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1506
1507         * output.cc (Output_section::add_merge_input_section): Allow
1508         to merge sections if the alignment is more than character size.
1509         * merge.h (Output_merge_string::Output_merge_string): Remove
1510         assert.
1511         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1512         only not-null strings. Check the alignment of strings.
1513         * stringpool.h
1514         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1515         alignment as the argument.
1516         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1517         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1518         Align non-zero length strings according to the addralign_.
1519         (Stringpool_template<Stringpool_char>::set_string_offsets):
1520         Updating offsets according to the given alignment.
1521         * testsuite/Makefile.am (text_section_grouping): Test if string
1522         literals are getting merged.
1523         * testsuite/Makefile.in: Regenerate.
1524         * testsuite/merge_string_literals_1.c: New file.
1525         * testsuite/merge_string_literals_2.c: Ditto.
1526         * testsuite/merge_string_literals.sh: Ditto.
1527
1528 2013-04-26  Ian Lance Taylor  <iant@google.com>
1529
1530         * target-reloc.h (relocate_section): If the reloc offset is out of
1531         range, pass VIEW as NULL to relocate.relocate.
1532         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1533         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1534         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1535         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1536         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1537         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1538
1539 2013-04-26  Geoff Pike  <gpike@chromium.org>
1540
1541         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1542         * layout.cc (Hash_task): New class.
1543         (Layout::queue_build_id_tasks): New function.
1544         (Layout::write_build_id): Handle single-thread portion of build ID
1545         computation.  (In some cases, all of it is single-threaded.)  Replace
1546         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1547         functionality in fewer lines of code.
1548         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1549         * options.h (General_options): make "--build-id" default to tree
1550         rather than sha1.  Add two new options related to --build-id=tree:
1551         --build-id-chunk-size-for-treehash and
1552         --build-id-min-file-size-for-treehash.
1553         * Makefile.am: add testing of --build-id=tree and related new options
1554         (these tests will be invoked by "make check").
1555         * Makefile.in: Regenerate.
1556
1557 2013-04-25  Alan Modra  <amodra@gmail.com>
1558
1559         * configure.tgt: Add powerpcle and powerpc64le.
1560
1561 2013-04-22  Alan Modra  <amodra@gmail.com>
1562
1563         PR gold/15355
1564         * layout.cc (Layout::segment_precedes): Allow more than one
1565         segment with the same type and flags.
1566
1567 2013-04-15  Cary Coutant  <ccoutant@google.com>
1568
1569         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1570         allocate space in file for BSS sections.
1571
1572 2013-04-15  Cary Coutant  <ccoutant@google.com>
1573
1574         * script-sections.cc (Orphan_output_section): Reset address
1575         to zero after each orphaned section for relocatable links.
1576
1577 2013-04-15  Cary Coutant  <ccoutant@google.com>
1578
1579         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1580         section starting address for relocatable link.
1581         * testsuite/Makefile.am (script_test_11): New test.
1582         * testsuite/Makefile.in: Regenerate.
1583         * testsuite/script_test_11.c: New source file.
1584         * testsuite/script_test_11.t: New linker script.
1585
1586 2013-04-13  Alan Modra  <amodra@gmail.com>
1587
1588         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1589         owner when sections are not adjacent and exceed group size.
1590         (Target_powerpc::group_sections): Handle corner case.
1591         (Target_powerpc::Branch_info::make_stub): Handle case where
1592         stub table doesn't exist due to branches in non-exec sections.
1593         (Target_powerpc::Relocate::relocate): Likewise.
1594
1595 2013-04-11  Alan Modra  <amodra@gmail.com>
1596
1597         PR gold/15354
1598         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1599         .branch_lt to match bfd ld.  Adjust comments throughout file.
1600
1601 2013-04-04  Ian Lance Taylor  <iant@google.com>
1602
1603         GCC PR c++/56840
1604         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1605         sections before checking whether they are included in the link.
1606
1607 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1608
1609         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1610         object before calling the plugin claim_file handler.  Pass the elf
1611         object of the archive to the plugin. Delete the elf object if the
1612         plugin claims the file.
1613
1614 2013-03-21  Alan Modra  <amodra@gmail.com>
1615
1616         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1617         segment when omagic.
1618
1619 2013-03-21  Alan Modra  <amodra@gmail.com>
1620
1621         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1622         comparison warning.
1623         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1624         uninitialized" warning.
1625
1626 2013-03-20  Alan Modra  <amodra@gmail.com>
1627
1628         * symtab.h (Symbol::clear_version): New function.
1629         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1630         is_needed by weak references.  Clear version for symbols defined
1631         in as-needed objects that are not needed.
1632
1633 2013-03-15  Alan Modra  <amodra@gmail.com>
1634
1635         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1636         static and public.  Add report_err param.  Return false for data refs.
1637         (Target_powerpc::rela_dyn_section): New overloaded function.
1638         (Target_powerpc::plt_, iplt_): Elucidate.
1639         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1640         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1641         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1642         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1643         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1644         push_branch and make_plt_entry for ifunc syms when
1645         reloc_needs_plt_for_ifunc.
1646         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1647         for ifunc unless reloc_needs_plt_for_ifunc.
1648
1649 2013-03-15  Alan Modra  <amodra@gmail.com>
1650
1651         * gc.h (gc_process_relocs): Don't look through function descriptors.
1652         * icf.cc (get_section_contents): Do so here instead.
1653
1654 2013-03-13  Alan Modra  <amodra@gmail.com>
1655
1656         * powerpc.cc (is_branch_reloc): Forward declare.
1657         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1658         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1659         false for 64-bit, true for 32-bit non-branch relocs.
1660         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1661         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1662         nm output.
1663         (icf_safe_test): Generate linker map file as well as nm output.
1664         (icf_safe_so_test): Likewise.
1665         * testsuite/Makefile.in: Regenerate.
1666         * testsuite/icf_test.sh: Parse linker map file to determine
1667         section folding.
1668         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1669         * testsuite/icf_safe_so_test.sh: Likewise.
1670         (X86_32_or_ARM_specific_safe_fold): Merge into..
1671         (arch_specific_safe_fold): ..this.
1672         (X86_64_specific_safe_fold): Delete unused function.
1673
1674 2013-03-12  Alan Modra  <amodra@gmail.com>
1675
1676         * gc.h (gc_process_relocs): Look through function descriptors
1677         to determine shndx, symvalue and addend used by ICF.  Tidy
1678         variable duplication.
1679
1680 2013-03-11  Alan Modra  <amodra@gmail.com>
1681
1682         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1683         * layout.cc (Layout_task_runner::run): ..to here.
1684         * symtab.h (struct Symbol_location): Extract from..
1685         (class Symbol_table): ..here.
1686         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1687         * target.h (class Target): Add function_location and
1688         do_function_location functions.
1689         (class Sized_target): Add do_function_location.
1690         * object.h (class Sized_relobj_file): Move find_shdr..
1691         (class Object): ..to here.
1692         * object.cc: Likewise.  Update to suit.  Instantiate.
1693         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1694         * powerpc.cc (class Powerpc_dynobj): New.
1695         (Target_powerpc::do_function_location): New function.
1696         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1697         (Powerpc_dynobj::do_read_symbols): New function.
1698         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1699
1700 2013-03-08  Ian Lance Taylor  <iant@google.com>
1701
1702         * options.cc (General_options::string_to_object_format): Accept
1703         "default".
1704
1705 2013-03-08  Alan Modra  <amodra@gmail.com>
1706
1707         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1708         pointer to Post_fde.
1709         (struct Post_fde): Move definition to here..
1710         * ehframe.cc (struct Post_fde): ..from here.
1711         (Cie::write): Don't alloc Post_fde.
1712         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1713
1714 2013-03-07  Alan Modra  <amodra@gmail.com>
1715
1716         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1717         relocation referencing .LC0.
1718         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1719
1720 2013-03-07  Alan Modra  <amodra@gmail.com>
1721
1722         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1723         always_inline.  Add assembly for powerpc to avoid GOT.
1724
1725 2013-03-07  Alan Modra  <amodra@gmail.com>
1726
1727         * testsuite/script_test_10.sh: Don't test .bss section
1728         header number.
1729
1730 2013-03-06  Alan Modra  <amodra@gmail.com>
1731
1732         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1733         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1734         all callers.  Handle folded sections.
1735         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1736         to Powerpc_relobj.
1737         (Global_symbol_visitor_opd::operator()): Likewise.
1738
1739 2013-03-04  Alan Modra  <amodra@gmail.com>
1740
1741         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1742         * testsuite/Makefile.in: Regenerate.
1743
1744 2013-03-01  Cary Coutant  <ccoutant@google.com>
1745
1746         Add dwp support for v2 DWARF package file format.
1747         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1748         tu_length parameter.  Adjust all callers.
1749         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1750         * dwp.cc: Include dwarf.h.
1751         (Section_bounds): New struct type.
1752         (Unit_set): New struct type.
1753         (Dwo_file::Dwo_file): Initialize new data member.
1754         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1755         Combine and rename to...
1756         (Dwo_file::read_unit_index): ...this.
1757         (Dwo_file::sized_read_compunit_index)
1758         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1759         (Dwo_file::sized_read_unit_index): ...this.
1760         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1761         parameters; add section_id parameter.
1762         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1763         (Dwo_file::add_unit_set): ...this.
1764         (Dwo_file::shndx_map_): Remove.
1765         (Dwo_file::sect_offsets_): New data member.
1766         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1767         (Dwp_output_file::add_section): Rename to...
1768         (Dwp_output_file::add_contribution): ...this.
1769         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1770         (Dwp_output_file::add_tu_set): Likewise.
1771         (Dwp_output_file::Contribution): New type.
1772         (Dwp_output_file::Section::contributions): New data member.
1773         (Dwp_output_file::Cu_or_tu_set): Remove.
1774         (Dwp_output_file::Section::Section): New ctor.
1775         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1776         (Dwp_output_file::Dwp_index::Section_table): New type.
1777         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1778         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1779         parameter.
1780         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1781         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1782         (Dwp_output_file::Dwp_index::section_table): New member function.
1783         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1784         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1785         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1786         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1787         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1788         (Dwp_output_file::Dwp_index::section_table_): New data member.
1789         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1790         (Dwp_output_file::add_output_section): New member function.
1791         (Dwp_output_file::write_new_section): New member function.
1792         (Dwp_output_file::write_contributions): New member function.
1793         (Dwp_output_file::section_id_map_): New data member.
1794         (class Dwo_id_info_reader): Remove.
1795         (class Unit_reader): New class.
1796         (get_dwarf_section_name): New function.
1797         (Dwo_file::read_executable): Adjust initializations of class data.
1798         (Dwo_file::read): Add support for v2 package file format.
1799         (Dwo_file::read_unit_index): Likewise.
1800         (Dwo_file::sized_read_unit_index): Likewise.
1801         (Dwo_file::copy_section): Likewise.
1802         (Dwo_file::add_unit_set): Likewise.
1803         (Dwp_output_file::add_output_section): Likewise.
1804         (Dwp_output_file::add_contribution): Likewise.
1805         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1806         for empty slot.
1807         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1808         file format.
1809         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1810         slot.
1811         (Dwp_output_file::initialize): Remove unused function.
1812         (Dwp_output_file::finalize): Add support for v2 package file format.
1813         (Dwp_output_file::write_index): Likewise.
1814         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1815         function prototype.
1816
1817 2013-03-01  Cary Coutant  <ccoutant@google.com>
1818
1819         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1820         function into class definition in header file.
1821         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1822         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1823         New function.
1824         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1825
1826 2013-02-28  Alan Modra  <amodra@gmail.com>
1827
1828         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1829         * target.cc (Target::do_plt_fde_location): New function.
1830         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1831         accessor function, and constructor param.
1832         (struct Post_fde, Post_fdes): Declare.
1833         (Cie::write): Add post_fdes param.
1834         * ehframe.cc (Fde::write): Use plt_fde_location.
1835         (struct Post_fde): Define.
1836         (Cie::write): Stash FDEs added post merge mapping.
1837         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1838         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1839         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1840         other FDEs.
1841         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1842         (Target_powerpc::has_glink): New function.
1843         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1844         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1845         glink_eh_frame_fde_32, default_fde): New data.
1846         (Stub_table::eh_frame_added_): New var.
1847         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1848         Make const.
1849         (Stub_table::add_eh_frame): New function.
1850         (Output_data_glink::add_eh_frame): New function.
1851         (Target_powerpc::make_glink_section): Call add_eh_frame.
1852
1853 2013-02-15  Ian Lance Taylor  <iant@google.com>
1854
1855         * options.h (DEFINE_uint64_alias): Define.
1856         (class General_options): Add -Ttext-segment as an alias for
1857         -Ttext.
1858
1859 2013-02-15  Alan Modra  <amodra@gmail.com>
1860
1861         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1862         (Stub_table::do_write): ..here, two places.
1863         (Stub_table::plt_call_size): Use it here too.
1864
1865 2013-02-11  Ian Lance Taylor  <iant@google.com>
1866
1867         * descriptors.cc (Descriptors::close_all): New function.
1868         * descriptors.h (class Descriptors): Declare close_all.
1869         (close_all_descriptors): New inline function.
1870         * plugin.cc: Include "descriptors.h".
1871         (Plugin_manager::cleanup): Call close_all_descriptors.
1872
1873 2013-02-06  Alan Modra  <amodra@gmail.com>
1874
1875         * README: Update coding style link.
1876
1877 2013-01-28  Cary Coutant  <ccoutant@google.com>
1878
1879         * dwp.cc (File_list): New typedef.
1880         (Dwo_name_info_reader): New class.
1881         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1882         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1883         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1884         (Dwo_file::read_executable): New function.
1885         (Dwo_file::read): Move common setup code to ...
1886         (Dwo_file::make_object): ... here.
1887         (dwp_options): Add --exec/-e.
1888         (usage): Likewise.
1889         (main): Likewise.
1890
1891 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1892
1893         * layout.cc (Layout::layout): Check for option text_reorder.
1894         (Layout::make_output_section): Ditto.
1895         * options.h (text_reorder): New option.
1896         * output.cc (Input_section_sort_compare): Remove special ordering
1897         of section names.
1898         (Output_section::
1899          Input_section_sort_section_name_special_ordering_compare::
1900          operator()): New function.
1901         (Output_section::sort_attached_input_sections): Use new sort function
1902         for .text.
1903         * output.h (Input_section_sort_section_name_special_ordering_compare):
1904         New struct.
1905         * testsuite/Makefile.am (text_section_grouping): Test option
1906         --no-text-reorder
1907         * testsuite/Makefile.in: Regenerate.
1908         * testsuite/text_section_grouping.sh: Check order of functions without
1909         default text reordering.
1910
1911 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1912
1913         * options.h (General_options): Change default to true for new_dtags.
1914
1915 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1916
1917         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1918         when enable_new_dtags is false.  Only add DT_RUNPATH when
1919         enable_new_dtags is true.
1920
1921 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1922
1923         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1924         used in declaration and definition consistent.
1925         (Target_powerpc::symval_for_branch): Ditto.
1926
1927 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1928
1929         * testsuite/plugin_final_layout.cc: Fix comment.
1930
1931 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1932
1933         * layout.cc (Layout::layout): Do not do default sorting for
1934         text sections when section ordering is specified.
1935         (make_output_section): Ditto.
1936         * testsuite/plugin_final_layout.cc: Name the function sections
1937         to catch reordering issues.
1938
1939 2013-01-15  Alan Modra  <amodra@gmail.com>
1940
1941         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1942         plt-thread-safe.
1943
1944 2013-01-15  Alan Modra  <amodra@gmail.com>
1945
1946         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1947         * testsuite/Makefile.in: Regenerate.
1948
1949 2013-01-14  Alan Modra  <amodra@gmail.com>
1950
1951         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1952         * testsuite/Makefile.in: Regenerate.
1953
1954 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1955
1956         PR bfd/14430
1957         Fix mingw gold build with plugins enabled
1958         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1959         * configure.ac: Export DLOPEN_LIBS and add headers check.
1960         * plugin.cc: Handle non-dlfcn case.
1961         * Makefile.in: Regenerate.
1962         * config.in: Regenerate.
1963         * configure: Regenerate.
1964         * testsuite/Makefile.in: Regenerate.
1965
1966 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1967
1968         * output.h (sort_attached_input_sections): Change to be public.
1969         * script-sections.cc
1970         (Output_section_definition::set_section_addresses): Sort
1971         attached input sections according to section order before linker
1972         script assigns section addresses.
1973         (Orphan_output_section::set_section_addresses): Sort
1974         attached input sections according to section order before linker
1975         script assigns section addresses.
1976         * Makefile.am (final_layout.sh): Use a simple linker script to
1977         check if section ordering still works.
1978         * Makefile.in: Regenerate.
1979
1980 2013-01-09  Ben Cheng  <bccheng@google.com>
1981
1982         * arm.cc (Target_arm::attributes_accept_div): New function.
1983         (Target_arm::attributes_forbid_div): New function.
1984         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1985         attribute using the same new functions as what bfd/elf32_arm.c
1986         does.
1987
1988 2013-01-07  Cary Coutant  <ccoutant@google.com>
1989
1990         PR gold/14993
1991         * output.cc (Output_section::add_input_section): For incremental
1992         updates, don't track input sections that are allocated from patch
1993         space.
1994
1995 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1996             Ian Lance Taylor  <iant@google.com>
1997
1998         PR gold/14897
1999         * configure.ac (--enable-ld): Removed.
2000         (install_as_default): Set to yes only for --enable-gold=default
2001         or --disable-ld.
2002         * configure: Regenerated.
2003
2004 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2005
2006         * options.h (General_options): Add -fuse-ld= for GCC linker
2007         option compatibility.
2008
2009 2013-01-04  Cary Coutant  <ccoutant@google.com>
2010
2011         * configure.ac: Fix typo restoring CXXFLAGS.
2012         * configure: Regenerate.
2013
2014 2013-01-04  Cary Coutant  <ccoutant@google.com>
2015
2016         * testsuite/Makefile.am (CXXLINK_S): New macro.
2017         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2018         * testsuite/Makefile.in: Regenerate.
2019
2020 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2021
2022         * version.cc (print_version): Update copyright year to 2013.
2023
2024 2012-12-20  Ian Lance Taylor  <iant@google.com>
2025
2026         * layout.cc (Layout::special_ordering_of_input_section): New
2027         function.
2028         (Layout::layout): If input section requires special ordering, must
2029         sort input sections.
2030         (Layout::make_output_section): May sort .text input sections.
2031         (Layout::is_section_name_prefix_grouped): Remove.
2032         * layout.h (class Layout): Declare
2033         special_ordering_of_input_section.  Don't declare
2034         is_section_name_prefix_grouped.
2035         * output.cc (Output_section::add_input_section): Revert last
2036         change.
2037         (Output_section::Input_section_sort::match_file_name): Don't crash
2038         if called on output section data.
2039         (Output_section::Input_section_sort_compare): Sort based on
2040         special ordering.
2041         (Output_section::Input_section_sort_section_order_index_compare):
2042         Revert last patch.
2043         (Output_section::sort_attached_input_sections): Likewise.
2044
2045 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2046
2047         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2048         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2049         * output.cc (Output_section::add_input_section): Check if section
2050         name contains special prefix.  Keep input sections to sort such
2051         sections.
2052         (Output_section::Input_section_sort_section_order_index_compare
2053          ::operator()): Group sections according to prefixes.
2054         (Output_section::sort_attached_input_sections): Add condition to
2055         Input_section_entry constructor call.
2056         * testsuite/Makefile.am (text_section_grouping): New test.
2057         * testsuite/Makefile.in: Regenerate.
2058         * testsuite/text_section_grouping.cc: New file.
2059         * testsuite/text_section_grouping.sh: New file.
2060
2061 2012-12-17  Nick Clifton  <nickc@redhat.com>
2062
2063         * Makefile.am: Add copyright notice.
2064         * NEWS: Likewise.
2065         * README: Likewise.
2066         * configure.ac: Likewise.
2067         * ftruncate.c: Likewise.
2068         * Makefile.in: Regenerate.
2069
2070 2012-12-14  Cary Coutant  <ccoutant@google.com>
2071
2072         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2073         --no-as-needed flag.
2074         (exception_separate_shared_12_test): Likewise.
2075         (incremental_copy_test): Likewise.
2076         * testsuite/Makefile.in: Regenerate.
2077
2078 2012-12-14  Cary Coutant  <ccoutant@google.com>
2079
2080         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2081         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2082
2083 2012-12-12  Alan Modra  <amodra@gmail.com>
2084
2085         * powerpc.cc (class Track_tls): New.
2086         (class Relocate, class Scan): Inherit Track_tls.
2087         (Target_powerpc::Scan::local, global): Track tls optimization
2088         and avoid creating plt entry for __tls_get_addr if all uses
2089         are optimized away.
2090         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2091
2092 2012-12-12  Alan Modra  <amodra@gmail.com>
2093
2094         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2095         Replace no_toc_optimize with toc_optimize.
2096         * output.h (Output_section::input_sections): Provide non-const variant.
2097         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2098         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2099         accessors.
2100         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2101         (class Sort_toc_sections): New.
2102         (Target_powerpc::do_finalize_sections): Sort toc sections.
2103         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2104
2105 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2106
2107         * testsuite/binary_unittest.cc (read_all): New function.
2108         (Sized_binary_test): Use it instead of ::read.
2109         * fileread.cc (do_read): Don't assume pread always reads the whole
2110         amount in a single call.
2111
2112 2012-12-10  Alan Modra  <amodra@gmail.com>
2113
2114         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2115         Set EM_PPC64 or EM_PPC here.
2116         (Target_selector_powerpc::do_recognize): Delete.
2117
2118 2012-12-10  Alan Modra  <amodra@gmail.com>
2119
2120         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2121         stub_table_.
2122         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2123
2124 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2125
2126         * testsuite/binary_unittest.cc (Sized_binary_test):
2127         Use open_descriptor rather than ::open.
2128
2129 2012-12-07  Alan Modra  <amodra@gmail.com>
2130
2131         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2132         typedef and invalid_address constant.
2133         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2134         instantiate constants.
2135
2136 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2137
2138         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2139         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2140         * aclocal.m4: Regenerate.
2141         * configure: Regenerate.
2142         * Makefile.in: Regenerate.
2143         * testsuite/Makefile.in: Regenerate.
2144
2145 2012-12-07  Alan Modra  <amodra@gmail.com>
2146
2147         * options.h (General_options): Add no_toc_optimize.
2148         * powerpc.cc (ok_lo_toc_insn): New function.
2149         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2150
2151 2012-12-06  Alan Modra  <amodra@gmail.com>
2152
2153         * options.h (General_options): Add plt_align, plt_static_chain,
2154         plt_thread_safe.  Update stub_group_size help text.
2155         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2156         for new plt_thread_safe_ var.
2157         (use_plt_offset): Correct comments.
2158         (Target_powerpc::do_relax): Look for thread creation symbols to
2159         determine default plt_thread_safe value.  Clear plt call stubs
2160         as well as branch stubs each iteration.
2161         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2162         insn constants.
2163         (l, hi, ha, write_insn): Move earlier.
2164         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2165         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2166         plt stubs too.
2167         (Stub_table::update_size): Adjust.
2168         (Stub_table::prev_size, set_prev_size): Delete.
2169         (Stub_table::stub_align): Let --plt-align affect result.
2170         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2171         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2172         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2173         (Stub_table::do_write): Support more stub variants.
2174
2175 2012-12-04  Alan Modra  <amodra@gmail.com>
2176
2177         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2178         (Target_powerpc::do_define_standard_symbols): New function.
2179
2180 2012-12-03  Alan Modra  <amodra@gmail.com>
2181
2182         * output.h: Formatting, whitespace.
2183
2184 2012-12-03  Alan Modra  <amodra@gmail.com>
2185
2186         * layout.h (Layout::get_executable_sections): Declare.
2187         * layout.cc (Layout::get_executable_sections): New function.
2188         * arm.cc (Target_arm::group_sections): Use it.
2189         (Arm_output_section::group_sections): Delete now redundant test.
2190         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2191         param to handle relative relocs.
2192         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2193         (Output_data_reloc::add_absolute): Adjust.
2194         (Output_data_reloc::add_relative): New function.
2195         (Output_data::reset_data_size): New function.
2196         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2197         (Output_section::set_addralign): New function.
2198         (Output_section::checkpoint_set_addralign): New function.
2199         (Output_section::clear_section_offsets_need_adjustment): New function.
2200         (Output_section::input_sections): Make public.
2201         * powerpc.cc (class Output_data_brlt_powerpc): New.
2202         (class Stub_table, class Stub_control): New.
2203         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2204         stub_table_, set_stub_table, stub_table): New vectors and accessor
2205         functions.
2206         (Target_powerpc::do_may_relax, do_relax, push_branch,
2207         new_stub_table, stub_tables, brlt_section, group_sections,
2208         add_branch_lookup_table, find_branch_lookup_table,
2209         write_branch_lookup_table, make_brlt_section): New functions.
2210         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2211         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2212         branch_info_): New vars.
2213         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2214         make call stubs here.
2215         (Output_data_glink): Remove all call stub handling from this class.
2216         (Target_powerpc::Scan::local, global): Save interesting branch
2217         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2218         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2219         functions on final link.
2220         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2221         Handle long branch destinations too.
2222         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2223         do_plt_address_for_local): Adjust lookup of plt call stubs.
2224
2225 2012-11-30  Alan Modra  <amodra@gmail.com>
2226
2227         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2228         relocs against protected symbols when building 32-bit shared libs.
2229
2230 2012-11-30  Alan Modra  <amodra@gmail.com>
2231
2232         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2233         param.  Call got_section() to make .got.  Update all callers
2234         and their callers and so on.
2235
2236 2012-11-30  Alan Modra  <amodra@gmail.com>
2237
2238         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2239         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2240         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2241         value if it already exists.
2242
2243 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2244
2245         PR gold/14858
2246         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2247
2248 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2249
2250         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2251         than bfc instruction for data sandboxing.
2252
2253 2012-11-08  Alan Modra  <amodra@gmail.com>
2254
2255         * po/POTFILES.in: Regenerate.
2256
2257 2012-11-05  Alan Modra  <amodra@gmail.com>
2258
2259         * configure.ac: Apply 2012-09-10 change to config.in here.
2260         * configure: Regenerate.
2261
2262 2012-11-05  Alan Modra  <amodra@gmail.com>
2263
2264         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2265         (struct Opd_ent): Use "Address" rather than "Offset".
2266         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2267         (Target_powerpc::got_section): Make public.
2268         (Target_powerpc::scan_relocs): Move code setting symbols..
2269         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2270         Create _SDA_BASE_ only when referenced.
2271
2272 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2273
2274         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2275         from last change.
2276
2277 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2278
2279         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2280         for offset_in_output_section parameter.
2281         (Sized_target::relocate_special_relocatable): Likewise.
2282         * arm.cc (Target_arm::relocate_relocs): Likewise.
2283         (Target_arm::relocate_special_relocatable): Likewise.
2284         * i386.cc (Target_i386::relocate_relocs): Likewise.
2285         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2286         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2287         * target-reloc.h (relocate_relocs): Likewise.
2288         * testsuite/testfile.cc (Target_test): Likewise.
2289         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2290         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2291
2292         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2293         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2294
2295         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2296         parameter, which is unused in the [!F_SETFD] case.
2297
2298         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2299         SYMNDX to off_t before comparing it to this->data_size().
2300         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2301         * incremental.cc (Output_section_incremental_inputs::do_write):
2302         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2303
2304         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2305
2306 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2307
2308         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2309         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2310         in EABI_VER5.
2311
2312 2012-10-29  Cary Coutant  <ccoutant@google.com>
2313
2314         * dwp.cc (usage): Add file and exit status parameters;
2315         add --help and --version options.
2316         (print_version): New function.
2317         (main): Add --help and --version options.
2318
2319 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2320
2321         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2322         final_layout_sequence.txt.
2323         * testsuite/Makefile.in: Regenerated.
2324
2325 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2326
2327         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2328         COMPILE generated by automake.
2329         (LINK1): Likewise.
2330         (CXXCOMPILE1): Likewise.
2331         (CXXLINK1): Likewise.
2332         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2333         (LINK): Likewise.
2334         (CXXCOMPILE): Likewise.
2335         (CXXLINK): Likewise.
2336         * testsuite/Makefile.in: Regenerated.
2337
2338 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2339
2340         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2341         on bad fwrite return.
2342
2343 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2344
2345         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2346         on val.
2347
2348 2012-10-23  Cary Coutant  <ccoutant@google.com>
2349
2350         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2351         * testsuite/Makefile.in: Regenerate.
2352         * testsuite/dwp_test.h: New source file.
2353         * testsuite/dwp_test_1.cc: New source file.
2354         * testsuite/dwp_test_1.s: New source file.
2355         * testsuite/dwp_test_1.sh: New source file.
2356         * testsuite/dwp_test_1b.cc: New source file.
2357         * testsuite/dwp_test_1b.s: New source file.
2358         * testsuite/dwp_test_2.cc: New source file.
2359         * testsuite/dwp_test_2.s: New source file.
2360         * testsuite/dwp_test_2.sh: New source file.
2361         * testsuite/dwp_test_main.cc: New source file.
2362         * testsuite/dwp_test_main.s: New source file.
2363
2364 2012-10-23  Cary Coutant  <ccoutant@google.com>
2365
2366         * dwp.h: New header file.
2367         * dwp.cc: New source file.
2368         * gold.h: Move shared declarations to system.h.
2369         * system.h: New header file.
2370         * Makefile.am: Add dwp.
2371         * Makefile.in: Regenerate.
2372
2373 2012-10-23  Cary Coutant  <ccoutant@google.com>
2374
2375         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2376         Dwarf_info_reader::read_from_pointer.
2377         (Dwarf_pubnames_table::read_header): Likewise.
2378         (Dwarf_pubnames_table::next_name): Likewise.
2379         (Dwarf_die::read_attributes): Likewise.
2380         (Dwarf_die::skip_attributes): Likewise.
2381         (Dwarf_info_reader::read_from_pointer): New function template.
2382         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2383         (Dwarf_pubnames_table): Likewise.
2384         (Dwarf_info_reader::read_from_pointer): New function template.
2385         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2386         Dwarf_pubnames_table ctor.
2387
2388 2012-10-23  Cary Coutant  <ccoutant@google.com>
2389
2390         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2391         abbrev_shndx.
2392         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2393         abbrev_shndx_.
2394         (Dwarf_info_reader::set_abbrev_shndx): New method.
2395         (Dwarf_info_reader::abbrev_shndx_): New data member.
2396
2397 2012-10-23  Cary Coutant  <ccoutant@google.com>
2398
2399         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2400         from object, not parameters.
2401         (Dwarf_info_reader::parse): Likewise.
2402         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2403         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2404         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2405         methods.
2406
2407 2012-10-23  Cary Coutant  <ccoutant@google.com>
2408
2409         * fileread.cc (Input_file::Input_file): New constructor.
2410         * fileread.h (class Input_file): Add new constructor.
2411
2412 2012-10-18  Alan Modra  <amodra@gmail.com>
2413
2414         PR gold/14727
2415         * object.cc (Relobj::is_section_name_included): Also match
2416         .sdata personality section.
2417
2418 2012-10-18  Alan Modra  <amodra@gmail.com>
2419
2420         * target-reloc.h (class Default_comdat_behavior): New, package up..
2421         (get_comdat_behaviour): ..this.
2422         (relocate_section): Add Relocate_comdat_behavior template arg,
2423         adjust code to suit.
2424         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2425         (Target_arm::scan_reloc_section): Likewise.
2426         * i386.cc (Target_i386::relocate_section): Likewise.
2427         * sparc.cc (Target_sparc::relocate_section): Likewise.
2428         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2429         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2430         * powerpc.cc (class Relocate_comdat_behavior): New.
2431         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2432         gold::relocate_section with new template arg.
2433
2434 2012-10-18  Alan Modra  <amodra@gmail.com>
2435
2436         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2437         dynamic relocs for GOT_TPREL got entries, without symbol if
2438         resolving locally.
2439         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2440         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2441         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2442
2443 2012-10-17  Alan Modra  <amodra@gmail.com>
2444
2445         PR gold/14726
2446         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2447
2448 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2449
2450         * layout.cc (Layout::include_section): Keep sections marked
2451         SHF_EXCLUDE when doing relocatable links.
2452
2453 2012-10-16  Alan Modra  <amodra@gmail.com>
2454
2455         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2456         (Target_powerpc::do_finalize_sections): Call it.
2457         (Output_data_save_res): New class and supporting functions.
2458         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2459         normal symbols defined in object files.
2460
2461 2012-10-12  Alan Modra  <amodra@gmail.com>
2462
2463         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2464         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2465         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2466         section if scan_opd_relocs not yet called.
2467         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2468
2469 2012-10-12  Alan Modra  <amodra@gmail.com>
2470
2471         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2472         add_local_ifunc_entry): Revert last change.
2473         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2474
2475 2012-10-05  Alan Modra  <amodra@gmail.com>
2476
2477         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2478         do_plt_address_for_global): New functions.
2479         (Output_data_got_powerpc::do_write): Don't segfault when linking
2480         statically.
2481         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2482         add_local_ifunc_entry): Return true on adding entry..
2483         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2484         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2485         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2486         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2487         set up symbols here.
2488         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2489         syms here.  Do so even when no .iplt.  Don't segfault when linking
2490         statically.
2491         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2492         new variants without reloc param.
2493         (Glink_sym_ent::Glink_sym_ent): Likewise.
2494         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2495         reloc when refs will resolve to plt call stub.
2496         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2497         R_PPC_PLTREL24 to resolve locally.
2498         (Target_powerpc::Scan::global): Correct ifunc handling.
2499         (Target_powerpc::Relocate::relocate): Correct local sym glink
2500         lookup.  Don't destroy "value" when we have a plt call stub,
2501         and when checking plt call validity.
2502         (Target_powerpc::do_dynsym_value): Simplify.
2503
2504 2012-10-05  Alan Modra  <amodra@gmail.com>
2505
2506         * i386.cc (Output_data_plt_i386::address_for_global,
2507         address_for_local): Add plt offset to returned value.  Adjust uses.
2508         * sparc.cc (Output_data_plt_sparc::address_for_global,
2509         address_for_local): Likewise.
2510         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2511         address_for_local): Likewise.
2512         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2513         address_for_local): Likewise.
2514         * target.h (Target::plt_address_for_global, plt_address_for_local):
2515         Update comment.
2516         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2517         (Output_data_got::Got_entry::write): Nor here.
2518         * output.h: Comment fix.
2519
2520 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2521
2522         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2523         global_offset_table_ value for larget got.
2524         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2525
2526 2012-09-29  Alan Modra  <amodra@gmail.com>
2527
2528         * powerpc.cc (Target_powerpc::iplt_): New output section.
2529         (Target_powerpc::iplt_section, make_iplt_section,
2530         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2531         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2532         Target_powerpc::plt_entry_count): Count iplt entries too.
2533         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2534         reloc section in constructor.  New params.
2535         (Target_powerpc::make_plt_section): Create reloc section here instead.
2536         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2537         functions.
2538         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2539         (Output_data_glink::add_entry, find_entry): New functions to
2540         deal with local syms.
2541         (Glink_sym_ent): Add support for local syms.
2542         (Output_data_glink::do_write): Handle ifunc plt entries.
2543         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2544         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2545         (Target_powerpc::Relocate::relocate): Likewise.
2546         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2547
2548 2012-09-25  Alan Modra  <amodra@gmail.com>
2549
2550         * object.h (Sized_relobj_file::adjust_local_symbol,
2551         do_adjust_local_symbol): New functions.
2552         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2553         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2554         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2555         and irregular opd entry spacing.
2556         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2557         (Global_symbol_visitor_opd): New functor.
2558         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2559         on deleted opd entries.
2560
2561 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2562
2563         * tilegx.cc: New file.
2564         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2565         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2566         * configure.tgt: Add entries for tilegx*.
2567         * configure.ac: Likewise.
2568         * Makefile.in: Rebuild.
2569         * configure: Likewise.
2570         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2571         tilegx.
2572
2573 2012-09-13  Alan Modra  <amodra@gmail.com>
2574
2575         * target-reloc.h (scan_relocs): Call scan.local for relocs
2576         against symbols in discarded sections.  Pass is_discarded
2577         param.
2578         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2579         Add is_discarded param.
2580         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2581         is_discarded to flag opd entry as discarded.  Don't emit dyn
2582         relocs on such entries.
2583         (Target_powerpc::Scan::global): Similarly detect and handle
2584         such opd entries.
2585         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2586         opd_ent_.  Update all uses.
2587         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2588         (Target_powerpc::relocate_section): Zero out discarded opd
2589         entry relocs.
2590
2591 2012-09-12  Ian Lance Taylor  <iant@google.com>
2592
2593         PR gold/14570
2594         * output.cc: Rename Output_data_got template parameter from size
2595         to got_size for all functions.  Compile all variants of
2596         Output_data_got.
2597         (Output_data_got::Got_entry::write): Correct use of size for
2598         symbol value.  Use local_is_tls rather than casting to
2599         Sized_relobj_file.
2600         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2601         (class Sized_relobj_file): Add do_local_is_tls.
2602         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2603
2604 2012-09-11  Alan Modra  <amodra@gmail.com>
2605
2606         PR gold/14566
2607         * layout.cc (Layout::set_segment_offsets): When using
2608         common-page-size alignment, ensure we are on a new max-page-size
2609         page.
2610         * output.cc (Output_segment::set_section_addresses): Use
2611         abi_pagesize, not common_pagesize for relro boundary.
2612         (Output_segment::set_offset): Likewise.
2613
2614 2012-09-11  Alan Modra  <amodra@gmail.com>
2615
2616         * output.h (Output_data_got::add_global_tls, add_local_tls,
2617         add_local_tls_pair): New functions.
2618         (Output_data_got::add_local_pair_with_rel): Remove second
2619         reloc param.  Expand comment.
2620         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2621         use_plt_or_tls_offset_, similarly for constructor param.
2622         (Output_data_got::Got_entry::write): Add got_index param.
2623         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2624         add_local_tls_pair): New functions.
2625         (Output_data_got::Got_entry::write): Handle tls symbols
2626         with use_plt_or_tls_offset_ set specially.
2627         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2628         (Output_data_got::do_write): Replace iterator with index, pass
2629         index to entry write function.
2630         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2631         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2632         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2633         call.
2634         * i386.cc (Target_i386::Scan::local): Likewise.
2635         * sparc.cc (Target_sparc::Scan::local): Likewise.
2636         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2637         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2638         do_tls_offset_for_global): New functions.
2639         (Target_powerpc::Scan::local): Correct TLS relocations and got
2640         entry values.
2641         (Target_powerpc::Scan::global): Don't emit unnecessary
2642         dynamic relocations on TLS GOT entries.
2643
2644 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2645
2646         * config.in: Disable sanity check for kfreebsd.
2647
2648 2012-09-10  Sterling Augustine  <saugustine@google.com>
2649
2650         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2651         (Gdb_index::pubtypes_read): New parameter.
2652         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2653         to calls.
2654         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2655         pubtypes_object_.
2656
2657 2012-09-09  Alan Modra  <amodra@gmail.com>
2658
2659         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2660         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2661         * gc.h (gc_process_relocs): Call target gc_add_reference.
2662         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2663         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2664         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2665         unnecessary cast.
2666         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2667         to cater for when we don't need code offset.  Update use.
2668         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2669         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2670         set_opd_valid): New functions.
2671         (Target_powerpc::do_gc_add_reference): New function.
2672         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2673         stashed refs.
2674         (Target_powerpc::do_gc_mark_symbol): New function.
2675
2676 2012-09-06  Cary Coutant  <ccoutant@google.com>
2677
2678         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2679         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2680         (Dwarf_die::skip_attributes): Likewise.
2681         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2682         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2683         (main): Call it.
2684         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2685
2686 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2687
2688         * testsuite/script_test_3.t: Add .got.plt output section
2689         statement.
2690         * testsuite/script_test_4.t: Likewise.
2691
2692 2012-09-05  Alan Modra  <amodra@gmail.com>
2693
2694         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2695         update all uses and lose "enum" when using type.
2696
2697 2012-09-05  Alan Modra  <amodra@gmail.com>
2698
2699         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2700         * configure: Regenerate.
2701         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2702         (plugin_final_layout.stdout): Likewise.
2703         (memory_test): Set page sizes to 0x1000.
2704         * testsuite/Makefile.in: Regenerate.
2705         * testsuite/discard_locals_test.sh: Add FIXME comment.
2706         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2707         * testsuite/pr14265.t: Add .got output section statement.
2708         * testsuite/script_test_2.t: Likewise.
2709         * testsuite/script_test_3.t: Likewise.
2710         * testsuite/script_test_4.t: Likewise.
2711         * testsuite/script_test_5.t: Likewise.
2712         * testsuite/script_test_6.t: Likewise.
2713         * testsuite/script_test_7.t: Likewise.
2714         * testsuite/script_test_9.t: Likewise.
2715
2716 2012-09-05  Alan Modra  <amodra@gmail.com>
2717
2718         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2719         (Powerpc_relocate_functions::Status): New typedef.
2720         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2721         (Target_powerpc::Scan::local): Handle REL64.
2722         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2723         for REL32 and REL64.
2724         (Target_powerpc::symval_for_branch): New function, extracted from..
2725         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2726         checks.  Report overflow errors.
2727
2728 2012-09-05  Alan Modra  <amodra@gmail.com>
2729
2730         * object.h (Sized_relobj_file::emit_relocs): Delete.
2731         (Sized_relobj_file::emit_relocs_reltype): Delete.
2732         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2733         relocate_relocs for --emit-relocs.
2734         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2735         * output.h: Update comment.
2736         (Output_segment::first_section): New function.
2737         (Output_segment::first_section_load_address): Use first_section.
2738         * output.cc (Output_segment::first_section): New function extracted..
2739         (Output_segment::first_section_load_address): ..from here.  Delete.
2740         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2741         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2742         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2743         adjust call to target.h function.
2744         * i386.cc (Target_i386): Likewise.
2745         * sparc.cc (Target_sparc): Likewise.
2746         * x86_64.cc (Target_x86_64): Likewise.
2747         * powerpc.cc (Target_powerpc): Likewise.
2748         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2749         first tls section has section symbol for optimised local dynamic
2750         output relocs.
2751         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2752         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2753         optimised tls code.
2754         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2755         Rename to relocate_relocs.  Update error message.
2756
2757 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2758
2759         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2760         --just-symbols.
2761
2762 2012-08-31  Alan Modra  <amodra@gmail.com>
2763
2764         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2765         (Powerpc_relobj::toc_base_offset): New stub function.
2766         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2767         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2768         (Target_powerpc::Relocate::enum skip_tls): New.
2769         (Target_powerpc::call_tls_get_addr_): New var.
2770         (Target_powerpc::is_branch_reloc): Move to file scope.
2771         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2772         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2773         New functions.
2774         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2775         (powerpc_info): Correct common_pagesize for ppc64.
2776         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2777         (Powerpc_relocate_functions): Add overflow check enums and functions.
2778         Add non-shift version of rela, rela_ua.  Delete all rel public
2779         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2780         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2781         addr16_ha3, addr14 functions.
2782         (Output_data_got_powerpc::add_constant_pair): New function.
2783         (Output_data_got_powerpc::got_base_offset): Likewise.
2784         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2785         (instruction constants): Sort, add some more.
2786         (Output_data_glink::do_write): Add and use Address typedef.  Use
2787         object->toc_base_offset() stub for 64-bit.
2788         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2789         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2790         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2791         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2792         Always treat .opd relocs as against locally defined symbol.
2793         Correct condition for RELATIVE relocs.
2794         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2795         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2796         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2797         calculations.  Handle TLS relocs, and more.  Add overflow
2798         checking and adjust for Powerpc_relocate_functions changes.
2799         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2800         Reinstate --emit-relocs code with FIXME.
2801
2802 2012-08-30  Alan Modra  <amodra@gmail.com>
2803
2804         * layout.cc (Layout::set_segment_offsets): Set p_align to
2805         abi_pagesize, not common_pagesize.
2806         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2807         to determine whether file header can go in segment.
2808
2809 2012-08-30  Alan Modra  <amodra@gmail.com>
2810
2811         * output.h (Output_reloc::Output_reloc <output section>): Add
2812         is_relative param.  Adjust calls.
2813         (Output_reloc::add_output_section_relative): New functions.
2814         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2815         is_relative.
2816         (Output_reloc::symbol_value): Handle SECTION_CODE.
2817
2818 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2819
2820         * gold.cc (queue_middle_tasks): Call layout again when unique
2821         segments for sections is desired.
2822         * layout.cc (Layout::Layout): Initialize new members.
2823         (Layout::get_output_section_flags): New function.
2824         (Layout::choose_output_section): Call get_output_section_flags.
2825         (Layout::layout): Make output section for mapping to a unique segment.
2826         (Layout::insert_section_segment_map): New function.
2827         (Layout::attach_allocated_section_to_segment): Make unique segment for
2828         output sections marked so.
2829         (Layout::segment_precedes): Check for unique segments when sorting.
2830         * layout.h (Layout::Unique_segment_info): New struct.
2831         (Layout::Section_segment_map): New typedef.
2832         (Layout::insert_section_segment_map): New function.
2833         (Layout::get_output_section_flags): New function.
2834         (Layout::is_unique_segment_for_sections_specified): New function.
2835         (Layout::set_unique_segment_for_sections_specified): New function.
2836         (Layout::unique_segment_for_sections_specified_): New member.
2837         (Layout::section_segment_map_): New member.
2838         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2839         Rename is_gc_pass_one to is_pass_one.
2840         Rename is_gc_pass_two to is_pass_two.
2841         Rename is_gc_or_icf to is_two_pass.
2842         Check for which pass based on whether symbols data is present.
2843         Make it two pass when unique segments for sections is desired.
2844         * output.cc (Output_section::Output_section): Initialize new
2845         members.
2846         * output.h (Output_section::is_unique_segment): New function.
2847         (Output_section::set_is_unique_segment): New function.
2848         (Output_section::is_unique_segment_): New member.
2849         (Output_section::extra_segment_flags): New function.
2850         (Output_section::set_extra_segment_flags): New function.
2851         (Output_section::extra_segment_flags_): New member.
2852         (Output_section::segment_alignment): New function.
2853         (Output_section::set_segment_alignment): New function.
2854         (Output_section::segment_alignment_): New member.
2855         (Output_segment::Output_segment): Initialize is_unique_segment_.
2856         (Output_segment::is_unique_segment): New function.
2857         (Output_segment::set_is_unique_segment): New function.
2858         (Output_segment::is_unique_segment_): New member.
2859         * plugin.cc (allow_unique_segment_for_sections): New function.
2860         (unique_segment_for_sections): New function.
2861         (Plugin::load): Add new functions to transfer vector.
2862         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2863         * Makefile.in: Regenerate.
2864         * testsuite/plugin_final_layout.sh: Check if unique segment
2865         functionality works.
2866         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2867         are available.
2868         (allow_unique_segment_for_sections): New global.
2869         (unique_segment_for_sections): New global.
2870         (claim_file_hook): Call allow_unique_segment_for_sections.
2871         (all_symbols_read_hook): Call unique_segment_for_sections.
2872
2873 2012-08-22  Cary Coutant  <ccoutant@google.com>
2874
2875         * layout.cc (Layout::include_section): Don't assert on GROUP
2876         sections with --emit-relocs.
2877
2878 2012-08-21  Cary Coutant  <ccoutant@google.com>
2879
2880         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2881         if --export-dynamic-symbol names an undef symbol.
2882
2883 2012-08-18  Alan Modra  <amodra@gmail.com>
2884
2885         * powerpc.cc: Formatting and white space.
2886         (Powerpc_relobj): Rename got2_section_ to special_.
2887         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2888         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2889         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2890         (Target_powerpc): Add Address typedef and invalid_address.  Use
2891         throughout.
2892         (Target_powerpc::is_branch_reloc): New function.
2893         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2894         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2895         for dst_mask, value and addend.
2896         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2897         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2898         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2899         uint16_t for 24-bit offset.  Use get_output_section_offset and
2900         check return.
2901         (Target_powerpc::Scan::local): Handle more relocs.
2902         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2903         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2904         Plug in toc restoring insn after plt calls.  Translate branches
2905         to function descriptor symbols to corresponding entry point.
2906         (Target_powerpc::relocate_for_relocatable): Check return from
2907         get_output_section_offset.
2908         * symtab.h: Comment typo.
2909
2910 2012-08-14  Ian Lance Taylor  <iant@google.com>
2911
2912         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2913         unsupported_relocal_local to call unsupported_reloc_global.
2914
2915 2012-08-14  Nick Clifton  <nickc@redhat.com>
2916
2917         PR ld/14265
2918         * script-sections.cc (Sections_element::output_section_name): Add
2919         keep return parameter.
2920         (Output_section_element::match_name): Add keep return parameter.
2921         Return the value of the keep_ member.
2922         * script-sections.h (class Output_section): Update
2923         output_section_name prototype.
2924         * layout.cc (Layout::keep_input_section): New public member
2925         function.
2926         (Layout::choose_output_section): Pass keep parameter to
2927         output_section_name.
2928         * layout.h (class Layout): Add keep_input_section.
2929         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2930         sections.
2931         * testsuite/Makefile.am: Add a test.
2932         * testsuite/Makefile.in: Regenerate.
2933         * testsuite/pr14265.c: Source file for the test.
2934         * testsuite/pr14265.t: Linker script for the test.
2935         * testsuite/pr14265.sh: Shell script for the test.
2936
2937 2012-08-14  Alan Modra  <amodra@gmail.com>
2938
2939         * target.h (Target::output_section_name): New function.
2940         (Target::do_output_section_name): New function.
2941         * layout.cc (Layout::choose_output_section): Call the above.
2942         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2943
2944 2012-08-14  Alan Modra  <amodra@gmail.com>
2945
2946         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2947         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2948         for replace_constant call.
2949         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2950         (Output_data_glink::do_print_to_mapfile): New function.
2951         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2952         (Target_powerpc::Relocate::relocate): Likewise.
2953
2954 2012-08-14  Alan Modra  <amodra@gmail.com>
2955
2956         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2957         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2958         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2959         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2960         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2961         here.
2962         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2963         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2964         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2965         here.
2966         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2967         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2968
2969 2012-08-12  Alan Modra  <amodra@gmail.com>
2970
2971         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2972         (glink insn constants): Use uint32_t.
2973         (Output_data_glink::add_entry): Use insert, not [] operator.
2974
2975 2012-08-11  Alan Modra  <amodra@gmail.com>
2976
2977         * object.h (Sized_relobj_file::find_shdr): New function.
2978         (Sized_relobj_file::find_special_sections): New function.
2979         * object.cc (Sized_relobj_file::find_shdr): New function.
2980         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2981         (Sized_relobj_file::find_special_sections): New function, split out..
2982         (Sized_relobj_file::do_read_symbols): ..from here.
2983         * output.h (Output_data_got::replace_constant): New function.
2984         (Output_data_got::num_entries): New function.
2985         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2986         (Output_data_got::got_offset): Protected rather than private.
2987         (Output_data_got::replace_got_entry): New function.
2988         * output.cc (Output_data_got::replace_got_entry): New function.
2989         * powerpc.cc (class Powerpc_relobj): New.
2990         (class Powerpc_relocate_functions): Delete all psymval variants or
2991         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2992         Implement _ha functions using corresponding _hi function.
2993         (Powerpc_relobj::find_special_sections): New function.
2994         (Target_powerpc::do_make_elf_object): New function.
2995         (class Output_data_got_powerpc): New.
2996         (class Output_data_glink): New.
2997         (class Powerpc_scan_relocatable_reloc): New.
2998         Many more changes througout file.
2999
3000 2012-08-09  Nick Clifton  <nickc@redhat.com>
3001
3002         * po/vi.po: Updated Vietnamese translation.
3003
3004 2012-08-07  Ian Lance Taylor  <iant@google.com>
3005
3006         * layout.cc (Layout::add_target_dynamic_tags): If
3007         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3008         plt_rel.
3009
3010 2012-07-30  Nick Clifton  <nickc@redhat.com>
3011
3012         * po/gold.pot: Updated template.
3013         * po/es.po: Updated Spanish translation.
3014
3015 2012-07-18  Cary Coutant  <ccoutant@google.com>
3016
3017         PR gold/14344
3018         * configure.ac: Add check for -gpubnames support.
3019         * configure: Regenerate.
3020         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3021         support; force -gno-pubnames.
3022         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3023         support.
3024         (gdb_index_test_4): New test.
3025         * testsuite/Makefile.in: Regenerate.
3026         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3027         * testsuite/gdb_index_test_2.sh: Likewise.
3028         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3029         * testsuite/gdb_index_test_4.sh: New script.
3030         * testsuite/gdb_index_test_comm.sh: New script with common code;
3031         don't look for space after colon.
3032
3033 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3034
3035         * gold.cc (queue_middle_tasks): Update function order only after
3036         deferred objects due to plugins are processed.
3037
3038 2012-07-11  Ian Lance Taylor  <iant@google.com>
3039
3040         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3041         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3042         (Target_arm::scan_reloc_for_stub): Likewise.
3043         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3044         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3045         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3046         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3047         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3048
3049 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3050             Ian Lance Taylor  <iant@google.com>
3051
3052         PR gold/14309
3053         * configure.ac: Test whether std::tr1::hash<off_t> works.
3054         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3055         needed.
3056         * output.h (class Output_fill): Add virtual destructor.
3057         * configure, config.in: Rebuild.
3058
3059 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3060
3061         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3062
3063 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3064
3065         * plugin.cc (Plugin::load): Handle position independent executables.
3066
3067 2012-06-06  Cary Coutant  <ccoutant@google.com>
3068
3069         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3070         add .debug_macro.
3071         (lines_only_debug_sections): Likewise.
3072         (gdb_fast_lookup_sections): New static array.
3073         (is_gdb_debug_section): Rename formal parameter.
3074         (is_lines_only_debug_section): Likewise.
3075         (is_gdb_fast_lookup_section): New function.
3076         (Layout::include_section): Check for ".zdebug_" prefix; pass
3077         section name suffix to is_gdb_debug_section, et al.; check for
3078         fast-lookup sections when building .gdb_index.
3079         * options.h (--strip-debug-gdb): Update GDB version number.
3080
3081 2012-06-06  Cary Coutant  <ccoutant@google.com>
3082
3083         * configure.ac: Add check for fallocate.
3084         * configure: Regenerate.
3085         * config.in: Regenerate.
3086
3087         * options.h (class General_options): Add --mmap-output-file and
3088         --posix-fallocate options.
3089         * output.cc: (posix_fallocate): Remove; replace with...
3090         (gold_fallocate): New function.
3091         (Output_file::map_no_anonymous): Call gold_fallocate.
3092         (Output_file::map): Check --mmap-output-file option.
3093
3094 2012-06-05  Jing Yu  <jingyu@google.com>
3095
3096         * gold.h (textdomain): Add do {} to empty while(0).
3097         (bindtextdomain): Likewise.
3098
3099 2012-06-04  Cary Coutant  <ccoutant@google.com>
3100
3101         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3102         has_dynsym_index.
3103
3104 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3105
3106         * symtab.cc (Symbol_table::define_special_symbol):
3107         Initialize *poldsym to prevent uninitialized variable errors.
3108
3109 2012-05-23  Cary Coutant  <ccoutant@google.com>
3110
3111         * layout.cc (Layout::section_name_mapping): Add rules to handle
3112         exact match on .data.rel.ro.local or .data.rel.ro.
3113         (Layout::output_section_name): Check for exact matches.
3114
3115 2012-05-23  Cary Coutant  <ccoutant@google.com>
3116
3117         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3118         more carefully.
3119
3120 2012-05-22  Cary Coutant  <ccoutant@google.com>
3121
3122         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3123         object before exporting symbol.
3124
3125 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3126
3127         * testsuite/tls_test.cc: Include "config.h" first.
3128         * testsuite/tls_test_c.c: Likewise.
3129
3130 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3131             Nick Clifton  <nickc@redhat.com>
3132
3133         PR 14072
3134         * configure.in: Add check that sysdep.h has been included before
3135         any system header files.
3136         * configure: Regenerate.
3137         * config.in: Regenerate.
3138
3139 2012-05-14  Cary Coutant  <ccoutant@google.com>
3140
3141         * layout.cc (Layout::make_output_section): Mark .tdata section
3142         as RELRO.
3143         * testsuite/relro_test.cc: Add a TLS variable.
3144
3145 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3146
3147         PR gold/14091
3148         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3149         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3150         R_X86_64_64.
3151
3152 2012-05-08  Cary Coutant  <ccoutant@google.com>
3153
3154         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3155         (lines_only_debug_sections): Likewise.
3156
3157 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3158
3159         * nacl.cc: New file.
3160         * nacl.h: New file.
3161         * Makefile.am (CCFILES, HFILES): Add them.
3162         * Makefile.in: Regenerate.
3163         * i386.cc (Output_data_plt_i386_nacl): New class.
3164         (Output_data_plt_i386_nacl_exec): New class.
3165         (Output_data_plt_i386_nacl_dyn): New class.
3166         (Target_i386_nacl): New class.
3167         (Target_selector_i386_nacl): New class.
3168         (target_selector_i386): Use it instead of Target_selector_i386.
3169         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3170         (Target_x86_64_nacl): New class.
3171         (Target_selector_x86_64_nacl): New class.
3172         (target_selector_x86_64, target_selector_x32): Use it instead of
3173         Target_selector_x86_64.
3174         * arm.cc (Output_data_plt_arm_nacl): New class.
3175         (Target_arm_nacl): New class.
3176         (Target_selector_arm_nacl): New class.
3177         (target_selector_arm, target_selector_armbe): Use it instead of
3178         Target_selector_arm.
3179
3180         * target-select.cc (select_target): Take new Input_file* and off_t
3181         arguments, pass them on to recognize method of selector.
3182         * object.cc (make_elf_sized_object): Update caller.
3183         * parameters.cc (parameters_force_valid_target): Likewise.
3184         * incremental.cc (make_sized_incremental_binary): Likewise.
3185         * target-select.h: Update decl.
3186         (Target_selector::recognize): Take new Input_file* argument,
3187         pass it on to do_recognize.
3188         (Target_selector::do_recognize): Take new Input_file* argument.
3189         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3190         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3191         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3192         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3193
3194         * target.h (Target::Target_info): New members isolate_execinstr
3195         and rosegment_gap.
3196         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3197         * arm.cc (Target_arm::arm_info): Update initializer.
3198         * i386.cc (Target_i386::i386_info): Likewise.
3199         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3200         * sparc.cc (Target_sparc::sparc_info): Likewise.
3201         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3202         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3203         * layout.cc (Layout::attach_allocated_section_to_segment):
3204         Take new const Target* argument.  If target->isolate_execinstr(), act
3205         like --rosegment.
3206         (Layout::find_first_load_seg): Take new const Target* argument;
3207         if target->isolate_execinstr(), reject PF_X segments.
3208         (Layout::relaxation_loop_body): Update caller.
3209         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3210         reset file offset to zero when we hit LOAD_SEG, and then do a second
3211         loop over the segments before LOAD_SEG to reassign offsets after
3212         addresses have been determined.  Handle target->rosegment_gap().
3213         (Layout::attach_section_to_segment): Take new const Target* argument;
3214         pass it to attach_allocated_section_to_segment.
3215         (Layout::make_output_section): Update caller.
3216         (Layout::attach_sections_to_segments): Take new const Target* argument;
3217         pass it to attach_section_to_segment.
3218         * gold.cc (queue_middle_tasks): Update caller.
3219         * layout.h (Layout): Update method decls with new arguments.
3220
3221         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3222         Target_info pointer to use.
3223         (Target_arm::do_make_data_plt): New virtual method.
3224         (Target_arm::make_data_plt): New method that calls it.
3225         (Target_arm::make_plt_entry): Use it.
3226         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3227         for the section alignment.
3228         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3229         method.
3230         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3231         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3232         method.
3233         (Output_data_plt_arm::get_plt_entry_size): Call it.
3234         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3235         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3236         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3237         method.
3238         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3239         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3240         method instead of sizeof(plt_entry).
3241         (Output_data_plt_arm::add_entry): Likewise.
3242         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3243         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3244         than static method.
3245         (Target_arm::plt_entry_size): Likewise.
3246         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3247         Move to ...
3248         (Output_data_plt_arm_standard): ... here, new class.
3249         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3250         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3251         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3252
3253         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3254         Take additional argument for the PLT entry size.
3255         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3256         Use get_plt_entry_size method rather than plt_entry_size variable.
3257         (Output_data_plt_x86_64::reserve_slot): Likewise.
3258         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3259         (Output_data_plt_x86_64::add_entry): Likewise.
3260         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3261         (Output_data_plt_x86_64::address_for_global): Likewise.
3262         (Output_data_plt_x86_64::address_for_local): Likewise.
3263         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3264         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3265         Make method non-static.
3266         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3267         method.
3268         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3269         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3270         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3271         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3272         virtual method.
3273         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3274         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3275         virtual method.
3276         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3277         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3278         virtual method.
3279         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3280         (Output_data_plt_x86_64::plt_entry_size)
3281         (Output_data_plt_x86_64::first_plt_entry)
3282         (Output_data_plt_x86_64::plt_entry)
3283         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3284         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3285         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3286         (Output_data_plt_x86_64_standard): ... here, new class.
3287         (Target_x86_64::Target_x86_64): Take optional argument for the
3288         Target_info pointer to use.
3289         (Target_x86_64::do_make_data_plt): New virtual method.
3290         (Target_x86_64::make_data_plt): New method to call it.
3291         (Target_x86_64::init_got_plt_for_update): Use that.
3292         Call this->plt_->add_eh_frame method here.
3293         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3294         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3295         rather than static method.
3296         (Target_x86_64::plt_entry_size): Likewise.
3297         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3298         rather than plt_entry_size variable.  Move guts of PLT filling to...
3299         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3300         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3301         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3302
3303         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3304         additional argument for the section alignment.
3305         Don't do add_eh_frame_for_plt here.
3306         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3307         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3308         variable.
3309         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3310         method.
3311         (Output_data_plt_i386::get_plt_entry_size): Call it.
3312         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3313         (Output_data_plt_i386::add_eh_frame): New method to call it.
3314         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3315         method.
3316         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3317         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3318         method.
3319         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3320         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3321         method instead of plt_entry_size.
3322         (Output_data_plt_i386::plt_entry_size)
3323         (Output_data_plt_i386::plt_eh_frame_fde_size)
3324         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3325         (Output_data_plt_i386_standard): ... here, new class.
3326         (Output_data_plt_i386_exec): New class.
3327         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3328         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3329         (Output_data_plt_i386::exec_plt_entry): Move to ...
3330         (Output_data_plt_i386_exec::plt_entry): ... here.
3331         (Output_data_plt_i386_dyn): New class.
3332         (Output_data_plt_i386::first_plt_entry): Move to ...
3333         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3334         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3335         (Output_data_plt_i386_dyn::plt_entry): ... here.
3336         (Target_i386::Target_i386): Take optional argument for the Target_info
3337         pointer to use.
3338         (Target_i386::do_make_data_plt): New virtual method.
3339         (Target_i386::make_data_plt): New method to call it.
3340         (Target_i386::make_plt_section): Use that.
3341         Call this->plt_->add_eh_frame method here.
3342         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3343         rather than plt_entry_size variable.
3344         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3345         (Output_data_plt_i386::address_for_local): Likewise.
3346         (Output_data_plt_i386::do_write): Likewise.
3347         Move guts of PLT filling to...
3348         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3349         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3350         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3351         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3352
3353 2012-05-01  Cary Coutant  <ccoutant@google.com>
3354
3355         * dwarf_reader.cc (Dwarf_die::read_attributes)
3356         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3357         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3358         * reduced_debug_output.cc
3359         (Output_reduced_debug_info_section::get_die_end): Remove
3360         DW_FORM_GNU_ref_index.  Add default case.
3361
3362 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3363
3364         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3365         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3366         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3367         DW_AT_high_pc as offset from DW_AT_low_pc.
3368
3369         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3370         * testsuite/Makefile.in: Regenerate.
3371         * testsuite/gdb_index_test_3.c: New test source file.
3372         * testsuite/gdb_index_test_3.sh: New test source file.
3373
3374 2012-04-25  Ian Lance Taylor  <iant@google.com>
3375
3376         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3377         pointer.
3378         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3379         as a class, not a struct.
3380         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3381         (Target_arm::apply_cortex_a8_workaround): Likewise.
3382         * gc.h: Declare Reloc_types as a struct, not a class.
3383         * object.h: Declare Symbols_data as a struct.
3384         * reloc.h: Declare Read_relocs_data as a struct.
3385         * target.h: Declare Relocate_info as a struct.
3386
3387 2012-04-24  David S. Miller  <davem@davemloft.net>
3388
3389         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3390         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3391         and R_SPARC_WPLT30.
3392
3393 2012-04-24  Cary Coutant  <ccoutant@google.com>
3394
3395         * incremental-dump.cc (find_input_containing_global): Replace
3396         magic number with symbolic constant.
3397         (dump_incremental_inputs): Update version number.
3398         * incremental.cc (Output_section_incremental_inputs): Update version
3399         number; import symbolic constants from Incremental_inputs_reader.
3400         (Incremental_inputs::create_data_sections): Align relocations
3401         section correctly for 64-bit targets.
3402         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3403         constants; add padding.
3404         (Output_section_incremental_inputs::write_header): Add assert for
3405         header_size.
3406         (Output_section_incremental_inputs::write_input_files): Add assert
3407         for input_entry_size.
3408         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3409         add assert for object_info_size, input_section_entry_size,
3410         global_sym_entry_size.
3411         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3412         for data structure sizes; use them.
3413         (Incremental_input_entry_reader): Import symbolic constants from
3414         Incremental_inputs_reader; use them.
3415
3416 2012-04-23  David S. Miller  <davem@davemloft.net>
3417
3418         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3419         and elf_flags_set_.
3420         (Target_sparc::Target_sparc): Initialize new fields.
3421         (Target_sparc::do_make_elf_object): New function.
3422         (Target_sparc::do_adjust_elf_header): New function.
3423
3424 2012-04-23  Cary Coutant  <ccoutant@google.com>
3425
3426         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3427         CU range table of gdb index.
3428
3429 2012-04-20  David S. Miller  <davem@davemloft.net>
3430
3431         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3432         instead of false.
3433
3434 2012-04-16  David S. Miller  <davem@davemloft.net>
3435
3436         * sparc.cc (Target_sparc::got_address): New function.
3437         (Sparc_relocate_functions::gdop_hix22): New function.
3438         (Sparc_relocate_functions::gdop_lox10): New function.
3439         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3440         relocs.
3441         (Target_sparc::Scan::local): Likewise if the global symbol is not
3442         preemptible and is not IFUNC.
3443         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3444         transformations for local and non-preemptible non-IFUNC global
3445         symbols.
3446
3447         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3448         writing out 64-bit part of ranges.
3449
3450         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3451         -fpic and -fpie respectively.
3452         * Makefile.in: Regenerate.
3453
3454         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3455         (Target_sparc::Target_sparc): Initialize new field.
3456         (Target_sparc::do_plt_section_for_global): New function.
3457         (Target_sparc::do_plt_section_for_local): New function.
3458         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3459         (Target_sparc::make_plt_section): New function, broken out of
3460         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3461         (Target_sparc::make_plt_entry): Call make_plt_section.
3462         (Target_sparc::make_local_ifunc_plt_entry): New function.
3463         (Target_sparc::rela_ifunc_section): New function.
3464         (Target_sparc::plt_section): Remove const.
3465         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3466         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3467         and ifunc_count_ fields.
3468         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3469         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3470         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3471         (Output_data_plt_sparc::rela_ifunc): New function.
3472         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3473         (Output_data_plt_sparc::has_ifunc_section): New function.
3474         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3475         (Output_data_plt_sparc::address_for_global): New function.
3476         (Output_data_plt_sparc::address_for_local): New function.
3477         (Output_data_plt_sparc::plt_index_to_offset): New function.
3478         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3479         and entry_count.
3480         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3481         entry_count.
3482         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3483         R_SPARC_JMP_IREL to switch.
3484         (Target_sparc::Scan::check_non_pic): Likewise.
3485         (Target_sparc::Scan::local): Handle IFUNC symbols.
3486         (Target_sparc::Scan::local): Likewise.
3487         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3488         and plt_address_for_local.
3489         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3490         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3491
3492         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3493         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3494         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3495         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3496         global relocs too.
3497         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3498         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3499         calls.
3500         * sparc.cc (Target_sparc::Scan::global): Likewise.
3501         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3502
3503 2012-04-16  Cary Coutant  <ccoutant@google.com>
3504
3505         * archive.cc (Library_base::should_include_member): Check for
3506         --export-dynamic-symbol.
3507         * options.h (class General_options): Add --export-dynamic-symbol.
3508         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3509         --export-dynamic-symbol.
3510         (Symbol_table::gc_mark_undef_symbols): Likewise.
3511         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3512
3513 2012-04-12  David S. Miller  <davem@davemloft.net>
3514
3515         * sparc.cc (Reloc::wdisp10): New relocation method.
3516         (Reloc::h34): Likewise.
3517         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3518         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3519         R_SPARC_WDISP10.
3520         (Target_sparc::Scan::local): Likewise.
3521         (Target_sparc::Scan::global): Likewise.
3522         (Target_sparc::Relocate::relocate): Likewise.
3523
3524 2012-04-09  Cary Coutant  <ccoutant@google.com>
3525
3526         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3527         low_pc == 0.
3528
3529 2012-04-06  Ian Lance Taylor  <iant@google.com>
3530
3531         * timer.cc: #include <unistd.h>.
3532
3533 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3534
3535         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3536         * config.in: Regenerate.
3537         * configure: Regenerate.
3538
3539 2012-04-05  Nick Clifton  <nickc@redhat.com>
3540
3541         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3542         (AM_LC_MESSAGES): Add.
3543         * aclocal.m4: Regenerate.
3544         * config.in: Regenerate.
3545         * configure: Regenerate.
3546
3547 2012-03-21  Cary Coutant  <ccoutant@google.com>
3548
3549         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3550         * Makefile.in: Regenerate.
3551         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3552         (Sized_elf_reloc_mapper::symbol_section): New function.
3553         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3554         (make_elf_reloc_mapper): New function.
3555         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3556         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3557         (Dwarf_abbrev_table::do_get_abbrev): New function.
3558         (Dwarf_ranges_table::read_ranges_table): New function.
3559         (Dwarf_ranges_table::read_range_list): New function.
3560         (Dwarf_pubnames_table::read_section): New function.
3561         (Dwarf_pubnames_table::read_header): New function.
3562         (Dwarf_pubnames_table::next_name): New function.
3563         (Dwarf_die::Dwarf_die): New function.
3564         (Dwarf_die::read_attributes): New function.
3565         (Dwarf_die::skip_attributes): New function.
3566         (Dwarf_die::set_name): New function.
3567         (Dwarf_die::set_linkage_name): New function.
3568         (Dwarf_die::attribute): New function.
3569         (Dwarf_die::string_attribute): New function.
3570         (Dwarf_die::int_attribute): New function.
3571         (Dwarf_die::uint_attribute): New function.
3572         (Dwarf_die::ref_attribute): New function.
3573         (Dwarf_die::child_offset): New function.
3574         (Dwarf_die::sibling_offset): New function.
3575         (Dwarf_info_reader::check_buffer): New function.
3576         (Dwarf_info_reader::parse): New function.
3577         (Dwarf_info_reader::do_parse): New function.
3578         (Dwarf_info_reader::do_read_string_table): New function.
3579         (Dwarf_info_reader::lookup_reloc): New function.
3580         (Dwarf_info_reader::get_string): New function.
3581         (Dwarf_info_reader::visit_compilation_unit): New function.
3582         (Dwarf_info_reader::visit_type_unit): New function.
3583         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3584         Sized_elf_reloc_mapper.
3585         (Sized_dwarf_line_info::symbol_section): Remove function.
3586         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3587         (Sized_dwarf_line_info::read_line_mappings): Remove object
3588         parameter, adjust callers.
3589         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3590         * dwarf_reader.h: Include <sys/types.h>.
3591         (class Track_relocs): Remove forward declaration.
3592         (class Elf_reloc_mapper): New class.
3593         (class Sized_elf_reloc_mapper): New class.
3594         (class Dwarf_abbrev_table): New class.
3595         (class Dwarf_range_list): New class.
3596         (class Dwarf_ranges_table): New class.
3597         (class Dwarf_pubnames_table): New class.
3598         (class Dwarf_die): New class.
3599         (class Dwarf_info_reader): New class.
3600         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3601         (Sized_dwarf_line_info::symbol_section): Remove member function.
3602         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3603         base class.
3604         * gdb-index.cc: New source file.
3605         * gdb-index.h: New source file.
3606         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3607         and .debug_types sections, call Layout::add_to_gdb_index.
3608         (Sized_relobj_incr::do_section_name): Implement.
3609         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3610         return type; Implement.
3611         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3612         return type.
3613         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3614         parameter list and return type.
3615         (Sized_incr_dynobj::do_section_contents): Likewise.
3616         * layout.cc: Include gdb-index.h.
3617         (Layout::Layout): Initialize gdb_index_data_.
3618         (Layout::init_fixed_output_section): Check for .gdb_index section.
3619         (Layout::add_to_gdb_index): New function. Instantiate.
3620         * layout.h: Add forward declaration for class Gdb_index.
3621         (Layout::add_to_gdb_index): New member function.
3622         (Layout::gdb_index_data_): New data member.
3623         * main.cc: Include gdb-index.h.
3624         (main): Print statistics for gdb index.
3625         * object.cc (Object::section_contents): Move code into
3626         do_section_contents.
3627         (need_decompressed_section): Check for sections needed when building
3628         gdb index.
3629         (build_compressed_section_map): Likewise.
3630         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3631         gdb index.
3632         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3633         sections; call Layout::add_to_gdb_index.
3634         (Sized_relobj_file::do_decompressed_section_contents): Call
3635         do_section_contents directly.
3636         * object.h (Object::do_section_contents): Adjust parameter list and
3637         return type.
3638         (Object::do_decompressed_section_contents): Call do_section_contents
3639         directly.
3640         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3641         return type.
3642         * options.h (class General_options): Add --gdb-index option.
3643         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3644         list and return type.
3645         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3646         * reloc.h (Track_relocs::checkpoint): New function.
3647         (Track_relocs::reset): New function.
3648
3649         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3650         New test cases.
3651         * testsuite/Makefile.in: Regenerate.
3652         * testsuite/gdb_index_test.cc: New test source file.
3653         * testsuite/gdb_index_test_1.sh: New test source file.
3654         * testsuite/gdb_index_test_2.sh: New test source file.
3655
3656 2012-03-19  Doug Kwan  <dougkwan@google.com>
3657
3658         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3659         (Target_arm::do_finalize_sections): Remove code which defines
3660         __exidx_start and __exidx_end.  Make symbol table parameter
3661         anonymous as it is not used.
3662         * gold.cc (queue_middle_tasks): Call target hook to define any
3663         target-specific symbols.
3664         * target.h (Target::define_standard_symbols): New method.
3665         (Target::do_define_standard_symbols): Same.
3666         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3667         * testsuite/Makefile.in: Regenerate.
3668         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3669         and __exidx_end.
3670         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3671         relocations are generated for __exidx_start and __exidx_end.
3672
3673 2012-03-16  Doug Kwan  <dougkwan@google.com>
3674
3675         * testsuite/Makefile.am: Disable test initpri3b.
3676         * testsuite/Makefile.in: Regenerate.
3677
3678 2012-03-15  Doug Kwan  <dougkwan@google.com>
3679
3680         * arm.cc (Target_arm::got_section): Make .got section read-only
3681         if -z now is given.
3682
3683 2012-03-15  Ian Lance Taylor  <iant@google.com>
3684
3685         PR gold/13850
3686         * layout.cc (Layout::make_output_section): Correctly mark
3687         SHT_INIT_ARRAY, et. al., as relro.
3688
3689 2012-03-14  Doug Kwan  <dougkwan@google.com>
3690
3691         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3692         dynamic relocations for protected symbols in shared objects.
3693
3694 2012-03-13  Ian Lance Taylor  <iant@google.com>
3695
3696         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3697         keep the larger alignment.
3698
3699 2012-03-12  Cary Coutant  <ccoutant@google.com>
3700
3701         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3702         handling of DW_LNE_define_file.
3703
3704 2012-03-12  Cary Coutant  <ccoutant@google.com>
3705
3706         * reduced_debug_output.cc
3707         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3708         codes to switch.
3709
3710 2012-02-29  Cary Coutant  <ccoutant@google.com>
3711
3712         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3713
3714 2012-02-29  Cary Coutant  <ccoutant@google.com>
3715
3716         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3717         Call Object::decompressed_section_contents.
3718         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3719         New dtor.
3720         (Sized_dwarf_line_info::buffer_start_): New data member.
3721         * merge.cc (Output_merge_data::do_add_input_section): Call
3722         Object::decompressed_section_contents.
3723         (Output_merge_string::do_add_input_section): Likewise.
3724         * object.cc (need_decompressed_section): New function.
3725         (build_compressed_section_map): Decompress sections needed later.
3726         (Sized_relobj_file::do_decompressed_section_contents): New function.
3727         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3728         * object.h (Object::decompressed_section_contents): New function.
3729         (Object::discard_decompressed_sections): New function.
3730         (Object::do_decompressed_section_contents): New function.
3731         (Object::do_discard_decompressed_sections): New function.
3732         (Compressed_section_info): New type.
3733         (Compressed_section_map): Include decompressed section contents.
3734         (Sized_relobj_file::do_decompressed_section_contents): New function.
3735         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3736
3737 2012-02-16  Cary Coutant  <ccoutant@google.com>
3738
3739         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3740         * testsuite/Makefile.in: Regenerate.
3741
3742 2012-02-14  Cary Coutant  <ccoutant@google.com>
3743
3744         * options.cc (General_options::finalize): Disallow -pie and -static.
3745
3746 2012-02-03  Doug Kwan  <dougkwan@google.com>
3747
3748         * arm.cc (Arm_relocate_functions::abs8,
3749         Arm_relocate_functions::abs16): Use
3750         Bits::has_signed_unsigned_overflow32.
3751         (Arm_relocate_functions::thm_abs8): Correct range of
3752         overflow check.
3753         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3754         in assertions.
3755
3756 2012-02-02  Doug Kwan  <dougkwan@google.com>
3757
3758         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3759         position independent outputs, not just shared objects.
3760
3761 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3762
3763         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3764         * configure: Regenerated.
3765
3766 2012-01-27  Ian Lance Taylor  <iant@google.com>
3767
3768         * reloc.h (Bits): New class with static functions, copied from
3769         namespace utils in arm.cc.
3770         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3771         instead.
3772
3773 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3774
3775         * incremental.cc (write_info_blocks): Correct relocation offset.
3776
3777 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3778
3779         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3780         (Relocate::tls_gd_to_le): Likewise.
3781
3782 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3783
3784         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3785
3786 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3787
3788         * configure.ac: Check if -mcmodel=medium works.
3789         * configure: Regenerated.
3790
3791 2012-01-24  Cary Coutant  <ccoutant@google.com>
3792
3793         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3794         definition and ...
3795         (read_unsigned_LEB_128_x): ... this new function.
3796         (read_signed_LEB_128): Replaced with inline definition and ...
3797         (read_signed_LEB_128_x): ... this new function.
3798         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3799         (read_unsigned_LEB_128): Add inline definition.
3800         (read_signed_LEB_128_x): New function.
3801         (read_signed_LEB_128): Add inline definition.
3802         * testsuite/Makefile.am (leb128_unittest): New unit test.
3803         * testsuite/Makefile.in: Regenerate.
3804         * testsuite/leb128_unittest.cc: New unit test.
3805
3806 2012-01-23  Ian Lance Taylor  <iant@google.com>
3807
3808         PR gold/13617
3809         * i386.cc (Target_i386::do_code_fill): When using a jmp
3810         instruction, pad with nop instructions.
3811         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3812
3813 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3814
3815         * x86_64.cc (gc_process_relocs): Add typename on types used in
3816         template.
3817         (scan_relocs): Likewise.
3818         (relocate_section): Likewise.
3819         (apply_relocation): Likewise.
3820
3821 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3822
3823         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3824         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3825         under x32.
3826
3827 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3828
3829         * x86_64.cc: Initial support for x32.
3830
3831 2012-01-03  Cary Coutant  <ccoutant@google.com>
3832
3833         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3834         Use abstract base class for GOT.
3835         * gold/output.h (class Output_data_got_base): New abstract base class.
3836         (class Output_data_got): Derive from new base class, adjust ctors.
3837         (Output_data_got::reserve_slot): Make virtual; rename to
3838         do_reserve_slot; Adjust callers.
3839         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3840         pointer to abstract base class.
3841         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3842
3843 2011-12-18  Ian Lance Taylor  <iant@google.com>
3844
3845         * object.h (Relobj::local_symbol_value): New function.
3846         (Relobj::local_plt_offset): New function.
3847         (Relobj::local_has_got_offset): New function.
3848         (Relobj::local_got_offset): New function.
3849         (Relobj::set_local_got_offset): New function.
3850         (Relobj::do_local_symbol_value): New pure virtual function.
3851         (Relobj::do_local_plt_offset): Likewise.
3852         (Relobj::do_local_has_got_offset): Likewise.
3853         (Relobj::do_local_got_offset): Likewise.
3854         (Relobj::do_set_local_got_offset): Likewise.
3855         (Sized_relobj::do_local_has_got_offset): Rename from
3856         local_has_got_offset.
3857         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3858         (Sized_relobj::do_set_local_got_offset): Rename from
3859         set_local_got_offset.
3860         (Sized_relobj_file::do_local_plt_offset): Rename from
3861         local_plt_offset.
3862         (Sized_relobj_file::do_local_symbol_value): New function.
3863         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3864         local_plt_offset.
3865         * output.cc (Output_data_got::Got_entry::write): Change object to
3866         Relobj.  Use local_symbol_value.
3867         (Output_data_got::add_global_with_rel): Change rel_dyn to
3868         Output_data_reloc_generic*.  Use add_global_generic.
3869         (Output_data_got::add_global_with_rela): Remove.  Change all
3870         callers to use add_global_with_rel.
3871         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3872         Output_data_reloc_generic*.  Use add_global_generic.
3873         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3874         callers to use add_global_pair_with_rel.
3875         (Output_data_got::add_local): Change object to Relobj*.
3876         (Output_data_got::add_local_plt): Likewise.
3877         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3878         change rel_dyn to Output_data_reloc_generic*.  Use
3879         add_local_generic.
3880         (Output_data_got::add_local_with_rela): Remove.  Change all
3881         callers to use all_local_with_rel.
3882         (Output_data_got::add_local_pair_with_rel): Change object to
3883         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3884         add_output_section_generic.
3885         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3886         callers to use add_local_pair_with_rel.
3887         (Output_data_got::reserve_local): Change object to Relobj*.
3888         * output.h: (class Output_data_reloc_generic): Add pure virtual
3889         declarations for add_global_generic, add_local_generic,
3890         add_output_section_generic.
3891         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3892         functions for Output_data_reloc_generic.  Update declarations for
3893         changes listed in output.cc.
3894         (class Output_data_got): Change template parameter to got_size.
3895         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3896         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3897         function.
3898         (Sized_relobj_incr::do_local_plt_offset): New function.
3899         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3900         add_global_generic.
3901
3902 2011-12-17  Cary Coutant  <ccoutant@google.com>
3903
3904         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3905         * resolve.cc (Symbol_table::resolve): Likewise.
3906         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3907         arrays.
3908         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3909
3910 2011-12-16  Ian Lance Taylor  <iant@google.com>
3911
3912         * output.h (Output_data_reloc_generic::add): Only call
3913         add_dynamic_reloc if this is a dynamic reloc section.
3914
3915 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3916
3917         PR gold/13505
3918         * target-reloc.h (apply_relocation): Replace <64, false> with
3919         <size, big_endian>.
3920
3921 2011-11-25  Nick Clifton  <nickc@redhat.com>
3922
3923         * po/it.po: New Italian translation.
3924
3925 2011-11-17  Sterling Augustine  <saugustine@google.com>
3926
3927         * script.cc (script_include_directive): Implement.
3928         (read_script_file): New local variables name and search_path. Update
3929         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3930         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3931         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3932
3933 2011-11-11  Sterling Augustine  <saugustine@google.com>
3934
3935         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3936         (file_or_sections_cmd): Likewise.
3937
3938 2011-11-11  Doug Kwan  <dougkwan@google.com>
3939
3940         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3941         if --just-symbols is given.
3942
3943 2011-11-10  Doug Kwan  <dougkwan@google.com>
3944
3945         PR gold/13362
3946         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3947         when processing data relocs.
3948         * reloc.h (Relocate_functions::rel_unaligned): New method.
3949         (Relocate_functions::pcrel_unaligned): Ditto.
3950         (Relocate_functions::rel32_unaligned): Ditto.
3951         (Relocate_functions::pcrel32_unaligned): Ditto.
3952
3953 2011-11-09  Doug Kwan  <dougkwan@google.com>
3954
3955         PR gold/13362
3956         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3957         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3958         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3959         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3960         (Relocate_functions::rel_unaligned): New.
3961         (Relocate_functions::rel32_unaligned): New.
3962         * target-reloc.h (relocate_for_relocatable): Add code to handle
3963         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3964         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3965         arm_unaligned_reloc_r): New targets.
3966         * testsuite/Makefile.in: Regenerate.
3967         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3968         linking.
3969
3970 2011-11-02  Ian Lance Taylor  <iant@google.com>
3971
3972         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3973         NATIVE_LINKER.
3974         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3975         * options.cc (General_options::finalize): Use library search path
3976         from configure script if specified.  If not native and no sysroot,
3977         only search TOOLLIBDIR.
3978         * options.h (Search_directory::Search_directory): Change name to
3979         const std::string&.
3980         (General_options::add_to_library_path_with_sysroot): Change arg to
3981         const std::string&.
3982         * configure, Makefile.in, config.in: Rebuild.
3983
3984 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3985
3986         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3987         we are working around the ARM1176 Erratum.
3988         * options.h (General_options::fix_arm1176): Add option.
3989         * testsuite/Makefile.am: Add testcases, and keep current ones
3990         working.
3991         * testsuite/Makefile.in: Regenerate.
3992         * testsuite/arm_fix_1176.s: New file.
3993         * testsuite/arm_fix_1176.sh: Likewise.
3994
3995 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3996
3997         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3998         may_use_blx_.
3999         (Target_arm::may_use_blx): Remove method.
4000         (Target_arm::set_may_use_blx): Likewise.
4001         (Target_arm::may_use_v4t_interworking): New method.
4002         (Target_arm::may_use_v5t_interworking): Likewise.
4003         (Target_arm::may_use_blx_): Remove member variable.
4004         (Arm_relocate_functions::arm_branch_common): Check for v5T
4005         interworking.
4006         (Arm_relocate_functions::thumb_branch_common): Likewise.
4007         (Reloc_stub::stub_type_for_reloc): Likewise.
4008         (Target_arm::do_finalize_sections): Correct interworking checks.
4009         * testsuite/Makefile.am: Add new tests.
4010         * testsuite/Makefile.in: Regenerate.
4011         * testsuite/arm_farcall_arm_arm.s: New test.
4012         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4013         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4014         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4015         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4016         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4017         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4018         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4019
4020 2011-10-31  Cary Coutant  <ccoutant@google.com>
4021
4022         PR gold/13023
4023         * expression.cc (Expression::eval_with_dot): Add
4024         is_section_dot_assignment parameter.
4025         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4026         absolute and assigning to dot within a section.
4027         * script-sections.cc
4028         (Output_section_element_assignment::set_section_addresses): Pass
4029         dot_section to set_if_absolute.
4030         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4031         as is_section_dot_assignment flag to eval_with_dot.
4032         (Output_section_element_dot_assignment::set_section_addresses):
4033         Likewise.
4034         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4035         parameter.  Also set value if relative to dot_section; set the
4036         symbol's output_section.
4037         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4038         parameter.  Adjust all callers.
4039         (Expression::eval_maybe_dot): Likewise.
4040         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4041         Adjust all callers.
4042         * testsuite/script_test_2.t: Test assignment of an absolute value
4043         to dot within an output section element.
4044
4045 2011-10-31  Cary Coutant  <ccoutant@google.com>
4046
4047         * options.h (class General_options): Add --[no-]gnu-unique options.
4048         * symtab.cc (Symbol_table::sized_write_globals): Convert
4049         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4050
4051 2011-10-31  Cary Coutant  <ccoutant@google.com>
4052
4053         PR gold/13359
4054         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4055         unnecessary assertion.
4056         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4057
4058 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4059
4060         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4061         gc_mark_symbol.
4062         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4063         gc_mark_symbol.
4064         Change to just keep the section associated with symbol.
4065         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4066         they are externally visible and --export-dynamic is turned on.
4067         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4068
4069 2011-10-19  Ian Lance Taylor  <iant@google.com>
4070
4071         PR gold/13163
4072         * script-sections.cc
4073         (Output_section_element_dot_assignment::needs_output_section): New
4074         function.
4075
4076 2011-10-19  Ian Lance Taylor  <iant@google.com>
4077
4078         PR gold/13204
4079         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4080         --section-start option was seen.
4081         * options.h (General_options::any_section_start): New function.
4082
4083 2011-10-18  David S. Miller  <davem@davemloft.net>
4084
4085         PR binutils/13301
4086         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4087         member to track relocation locations that have moved during TLS
4088         reloc optimizations.
4089         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4090         (Target_sparc::Relocate::relocate): Adjust view down by 4
4091         bytes if it matches reloc_adjust_addr_.
4092         (Target_sparc::Relocate::relocate_tls): Always move the
4093         __tls_get_addr call delay slot instruction forward 4 bytes when
4094         performing relaxation.
4095
4096 2011-10-18  Cary Coutant  <ccoutant@google.com>
4097
4098         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4099         (Output_file::map_no_anonymous): Check for non-zero
4100         return code from posix_fallocate.
4101
4102 2011-10-17  Cary Coutant  <ccoutant@google.com>
4103
4104         PR gold/13245
4105         * plugin.cc (is_visible_from_outside): Check for symbols
4106         referenced from dynamic objects.
4107         * resolve.cc (Symbol_table::resolve): Don't count references
4108         from dynamic objects as references from real ELF files.
4109         * testsuite/plugin_test_2.sh: Adjust expected result.
4110
4111 2011-10-17  Cary Coutant  <ccoutant@google.com>
4112
4113         * gold.cc: Include timer.h.
4114         (queue_middle_tasks): Stamp time.
4115         (queue_final_tasks): Likewise.
4116         * main.cc (main): Store timer in parameters.  Print timers
4117         for each pass.
4118         * parameters.cc (Parameters::Parameters): Initialize timer_.
4119         (Parameters::set_timer): New function.
4120         (set_parameters_timer): New function.
4121         * parameters.h (Parameters::set_timer): New function.
4122         (Parameters::timer): New function.
4123         (Parameters::timer_): New data member.
4124         (set_parameters_timer): New function.
4125         * timer.cc (Timer::stamp): New function.
4126         (Timer::get_pass_time): New function.
4127         * timer.h (Timer::stamp): New function.
4128         (Timer::get_pass_time): New function.
4129         (Timer::pass_times_): New data member.
4130
4131 2011-10-17  Cary Coutant  <ccoutant@google.com>
4132
4133         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4134         task for members of lib groups.
4135
4136 2011-10-17  Cary Coutant  <ccoutant@google.com>
4137
4138         PR gold/13288
4139         * fileread.cc (File_read::find_view): Add assert.
4140         (File_read::make_view): Move bounds check (replace with assert)...
4141         (File_read::find_or_make_view): ... to here.
4142
4143 2011-10-12  Cary Coutant  <ccoutant@google.com>
4144
4145         * output.cc (Output_file::open_base_file): Handle case where
4146         ::read returns less than requested size.
4147
4148 2011-10-10  Cary Coutant  <ccoutant@google.com>
4149
4150         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4151         Initialize defined_count_.
4152         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4153         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4154         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4155         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4156         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4157         * incremental.h (Sized_relobj_incr::defined_count_): New data
4158         member.
4159         (Sized_incr_dynobj::defined_count_): New data member.
4160         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4161         Return zeroes instead of internal error.
4162
4163 2011-10-10  Cary Coutant  <ccoutant@google.com>
4164
4165         PR gold/13249
4166         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4167         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4168         * output.h (class Output_reloc): Add use_plt_offset flag.
4169         (Output_reloc::type_): Adjust size of bit field.
4170         (Output_reloc::use_plt_offset_): New bit field.
4171         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4172         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4173         flag.  Adjust all callers.
4174         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4175         creating RELATIVE relocations.
4176
4177 2011-10-10  Nick Clifton  <nickc@redhat.com>
4178
4179         * po/es.po: Updated Spanish translation.
4180         * po/fi.po: Updated Finnish translation.
4181
4182 2011-10-03   Diego Novillo  <dnovillo@google.com>
4183
4184         * options.cc (parse_uint): Fix dereference of RETVAL.
4185
4186 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4187
4188         * layout.h (section_order_map_): New member.
4189         (get_section_order_map): New member function.
4190         * output.cc (Output_section::add_input_section): Check for patterns
4191         only when --section-ordering-file is specified.
4192         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4193         output_sections have been formed.
4194         * layout.cc (Layout_Layout): Initialize section_order_map_.
4195         * plugin.cc (update_section_order): Store order in order_map. Do not
4196         update the order.
4197         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4198         * testsuite/Makefile.in: Regenerate.
4199         * testsuite/plugin_section_order.c: New file.
4200         * testsuite/plugin_final_layout.cc: New file.
4201         * testsuite/plugin_final_layout.sh: New file.
4202
4203 2011-09-29  Cary Coutant  <ccoutant@google.com>
4204
4205         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4206         Check for NULL.
4207         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4208         symbols during incremental update.
4209         (Symbol_table::add_from_dynobj): Likewise.
4210
4211 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4212             Ian Lance Taylor  <iant@google.com>
4213
4214         * symtab.cc (Symbol_table::define_special_symbol): Always
4215         canonicalize version string.
4216
4217 2011-09-26  Cary Coutant  <ccoutant@google.com>
4218
4219         * gold.cc (queue_initial_tasks): Move option checks ...
4220         * options.cc (General_options::finalize): ... to here. Disable
4221         some options; make others fatal.
4222
4223 2011-09-26  Cary Coutant  <ccoutant@google.com>
4224
4225         gcc PR lto/47247
4226         * plugin.cc (get_symbols_v2): New function.
4227         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4228         (is_referenced_from_outside): New function.
4229         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4230         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4231         (get_symbols): Pass version parameter.
4232         (get_symbols_v2): New function.
4233         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4234         parameter.
4235         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4236         (onload): Add LDPT_GET_SYMBOLS_V2.
4237         (all_symbols_read_hook): Use get_symbols_v2; check for
4238         LDPR_PREVAILING_DEF_IRONLY_EXP.
4239         * testsuite/plugin_test_3.sh: Update expected results.
4240
4241 2011-09-23  Simon Baldwin  <simonb@google.com>
4242
4243         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4244         configuration options.
4245         * configure: Regenerate.
4246         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4247         * Makefile.in: Regenerate.
4248         * testsuite/Makefile.in: Regenerate.
4249
4250 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4251
4252         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4253
4254 2011-09-19  Cary Coutant  <ccoutant@google.com>
4255
4256         * incremental.cc (can_incremental_update): Fix typo in comment.
4257         * incremental.h (can_incremental_update): Likewise.
4258
4259 2011-09-18  Cary Coutant  <ccoutant@google.com>
4260
4261         * incremental.cc (can_incremental_update): New function.
4262         * incremental.h (can_incremental_update): New function.
4263         * layout.cc (Layout::init_fixed_output_section): Call it.
4264         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4265         * object.cc (Sized_relobj_file::do_layout): Call
4266         can_incremental_update.
4267
4268 2011-09-13  Cary Coutant  <ccoutant@google.com>
4269
4270         * configure.ac: Check for glibc support for gnu_indirect_function
4271         support with static linking, setting automake conditional
4272         IFUNC_STATIC.
4273         * Makefile.in: Regenerate.
4274         * configure: Regenerate.
4275
4276         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4277         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4278         for IFUNC_STATIC.
4279         * testsuite/Makefile.in: Regenerate.
4280
4281 2011-09-13  Cary Coutant  <ccoutant@google.com>
4282
4283         * incremental.cc (Sized_relobj_incr::do_layout): Call
4284         report_comdat_group for kept comdat sections.
4285         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4286         * testsuite/Makefile.in: Regenerate.
4287         * testsuite/incr_comdat_test_1.cc: New source file.
4288         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4289         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4290         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4291
4292 2011-09-13  Ian Lance Taylor  <iant@google.com>
4293
4294         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4295         variable external_symbols_offset.
4296
4297 2011-09-12  Ian Lance Taylor  <iant@google.com>
4298
4299         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4300         triggered if object has no symbols.
4301
4302 2011-09-09  David S. Miller  <davem@davemloft.net>
4303
4304         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4305         (Output_fill_debug_line::do_write): Likewise.
4306
4307 2011-08-29  Cary Coutant  <ccoutant@google.com>
4308
4309         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4310         casts to match formatting specs.
4311         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4312
4313 2011-08-26  Cary Coutant  <ccoutant@google.com>
4314
4315         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4316         remaining hole size when allocating.
4317         (Layout::make_output_section): Set fill methods for debug sections.
4318         * layout.h (Free_list::Free_list_node): Move from private to
4319         public.
4320         (Free_list::set_min_hole_size): New function.
4321         (Free_list::begin, Free_list::end): New functions.
4322         (Free_list::min_hole_): New data member.
4323         * output.cc: Include dwarf.h.
4324         (Output_fill_debug_info::do_minimum_hole_size): New function.
4325         (Output_fill_debug_info::do_write): New function.
4326         (Output_fill_debug_line::do_minimum_hole_size): New function.
4327         (Output_fill_debug_line::do_write): New function.
4328         (Output_section::Output_section): Initialize new data member.
4329         (Output_section::set_final_data_size): Ensure patch space is larger
4330         than minimum hole size.
4331         (Output_section::do_write): Fill holes in debug sections.
4332         * output.h (Output_fill): New class.
4333         (Output_fill_debug_info): New class.
4334         (Output_fill_debug_line): New class.
4335         (Output_section::set_free_space_fill): New function.
4336         (Output_section::free_space_fill_): New data member.
4337         * testsuite/Makefile.am (incremental_test_3): Add
4338         --incremental-patch option.
4339         (incremental_test_4): Likewise.
4340         (incremental_test_5): Likewise.
4341         (incremental_test_6): Likewise.
4342         (incremental_copy_test): Likewise.
4343         (incremental_common_test_1): Likewise.
4344         * testsuite/Makefile.in: Regenerate.
4345
4346 2011-08-26  Nick Clifton  <nickc@redhat.com>
4347
4348         * po/es.po: Updated Spanish translation.
4349
4350 2011-08-01  Cary Coutant  <ccoutant@google.com>
4351
4352         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4353         * gold/testsuite/Makefile.in: Regenerate.
4354         * gold/testsuite/justsyms_exec.c: New source file.
4355         * gold/testsuite/justsyms_lib.c: New source file.
4356
4357 2011-08-01  Cary Coutant  <ccoutant@google.com>
4358
4359         * layout.cc (Layout::set_segment_offsets): Don't realign text
4360         segment if -Ttext was specified.
4361         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4362         file type.
4363         * object.h (Sized_relobj_file::e_type): New function.
4364         (Sized_relobj_file::e_type_): New data member.
4365         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4366         base address for ET_EXEC files.
4367         * target.cc (Target::do_make_elf_object_implementation): Allow
4368         ET_EXEC files with --just-symbols option.
4369
4370 2011-07-28  Cary Coutant  <ccoutant@google.com>
4371
4372         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4373         Add thread_number parameter.
4374         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4375         * workqueue-threads.cc
4376         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4377         current thread if its thread number is greater than desired thread
4378         count.
4379         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4380         Add thread_number parameter.
4381         (Workqueue::should_cancel_thread): Likewise.
4382         (Workqueue::find_runnable_or_wait): Pass thread_number to
4383         should_cancel_thread.
4384         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4385         parameter.
4386
4387 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4388
4389         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4390         only after checking if it cannot be forced local.
4391         * symtab.h (is_externally_visible): Check if the symbol is not forced
4392         local.
4393
4394 2011-07-15  Ian Lance Taylor  <iant@google.com>
4395
4396         * options.h (class General_options): Add --print-output-format.
4397         Move -EL next to -EB, for  better --help output.
4398         * target-select.cc: Include <cstdio>, "options.h", and
4399         "parameters.h".
4400         (Target_selector::do_target_bfd_name): New function.
4401         (print_output_format): New function.
4402         * target-select.h (class Target_selector): Update declarations.
4403         (Target_selector::target_bfd_name): New function.
4404         (print_output_format): Declare.
4405         * main.cc: Include "target-select.h".
4406         (main): Handle --print-output-format.
4407         * gold.cc: Include "target-select.h".
4408         (queue_initial_tasks): Handle --print-output-format when there are
4409         no input files.
4410         * parameters.cc (parameters_force_valid_target): Give a better
4411         error message if -EB/-EL does not match target.
4412         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4413         function.
4414
4415 2011-07-15  Ian Lance Taylor  <iant@google.com>
4416
4417         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4418         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4419         (Output_data_plt_i386::do_write): Write address of .dynamic
4420         section to first entry in .got.plt section.
4421         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4422         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4423         Initialize layout_.
4424         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4425         section to first entry in .got.plt section.
4426         * layout.h (Layout::dynamic_section): New function.
4427
4428 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4429
4430         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4431         to claim_file call.
4432         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4433         input_section_position_, and input_section_glob_.
4434         (read_layout_from_file): Call function section_ordering_specified.
4435         * layout.h (is_section_ordering_specified): New function.
4436         (section_ordering_specified): New function.
4437         (section_ordering_specified_): New boolean member.
4438         * main.cc(main): Call load_plugins after layout object is defined.
4439         * output.cc (Output_section::add_input_section): Use
4440         function section_ordering_specified to check if section ordering is
4441         needed.
4442         * output.cc (Output_section::add_relaxed_input_section): Use
4443         function section_ordering_specified to check if section ordering is
4444         needed.
4445         (Output_section::update_section_layout): New function.
4446         (Output_section::sort_attached_input_sections): Check if input section
4447         must be reordered.
4448         * output.h (Output_section::update_section_layout): New function.
4449         * plugin.cc (get_section_count): New function.
4450         (get_section_type): New function.
4451         (get_section_name): New function.
4452         (get_section_contents): New function.
4453         (update_section_order): New function.
4454         (allow_section_ordering): New function.
4455         (Plugin::load): Add the new interfaces to the transfer vector.
4456         (Plugin_manager::load_plugins): New parameter.
4457         (Plugin_manager::all_symbols_read): New parameter.
4458         (Plugin_manager::claim_file): New parameter. Save the elf object for
4459         unclaimed objects.
4460         (Plugin_manager::get_elf_object): New function.
4461         (Plugin_manager::get_view): Change to directly use the bool to check
4462         if get_view is called from claim_file_hook.
4463         * plugin.h (input_objects): New function
4464         (Plugin__manager::load_plugins): New parameter.
4465         (Plugin_manager::claim_file): New parameter.
4466         (Plugin_manager::get_elf_object): New function.
4467         (Plugin_manager::in_claim_file_handler): New function.
4468         (Plugin_manager::in_claim_file_handler_): New member.
4469         (layout): New function.
4470         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4471         handler with an extra parameter. Make the elf object before calling
4472         claim_file handler.
4473         * testsuite/plugin_test.c (get_section_count): New function pointer.
4474         (get_section_type): New function pointer.
4475         (get_section_name): New function pointer.
4476         (get_section_contents): New function pointer.
4477         (update_section_order): New function pointer.
4478         (allow_section_ordering): New function pointer.
4479         (onload): Check if the new interfaces exist.
4480
4481 2011-07-13  Ian Lance Taylor  <iant@google.com>
4482
4483         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4484         relro section.
4485         * x86_64.cc (Target_x86_64::got_section): Likewise.
4486         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4487         (relro_now_test_SOURCES): New variable.
4488         (relro_now_test_DEPENDENCIES): New variable.
4489         (relro_now_test_LDFLAGS): New variable.
4490         (relro_now_test_LDADD): New variable.
4491         (relro_now_test.so): New target.
4492         * testsuite/Makefile.in: Rebuild.
4493
4494 2011-07-12  Ian Lance Taylor  <iant@google.com>
4495
4496         PR gold/12980
4497         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4498         GLOB_DAT relocation rather than a RELATIVE relocation for a
4499         protected symbol when creating a shared library.
4500         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4501         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4502         * testsuite/protected_main_1.cc (main): Test that protected
4503         function has same address.
4504
4505 2011-07-11  Ian Lance Taylor  <iant@google.com>
4506
4507         PR gold/12979
4508         * options.h (class General_options): Add -Bgroup.
4509         * options.cc (General_options::finalize): If -Bgroup is set,
4510         default to --unresolved-symbols=report-all.
4511         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4512         * target-reloc.h (issue_undefined_symbol_error): Handle
4513         --unresolved-symbols=report-all.
4514
4515 2011-07-08  Ian Lance Taylor  <iant@google.com>
4516
4517         PR gold/11985
4518         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4519         if linker script discards key sections.
4520         (Layout::create_dynamic_symtab): Likewise.
4521         (Layout::assign_local_dynsym_offsets): Likewise.
4522         (Layout::sized_create_version_sections): Likewise.
4523         (Layout::create_interp): Likewise.
4524         (Layout::finish_dynamic_section): Likewise.
4525         (Layout::set_dynamic_symbol_size): Likewise.
4526
4527 2011-07-08  Ian Lance Taylor  <iant@google.com>
4528
4529         PR gold/12386
4530         * options.h (class General_options): Add --unresolved-symbols.
4531         * target-reloc.h (issue_undefined_symbol_error): Check
4532         --unresolved-symbols.  Add comments.
4533
4534 2011-07-08  Ian Lance Taylor  <iant@google.com>
4535
4536         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4537         expression more complex.
4538
4539 2011-07-08  Ian Lance Taylor  <iant@google.com>
4540
4541         PR gold/11317
4542         * target-reloc.h (issue_undefined_symbol_error): New inline
4543         function, broken out of relocate_section.
4544         (relocate_section): Call issue_undefined_symbol_error.
4545         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4546         there is no TLS segment if we are about to issue an undefined
4547         symbol error.
4548         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4549
4550 2011-07-08  Ian Lance Taylor  <iant@google.com>
4551
4552         PR gold/12279
4553         * resolve.cc (Symbol_table::should_override): Add fromtype
4554         parameter.  Change all callers.  Give error when linking together
4555         TLS and non-TLS symbol.
4556         (Symbol_table::should_override_with_special): Add fromtype
4557         parameter.  Change all callers.
4558         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4559         there is no TLS segment if we have reported some errors.
4560         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4561
4562 2011-07-08  Ian Lance Taylor  <iant@google.com>
4563
4564         PR gold/12372
4565         * target.h (Target::plt_address_for_global): New function.
4566         (Target::plt_address_for_local): New function.
4567         (Target::plt_section_for_global): Remove.
4568         (Target::plt_section_for_local): Remove.
4569         (Target::do_plt_address_for_global): New virtual function.
4570         (Target::do_plt_address_for_local): New virtual function.
4571         (Target::do_plt_section_for_global): Remove.
4572         (Target::do_plt_section_for_local): Remove.
4573         (Target::register_global_plt_entry): Add Symbol_table and Layout
4574         parameters.
4575         * output.cc (Output_data_got::Got_entry::write): Use
4576         plt_address_for_global and plt_address_for_local.
4577         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4578         address of output section.
4579         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4580         got_irelative_, and irelative_count_ fields.  Update
4581         declarations.
4582         (Output_data_plt_i386::has_irelative_section): New function.
4583         (Output_data_plt_i386::entry_count): Add irelative_count_.
4584         (Output_data_plt_i386::set_final_data_size): Likewise.
4585         (class Target_i386): Add got_irelative_ and rel_irelative_
4586         fields.  Update declarations.
4587         (Target_i386::Target_i386): Initialize new fields.
4588         (Target_i386::do_plt_address_for_global): New function replacing
4589         do_plt_section_for_global.
4590         (Target_i386::do_plt_address_for_local): New function replacing
4591         do_plt_section_for_local.
4592         (Target_i386::got_section): Create got_irelative_.
4593         (Target_i386::rel_irelative_section): New function.
4594         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4595         fields.  Don't define __rel_iplt_{start,end}.
4596         (Output_data_plt_i386::add_entry): Add symtab and layout
4597         parameters.  Change all callers.  Use different PLT and GOT for
4598         IFUNC symbols.
4599         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4600         layout parameters.  Change all callers.  Use different PLT and
4601         GOT.
4602         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4603         (Output_data_plt_i386::rel_irelative): New function.
4604         (Output_data_plt_i386::address_for_global): New function.
4605         (Output_data_plt_i386::address_for_local): New function.
4606         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4607         IRELATIVE GOT when changing IFUNC GOT entries.
4608         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4609         reloc.
4610         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4611         if we didn't create an IRELATIVE GOT.
4612         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4613         plt_address_for_local.
4614         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4615         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4616         got_irelative_, and irelative_count_ fields.  Update
4617         declarations.
4618         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4619         Initialize new fields.  Remove symtab parameter.  Change all
4620         callers.
4621         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4622         irelative_count_.
4623         (Output_data_plt_x86_64::has_irelative_section): New function.
4624         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4625         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4626         fields.  Update declarations.
4627         (Target_x86_64::Target_x86_64): Initialize new fields.
4628         (Target_x86_64::do_plt_address_for_global): New function replacing
4629         do_plt_section_for_global.
4630         (Target_x86_64::do_plt_address_for_local): New function replacing
4631         do_plt_section_for_local.
4632         (Target_x86_64::got_section): Create got_irelative_.
4633         (Target_x86_64::rela_irelative_section): New function.
4634         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4635         all callers.  Don't create __rel_iplt_{start,end}.
4636         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4637         parameters.  Change all callers.  Use different PLT and GOT for
4638         IFUNC symbols.
4639         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4640         layout parameters.  Change all callers.  Use different PLT and
4641         GOT.
4642         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4643         parameters.  Change all callers.  Use different PLT and GOT for
4644         IFUNC symbols.
4645         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4646         (Output_data_plt_x86_64::rela_irelative): New function.
4647         (Output_data_plt_x86_64::address_for_global): New function.
4648         (Output_data_plt_x86_64::address_for_local): New function.
4649         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4650         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4651         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4652         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4653         parameters.
4654         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4655         reloc.
4656         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4657         symbols if we didn't create an IRELATIVE GOT.
4658         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4659         plt_address_for_local.
4660         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4661         * testsuite/ifuncvar1.c: New test file.
4662         * testsuite/ifuncvar2.c: New test file.
4663         * testsuite/ifuncvar3.c: New test file.
4664         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4665         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4666         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4667         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4668         * testsuite/Makefile.in: Rebuild.
4669
4670 2011-07-07  Cary Coutant  <ccoutant@google.com>
4671
4672         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4673         (two_file_test_1_ndebug.o): Likewise.
4674         (two_file_test_1b_ndebug.o): Likewise.
4675         (two_file_test_2_ndebug.o): Likewise.
4676         (two_file_test_main_ndebug.o): Likewise.
4677         (incremental_test_2): Link with no-debug versions.
4678
4679 2011-07-06  Cary Coutant  <ccoutant@google.com>
4680
4681         * gold/incremental.cc
4682         (Output_section_incremental_inputs::write_info_blocks): Check for
4683         hidden and internal symbols.
4684
4685 2011-07-06  Cary Coutant  <ccoutant@google.com>
4686
4687         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4688         Check disposition for startup file.
4689         (Incremental_inputs::report_command_line): Ignore
4690         --incremental-startup-unchanged option.
4691         * options.cc (General_options::parse_incremental_startup_unchanged):
4692         New function.
4693         (General_options::General_options): Initialize new data member.
4694         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4695         (General_options): Add --incremental-startup-unchanged option.
4696         (General_options::incremental_startup_disposition): New function.
4697         (General_options::incremental_startup_disposition_): New data member.
4698
4699 2011-07-06  Cary Coutant  <ccoutant@google.com>
4700
4701         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4702         input file index to Script_info ctor.
4703         (Sized_incremental_binary::do_file_has_changed): Find the
4704         command-line argument for files named in scripts.
4705         * incremental.h (Script_info::Script_info): New ctor
4706         with input file index.
4707         (Script_info::input_file_index): New function.
4708         (Script_info::input_file_index_): New data member.
4709         (Incremental_binary::get_library): Add const.
4710         (Incremental_binary::get_script_info): Add const.
4711         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4712         * testsuite/Makefile.am (incremental_test_5): New test case.
4713         (incremental_test_6): New test case.
4714         * testsuite/Makefile.in: Regenerate.
4715
4716 2011-07-06  Cary Coutant  <ccoutant@google.com>
4717
4718         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4719         debug output when command lines differ.
4720
4721 2011-07-06  Cary Coutant  <ccoutant@google.com>
4722
4723         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4724         --incremental-patch option.
4725         * layout.cc (Free_list::allocate): Extend allocation beyond original
4726         end if enabled.
4727         (Layout::make_output_section): Mark sections that should get
4728         patch space.
4729         * options.cc (parse_percent): New function.
4730         * options.h (parse_percent): New function.
4731         (DEFINE_percent): New macro.
4732         (General_options): Add --incremental-patch option.
4733         * output.cc (Output_section::Output_section): Initialize new data
4734         members.
4735         (Output_section::add_input_section): Print section name when out
4736         of patch space.
4737         (Output_section::add_output_section_data): Likewise.
4738         (Output_section::set_final_data_size): Add patch space when
4739         doing --incremental-full.
4740         (Output_section::do_reset_address_and_file_offset): Remove patch
4741         space.
4742         (Output_segment::set_section_list_addresses): Print debug output
4743         only if --incremental-update.
4744         * output.h (Output_section::set_is_patch_space_allowed): New function.
4745         (Output_section::is_patch_space_allowed_): New data member.
4746         (Output_section::patch_space_): New data member.
4747         * parameters.cc (Parameters::incremental_full): New function.
4748         * parameters.h (Parameters::incremental_full): New function
4749         * testsuite/Makefile.am (incremental_test_2): Add test for
4750         --incremental-patch option.
4751         * testsuite/Makefile.in: Regenerate.
4752         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4753         (t18): Remove function body.
4754
4755 2011-07-05  Doug Kwan  <dougkwan@google.com>
4756
4757         PR gold/12771
4758         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4759         Arm_Address type for relocation result.
4760         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4761         overflow check.
4762         (Arm_relocate_functions::abs32): Use unaligned access.
4763         (Arm_relocate_functions::rel32): Ditto.
4764         (Arm_relocate_functions::prel31): Ditto.
4765         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4766         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4767         static data relocations.
4768         * testsuite/Makefile.in: Regnerate.
4769         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4770
4771 2011-07-05  Ian Lance Taylor  <iant@google.com>
4772
4773         PR gold/12392
4774         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4775         symbols if necessary.
4776         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4777
4778 2011-07-05  Ian Lance Taylor  <iant@google.com>
4779
4780         PR gold/12952
4781         * resolve.cc (Symbol::override_base_with_special): Simply override
4782         version with special symbol version, ignoring previous version.
4783
4784 2011-07-05  Ian Lance Taylor  <iant@google.com>
4785
4786         * object.cc (Sized_relobj_file::include_section_group): Add
4787         information to comment about signature location.
4788
4789 2011-07-02  Ian Lance Taylor  <iant@google.com>
4790
4791         PR gold/12957
4792         * options.h (class General_options): Add -f and -F.
4793         * options.cc (General_options::finalize): Fatal error if -f/-F
4794         are used without -shared.
4795         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4796
4797 2011-07-02  Ian Lance Taylor  <iant@google.com>
4798
4799         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4800
4801 2011-07-01  Ian Lance Taylor  <iant@google.com>
4802
4803         PR gold/12525
4804         PR gold/12952
4805         * resolve.cc (Symbol::override_base_with_special): Don't override
4806         the version if the overriding symbol has a different name.
4807         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4808         all callers.  If we give an error about an undefined version,
4809         define the base version if necessary.
4810         * dynobj.h (class Versions): Update declaration.
4811         * testsuite/weak_alias_test_5.cc: New file.
4812         * testsuite/weak_alias_test.script: New file.
4813         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4814         and versioned_alias have the right value, and call t2.
4815         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4816         weak_alias_test_5.so.
4817         (weak_alias_test_LDADD): Likewise.
4818         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4819         * testsuite/Makefile.in: Rebuild.
4820
4821 2011-07-01  Ian Lance Taylor  <iant@google.com>
4822
4823         PR gold/12525
4824         * options.h (class General_options): Support -z notext.
4825         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4826         -Wl,-z,notext.
4827         (two_file_shared_nonpic.so): Likewise.
4828         (two_file_shared_mixed.so): Likewise.
4829         (two_file_shared_mixed_1.so): Likewise.
4830         (weak_undef_lib_nonpic.so): Likewise.
4831         (alt/weak_undef_lib_nonpic.so): Likewise.
4832         (tls_test_shared_nonpic.so): Likewise.
4833         * testsuite/Makefile.in: Rebuild.
4834
4835 2011-07-01  Ian Lance Taylor  <iant@google.com>
4836
4837         PR gold/12525
4838         * configure.ac: Test whether static linking works, setting
4839         the automake conditional HAVE_STATIC.
4840         * testsuite/Makefile.am: Disable tests using -static if
4841         HAVE_STATIC is not true.
4842         * configure, testsuite/Makefile.in: Rebuild.
4843
4844 2011-07-01  Ian Lance Taylor  <iant@google.com>
4845
4846         PR gold/12525
4847         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4848         Assert if we see DW_EH_PE_indirect.
4849         * target.h (Target::ehframe_datarel_base): New function.
4850         (Target::do_ehframe_datarel_base): New target function.
4851         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4852         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4853         function.
4854
4855 2011-07-01  Ian Lance Taylor  <iant@google.com>
4856
4857         PR gold/12571
4858         * options.h (class General_options): Add
4859         --ld-generated-unwind-info.
4860         * ehframe.cc (Fde::write): Add address parameter.  Change all
4861         callers.  If associated with PLT, fill in address and size.
4862         (Cie::set_output_offset): Only add merge mapping if there is an
4863         object.
4864         (Cie::write): Add address parameter.  Change all callers.
4865         (Eh_frame::add_ehframe_for_plt): New function.
4866         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4867         input_offset_ fields into union u_, with new plt field.
4868         (Fde::Fde): Adjust for new union field.
4869         (Fde::Fde) [Output_data version]: New constructor.
4870         (Fde::add_mapping): Only add merge mapping if there is an object.
4871         (class Cie): Update declarations.
4872         (class Eh_frame): Declare add_ehframe_for_plt.
4873         * layout.cc (Layout::layout_eh_frame): Break out code into
4874         make_eh_frame_section, and call it.
4875         (Layout::make_eh_frame_section): New function.
4876         (Layout::add_eh_frame_for_plt): New function.
4877         * layout.h (class Layout): Update declarations.
4878         * merge.cc (Merge_map::add_mapping): Add assertion.
4879         * i386.cc: Include "dwarf.h".
4880         (class Output_data_plt_i386): Make first_plt_entry,
4881         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4882         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4883         and plt_eh_frame_fde.
4884         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4885         boundary.  Call add_eh_frame_for_plt if appropriate.
4886         * x86_64.cc: Include "dwarf.h".
4887         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4888         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4889         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4890         and plt_eh_frame_fde.
4891         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4892         appropriate.
4893
4894 2011-06-29  Ian Lance Taylor  <iant@google.com>
4895
4896         PR gold/12629
4897         * object.cc (Sized_relobj_file::layout_section): Change shdr
4898         parameter to be const.
4899         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4900         out of do_layout.
4901         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4902         appropriate.  Call layout_eh_frame_section.
4903         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4904         sections.
4905         * object.h (class Sized_relobj_file): Update declarations.
4906
4907 2011-06-29  Ian Lance Taylor  <iant@google.com>
4908
4909         PR gold/12652
4910         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4911         modifier.
4912         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4913
4914 2011-06-29  Ian Lance Taylor  <iant@google.com>
4915
4916         PR gold/12675
4917         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4918         SHT_X86_64_UNWIND.
4919         * layout.cc (Layout::layout_eh_frame): Likewise.
4920
4921 2011-06-29  Ian Lance Taylor  <iant@google.com>
4922
4923         PR gold/12695
4924         * layout.cc (Layout::symtab_section_shndx): New function.
4925         * layout.h (class Layout): Declare symtab_section_shndx.
4926         * output.cc (Output_section::write_header): Call it.
4927
4928 2011-06-29  Ian Lance Taylor  <iant@google.com>
4929
4930         PR gold/12818
4931         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4932         symbols which are not used in a relocation.
4933
4934 2011-06-28  Ian Lance Taylor  <iant@google.com>
4935
4936         PR gold/12898
4937         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4938         script create indistinguishable segments.
4939         (Layout::set_segment_offsets): Use stable_sort when sorting
4940         segments.  Pass this to Compare_segments constructor.
4941         * layout.h (class Layout): Make segment_precedes non-static.
4942         (class Compare_segments): Change from struct to class.  Add
4943         layout_ field.  Add constructor.
4944         * script-sections.cc
4945         (Script_sections::attach_sections_using_phdrs_clause): Rename
4946         local orphan to is_orphan.  Don't report failure to put empty
4947         section in segment.  On attachment failure, report name of
4948         section, and attach to first PT_LOAD segment.
4949
4950 2011-06-28  Ian Lance Taylor  <iant@google.com>
4951
4952         PR gold/12934
4953         * target-select.cc (Target_selector::Target_selector): Add
4954         emulation parameter.  Change all callers.
4955         (select_target_by_bfd_name): Rename from select_target_by_name.
4956         Change all callers.
4957         (select_target_by_emulation): New function.
4958         (supported_emulation_names): New function.
4959         * target-select.h (class Target_selector): Add emulation_ field.
4960         Update declarations.
4961         (Target_selector::recognize_by_bfd_name): Rename from
4962         recognize_by_name.  Change all callers.
4963         (Target_selector::supported_bfd_names): Rename from
4964         supported_names.  Change all callers.
4965         (Target_selector::recognize_by_emulation): New function.
4966         (Target_selector::supported_emulations): New function.
4967         (Target_selector::emulation): New function.
4968         (Target_selector::do_recognize_by_bfd_name): Rename from
4969         do_recognize_by_name.  Change all callers.
4970         (Target_selector::do_supported_bfd_names): Rename from
4971         do_supported_names.  Change all callers.
4972         (Target_selector::do_recognize_by_emulation): New function.
4973         (Target_selector::do_supported_emulations): New function.
4974         (select_target_by_bfd_name): Change name in declaration.
4975         (select_target_by_emulation): Declare.
4976         (supported_emulation_names): Declare.
4977         * parameters.cc (parameters_force_valid_target): Try to find
4978         target based on emulation from -m option.
4979         * options.h (class General_options): Change doc string for -m.
4980         * options.cc (help): Print emulations.
4981         (General_options::parse_V): Likewise.
4982         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4983         Add emulation parameter.  Change all callers.
4984
4985 2011-06-28  Ian Lance Taylor  <iant@google.com>
4986
4987         * target.h (class Target): Add osabi_ field.
4988         (Target::osabi): New function.
4989         (Target::set_osabi): New function.
4990         (Target::Target): Initialize osabi_.
4991         (Target::do_adjust_elf_header): Make pure virtual.
4992         (Sized_target::do_adjust_elf_header): Declare.
4993         * target.cc (Sized_target::do_adjust_elf_header): New function.
4994         (class Sized_target): Instantiate all versions.
4995         * freebsd.h (class Target_freebsd): Remove.
4996         (Target_selector_freebsd::do_recognize): Call set_osabi on
4997         Target.
4998         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4999         (Target_selector_freebsd::set_osabi): Remove.
5000         * i386.cc (class Target_i386): Inherit from Sized_target rather
5001         than Target_freebsd.
5002         * x86_64.cc (class Target_x86_64): Likewise.
5003
5004 2011-06-28  Ian Lance Taylor  <iant@google.com>
5005
5006         * target.h (Target::can_check_for_function_pointers): Rewrite.
5007         Make non-virtual.
5008         (Target::can_icf_inline_merge_sections): Likewise.
5009         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5010         (Target::Target_info): Add can_icf_inline_merge_sections field.
5011         (Target::do_can_check_for_function_pointers): New virtual
5012         function.
5013         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5014         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5015         from can_check_for_function_pointers, move in file.
5016         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5017         section_may_have_icf_unsafe_poineters, move in file.
5018         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5019         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5020         Rename from can_check_for_function_pointers, move in file.
5021         (Target_i386::can_icf_inline_merge_sections): Remove.
5022         (Target_i386::i386_info): Initialize
5023         can_icf_inline_merge_sections.
5024         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5025         Initialize can_icf_inline_merge_sections.
5026         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5027         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5028         Rename from can_check_for_function_pointers, move in file.
5029         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5030         (Target_x86_64::x86_64_info): Initialize
5031         can_icf_inline_merge_sections.
5032         * testsuite/testfile.cc (Target_test::test_target_info):
5033         Likewise.
5034         * icf.cc (get_section_contents): Correct formatting.
5035
5036 2011-06-27  Ian Lance Taylor  <iant@google.com>
5037
5038         * symtab.cc (Symbol::versioned_name): New function.
5039         (Symbol_table::add_to_final_symtab): Use versioned_name when
5040         appropriate.
5041         (Symbol_table::sized_write_symbol): Likewise.
5042         * symtab.h (class Symbol): Declare versioned_name.
5043         * stringpool.h (class Stringpool_template): Add variant of add
5044         which takes a std::basic_string.
5045         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5046         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5047         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5048         (ver_test_12.o): New target.
5049         * testsuite/Makefile.in: Rebuild.
5050
5051 2011-06-27  Doug Kwan  <dougkwan@google.com>
5052
5053         * arm.cc (Arm_relocate_functions::thm_jump8,
5054         Arm_relocate_functions::thm_jump11): Use a wider signed
5055         type to compute offset.
5056         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5057         arm_thm_jump8.
5058         * testsuite/Makefile.in: Regenerate.
5059         * testsuite/arm_branch_in_range.sh: Check test results of
5060         arm_thm_jump11 and arm_thm_jump8.
5061         * testsuite/arm_thm_jump11.s: New test source file.
5062         * testsuite/arm_thm_jump11.t: New linker script.
5063         * testsuite/arm_thm_jump8.s: New test source file.
5064         * testsuite/arm_thm_jump8.t: New linker script.
5065
5066 2011-06-24  Ian Lance Taylor  <iant@google.com>
5067
5068         * layout.cc: Include "object.h".
5069         (ctors_sections_in_init_array): New static variable.
5070         (Layout::is_ctors_in_init_array): New function.
5071         (Layout::layout): Add entry to ctors_sections_in_init_array if
5072         appropriate.
5073         * layout.h (class Layout): Declare is_ctors_in_init_array.
5074         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5075         is_ctors_reverse_view is set.
5076         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5077         all callers.  Set is_ctors_reverse_view field of View_size.
5078         (Sized_relobj_file::reverse_words): New function.
5079         * object.h (Sized_relobj_file::View_size): Add
5080         is_ctors_reverse_view field.
5081         (class Sized_relobj_file): Update declarations.
5082         * testsuite/initpri3.c: New test.
5083         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5084         initpri3b.
5085         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5086         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5087         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5088         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5089         * testsuite/Makefile.in: Rebuild.
5090
5091 2011-06-24  Cary Coutant  <ccoutant@google.com>
5092
5093         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5094         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5095         (debug_msg_cdebug.err): New targets.
5096         * testsuite/Makefile.in: Regenerate.
5097         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5098         Fix checks for link with shared library.
5099
5100 2011-06-24  Doug Kwan  <dougkwan@google.com>
5101
5102         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5103         skip empty text sections.
5104         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5105
5106 2011-06-22  Ian Lance Taylor  <iant@google.com>
5107
5108         PR gold/12910
5109         * options.h (class General_options): Add --ctors-in-init-array.
5110         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5111         friends as SHT_PROGBITS for merging sections.
5112         (Layout::layout): Remove special handling of .init_array and
5113         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5114         and .dtors if ctors_in_init_array.
5115         (Layout::make_output_section): Force correct section types for
5116         .init_array and friends.  Don't sort if doing relocatable link,
5117         Don't sort .ctors and .dtors if ctors_in_init_array.
5118         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5119         (Layout::output_section_name): Add relobj parameter.  Change all
5120         callers.  Handle .ctors. and .dtors. in code rather than table.
5121         Handle .ctors and .dtors if ctors_in_init_array.
5122         (Layout::match_file_name): New function, moved from output.cc.
5123         * layout.h (class Layout): Update declarations.
5124         * output.cc: Include "layout.h".
5125         (Input_section_sort_entry::get_priority): New function.
5126         (Input_section_sort_entry::match_file_name): Just call
5127         Layout::match_file_name.
5128         (Output_section::Input_section_sort_init_fini_compare::operator()):
5129         Handle .ctors and .dtors.  Sort by explicit priority rather than
5130         by name.
5131         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5132         * testsuite/initpri2.c: New test.
5133         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5134         (check_PROGRAMS): Add initpri2.
5135         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5136         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5137         * configure, testsuite/Makefile.in: Rebuild.
5138
5139 2011-06-19  Ian Lance Taylor  <iant@google.com>
5140
5141         PR gold/12880
5142         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5143         .interp section to a PT_INTERP segment even if we have seen a
5144         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5145         clause in a linker script.
5146         (Layout::finalize): Don't create a .interp section if we've
5147         already create a PT_INTERP segment.
5148         (Layout::create_interp): Always call choose_output_section (revert
5149         patch of 2011-06-17).  Don't create PT_INTERP segment.
5150         * script-sections.cc
5151         (Script_sections::create_note_and_tls_segments): Add a .interp
5152         section to a PT_INTERP segment even if we have seen a
5153         --dynamic-linker option.
5154
5155 2011-06-18  Ian Lance Taylor  <iant@google.com>
5156
5157         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5158         merely because a non-PT_LOAD segment has a dynamic reloc.
5159
5160 2011-06-18  Ian Lance Taylor  <iant@google.com>
5161
5162         * layout.cc (Layout::finish_dynamic_section): Don't create
5163         DT_FLAGS entry if not needed.
5164
5165 2011-06-18  Ian Lance Taylor  <iant@google.com>
5166
5167         PR gold/12745
5168         * layout.cc (Layout::layout_eh_frame): Correct handling of
5169         writable .eh_frame section.
5170
5171 2011-06-17  Ian Lance Taylor  <iant@google.com>
5172
5173         PR gold/12893
5174         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5175         symbol is redefined with the exact same object and value.
5176
5177 2011-06-17  Ian Lance Taylor  <iant@google.com>
5178
5179         PR gold/12880
5180         * layout.h (class Layout): Add interp_segment_ field.
5181         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5182         (Layout::attach_allocated_section_to_segment): If making shared
5183         library, put .interp section in PT_INTERP segment.
5184         (Layout::finalize): Also call create_interp if -dynamic-linker
5185         option was used.
5186         (Layout::create_interp): Assert that there is no PT_INTERP
5187         segment.  If not using a SECTIONS clause, use make_output_section.
5188         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5189         * script-sections.cc
5190         (Script_sections::create_note_and_tls_segments): If making shared
5191         library, put .interp section in PT_INTERP segment.
5192
5193 2011-06-17  Ian Lance Taylor  <iant@google.com>
5194
5195         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5196         when making a shared library.
5197
5198 2011-06-17  Ian Lance Taylor  <iant@google.com>
5199
5200         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5201         parameter.  Change all callers.  Don't issue warning about PC32
5202         against locally defined symbol.
5203
5204 2011-06-16  Ian Lance Taylor  <iant@google.com>
5205
5206         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5207         occurs in same object.
5208
5209 2011-06-14  Alan Modra  <amodra@gmail.com>
5210
5211         * po/POTFILES.in: Regenerate.
5212
5213 2011-06-09  Ian Lance Taylor  <iant@google.com>
5214
5215         * script-sections.cc
5216         (Orphan_output_section::set_section_addresses): For a relocatable
5217         link set address to 0.
5218
5219 2011-06-09  Cary Coutant  <ccoutant@google.com>
5220
5221         PR gold/12804
5222         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5223         used with --compress-debug-sections.
5224         * gold/object.cc (Sized_relobj_file::do_layout): Report
5225         uncompressed size of compressed input sections.
5226
5227 2011-06-08  Cary Coutant  <ccoutant@google.com>
5228
5229         PR gold/12804
5230         * testsuite/two_file_test_2_v1.cc: Change initialization of
5231         v2 to keep it in .data.
5232
5233 2011-06-07  Cary Coutant  <ccoutant@google.com>
5234
5235         * common.cc (Symbol_table::do_allocate_commons_list): Call
5236         gold_fallback.
5237         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5238         (Errors::fallback): New function.
5239         (gold_fallback): New function.
5240         * errors.h (Errors::fallback): New function.
5241         * gold.cc (gold_exit): Change status parameter to enum; adjust
5242         all callers.
5243         (queue_initial_tasks): Call gold_fallback.
5244         * gold.h: Include cstdlib.
5245         (Exit_status): New enum type.
5246         (gold_exit): Change status parameter to enum.
5247         (gold_fallback): New function.
5248         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5249         (Layout::create_symtab_sections): Likewise.
5250         (Layout::create_shdrs): Likewise.
5251         * main.cc (main): Adjust call to gold_exit.
5252         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5253         (Output_data_got::add_got_entry_pair): Likewise.
5254         (Output_section::add_input_section): Likewise.
5255         (Output_section::add_output_section_data): Likewise.
5256         (Output_segment::set_section_list_addresses): Likewise.
5257         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5258
5259 2011-06-07  Cary Coutant  <ccoutant@google.com>
5260
5261         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5262         for incremental links.
5263         * output.cc (Output_segment::set_section_list_addresses): Remove
5264         FIXME and test for TLS or BSS.
5265
5266 2011-06-07  Cary Coutant  <ccoutant@google.com>
5267
5268         * testsuite/Makefile.am: Add incremental_copy_test,
5269         incremental_common_test_1.
5270         * testsuite/Makefile.in: Regenerate.
5271         * testsuite/common_test_1_v1.c: New source file.
5272         * testsuite/common_test_1_v2.c: New source file.
5273         * testsuite/copy_test_v1.cc: New source file.
5274
5275 2011-06-07  Cary Coutant  <ccoutant@google.com>
5276
5277         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5278         update, allocate common from bss section's free list.
5279         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5280         linker-defined symbols.
5281         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5282         Skip GOT and PLT entries that are no longer referenced.
5283         (Output_section_incremental_inputs::write_info_blocks): Mark
5284         linker-defined symbols.
5285         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5286         * output.cc (Output_section::allocate): New function.
5287         * output.h (Output_section::allocate): New function.
5288         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5289         linker-defined symbols.
5290         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5291         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5292         (Symbol::init_base_output_data): Likewise.
5293         (Symbol::init_base_output_segment): Likewise.
5294         (Symbol::init_base_constant): Likewise.
5295         (Sized_symbol::init_output_data): Likewise.
5296         (Sized_symbol::init_output_segment): Likewise.
5297         (Sized_symbol::init_constant): Likewise.
5298         (Symbol_table::do_define_in_output_data): Likewise.
5299         (Symbol_table::do_define_in_output_segment): Likewise.
5300         (Symbol_table::do_define_as_constant): Likewise.
5301         * symtab.h (Symbol::is_predefined): New function.
5302         (Symbol::init_base_output_data): Add is_predefined parameter.
5303         (Symbol::init_base_output_segment): Likewise.
5304         (Symbol::init_base_constant): Likewise.
5305         (Symbol::is_predefined_): New data member.
5306         (Sized_symbol::init_output_data): Add is_predefined parameter.
5307         (Sized_symbol::init_output_segment): Likewise.
5308         (Sized_symbol::init_constant): Likewise.
5309         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5310
5311 2011-06-07  Cary Coutant  <ccoutant@google.com>
5312
5313         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5314         instead of emit_copy_reloc.
5315         (Copy_relocs::emit_copy_reloc): Refactor.
5316         (Copy_relocs::make_copy_reloc): New function.
5317         (Copy_relocs::add_copy_reloc): Remove.
5318         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5319         section.
5320         (Copy_relocs::make_copy_reloc): New function.
5321         (Copy_relocs::add_copy_reloc): Remove.
5322         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5323         unchanged input files.
5324         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5325         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5326         Reserve BSS space for COPY relocations.
5327         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5328         (Output_section_incremental_inputs::write_info_blocks): Record
5329         whether a symbol is copied from a shared object.
5330         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5331         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5332         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5333         (Incremental_input_entry_reader::get_output_symbol_index): Add
5334         is_copy parameter.
5335         (Incremental_binary::emit_copy_relocs): New function.
5336         (Incremental_binary::do_emit_copy_relocs): New function.
5337         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5338         new data member.
5339         (Sized_incremental_binary::add_copy_reloc): New function.
5340         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5341         (Sized_incremental_binary::Copy_reloc): New struct.
5342         (Sized_incremental_binary::Copy_relocs): New typedef.
5343         (Sized_incremental_binary::copy_relocs_): New data member.
5344         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5345         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5346         * target.h (Sized_target::emit_copy_reloc): New function.
5347         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5348
5349 2011-06-02  Cary Coutant  <ccoutant@google.com>
5350
5351         PR gold/12163
5352         * gold/archive.cc (Archive::Archive): Initialize new data member.
5353         (Archive::include_all_members): Return if archive has already been
5354         included.
5355         * gold/archive.h (Archive::include_all_members_): New data member.
5356
5357 2011-06-02  Nick Clifton  <nickc@redhat.com>
5358
5359         * dynobj.h: Fix spelling mistake in comment.
5360         * output.cc: Likewise.
5361
5362 2011-05-31  Doug Kwan  <dougkwan@google.com>
5363             Asier Llano
5364
5365         PR gold/12826
5366         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5367         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5368         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5369         redundant arm_exidx_test.so.
5370         * testsuite/Makefile.in: Regenerate.
5371         (check_SCRIPTS): Add pr12826.sh
5372         (check_DATA): Add pr12826.stdout
5373         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5374         * testsuite/pr12826.sh: New file.
5375         * testsuite/pr12826_1.s: Ditto.
5376         * testsuite/pr12826_1.s: Ditto.
5377
5378 2011-05-30  Ian Lance Taylor  <iant@google.com>
5379
5380         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5381         sections.
5382
5383 2011-05-29  Ian Lance Taylor  <iant@google.com>
5384
5385         PR gold/12804
5386         * testsuite/Makefile.am: Use different file name for two_file_test
5387         temporary file for each incremental test.
5388         * testsuite/Makefile.in: Rebuild.
5389
5390 2011-05-29  Ian Lance Taylor  <iant@google.com>
5391
5392         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5393         binary input file is empty.
5394
5395 2011-05-27  Ian Lance Taylor  <iant@google.com>
5396
5397         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5398         (ver_test_9.so): Likewise.
5399         * testsuite/Makefile.in: Rebuild.
5400
5401 2011-05-26 Cary Coutant  <ccoutant@google.com>
5402
5403         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5404         * incremental.cc (Incremental_inputs::report_input_section): Fix
5405         comment, indentation.
5406         (Incremental_inputs::report_comdat_group): New function.
5407         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5408         of data for incremental input file entry.
5409         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5410         group count, COMDAT group signatures.
5411         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5412         an unchanged input file.
5413         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5414         Initialize new data member.
5415         (Incremental_object_entry::add_comdat_group): New function.
5416         (Incremental_object_entry::get_comdat_group_count): New function.
5417         (Incremental_object_entry::get_comdat_signature_key): New function.
5418         (Incremental_object_entry::groups_): New data member.
5419         (Incremental_inputs::report_comdat_group): New function.
5420         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5421         data for incremental input file entry.
5422         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5423         (Incremental_input_entry_reader::get_input_section): Adjust size of
5424         data for incremental input file entry.
5425         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5426         (Incremental_input_entry_reader::get_comdat_group_signature): New
5427         function.
5428         * object.cc (Sized_relobj::include_section_group): Report kept
5429         COMDAT groups for incremental links.
5430
5431 2011-05-24  David Meyer  <pdox@google.com>
5432
5433         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5434         with name parameter.  Add found_name parameter.
5435         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5436         * dirsearch.h (class Dirsearch): Update declaration.
5437
5438 2011-05-24  Ian Lance Taylor  <iant@google.com>
5439
5440         * archive.cc (Library_base::should_include_member): Pull in object
5441         from archive if it defines the entry symbol.
5442         * parameters.cc (Parameters::entry): New function.
5443         * parameters.h (class Parameters): Declare entry.
5444         * output.h (class Output_file_header): Remove entry_ field.
5445         * output.cc (Output_file_header::Output_file_header): Remove entry
5446         parameter.  Change all callers.
5447         (Output_file_header::entry): Use parameters->entry.
5448         * gold.cc (queue_middle_tasks): Likewise.
5449         * plugin.cc (Plugin_hook::run): Likewise.
5450
5451 2011-05-24 Cary Coutant  <ccoutant@google.com>
5452
5453         * gold.cc (queue_initial_tasks): Pass incremental base filename
5454         to Output_file::open_base_file; don't print error message.
5455         * incremental-dump.cc (main): Adjust call to
5456         Output_file::open_for_modification.
5457         * incremental-dump.cc (main): Likewise.
5458         * incremental.cc (Incremental_inputs::report_command_line):
5459         Ignore --incremental-base option when comparing command lines.
5460         Ignore parameter when given as separate argument.
5461         * options.h (class General_options): Add --incremental-base.
5462         * output.cc (Output_file::Output_file):
5463         (Output_file::open_base_file): Add base_name and writable parameters;
5464         read base file into new file; print error message here.
5465         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5466         callers.
5467         * output.h (Output_file::open_for_modification): Rename to...
5468         (Output_file::open_base_file): ...this; add base_name and
5469         writable parameters; adjust all callers.
5470         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5471         callers.
5472         * testsuite/Makefile.am (incremental_test_4): Test
5473         --incremental-base.
5474         * testsuite/Makefile.in: Regenerate.
5475
5476 2011-05-24 Cary Coutant  <ccoutant@google.com>
5477
5478         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5479         incremental_test_4.
5480         * testsuite/Makefile.in: Regenerate.
5481         * testsuite/two_file_test_1_v1.cc: New test source file.
5482         * testsuite/two_file_test_1b_v1.cc: New test source file.
5483         * testsuite/two_file_test_2_v1.cc: New test source file.
5484
5485 2011-05-24 Cary Coutant  <ccoutant@google.com>
5486
5487         * dynobj.h (Dynobj::do_dynobj): New function.
5488         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5489         flag and soname for shared objects.
5490         * incremental.cc (Incremental_inputs::report_object): Make
5491         either Incremental_object_entry or Incremental_dynobj_entry; add
5492         soname to string table.
5493         (Incremental_inputs::report_input_section): Add assertion.
5494         (Output_section_incremental_inputs::set_final_data_size): Adjust
5495         type of input file entry for shared libraries; adjust size of
5496         shared library info entry.
5497         (Output_section_incremental_inputs::write_input_files): Write
5498         as_needed flag for shared libraries.
5499         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5500         of input file entry for shared libraries; write soname.
5501         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5502         soname from incremental info.
5503         * incremental.h (enum Incremental_input_flags): Add
5504         INCREMENTAL_INPUT_AS_NEEDED.
5505         (Incremental_input_entry::Incremental_input_entry): Initialize new
5506         data member.
5507         (Incremental_input_entry::set_as_needed): New function.
5508         (Incremental_input_entry::as_needed): New function.
5509         (Incremental_input_entry::do_dynobj_entry): New function.
5510         (Incremental_input_entry::as_needed_): New data member.
5511         (Incremental_object_entry::Incremental_object_entry): Don't check
5512         for shared library.
5513         (Incremental_object_entry::do_type): Likewise.
5514         (class Incremental_dynobj_entry): New class.
5515         (Incremental_input_entry_reader::as_needed): New function.
5516         (Incremental_input_entry_reader::get_soname): New function.
5517         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5518         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5519         size of shared library info entry.
5520         * layout.cc (Layout::finish_dynamic_section): Don't test for
5521         incremental link when adding DT_NEEDED entries.
5522         * object.h (Object::Object): Initialize new data member.
5523         (Object::dynobj): New function.
5524         (Object::set_as_needed): New function.
5525         (Object::as_needed): New function.
5526         (Object::do_dynobj): New function.
5527         (Object::as_needed_): New data member.
5528
5529 2011-05-24 Cary Coutant  <ccoutant@google.com>
5530
5531         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5532         info; adjust display of GOT entries.
5533         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5534         vector of input objects; remove file_status_.
5535         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5536         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5537         got_plt reader; call target hooks to reserve GOT entries.
5538         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5539         of input file info header and GOT info entry.
5540         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5541         relocation info.
5542         (Got_plt_view_info::got_descriptor): Remove.
5543         (Got_plt_view_info::sym_index): New data member.
5544         (Got_plt_view_info::input_index): New data member.
5545         (Local_got_offset_visitor::visit): Write input file index.
5546         (Global_got_offset_visitor::visit): Write 0 for input file index.
5547         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5548         with sym_index and input_index.
5549         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5550         incremental info GOT entry; replace got_descriptor with input_index.
5551         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5552         map from input file index to object.
5553         (Sized_relobj_incr::do_layout): Replace direct data member reference
5554         with accessor function.
5555         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5556         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5557         Adjust size of input file info header.
5558         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5559         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5560         (Incremental_input_entry_reader::get_input_section): Adjust size of
5561         input file info header.
5562         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5563         of incremental info GOT entry.
5564         (Incremental_got_plt_reader::get_got_desc): Remove.
5565         (Incremental_got_plt_reader::get_got_symndx): New function.
5566         (Incremental_got_plt_reader::get_got_input_index): New function.
5567         (Sized_incremental_binary::Sized_incremental_binary): Remove
5568         file_status_; add input_objects_.
5569         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5570         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5571         (Sized_incremental_binary::file_is_unchanged): Remove.
5572         (Sized_incremental_binary::set_input_object): New function.
5573         (Sized_incremental_binary::input_object): New function.
5574         (Sized_incremental_binary::file_status_): Remove.
5575         (Sized_incremental_binary::input_objects_): New data member.
5576         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5577         references.
5578         (Sized_relobj_incr::invalid_address): Move to base class.
5579         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5580         class.
5581         (Sized_relobj_incr::do_output_section_offset): Likewise.
5582         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5583         (Sized_relobj_incr::section_offsets_): Likewise.
5584         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5585         function.
5586         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5587         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5588         with accessor function.
5589         (Sized_relobj_file::do_layout): Likewise.
5590         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5591         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5592         (Sized_relobj_file::compute_final_local_value): Replace refs to
5593         section_offsets_ with accessor function.
5594         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5595         * object.h (Relobj::Relobj): Initialize new data members.
5596         (Relobj::add_dyn_reloc): New function.
5597         (Relobj::first_dyn_reloc): New function.
5598         (Relobj::dyn_reloc_count): New function.
5599         (Relobj::first_dyn_reloc_): New data member.
5600         (Relobj::dyn_reloc_count_): New data member.
5601         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5602         references.
5603         (Sized_relobj::Address): New typedef.
5604         (Sized_relobj::invalid_address): Move here from child class.
5605         (Sized_relobj::Sized_relobj): Initialize new data members.
5606         (Sized_relobj::sized_relobj): New function.
5607         (Sized_relobj::is_output_section_offset_invalid): Move here from
5608         child class.
5609         (Sized_relobj::get_output_section_offset): Likewise.
5610         (Sized_relobj::local_has_got_offset): Likewise.
5611         (Sized_relobj::local_got_offset): Likewise.
5612         (Sized_relobj::set_local_got_offset): Likewise.
5613         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5614         (Sized_relobj::clear_got_offsets): New function.
5615         (Sized_relobj::section_offsets): Move here from child class.
5616         (Sized_relobj::do_output_section_offset): Likewise.
5617         (Sized_relobj::do_set_section_offset): Likewise.
5618         (Sized_relobj::Local_got_offsets): Likewise.
5619         (Sized_relobj::local_got_offsets_): Likewise.
5620         (Sized_relobj::section_offsets_): Likewise.
5621         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5622         references.
5623         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5624         class.
5625         (Sized_relobj_file::sized_relobj): New function
5626         (Sized_relobj_file::local_has_got_offset): Move to base class.
5627         (Sized_relobj_file::local_got_offset): Likewise.
5628         (Sized_relobj_file::set_local_got_offset): Likewise.
5629         (Sized_relobj_file::get_output_section_offset): Likewise.
5630         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5631         (Sized_relobj_file::do_output_section_offset): Likewise.
5632         (Sized_relobj_file::do_set_section_offset): Likewise.
5633         (Sized_relobj_file::Local_got_offsets): Likewise.
5634         (Sized_relobj_file::local_got_offsets_): Likewise.
5635         (Sized_relobj_file::section_offsets_): Likewise.
5636         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5637         (all constructors).
5638         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5639         (Output_reloc::get_symbol_index): Likewise.
5640         (Output_reloc::local_section_offset): Likewise.
5641         (Output_reloc::get_address): Likewise.
5642         (Output_reloc::symbol_value): Likewise.
5643         (Output_data_got::reserve_slot): Move to class definition.
5644         (Output_data_got::reserve_local): New function.
5645         (Output_data_got::reserve_slot_for_global): Remove.
5646         (Output_data_got::reserve_global): New function.
5647         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5648         (all constructors, two instantiations).
5649         (Output_reloc::get_relobj): New function (two instantiations).
5650         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5651         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5652         (Output_data_reloc::add_global): Adjust type of relobj.
5653         (Output_data_reloc::add_global_relative): Likewise.
5654         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5655         (Output_data_reloc::add_local): Likewise.
5656         (Output_data_reloc::add_local_relative): Likewise.
5657         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5658         (Output_data_reloc::add_local_section): Likewise.
5659         (Output_data_reloc::add_output_section): Likewise.
5660         (Output_data_reloc::add_absolute): Likewise.
5661         (Output_data_reloc::add_target_specific): Likewise.
5662         (Output_data_got::reserve_slot): Move definition here.
5663         (Output_data_got::reserve_local): New function.
5664         (Output_data_got::reserve_global): New function.
5665         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5666         section_offsets_ with accessor function.
5667         (Sized_relobj_file::write_sections): Likewise.
5668         (Sized_relobj_file::do_relocate_sections): Likewise.
5669         * target.h (Sized_target::reserve_local_got_entry): New function.
5670         (Sized_target::reserve_global_got_entry): New function.
5671         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5672         (Target_x86_64::reserve_global_got_entry): New function.
5673         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5674
5675 2011-05-23 Cary Coutant  <ccoutant@google.com>
5676
5677         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5678         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5679         bit when checking got_type.
5680         * incremental.cc (Sized_incremental_binary::setup_readers):
5681         Store symbol table and string table locations; initialize bit vector
5682         of file status flags.
5683         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5684         unchanged files.
5685         (Sized_incremental_binary::do_process_got_plt): New function.
5686         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5687         (Output_section_incremental_inputs::set_final_data_size): Record
5688         file index for each input file.
5689         (Output_section_incremental_inputs::write_got_plt): Store file index
5690         instead of input entry offset for each GOT entry.
5691         * incremental.h
5692         (Incremental_input_entry::Incremental_input_entry): Initialize new
5693         data member.
5694         (Incremental_input_entry::set_offset): Store file index.
5695         (Incremental_input_entry::get_file_index): New function.
5696         (Incremental_input_entry::file_index_): New data member.
5697         (Incremental_binary::process_got_plt): New function.
5698         (Incremental_binary::do_process_got_plt): New function.
5699         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5700         data members.
5701         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5702         (Sized_incremental_binary::set_file_is_unchanged): New function.
5703         (Sized_incremental_binary::file_is_unchanged): New function.
5704         (Sized_incremental_binary::do_process_got_plt): New function.
5705         (Sized_incremental_binary::file_status_): New data member.
5706         (Sized_incremental_binary::main_symtab_loc_): New data member.
5707         (Sized_incremental_binary::main_strtab_loc_): New data member.
5708         * output.cc (Output_data_got::Got_entry::write): Add case
5709         RESERVED_CODE.
5710         (Output_data_got::add_global): Call add_got_entry.
5711         (Output_data_got::add_global_plt): Likewise.
5712         (Output_data_got::add_global_with_rel): Likewise.
5713         (Output_data_got::add_global_with_rela): Likewise.
5714         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5715         (Output_data_got::add_global_pair_with_rela): Likewise.
5716         (Output_data_got::add_local): Call add_got_entry.
5717         (Output_data_got::add_local_plt): Likewise.
5718         (Output_data_got::add_local_with_rel): Likewise.
5719         (Output_data_got::add_local_with_rela): Likewise.
5720         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5721         (Output_data_got::add_local_pair_with_rela): Likewise.
5722         (Output_data_got::reserve_slot): New function.
5723         (Output_data_got::reserve_slot_for_global): New function.
5724         (Output_data_got::add_got_entry): New function.
5725         (Output_data_got::add_got_entry_pair): New function.
5726         (Output_section::add_output_section_data): Edit FIXME.
5727         * output.h
5728         (Output_section_data_build::Output_section_data_build): New
5729         constructor with size parameter.
5730         (Output_data_space::Output_data_space): Likewise.
5731         (Output_data_got::Output_data_got): Initialize new data member; new
5732         constructor with size parameter.
5733         (Output_data_got::add_constant): Call add_got_entry.
5734         (Output_data_got::reserve_slot): New function.
5735         (Output_data_got::reserve_slot_for_global): New function.
5736         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5737         (Output_data_got::add_got_entry): New function.
5738         (Output_data_got::add_got_entry_pair): New function.
5739         (Output_data_got::free_list_): New data member.
5740         * target.h (Sized_target::init_got_plt_for_update): New function.
5741         (Sized_target::register_global_plt_entry): New function.
5742         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5743         Initialize new data member; call init; add constructor with PLT count.
5744         (Output_data_plt_x86_64::init): New function.
5745         (Output_data_plt_x86_64::add_relocation): New function.
5746         (Output_data_plt_x86_64::reserve_slot): New function.
5747         (Output_data_plt_x86_64::free_list_): New data member.
5748         (Target_x86_64::init_got_plt_for_update): New function.
5749         (Target_x86_64::register_global_plt_entry): New function.
5750         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5751         incremental updates.
5752         (Output_data_plt_x86_64::add_relocation): New function.
5753         * testsuite/object_unittest.cc (Object_test): Set default options.
5754
5755 2011-05-16  Ian Lance Taylor  <iant@google.com>
5756
5757         * options.h (class General_options): Make -i a synonym for -r.
5758
5759 2011-05-16  Ian Lance Taylor  <iant@google.com>
5760
5761         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5762
5763 2011-05-10 Cary Coutant  <ccoutant@google.com>
5764
5765         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5766         strip_all (-s).
5767
5768 2011-05-06  Ian Lance Taylor  <iant@google.com>
5769
5770         * layout.cc (Layout::layout): If the output section flags change,
5771         update the ordering.
5772
5773 2011-04-25 Cary Coutant  <ccoutant@google.com>
5774
5775         * incremental-dump.cc (dump_incremental_inputs): Print local
5776         symbol info for each input file.
5777         * incremental.cc
5778         (Output_section_incremental_inputs::set_final_data_size): Add local
5779         symbol info to input file entries in incremental info.
5780         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5781         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5782         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5783         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5784         implementation.
5785         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5786         (Sized_incr_relobj::do_relocate): Write the local symbols.
5787         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5788         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5789         Adjust size of input file header.
5790         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5791         (Incremental_inputs_reader::get_local_symbol_count): New function.
5792         (Incremental_inputs_reader::get_input_section): Adjust size of input
5793         file header.
5794         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5795         (Sized_incr_relobj::This): New typedef.
5796         (Sized_incr_relobj::sym_size): New const data member.
5797         (Sized_incr_relobj::Local_symbol): New struct.
5798         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5799         (Sized_incr_relobj::do_local_symbol_offset): New function.
5800         (Sized_incr_relobj::local_symbol_count_): New data member.
5801         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5802         (Sized_incr_relobj::local_symbol_index_): New data member.
5803         (Sized_incr_relobj::local_symbol_offset_): New data member.
5804         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5805         (Sized_incr_relobj::local_symbols_): New data member.
5806         * object.h (Relobj::output_local_symbol_count): New function.
5807         (Relobj::local_symbol_offset): New function.
5808         (Relobj::do_output_local_symbol_count): New function.
5809         (Relobj::do_local_symbol_offset): New function.
5810         (Sized_relobj::do_output_local_symbol_count): New function.
5811         (Sized_relobj::do_local_symbol_offset): New function.
5812
5813 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5814
5815         * descriptors.cc (set_close_on_exec): New function.
5816         (Descriptors::open): Use set_close_on_exec.
5817         * output.cc (S_ISLNK): Define if not defined.
5818
5819 2011-04-22 Cary Coutant  <ccoutant@google.com>
5820
5821         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5822         global symbol map.
5823         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5824         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5825         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5826         relocations.
5827         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5828         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5829         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5830         * incremental.h
5831         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5832         function.
5833         (Incremental_binary::apply_incremental_relocs): New function.
5834         (Incremental_binary::do_apply_incremental_relocs): New function.
5835         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5836         data member.
5837         (Sized_incremental_binary::add_global_symbol): New function.
5838         (Sized_incremental_binary::global_symbol): New function.
5839         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5840         (Sized_incremental_binary::symbol_map_): New data member.
5841         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5842         * target.h (Sized_target::apply_relocation): New function.
5843         * target-reloc.h (apply_relocation): New function.
5844         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5845
5846 2011-04-22  Doug Kwan  <dougkwan@google.com>
5847
5848         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5849         flag of a SHT_ARM_EXIDX section.
5850         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5851         * testsuite/Makefile.in: Regenerate.
5852         * testsuite/arm_exidx_test.s: New file.
5853         * testsuite/arm_exidx_test.sh: Same.
5854
5855 2011-04-20 Cary Coutant  <ccoutant@google.com>
5856
5857         PR gold/12689
5858         * archive.h (Incremental_archive_entry::Archive_member):
5859         Initialize arg_serial_ (second constructor).
5860
5861 2011-04-17  Ian Lance Taylor  <iant@google.com>
5862
5863         * object.cc (Relocate_info::location): Simplify location string.
5864         * errors.cc (Errors::error_at_location): Don't print program
5865         name.
5866         (Errors::warning_at_location): Likewise.
5867         (Errors::undefined_symbol): Likewise.
5868         * testsuite/debug_msg.sh: Update accordingly.
5869
5870 2011-04-14 Cary Coutant  <ccoutant@google.com>
5871
5872         * gold/layout.cc (Layout::symtab_section_offset): New function.
5873         * gold/layout.h (Layout::symtab_section_offset): New function.
5874         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5875
5876 2011-04-12  Ian Lance Taylor  <iant@google.com>
5877
5878         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5879         with MREMAP_MAYMOVE.
5880         * output.h (class Output_file): Add map_is_allocated_ field.
5881         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5882         not available, provide stubs.  If mremap is not available, #define
5883         it to gold_mremap.
5884         (MREMAP_MAYMOVE): Define if not defined.
5885         (Output_file::Output_file): Initialize map_is_allocated_.
5886         (Output_file::resize): Check map_is_allocated_.
5887         (Output_file::map_anonymous): If mmap fails, use malloc.
5888         (Output_file::unmap): Don't do anything for an anonymous map.
5889         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5890         is not available, provide stubs.
5891         (File_read::View::~View): Use free rather than delete[].
5892         (File_read::make_view): Use malloc rather than new[].  If mmap
5893         fails, use malloc.
5894         (File_read::find_or_make_view): Use malloc rather than new[].
5895         * gold.h: Remove HAVE_REMAP code.
5896         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5897         exists.  Rename mremap to gold_mremap.  If mmap is not available
5898         don't do anything.
5899         * configure, config.in: Rebuild.
5900
5901 2011-04-11  Ian Lance Taylor  <iant@google.com>
5902
5903         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5904         initialize local variable v.
5905
5906 2011-04-11  Cary Coutant  <ccoutant@google.com>
5907
5908         * archive.cc (Archive::include_member): Adjust call to
5909         report_object.
5910         (Add_archive_symbols::run): Track argument serial numbers.
5911         (Lib_group::include_member): Likewise.
5912         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5913         * archive.h (Incremental_archive_entry::Archive_member):
5914         Initialize arg_serial_.
5915         (Archive_member::arg_serial_): New data member.
5916         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5917         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5918         incremental link.
5919         (Sized_dynobj::do_for_all_local_got_entries): New function.
5920         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5921         function.
5922         * fileread.cc (get_mtime): New function.
5923         * fileread.h (get_mtime): New function.
5924         * gold.cc (queue_initial_tasks): Check for incremental update.
5925         (process_incremental_input): New function.
5926         (queue_middle_tasks): Don't force valid target for incremental
5927         update.
5928         * incremental-dump.cc (find_input_containing_global): Adjust
5929         size of symbol info entry.
5930         (dump_incremental_inputs): Dump argument serial number and
5931         in_system_directory flag; bias shndx by 1; print symbol names
5932         when dumping per-file symbol lists; use new symbol info readers.
5933         * incremental.cc
5934         (Output_section_incremental_inputs:update_data_size): New function.
5935         (Sized_incremental_binary::setup_readers): Setup input readers
5936         for each input file; build maps for files added from libraries
5937         and scripts.
5938         (Sized_incremental_binary::check_input_args): New function.
5939         (Sized_incremental_binary::do_check_inputs): Build map of argument
5940         serial numbers to input arguments.
5941         (Sized_incremental_binary::do_file_has_changed): Rename
5942         do_file_is_unchanged to this; compare file modification times.
5943         (Sized_incremental_binary::do_init_layout): New function.
5944         (Sized_incremental_binary::do_reserve_layout): New function.
5945         (Sized_incremental_binary::do_get_input_reader): Remove.
5946         (Sized_incremental_binary::get_symtab_view): New function.
5947         (Incremental_checker::can_incrementally_link_output_file): Remove.
5948         (Incremental_inputs::report_command_line): Exclude --debug options.
5949         (Incremental_inputs::report_archive_begin): Add parameter; track
5950         argument serial numbers; don't put input file entry for archive
5951         before archive members.
5952         (Incremental_inputs::report_archive_end): Put input file entry
5953         for archive after archive members.
5954         (Incremental_inputs::report_object): Add parameter; track argument
5955         serial numbers and in_system_directory flag.
5956         (Incremental_inputs::report_script): Add parameter; track argument
5957         serial numbers.
5958         (Output_section_incremental_inputs::set_final_data_size): Adjust
5959         size of symbol info entry; check for forwarding symbols.
5960         (Output_section_incremental_inputs::write_input_files): Write
5961         in_system_directory flag and argument serial number.
5962         (Output_section_incremental_inputs::write_info_blocks): Map section
5963         indices between incremental info and original input file; store
5964         input section index for each symbol.
5965         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5966         change operator() to visit().
5967         (class Global_got_offset_visitor): Likewise.
5968         (class Global_symbol_visitor_got_plt):
5969         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5970         classes.
5971         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5972         (Sized_incr_relobj::do_read_symbols): New function.
5973         (Sized_incr_relobj::do_layout): New function.
5974         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5975         (Sized_incr_relobj::do_add_symbols): New function.
5976         (Sized_incr_relobj::do_should_include_member): New function.
5977         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5978         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5979         (Sized_incr_relobj::do_section_size): New function.
5980         (Sized_incr_relobj::do_section_name): New function.
5981         (Sized_incr_relobj::do_section_contents): New function.
5982         (Sized_incr_relobj::do_section_flags): New function.
5983         (Sized_incr_relobj::do_section_entsize): New function.
5984         (Sized_incr_relobj::do_section_address): New function.
5985         (Sized_incr_relobj::do_section_type): New function.
5986         (Sized_incr_relobj::do_section_link): New function.
5987         (Sized_incr_relobj::do_section_info): New function.
5988         (Sized_incr_relobj::do_section_addralign): New function.
5989         (Sized_incr_relobj::do_initialize_xindex): New function.
5990         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5991         (Sized_incr_relobj::do_read_relocs): New function.
5992         (Sized_incr_relobj::do_gc_process_relocs): New function.
5993         (Sized_incr_relobj::do_scan_relocs): New function.
5994         (Sized_incr_relobj::do_count_local_symbols): New function.
5995         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5996         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5997         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5998         (Sized_incr_relobj::do_relocate): New function.
5999         (Sized_incr_relobj::do_set_section_offset): New function.
6000         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6001         (Sized_incr_dynobj::do_read_symbols): New function.
6002         (Sized_incr_dynobj::do_layout): New function.
6003         (Sized_incr_dynobj::do_add_symbols): New function.
6004         (Sized_incr_dynobj::do_should_include_member): New function.
6005         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6006         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6007         (Sized_incr_dynobj::do_section_size): New function.
6008         (Sized_incr_dynobj::do_section_name): New function.
6009         (Sized_incr_dynobj::do_section_contents): New function.
6010         (Sized_incr_dynobj::do_section_flags): New function.
6011         (Sized_incr_dynobj::do_section_entsize): New function.
6012         (Sized_incr_dynobj::do_section_address): New function.
6013         (Sized_incr_dynobj::do_section_type): New function.
6014         (Sized_incr_dynobj::do_section_link): New function.
6015         (Sized_incr_dynobj::do_section_info): New function.
6016         (Sized_incr_dynobj::do_section_addralign): New function.
6017         (Sized_incr_dynobj::do_initialize_xindex): New function.
6018         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6019         (make_sized_incremental_object): New function.
6020         (Incremental_library::copy_unused_symbols): New function.
6021         (Incremental_library::do_for_all_unused_symbols): New function.
6022         * incremental.h (enum Incremental_input_flags): New type.
6023         (class Incremental_checker): Remove.
6024         (Incremental_input_entry::Incremental_input_entry): Add argument
6025         serial number.
6026         (Incremental_input_entry::arg_serial): New function.
6027         (Incremental_input_entry::set_is_in_system_directory): New function.
6028         (Incremental_input_entry::is_in_system_directory): New function.
6029         (Incremental_input_entry::arg_serial_): New data member.
6030         (Incremental_input_entry::is_in_system_directory_): New data member.
6031         (class Script_info): Move here from script.h.
6032         (Script_info::Script_info): Add filename parameter.
6033         (Script_info::filename): New function.
6034         (Script_info::filename_): New data member.
6035         (Incremental_script_entry::Incremental_script_entry): Add argument
6036         serial number.
6037         (Incremental_object_entry::Incremental_object_entry): Likewise.
6038         (Incremental_object_entry::add_input_section): Build list of input
6039         sections with map to original shndx.
6040         (Incremental_object_entry::get_input_section_index): New function.
6041         (Incremental_object_entry::shndx_): New data member.
6042         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6043         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6044         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6045         serial number.
6046         (Incremental_inputs::report_archive_begin): Likewise.
6047         (Incremental_inputs::report_object): Likewise.
6048         (Incremental_inputs::report_script): Likewise.
6049         (class Incremental_global_symbol_reader): New class.
6050         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6051         and store flags and input file type.
6052         (Incremental_input_entry_reader::arg_serial): New function.
6053         (Incremental_input_entry_reader::type): Extract type from flags.
6054         (Incremental_input_entry_reader::is_in_system_directory): New function.
6055         (Incremental_input_entry_reader::get_input_section_count): Call
6056         accessor function for type.
6057         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6058         function for type; adjust size of global symbol entry.
6059         (Incremental_input_entry_reader::get_global_symbol_count): Call
6060         accessor function for type.
6061         (Incremental_input_entry_reader::get_object_count): Likewise.
6062         (Incremental_input_entry_reader::get_object_offset): Likewise.
6063         (Incremental_input_entry_reader::get_member_count): Likewise.
6064         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6065         (Incremental_input_entry_reader::get_member_offset): Likewise.
6066         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6067         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6068         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6069         (Incremental_input_entry_reader::get_global_symbol_reader): New
6070         function.
6071         (Incremental_input_entry_reader::get_output_symbol_index): New
6072         function.
6073         (Incremental_input_entry_reader::type_): Remove.
6074         (Incremental_input_entry_reader::flags_): New data member.
6075         (Incremental_inputs_reader::input_file_offset): New function.
6076         (Incremental_inputs_reader::input_file_index): New function.
6077         (Incremental_inputs_reader::input_file): Call input_file_offset.
6078         (Incremental_inputs_reader::input_file_at_offset): New function.
6079         (Incremental_relocs_reader::get_r_type): Reformat.
6080         (Incremental_relocs_reader::get_r_shndx): Reformat.
6081         (Incremental_relocs_reader::get_r_offset): Reformat.
6082         (Incremental_relocs_reader::data): New function.
6083         (Incremental_binary::Incremental_binary): Initialize new data members.
6084         (Incremental_binary::check_inputs): Add cmdline parameter.
6085         (Incremental_binary::file_is_unchanged): Remove.
6086         (Input_reader::arg_serial): New function.
6087         (Input_reader::get_unused_symbol_count): New function.
6088         (Input_reader::get_unused_symbol): New function.
6089         (Input_reader::do_arg_serial): New function.
6090         (Input_reader::do_get_unused_symbol_count): New function.
6091         (Input_reader::do_get_unused_symbol): New function.
6092         (Incremental_binary::input_file_count): New function.
6093         (Incremental_binary::get_input_reader): Change signature to use
6094         index instead of filename.
6095         (Incremental_binary::file_has_changed): New function.
6096         (Incremental_binary::get_input_argument): New function.
6097         (Incremental_binary::get_library): New function.
6098         (Incremental_binary::get_script_info): New function.
6099         (Incremental_binary::init_layout): New function.
6100         (Incremental_binary::reserve_layout): New function.
6101         (Incremental_binary::output_file): New function.
6102         (Incremental_binary::do_check_inputs): New function.
6103         (Incremental_binary::do_file_is_unchanged): Remove.
6104         (Incremental_binary::do_file_has_changed): New function.
6105         (Incremental_binary::do_init_layout): New function.
6106         (Incremental_binary::do_reserve_layout): New function.
6107         (Incremental_binary::do_input_file_count): New function.
6108         (Incremental_binary::do_get_input_reader): Change signature.
6109         (Incremental_binary::input_args_map_): New data member.
6110         (Incremental_binary::library_map_): New data member.
6111         (Incremental_binary::script_map_): New data member.
6112         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6113         new data members.
6114         (Sized_incremental_binary::output_section): New function.
6115         (Sized_incremental_binary::inputs_reader): Add const.
6116         (Sized_incremental_binary::symtab_reader): Add const.
6117         (Sized_incremental_binary::relocs_reader): Add const.
6118         (Sized_incremental_binary::got_plt_reader): Add const.
6119         (Sized_incremental_binary::get_symtab_view): New function.
6120         (Sized_incremental_binary::Inputs_reader): New typedef.
6121         (Sized_incremental_binary::Input_entry_reader): New typedef.
6122         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6123         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6124         (Sized_incremental_binary::do_file_has_changed): New function.
6125         (Sized_incremental_binary::do_init_layout): New function.
6126         (Sized_incremental_binary::do_reserve_layout): New function.
6127         (Sized_input_reader::Inputs_reader): Remove.
6128         (Sized_input_reader::Input_entry_reader): Remove.
6129         (Sized_input_reader::do_arg_serial): New function.
6130         (Sized_input_reader::do_get_unused_symbol_count): New function.
6131         (Sized_input_reader::do_get_unused_symbol): New function.
6132         (Sized_incremental_binary::do_input_file_count): New function.
6133         (Sized_incremental_binary::do_get_input_reader): Change signature;
6134         use index instead of filename.
6135         (Sized_incremental_binary::section_map_): New data member.
6136         (Sized_incremental_binary::input_entry_readers_): New data member.
6137         (class Sized_incr_relobj): New class.
6138         (class Sized_incr_dynobj): New class.
6139         (make_sized_incremental_object): New function.
6140         (class Incremental_library): New class.
6141         * layout.cc (Free_list::num_lists): New static data member.
6142         (Free_list::num_nodes): New static data member.
6143         (Free_list::num_removes): New static data member.
6144         (Free_list::num_remove_visits): New static data member.
6145         (Free_list::num_allocates): New static data member.
6146         (Free_list::num_allocate_visits): New static data member.
6147         (Free_list::init): New function.
6148         (Free_list::remove): New function.
6149         (Free_list::allocate): New function.
6150         (Free_list::dump): New function.
6151         (Free_list::print_stats): New function.
6152         (Layout_task_runner::run): Resize output file for incremental updates.
6153         (Layout::Layout): Initialize new data members.
6154         (Layout::set_incremental_base): New function.
6155         (Layout::init_fixed_output_section): New function.
6156         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6157         incremental updates.
6158         (Layout::create_gold_note): Do not create gold note section for
6159         incremental updates.
6160         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6161         for incremental updates.
6162         (Layout::set_section_offsets): For incremental updates, allocate space
6163         from free list.
6164         (Layout::create_symtab_sections): Layout with offsets relative to
6165         start of section; for incremental updates, allocate space from free
6166         list.
6167         (Layout::create_shdrs): For incremental updates, allocate space from
6168         free list.
6169         (Layout::finish_dynamic_section): For incremental updates, do not
6170         check --as-needed (fixed in subsequent patch).
6171         * layout.h (class Free_list): New class.
6172         (Layout::set_incremental_base): New function.
6173         (Layout::incremental_base): New function.
6174         (Layout::init_fixed_output_section): New function.
6175         (Layout::allocate): New function.
6176         (Layout::incremental_base_): New data member.
6177         (Layout::free_list_): New data member.
6178         * main.cc (main): Print Free_list statistics.
6179         * object.cc (Relobj::finalize_incremental_relocs): Add
6180         clear_counts parameter; clear counts only when clear_counts is set.
6181         (Sized_relobj::Sized_relobj): Initialize new base class.
6182         (Sized_relobj::do_layout): Don't report special sections.
6183         (Sized_relobj::do_for_all_local_got_entries): New function.
6184         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6185         symtab_off to all symbol table offsets.
6186         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6187         * object.h (class Got_offset_list): Move to top of file.
6188         (Object::Object): Allow case where input_file == NULL.
6189         (Object::~Object): Likewise.
6190         (Object::input_file): Assert that input_file != NULL.
6191         (Object::lock): Allow case where input_file == NULL.
6192         (Object::unlock): Likewise.
6193         (Object::is_locked): Likewise.
6194         (Object::token): Likewise.
6195         (Object::release): Likewise.
6196         (Object::is_incremental): New function.
6197         (Object::get_mtime): New function.
6198         (Object::for_all_local_got_entries): New function.
6199         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6200         (Object::set_is_in_system_directory): New function.
6201         (Object::is_in_system_directory): New function.
6202         (Object::do_is_incremental): New function.
6203         (Object::do_get_mtime): New function.
6204         (Object::do_for_all_local_got_entries): New function.
6205         (Object::is_in_system_directory_): New data member.
6206         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6207         (class Sized_relobj_base): New class.
6208         (class Sized_relobj): Derive from Sized_relobj_base.
6209         (class Sized_relobj::Symbols): Redeclare from base class.
6210         (class Sized_relobj::local_got_offset_list): Remove.
6211         (class Sized_relobj::Output_sections): Redeclare from base class.
6212         (class Sized_relobj::do_for_all_local_got_entries): New function.
6213         (class Sized_relobj::write_local_symbols): Add offset parameter.
6214         (class Sized_relobj::local_symbol_offset_): Update comment.
6215         (class Sized_relobj::local_dynsym_offset_): Update comment.
6216         * options.cc (Input_arguments::add_file): Remove const.
6217         * options.h (Input_file_argument::Input_file_argument):
6218         Initialize arg_serial_ (all constructors).
6219         (Input_file_argument::set_arg_serial): New function.
6220         (Input_file_argument::arg_serial): New function.
6221         (Input_file_argument::arg_serial_): New data member.
6222         (Input_arguments::Input_arguments): Initialize file_count_.
6223         (Input_arguments::add_file): Remove const.
6224         (Input_arguments::number_of_input_files): New function.
6225         (Input_arguments::file_count_): New data member.
6226         (Command_line::number_of_input_files): Call
6227         Input_arguments::number_of_input_files.
6228         * output.cc (Output_segment_headers::Output_segment_headers):
6229         Set current size.
6230         (Output_section::Input_section::current_data_size): New function.
6231         (Output_section::Output_section): Initialize new data members.
6232         (Output_section::add_input_section): Don't do merge sections for
6233         an incremental link; allocate space from free list for an
6234         incremental update.
6235         (Output_section::add_output_section_data): Allocate space from
6236         free list for an incremental update.
6237         (Output_section::update_data_size): New function.
6238         (Output_section::set_fixed_layout): New function.
6239         (Output_section::reserve): New function.
6240         (Output_segment::set_section_addresses): Remove const.
6241         (Output_segment::set_section_list_addresses): Remove const; allocate
6242         space from free list for an incremental update.
6243         (Output_segment::set_offset): Adjust size of RELRO segment for an
6244         incremental update.
6245         * output.h (Output_data::current_data_size): Move here from
6246         child classes.
6247         (Output_data::pre_finalize_data_size): New function.
6248         (Output_data::update_data_size): New function.
6249         (Output_section_headers::update_data_size): new function.
6250         (Output_section_data_build::current_data_size): Move to Output_data.
6251         (Output_data_strtab::update_data_size): New function.
6252         (Output_section::current_data_size): Move to Output_data.
6253         (Output_section::set_fixed_layout): New function.
6254         (Output_section::has_fixed_layout): New function.
6255         (Output_section::reserve): New function.
6256         (Output_section::update_data_size): New function.
6257         (Output_section::has_fixed_layout_): New data member.
6258         (Output_section::free_list_): New data member.
6259         (Output_segment::set_section_addresses): Remove const.
6260         (Output_segment::set_section_list_addresses): Remove const.
6261         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6262         New function.
6263         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6264         New function.
6265         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6266         parameter when calling Add_symbols constructor; store argument
6267         serial number for members of a lib group.
6268         (Add_symbols::locks): Allow case where token == NULL.
6269         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6270         (Read_member::~Read_member): New function.
6271         (Read_member::is_runnable): New function.
6272         (Read_member::locks): New function.
6273         (Read_member::run): New function.
6274         (Check_script::~Check_script): New function.
6275         (Check_script::is_runnable): New function.
6276         (Check_script::locks): New function.
6277         (Check_script::run): New function.
6278         (Check_library::~Check_library): New function.
6279         (Check_library::is_runnable): New function.
6280         (Check_library::locks): New function.
6281         (Check_library::run): New function.
6282         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6283         (Add_symbols::library_): New data member.
6284         (class Read_member): New class.
6285         (class Check_script): New class.
6286         (class Check_library): New class.
6287         * reloc.cc (Read_relocs::is_runnable): Allow case where
6288         token == NULL.
6289         (Read_relocs::locks): Likewise.
6290         (Scan_relocs::locks): Likewise.
6291         (Relocate_task::locks): Likewise.
6292         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6293         to clear counters.
6294         (Sized_relobj::incremental_relocs_scan): Fix comment.
6295         (Sized_relobj::do_relocate): Pass output file offset to
6296         write_local_symbols.
6297         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6298         from class declaration.
6299         * script.cc (read_input_script): Allocate Script_info; pass
6300         argument serial number to report_script.
6301         * script.h (class Script_info): Move to incremental.h.
6302         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6303         * symtab.h (Symbol_table::add_from_incrobj): New function.
6304         (Symbol_table::set_file_offset): New function.
6305
6306 2011-04-05  Cary Coutant  <ccoutant@google.com>
6307
6308         * incremental-dump.cc (dump_incremental_inputs): Change signature
6309         to take a Sized_incremental_binary; change caller.  Use readers
6310         in Sized_incremental_binary.
6311         * incremental.cc
6312         (Sized_incremental_binary::find_incremental_inputs_sections):
6313         Rename do_find_incremental_inputs_sections to this.
6314         (Sized_incremental_binary::setup_readers): New function.
6315         (Sized_incremental_binary::do_check_inputs): Check
6316         has_incremental_info_ flag; move setup code to setup_readers;
6317         use input readers.
6318         (Sized_incremental_binary::do_file_is_unchanged): New function.
6319         (Sized_incremental_binary::do_get_input_reader): New function.
6320         * incremental.h (class Incremental_binary): Move to end of file.
6321         (Incremental_binary::file_is_unchanged): New function.
6322         (Incremental_binary::do_file_is_unchanged): New function.
6323         (Incremental_binary::Input_reader): New class.
6324         (Incremental_binary::get_input_reader): New function.
6325         (class Sized_incremental_binary): Move to end of file.
6326         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6327         input section reader classes.
6328         (Sized_incremental_binary::has_incremental_info): New function.
6329         (Sized_incremental_binary::inputs_reader): New function.
6330         (Sized_incremental_binary::symtab_reader): New function.
6331         (Sized_incremental_binary::relocs_reader): New function.
6332         (Sized_incremental_binary::got_plt_reader): New function.
6333         (Sized_incremental_binary::do_file_is_unchanged): New function.
6334         (Sized_incremental_binary::Sized_input_reader): New class.
6335         (Sized_incremental_binary::get_input_reader): New function.
6336         (Sized_incremental_binary::find_incremental_inputs_sections):
6337         Rename do_find_incremental_inputs_sections to this.
6338         (Sized_incremental_binary::setup_readers): New function.
6339         (Sized_incremental_binary::has_incremental_info_): New data member.
6340         (Sized_incremental_binary::inputs_reader_): New data member.
6341         (Sized_incremental_binary::symtab_reader_): New data member.
6342         (Sized_incremental_binary::relocs_reader_): New data member.
6343         (Sized_incremental_binary::got_plt_reader_): New data member.
6344         (Sized_incremental_binary::current_input_file_): New data member.
6345
6346 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6347
6348         PR gold/12640
6349         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6350         violation.
6351
6352 2011-03-30  Cary Coutant  <ccoutant@google.com>
6353
6354         * archive.cc (Archive::include_member): Adjust call to report_object.
6355         (Add_archive_symbols::run): Add script_info to call to
6356         report_archive_begin.
6357         (Lib_group::include_member): Adjust call to report_object.
6358         (Add_lib_group_symbols::run): Adjust call to report_object.
6359         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6360         blocks.  Add object count for script input files.
6361         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6362         script_info parameter; change all callers.
6363         (Incremental_inputs::report_object): Add script_info parameter;
6364         change all callers.
6365         (Incremental_inputs::report_script): Store backpointer to
6366         incremental info entry.
6367         (Output_section_incremental_inputs::set_final_data_size): Record
6368         additional information for scripts.
6369         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6370         * incremental.h (Incremental_script_entry::add_object): New function.
6371         (Incremental_script_entry::get_object_count): New function.
6372         (Incremental_script_entry::get_object): New function.
6373         (Incremental_script_entry::objects_): New data member; adjust
6374         constructor.
6375         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6376         (Incremental_inputs::report_object): Add script_info parameter.
6377         (Incremental_inputs_reader::get_object_count): New function.
6378         (Incremental_inputs_reader::get_object_offset): New function.
6379         * options.cc (Input_arguments::add_file): Return reference to
6380         new input argument.
6381         * options.h (Input_argument::set_script_info): New function.
6382         (Input_argument::script_info): New function.
6383         (Input_argument::script_info_): New data member; adjust all
6384         constructors.
6385         (Input_file_group::add_file): Return reference to new input argument.
6386         (Input_file_lib::add_file): Likewise.
6387         (Input_arguments::add_file): Likewise.
6388         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6389         * script.cc (Parser_closure::Parser_closure): Add script_info
6390         parameter; adjust all callers.
6391         (Parser_closure::script_info): New function.
6392         (Parser_closure::script_info_): New data member.
6393         (read_input_script): Report scripts earlier to incremental info.
6394         (script_add_file): Set script_info in Input_argument.
6395         (script_add_library): Likewise.
6396         * script.h (Script_options::Script_info): Rewrite class.
6397
6398 2011-03-29  Cary Coutant  <ccoutant@google.com>
6399
6400         * archive.cc (Library_base::should_include_member): Move
6401         method here from class Archive.
6402         (Archive::Archive): Initialize base class.
6403         (Archive::should_include_member): Move to base class.
6404         (Archive::do_for_all_unused_symbols): New function.
6405         (Add_archive_symbols::run): Remove redundant access to
6406         incremental_inputs.
6407         (Lib_group::Lib_group): Initialize base class.
6408         (Lib_group::do_filename): New function.
6409         (Lib_group::include_member): Pass pointer to Lib_group to
6410         report_object.
6411         (Lib_group::do_for_all_unused_symbols): New function.
6412         (Add_lib_group_symbols::run): Report archive information for
6413         incremental links.
6414         * archive.h (class Library_base): New base class.
6415         (class Archive): Derive from Library_base.
6416         (Archive::filename): Move to base class.
6417         (Archive::set_incremental_info): Likewise.
6418         (Archive::incremental_info): Likewise.
6419         (Archive::Should_include): Likewise.
6420         (Archive::should_include_member): Likewise.
6421         (Archive::Armap_entry): Remove.
6422         (Archive::Unused_symbol_iterator): Remove.
6423         (Archive::unused_symbols_begin): Remove.
6424         (Archive::unused_symbols_end): Remove.
6425         (Archive::do_filename): New function.
6426         (Archive::do_get_mtime): New function.
6427         (Archive::do_for_all_unused_symbols): New function.
6428         (Archive::task_): Move to base class.
6429         (Archive::incremental_info_): Likewise.
6430         (class Lib_group): Derive from Library_base.
6431         (Lib_group::do_filename): New function.
6432         (Lib_group::do_get_mtime): New function.
6433         (Lib_group::do_for_all_unused_symbols): New function.
6434         (Lib_group::task_): Move to base class.
6435         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6436         function.
6437         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6438         function.
6439         * incremental.cc (Incremental_inputs::report_archive_begin):
6440         Use Library_base; call library's get_mtime; add incremental inputs
6441         entry before members.
6442         (class Unused_symbol_visitor): New class.
6443         (Incremental_inputs::report_archive_end): Use Library_base; use
6444         visitor class to record unused symbols; don't add incremental inputs
6445         entry after members.
6446         (Incremental_inputs::report_object): Use Library_base.
6447         * incremental.h
6448         (Incremental_archive_entry::Incremental_archive_entry): Remove
6449         unused Archive parameter.
6450         (Incremental_inputs::report_archive_begin): Use Library_base.
6451         (Incremental_inputs::report_archive_end): Likewise.
6452         (Incremental_inputs::report_object): Likewise.
6453         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6454         function.
6455         * object.h (Object::for_all_global_symbols): New function.
6456         (Object::do_for_all_global_symbols): New function.
6457         (Sized_relobj::do_for_all_global_symbols): New function.
6458         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6459         function.
6460         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6461         function.
6462
6463 2011-03-27  Ian Lance Taylor  <iant@google.com>
6464
6465         * archive.cc (Archive::interpret_header): Return -1 if something
6466         goes wrong.  Change callers accordingly.
6467
6468 2011-03-25  Cary Coutant  <ccoutant@google.com>
6469
6470         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6471         * testsuite/Makefile.in: Regenerate.
6472
6473 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6474
6475         * plugin.cc (get_view): New.
6476         (Plugin::load): Pass get_view to the plugin.
6477         (Plugin_manager::get_view): New.
6478
6479 2011-03-21  Ian Lance Taylor  <iant@google.com>
6480
6481         * testsuite/final_layout.sh: Rewrite to not use dc.
6482         * testsuite/relro_test.sh: Fail if dc is not present.
6483
6484 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6485
6486         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6487         Change == to -eq.
6488         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6489         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6490         Change == to -eq.
6491         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6492         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6493
6494 2011-03-14  Ian Lance Taylor  <iant@google.com>
6495
6496         * script-sections.cc (Sort_output_sections::script_compare):
6497         Rename from is_before, change return type.
6498         (Sort_output_sections::operator()): Adjust accordingly.
6499
6500 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6501
6502         PR gold/12572
6503         * testsuite/odr_violation2.cc: Add comment to make all error line
6504         numbers double digits.
6505         * testsuite/debug_msg.sh: Adjust expected errors.
6506
6507 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6508
6509         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6510         but mark earlier ones as non-canonical
6511         (offset_to_iterator): Update search target and example
6512         (do_addr2line): Return extra lines in a vector*
6513         (format_file_lineno): Extract from do_addr2line
6514         (one_addr2line): Add vector* out-param
6515         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6516         when a lineno entry appeared last for its instruction
6517         (Dwarf_line_info): Add vector* out-param
6518         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6519         * symtab.cc (Odr_violation_compare): Include the lineno in the
6520         comparison again.
6521         (linenos_from_loc): New. Combine the canonical line for an
6522         address with its other lines.
6523         (True_if_intersect): New. Helper functor to make
6524         std::set_intersection a query.
6525         (detect_odr_violations): Compare sets of lines instead of just
6526         one line for each function. This became less deterministic, but
6527         has fewer false positives.
6528         * symtab.h: Declarations.
6529         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6530         mix an optimized and non-optimized object in the same binary
6531         (odr_violation2.so): Same.
6532         * testsuite/Makefile.in: Regenerate from Makefile.am.
6533         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6534         * testsuite/debug_msg.sh: Update line numbers and add
6535         assertions.
6536         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6537         non-optimized context.
6538         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6539         isn't inlined, and use OdrDerived in an optimized context.
6540         * testsuite/odr_header1.h: Defines OdrDerived, where
6541         optimization will change the
6542         first-instruction-in-the-destructor's file and line number.
6543         * testsuite/odr_header2.h: Defines OdrBase.
6544
6545 2011-03-09  Ian Lance Taylor  <iant@google.com>
6546
6547         * fileread.cc (File_read::clear_views): Don't delete the whole
6548         file view.
6549
6550 2011-03-08  Ian Lance Taylor  <iant@google.com>
6551
6552         PR gold/12525
6553         * fileread.cc: #include <climits>.
6554         (GOLD_IOV_MAX): Define.
6555         (File_read::read_multiple): Limit number of entries by iov_max.
6556         * fileread.h (class File_read): Always set max_readv_entries to
6557         128.
6558
6559 2011-03-07  Ian Lance Taylor  <iant@google.com>
6560
6561         PR gold/12525
6562         * options.h (class General_options): Add -dy and -dn.
6563
6564 2011-03-02  Cary Coutant  <ccoutant@google.com>
6565
6566         * testsuite/script_test_9.t: Add TLS segment.
6567
6568 2011-03-02  Simon Baldwin  <simonb@google.com>
6569
6570         * configure.ac: Add check for gnu_indirect_function support in
6571         the toolchain building binutils.
6572         * configure: Rebuild.
6573
6574 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6575
6576         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6577         plugin only symbols.
6578         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6579         in plugin files as not needed in the symbol table.
6580
6581 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6582
6583         * output.cc (Output_section::add_input_section): Delay fill
6584         generation for section ordering.
6585
6586 2011-02-09  Ian Lance Taylor  <iant@google.com>
6587
6588         PR gold/12316
6589         * object.h (class Sized_relobj): Remove clear_local_symbols.
6590         * reloc.cc (Sized_relobj::do_relocate): Don't call
6591         clear_local_symbols.
6592
6593 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6594
6595         * plugin.cc (is_visible_from_outside): Return true for symbols
6596         in the -u option.
6597
6598 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6599
6600         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6601         filename.
6602
6603 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6604
6605         * icf.h (is_section_foldable_candidate): Change type of parameter
6606         to std::string.
6607         * icf.cc (Icf::find_identical_sections): Change type of local variable
6608         section_name to be std::string.
6609         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6610
6611 2011-01-25  Ian Lance Taylor  <iant@google.com>
6612
6613         * script.cc (script_add_extern): Rewrite to use
6614         add_symbol_reference.
6615
6616 2011-01-25  Doug Kwan  <dougkwan@google.com>
6617
6618         * icf.cc (get_section_contents): Always lock section's object.
6619
6620 2011-01-24  Ian Lance Taylor  <iant@google.com>
6621
6622         * options.h (class General_options): Accept
6623         --no-detect-odr-violations.
6624
6625 2011-01-24  Ian Lance Taylor  <iant@google.com>
6626
6627         * version.cc (version_string): Bump to 1.11.
6628
6629 2011-01-24  Ian Lance Taylor  <iant@google.com>
6630
6631         * plugin.cc (class Plugin_rescan): Define new class.
6632         (Plugin_manager::claim_file): Set any_claimed_.
6633         (Plugin_manager::save_archive): New function.
6634         (Plugin_manager::save_input_group): New function.
6635         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6636         necessary.
6637         (Plugin_manager::new_undefined_symbol): New function.
6638         (Plugin_manager::rescan): New function.
6639         (Plugin_manager::rescannable_defines): New function.
6640         (Plugin_manager::add_input_file): Set any_added_.
6641         * plugin.h (class Plugin_manager): define new fields rescannable_,
6642         undefined_symbols_, any_claimed_, and any_added_.  Declare
6643         Plugin_rescan as friend.  Declare new functions.
6644         (Plugin_manager::Rescannable): Define type.
6645         (Plugin_manager::Rescannable_list): Define type.
6646         (Plugin_manager::Undefined_symbol_list): Define type.
6647         (Plugin_manager::Plugin_manager): Initialize new fields.
6648         * archive.cc (Archive::defines_symbol): New function.
6649         (Add_archive_symbols::run): Pass archive to plugins if any.
6650         * archive.h (class Archive): Declare defines_symbol.
6651         * readsyms.cc (Input_group::~Input_group): New function.
6652         (Finish_group::run): Pass input_group to plugins if any.
6653         * readsyms.h (class Input_group): Declare destructor.
6654         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6655         any.
6656
6657 2011-01-10  Ian Lance Taylor  <iant@google.com>
6658
6659         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6660         section as relro.
6661         (Layout::set_segment_offsets): Reset increase_relro before calling
6662         set_section_addresses a second time.
6663
6664 2011-01-04  Cary Coutant  <ccoutant@google.com>
6665
6666         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6667         sections before NOBITS sections.
6668
6669 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6670
6671         * version.cc (print_version): Update copyright to 2011.
6672
6673 2010-12-23  Cary Coutant  <ccoutant@google.com>
6674
6675         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6676         of OS to this->add.  Add OD parameter to second form of the function.
6677
6678 2010-12-20  Ian Lance Taylor  <iant@google.com>
6679
6680         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6681         second of two consecutive entries with same offset.
6682
6683 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6684
6685         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6686         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6687         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6688         to avoid unneeded links against $(LDADD).
6689         * testsuite/Makefile.in: Regenerate.
6690
6691 2010-12-15  Ian Lance Taylor  <iant@google.com>
6692
6693         PR gold/12324
6694         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6695         for R_X86_64_32 and R_X86_64_PC32.
6696         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6697         ver_matching_def_pic.o.
6698         (ver_matching_def_pic.o): New target.
6699
6700 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6701
6702         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6703         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6704         Move definition before File_read::View member definitions.
6705         (File_read::View::~View): Initialize and hold lock before
6706         updating current_mapped_bytes.
6707
6708 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6709
6710         * dwarf_reader.cc: Remove outdated comment.
6711         * gold-threads.cc: Fix typo in error message.
6712         * archive.cc: Fix typos in comments.
6713         * archive.h: Likewise.
6714         * arm-reloc-property.cc: Likewise.
6715         * arm-reloc-property.h: Likewise.
6716         * arm-reloc.def: Likewise.
6717         * arm.cc: Likewise.
6718         * attributes.h: Likewise.
6719         * cref.cc: Likewise.
6720         * ehframe.cc: Likewise.
6721         * fileread.h: Likewise.
6722         * gold.h: Likewise.
6723         * i386.cc: Likewise.
6724         * icf.cc: Likewise.
6725         * incremental.h: Likewise.
6726         * int_encoding.cc: Likewise.
6727         * layout.h: Likewise.
6728         * main.cc: Likewise.
6729         * merge.h: Likewise.
6730         * object.cc: Likewise.
6731         * object.h: Likewise.
6732         * options.cc: Likewise.
6733         * readsyms.cc: Likewise.
6734         * reduced_debug_output.cc: Likewise.
6735         * reloc.cc: Likewise.
6736         * script-sections.cc: Likewise.
6737         * sparc.cc: Likewise.
6738         * symtab.h: Likewise.
6739         * target-reloc.h: Likewise.
6740         * target.cc: Likewise.
6741         * target.h: Likewise.
6742         * timer.cc: Likewise.
6743         * timer.h: Likewise.
6744         * x86_64.cc: Likewise.
6745
6746 2010-12-09  Cary Coutant  <ccoutant@google.com>
6747
6748         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6749         stack.
6750         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6751         parameter; change all callers.
6752         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6753         * options.h (warn_execstack): New option.
6754
6755 2010-12-07  Doug Kwan  <dougkwan@google.com>
6756
6757         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6758         like function call relocations.
6759
6760 2010-12-07  Ian Lance Taylor  <iant@google.com>
6761
6762         * archive.cc (Archive::get_elf_object_for_member): Permit
6763         punconfigured to be NULL.
6764         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6765         (Archive::include_member): Pass NULL to get_elf_object_for_member
6766         if we searched for the archive and this is the first included
6767         object.
6768
6769 2010-12-01  Ian Lance Taylor  <iant@google.com>
6770
6771         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6772         track_relocs_type_ field.
6773         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6774         Set track_relocs_type_.
6775         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6776         contents when using RELA relocs.
6777         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6778         reloc_map_.
6779         * reloc.cc (Track_relocs::next_addend): New function.
6780         * reloc.h (class Track_relocs): Declare next_addend.
6781
6782 2010-12-01  Ian Lance Taylor  <iant@google.com>
6783
6784         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6785         virtual destructor.
6786
6787 2010-12-01  Ian Lance Taylor  <iant@google.com>
6788
6789         * README: Update compilers known to work and fail.
6790
6791 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6792
6793         * configure.in: For --enable-gold, handle value `default' instead of
6794         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6795         not the default.
6796         * configure: Regenerate.
6797
6798 2010-11-18  Doug Kwan  <dougkwan@google.com>
6799
6800         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6801         and right_alignment to be zero.  Store result alignment only if it is
6802         greater than existing alignment.
6803
6804 2010-11-16  Cary Coutant  <ccoutant@google.com>
6805
6806         PR gold/12220
6807         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6808         Check for ".zdebug_line".
6809
6810 2010-11-16  Doug Kwan  <dougkwan@google.com>
6811             Cary Coutant  <ccoutant@google.com>
6812
6813         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6814         by reference; adjust all callers.
6815         * output.cc (Output_segment::set_section_addresses): Adjust references
6816         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6817         list is empty.
6818         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6819         end at page boundary.
6820
6821 2010-11-16  Cary Coutant  <ccoutant@google.com>
6822
6823         PR gold/12220
6824         * layout.cc (Layout::choose_output_section): Transform names of
6825         compressed sections even when using a script with a SECTIONS clause.
6826         (Layout::output_section_name): Remove code to transform
6827         compressed debug section names.
6828         * output.cc (Output_section::add_input_section): Use uncompressed
6829         section size when tracking input sections.
6830
6831 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6832
6833         * symtab.h (Symbol::NON_PIC_REF): Remove.
6834         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6835         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6836         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6837         (Symbol::use_plt_offset): Take a flags argument and pass it
6838         directly to needs_dynamic_reloc.  Restrict check for undefined
6839         weak symbols to function calls.
6840         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6841         (Target_arm::Scan::global): Use it.
6842         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6843         (Target_arm::Relocate::relocate): Likewise.
6844         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6845         parameter with an r_type parameter.  Use get_reference_flags
6846         to get the flags.
6847         (Target_arm::Relocate::relocate): Update accordingly.
6848         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6849         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6850         (Target_i386::Scan::global): Likewise.
6851         (Target_i386::Relocate::relocate): Likewise.
6852         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6853         parameter with an r_type parameter.  Use get_reference_flags
6854         to get the flags.
6855         (Target_i386::Relocate::relocate): Update accordingly.
6856         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6857         (Target_powerpc::Scan::global): Use it.
6858         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6859         (Target_powerpc::Relocate::relocate): Likewise.
6860         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6861         (Target_sparc::Scan::global): Use it.
6862         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6863         (Target_sparc::Relocate::relocate): Likewise.
6864         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6865         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6866         (Target_x86_64::Scan::global): Likewise.
6867         (Target_x86_64::Relocate::relocate): Likewise.
6868
6869 2010-11-08  Doug Kwan  <dougkwan@google.com>
6870             Cary Coutant  <ccoutant@google.com>
6871
6872         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6873         (Arm_exidx_merge_section::section_contents_): New data member.
6874         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6875         (Arm_input_section::~Arm_input_section): De-allocate memory.
6876         (Arm_input_section::original_contents_): New data member.
6877         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6878         in parameters instead of calling Object::section_contents without
6879         locking.
6880         (Arm_output_section::group_section): New parameter TASK.  Pass it
6881         to callees that need locking objects.
6882         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6883         to lock EXIDX input sections.  Fix a formatting issue.  Call
6884         Arm_exidx_merged_section::build_contents to create merged section
6885         contents.
6886         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6887         to lock object of stub table owner.
6888         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6889         TEXT_SIZE to initialize data member TEXT_SIZE_.
6890         (Arm_exidx_input_section::addralign): Fix typo in comment.
6891         (Arm_exidx_input_section::text_size): New method.
6892         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6893         that require locking objects.  Lock objects before scanning for stubs
6894         and updating local symbols.
6895         (Arm_input_section<big_endian>::init): Copy contents of original
6896         input section.
6897         (Arm_input_section<big_endian>::do_write): Use saved contents of
6898         original input section instead of calling Object::section_contents
6899         without locking.
6900         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6901         size without calling Object::section_size().
6902         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6903         for size.  Allocate a buffer for merged EXIDX entries.
6904         (Arm_exidx_merged_section::build_contents): New method.
6905         (Arm_exidx_merged_section::do_write): Move merge section contents
6906         building code to Arm_exidx_merged_section::build_contetns.  Write
6907         out contetns in buffer instead of building it on the fly.
6908         (Arm_relobj::make_exidx_input_section): Also pass text section size
6909         to Arm_exidx_input_section constructor.
6910         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6911         (Arm_dynobj::do_read_symbols): Fix memory leak.
6912         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6913         * target.h: (class Task): Add forward declaration.
6914         (Target::relax): Add new parameter TASK and pass it to
6915         Target::do_relax().
6916         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6917
6918 2010-11-05  Cary Coutant  <ccoutant@google.com>
6919
6920         PR gold/10708
6921         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6922         object when reading from the file.
6923         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6924         second layout pass.
6925         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6926         when reading section contents.
6927         (get_section_contents): Likewise.
6928         (icf::find_identical_sections): Likewise.
6929         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6930         object when reading from the file.
6931         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6932         the object when doing deferred section layout.
6933
6934 2010-11-03  Nick Clifton  <nickc@redhat.com>
6935
6936         PR gold/12001
6937         * script.h (class Symbol_assignment: name): New member.  Returns
6938         the name of the symbol.
6939         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6940         Returns true if the given symbol name is on the list of
6941         assignments wating to be processed.
6942         * archive.cc (should_incldue_member): If the symbol is undefined,
6943         check to see if it is on the list of symbols pending assignment.
6944
6945 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6946
6947         * script-sections.cc (Script_sections::find_memory_region): Check
6948         for a NULL output section pointer.
6949
6950 2010-10-29  Doug Kwan  <dougkwan@google.com>
6951
6952         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6953         Output_section::add_relaxed_input_section.
6954         * output.cc (Output_section::add_relaxed_input_section): Add new
6955         arguments LAYOUT and NAME.  Set section order index.
6956         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6957         Copy section order index.
6958         * output.h (Output_section::add_relaxed_input_section): Add new
6959         arguments LAYOUT and NAME.
6960
6961 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6962
6963         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6964         NATIVE_OR_CROSS_LINKER.
6965         * testsuite/Makefile.in: Regenerate.
6966
6967 2010-10-20  Doug Kwan  <dougkwan@google.com>
6968
6969         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6970         without SHF_LINK_ORDER flags.
6971         * layout.cc (Layout::choose_output_section): Do not filter
6972         SHF_LINK_ORDER flag in a relocatable link.
6973
6974 2010-10-17  Cary Coutant  <ccoutant@google.com>
6975
6976         * output.h (Output_segment::set_section_addresses): Change function
6977         signature.  Update all callers.
6978         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6979         sections.
6980         (Output_segment::set_section_addresses): Align after last TLS
6981         section.  Add padding before last relro section instead of after.
6982
6983 2010-10-17  Doug Kwan  <dougkwan@google.com>
6984
6985         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6986         GOT output section to be writable.
6987
6988 2010-10-14  Cary Coutant  <ccoutant@google.com>
6989
6990         * debug.h (DEBUG_INCREMENTAL): New flag.
6991         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6992         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6993         mode.
6994         * incremental.cc (report_command_line): Ignore all forms of
6995         --incremental.
6996         * layout.cc (Layout::Layout): Check parameters for incremental link
6997         mode.
6998         * options.cc (General_options::parse_incremental): New function.
6999         (General_options::parse_no_incremental): New function.
7000         (General_options::parse_incremental_full): New function.
7001         (General_options::parse_incremental_update): New function.
7002         (General_options::incremental_mode_): New data member.
7003         (General_options::finalize): Check incremental_mode_.
7004         * options.h (General_options): Update help text for --incremental.
7005         Add --no-incremental, --incremental-full, --incremental-update.
7006         (General_options::Incremental_mode): New enum type.
7007         (General_options::incremental_mode): New function.
7008         (General_options::incremental_mode_): New data member.
7009         * parameters.cc (Parameters::incremental_mode_): New data member.
7010         (Parameters::set_options): Set incremental_mode_.
7011         (Parameters::set_incremental_full): New function.
7012         (Parameters::incremental): New function.
7013         (Parameters::incremental_update): New function.
7014         (set_parameters_incremental_full): New function.
7015         * parameters.h (Parameters::set_incremental_full): New function.
7016         (Parameters::incremental): New function.
7017         (Parameters::incremental_update): New function.
7018         (Parameters::incremental_mode_): New data member.
7019         (set_parameters_incremental_full): New function.
7020         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7021         incremental link mode.
7022         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7023         (Sized_relobj::do_relocate_sections): Likewise.
7024         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7025         option.
7026         * testsuite/Makefile.in: Regenerate.
7027         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7028
7029 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7030
7031         * script-sections.h (class Script_sections): Make
7032         Sections_elements typedef public.
7033         * script-sections.cc (class Sort_output_sections): Add elements_
7034         field.  Add constructor which sets it; change all callers.
7035         (Sort_output_sections::is_before): New function.
7036         (Sort_output_sections::operator()): Call is_before.
7037         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7038         conditional.
7039         * testsuite/script_test_10.sh: New test. Test script section
7040         order.
7041         * testsuite/script_test_10.t: Likewise.
7042         * testsuite/script_test_10.s: Likewise.
7043         * testsuite/Makefile.am: Wrap the cross linker tests and the
7044         common tests into NATIVE_OR_CROSS_LINKER.
7045         (check_SCRIPTS): Add script_test_10.sh.
7046         (check_DATA): Add script_test_10.stdout.
7047         (script_test_10.o, script_test_10): New targets.
7048         (script_test_10.stdout): New target.
7049         * configure, testsuite/Makefile.in: Regenerate.
7050
7051 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7052
7053         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7054         error for the deprecated relocations.
7055         (Target_arm::Scan::global): Likewise.
7056         (Target_arm::Relocate::relocate): Likewise.
7057
7058 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7059
7060         * fileread.cc (Input_file::find_file): Initialize *found_name
7061         and *namep when using the fallback search for case 4.
7062
7063 2010-10-11  Cary Coutant  <ccoutant@google.com>
7064
7065         * options.h (class General_options): Redefine -z lazy as an alias for
7066         the negation of -z now.
7067
7068 2010-10-11  Ian Lance Taylor  <iant@google.com>
7069
7070         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7071         binding.
7072
7073 2010-10-06  Nick Clifton  <nickc@redhat.com>
7074
7075         * script-sections.cc(class Memory_region): Remove
7076         current_lma_offset_ field.  Rename current_vma_offset_ to
7077         current_offset_.  Add last_section_ field.
7078         (Memory_region::get_current_vma_address): Rename to
7079         get_current_address.
7080         (Memory_region::get_current_lma_address): Delete.
7081         (Memory_region::increment_vma_offset): Rename to
7082         increment_offset.
7083         (Memory_region::increment_lma_offset): Delete.
7084         (Memory_region::attributes_compatible): New method.  Returns
7085         true if the provided section is compatible with the region.
7086         (Memory_region::get_last_section): New method.  Returns the last
7087         section to use the region.
7088         (Memory_region::set_last_section): New method.  Stores the last
7089         section to use the region.
7090         (Script_sections::block_in_region): New method.  Returns true if
7091         a block of memory is contained within a region.
7092         (Script_sections::find_memory_region): New method.  Locates a
7093         memory region to be used to set a VMA or LMA address.
7094         (Output_section_definition::set_section_addresses): Add code to
7095         check for addresses set by memory regions.
7096         (Output_segment::set_section_addresses): Remove memory region
7097         walking code.
7098         (Script_sections::create_segment): Add a warning if a header
7099         segment is created outside of any region.
7100         * script-sections.h (class Script_sections): Add prototypes for
7101         find_memory_region and block_in_region methods.
7102         * testsuite/memory_test.s: Use .long instead of .word.
7103         * testsuite/memory_test.t: Add some more output sections.
7104         * testsuite/memory_test.sh: Update expected output.
7105
7106 2010-10-02  Doug Kwan  <dougkwan@google.com>
7107
7108         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7109         defintion to symtab.h
7110         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7111         declaration to defintion.
7112
7113 2010-10-01  Nick Clifton  <nickc@redhat.com>
7114
7115         * expression.cc (eval): Replace dummy argument with NULL.
7116         (eval_maybe_dot): Check for a NULL result section pointer.
7117         (Symbol_expression::value): Likewise.
7118         (Dot_expression::value): Likewise.
7119         (BINARY_EXPRESSION): Likewise.
7120         (Max_expression::value): Likewise.
7121         (Min_expression::value): Likewise.
7122         (Absolute_expression::value): Likewise.
7123         (Addr_expression::value_from_output_section): Likewise.
7124         (Loaddddr_expression::value_from_output_section): Likewise.
7125         (Segment_start_expression::value): Likewise.
7126         * script-sections.cc
7127         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7128         argument with NULL.
7129         (Sections_elememt_dot_assignment::set_section_addresses):
7130         Likewise.
7131         (Output_data_expression::do_write_to_buffer): Likewise.
7132         (Output_section_definition::finalize_symbols): Likewise.
7133         (Output_section_definition::set_section_addresses): Likewise.
7134
7135 2010-09-30  Doug Kwan  <dougkwan@google.com>
7136
7137         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7138
7139 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7140
7141         * target.h (Target::can_icf_inline_merge_sections): New virtual
7142         function.
7143         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7144         virtual function.
7145         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7146         virtual function.
7147         * icf.cc (get_section_contents): Inline merge sections only when
7148         target allows it.
7149
7150 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7151
7152         * configure: Regenerate.
7153
7154 2010-09-17  Ian Lance Taylor  <iant@google.com>
7155
7156         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7157         * testsuite/Makefile.am (memory_test.o): New target.
7158         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7159         memory_test.t.
7160         * testsuite/Makefile.in: Rebuild.
7161
7162 2010-09-17  Doug Kwan  <dougkwan@google.com>
7163
7164         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7165         defintion if relocation uses GOT entries of the symbol.
7166         * testsuite/icf_safe_test.sh: Fix test.
7167         * testsuite/icf_safe_so_test.sh: Fix test.
7168
7169 2010-09-16  Cary Coutant  <ccoutant@google.com>
7170
7171         * script_sections.cc (class Memory_region): Remove "NULL" from
7172         vector initializations.
7173
7174 2010-09-15  Cary Coutant  <ccoutant@google.com>
7175
7176         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7177         Resolve forwarding symbols.
7178
7179 2010-09-15  Doug Kwan  <dougkwan@google.com>
7180
7181         * gold/testsuite/script_test_3.t: Add ARM special sections.
7182         * gold/testsuite/script_test_4.t: Same.
7183         * gold/testsuite/script_test_5.t: Same.
7184         * gold/testsuite/script_test_6.t: Same.
7185         * gold/testsuite/script_test_7.t: Same.
7186         * gold/testsuite/script_test_7.t: Same.
7187         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7188
7189 2010-09-14  Cary Coutant  <ccoutant@google.com>
7190
7191         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7192         (Target_x86_64::Relocate::relocate_tls): Replace check for
7193         saw_tls_block_reloc_ with test for executable section.
7194
7195 2010-09-12  Cary Coutant  <ccoutant@google.com>
7196
7197         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7198         position-independent executables to shared libraries need dynamic
7199         relocations.
7200         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7201         position-independent executables.
7202         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7203         * testsuite/Makefile.in: Regenerate.
7204
7205 2010-09-10  Nick Clifton  <nickc@redhat.com>
7206
7207         PR gold/11997
7208         * testsuite/memory_test.t: Discard any sections that are not
7209         needed.
7210
7211 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7212
7213         PR gold/11996
7214         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7215         "This::" to work around a bug in gcc 4.2.
7216
7217         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7218
7219 2010-09-09  Rafael Espindola  <espindola@google.com>
7220
7221         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7222         sections with different PF_X flags in the same segment.
7223         (Layout::find_first_load_seg): Search all segments to find the first
7224         one.
7225         * options.h (rosegment): New.
7226
7227 2010-09-08  Rafael Espindola  <espindola@google.com>
7228
7229         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7230
7231 2010-09-08  Doug Kwan  <dougkwan@google.com>
7232
7233         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7234         (Arm_relobj::do_relocate_sections): Add new parameter for output
7235         file to match the parent.
7236         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7237         of local symbols instead of input values.  Update code to track
7238         changes in gold::relocate_section.
7239         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7240         (Sized_relobj::compute_final_local_value_internal): New methods.
7241         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7242         body into private version of Sized_relobj::compute_final_local_value.
7243         Call the inline method.
7244         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7245         merged symbol value if there is one.
7246         (Symbol_value::has_output_value): New method defintiion.
7247         (Sized_relobj::Compute_final_local_value_status): New enum type.
7248         (Sized_relobj::compute_final_local_value): New methods.
7249         (Sized_relobj::compute_final_local_value_internal): New methods.
7250         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7251         and arm_cortex_a8.sh.
7252         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7253         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7254         New tests.
7255         * Makefile.in: Regenerate.
7256         * testsuite/arm_bl_out_of_range.s: Update test.
7257         * testsuite/thumb_bl_out_of_range.s: Ditto.
7258         * testsuite/thumb_blx_out_of_range.s: Ditto.
7259         * testsuite/arm_branch_out_of_range.sh: New file.
7260         * testsuite/arm_cortex_a8.sh: Ditto.
7261         * testsuite/arm_cortex_a8_b.s: Ditto.
7262         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7263         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7264         * testsuite/arm_cortex_a8_bl.s: Ditto.
7265         * testsuite/arm_cortex_a8_blx.s: Ditto.
7266         * testsuite/arm_cortex_a8_local.s: Ditto.
7267         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7268         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7269
7270 2010-09-08  Rafael Espindola  <espindola@google.com>
7271
7272         * Makefile.am (memory_test.stdout): Run readelf with -W.
7273         * Makefile.in: Regenerate.
7274         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7275         64 bit output.
7276
7277 2010-09-08  Rafael Espindola  <espindola@google.com>
7278
7279         * script-sections.cc (Script_sections::add_memory_region): Convert
7280         field precision to int.
7281         * script.cc (script_set_section_region, script_set_section_region):
7282         Convert field precision to int.
7283
7284 2010-09-08  Rafael Espindola  <espindola@google.com>
7285
7286         * arm.cc (do_finalize_sections): Create the __exidx_start and
7287         __exdix_end symbols even when the section is missing.
7288
7289 2010-09-08  Nick Clifton  <nickc@redhat.com>
7290
7291         * README: Remove claim that MEMORY is not supported.
7292         * expression.cc (script_exp_function_origin)
7293         (script_exp_function_length): Move from here to ...
7294         * script.cc: ... here.
7295         (script_set_section_region, script_add_memory)
7296         (script_parse_memory_attr, script_include_directive): New
7297         functions.
7298         * script-sections.cc
7299         (class Memory_region): New class.
7300         (class Output_section_definition): Add set_memory_region,
7301         set_section_vma, set_section_lma and get_section_name methods.
7302         (class Script_Sections): Add add_memory_region,
7303         find_memory_region, find_memory_region_origin,
7304         find_memory_region_length and set_memory_region methods.
7305         Have set_section_addresses method walk the list of set memory
7306         regions.
7307         Extend the print methos to display memory regions.
7308         * script-sections.h: Add prototypes for new methods.
7309         Add enum for MEMORY region attributes.
7310         * yyscript.y: Add support for parsing MEMORY regions.
7311         * script-c.h: Add prototypes for new functions.
7312         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7313         * testsuite/Makefile.in: Regenerate.
7314         * testsuite/memory_test.sh: New script.
7315         * testsuite/memory_test.s: New assembler source file.
7316         * testsuite/memory_test.t: New linker script.
7317
7318 2010-08-27  Doug Kwan  <dougkwan@google.com>
7319
7320         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7321         reference override an existing dynamic weak reference.
7322         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7323         * testsuite/Makefile.in: Regenerate.
7324         * testsuite/dyn_weak_ref.sh: New file.
7325         * testsuite/dyn_weak_ref_1.c: Ditto.
7326         * testsuite/dyn_weak_ref_2.c: Ditto.
7327
7328 2010-08-27  Ian Lance Taylor  <iant@google.com>
7329
7330         * incremental.h (class Incremental_input_entry): Add virtual
7331         destructor.
7332
7333 2010-08-27  Ian Lance Taylor  <iant@google.com>
7334
7335         * testsuite/start_lib_test_3.c: Mark t3 as used.
7336
7337 2010-08-27  Nick Clifton  <nickc@redhat.com>
7338
7339         * options.cc (version_script): Fix small typo in previous
7340         whitespace tidyup.
7341
7342 2010-08-25  Nick Clifton  <nickc@redhat.com>
7343
7344         * archive.cc: Formatting fixes: Remove whitespace between
7345         typename and following asterisk.  Remove whitespace between
7346         function name and opening parenthesis.
7347         * archive.h: Likewise.
7348         * arm.cc: Likewise.
7349         * attributes.cc: Likewise.
7350         * attributes.h: Likewise.
7351         * common.cc: Likewise.
7352         * copy-relocs.cc: Likewise.
7353         * dirsearch.h: Likewise.
7354         * dynobj.cc: Likewise.
7355         * ehframe.cc: Likewise.
7356         * ehframe.h: Likewise.
7357         * expression.cc: Likewise.
7358         * fileread.cc: Likewise.
7359         * fileread.h: Likewise.
7360         * gc.h: Likewise.
7361         * gold-threads.cc: Likewise.
7362         * gold.cc: Likewise.
7363         * i386.cc: Likewise.
7364         * icf.h: Likewise.
7365         * incremental-dump.cc: Likewise.
7366         * incremental.cc: Likewise.
7367         * layout.cc: Likewise.
7368         * layout.h: Likewise.
7369         * main.cc: Likewise.
7370         * merge.cc: Likewise.
7371         * merge.h: Likewise.
7372         * object.cc: Likewise.
7373         * object.h: Likewise.
7374         * options.cc: Likewise.
7375         * options.h: Likewise.
7376         * output.cc: Likewise.
7377         * output.h: Likewise.
7378         * plugin.cc: Likewise.
7379         * plugin.h: Likewise.
7380         * powerpc.cc: Likewise.
7381         * reloc.cc: Likewise.
7382         * script-c.h: Likewise.
7383         * script-sections.cc: Likewise.
7384         * script.cc: Likewise.
7385         * stringpool.cc: Likewise.
7386         * symtab.cc: Likewise.
7387         * symtab.h: Likewise.
7388         * target.cc: Likewise.
7389         * timer.cc: Likewise.
7390         * timer.h: Likewise.
7391         * version.cc: Likewise.
7392         * x86_64.cc: Likewise.
7393
7394 2010-08-24  Nick Clifton  <nickc@redhat.com>
7395
7396         PR 11899
7397         * layout.cc (segment_precedes): Sort segments by their physical
7398         addresses, if they have been set.
7399
7400 2010-08-23  Cary Coutant  <ccoutant@google.com>
7401
7402         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7403         symbols data.
7404         (Lib_group::include_member): Unlock object after deleting its
7405         symbols data.
7406         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7407         the bug fixed here.
7408
7409 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7410             Cary Coutant  <ccoutant@google.com>
7411
7412         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7413         constructor, and set_blocker.
7414         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7415         readsyms_blocker_.
7416         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7417         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7418         * testsuite/Makefile.am (start_lib_test): New test case.
7419         * testsuite/Makefile.in: Regenerate.
7420         * testsuite/start_lib_test_main.c: New file.
7421         * testsuite/start_lib_test_1.c: New file.
7422         * testsuite/start_lib_test_2.c: New file.
7423         * testsuite/start_lib_test_3.c: New file.
7424
7425 2010-08-19  Ian Lance Taylor  <iant@google.com>
7426
7427         * Makefile.in: Rebuild with automake 1.11.1.
7428         * aclocal.m4: Likewise.
7429         * testsuite/Makefile.in: Likewise.
7430
7431 2010-08-19  Ian Lance Taylor  <iant@google.com>
7432
7433         PR 10893
7434         * i386.cc (class Output_data_plt_i386): Update declarations.
7435         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7436         local_ifuncs_ fields.
7437         (Target_i386::do_plt_section_for_global): New function.
7438         (Target_i386::do_plt_section_for_local): New function.
7439         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7440         parameter; change all callers.  Initialize global_ifuncs_ and
7441         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7442         __rel_iplt_end.
7443         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7444         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7445         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7446         symbols.
7447         (Target_i386::make_plt_section): New function, broken out of
7448         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7449         (Target_i386::make_plt_entry): Call make_plt_section.
7450         (Target_i386::make_local_ifunc_plt_entry): New function.
7451         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7452         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7453         R_386_IRELATIVE to switch.
7454         (Target_i386::Scan::global): Likewise.
7455         (Target_i386::Relocate::relocate): Likewise.
7456         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7457         switch.
7458         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7459         (Target_x86_64::do_plt_section_for_global): New function.
7460         (Target_x86_64::do_plt_section_for_local): New function.
7461         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7462         parameter; change all callers.  If doing a static link define
7463         __rela_iplt_start and __rela_iplt_end.
7464         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7465         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7466         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7467         to point to .plt.
7468         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7469         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7470         switch.
7471         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7472         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7473         R_X86_64_IRELATIVE to switch.
7474         (Target_x86_64::Scan::global): Likewise.
7475         (Target_x86_64::Relocate::relocate): Likewise.
7476         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7477         switch.
7478         * target.h (class Target): Add plt_section_for_global and
7479         plt_section_for_local functions.  Add do_plt_section_for_global
7480         and do_plt_section_for_local virtual functions.
7481         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7482         clarifying comments.
7483         (Symbol::use_plt_offset): Handle IFUNC symbol.
7484         * object.cc (Sized_relobj::Sized_relobj): Initialize
7485         local_plt_offsets_.
7486         (Sized_relobj::local_has_plt_offset): New function.
7487         (Sized_relobj::local_plt_offset): New function.
7488         (Sized_relobj::set_local_plt_offset): New function.
7489         (Sized_relobj::do_count): Handle IFUNC symbol.
7490         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7491         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7492         is_ifunc_symbol functions.
7493         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7494         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7495         local_plt_offsets_ field.
7496         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7497         * output.h (class Output_section_data): Add non-const
7498         output_section function.
7499         (class Output_data_got): Update declarations.
7500         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7501         Add use_plt_offset parameter to global and local constructors.
7502         Change all callers.  Change local_sym_index_ field to 31 bits.
7503         Change GSYM_CODE and CONSTANT_CODE accordingly.
7504         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7505         doing a static link don't set sh_link field.
7506         (Output_data_got::Got_entry::write): Use PLT offset if
7507         appropriate.
7508         (Output_data_got::add_global_plt): New function.
7509         (Output_data_got::add_local_plt): New function.
7510         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7511         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7512         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7513         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7514         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7515         IFUNC conditional.
7516         * testsuite/ifunc-sel.h: New file.
7517         * testsuite/ifuncmain1.c: New file.
7518         * testsuite/ifuncmain1vis.c: New file.
7519         * testsuite/ifuncmod1.c: New file.
7520         * testsuite/ifuncdep2.c: New file.
7521         * testsuite/ifuncmain2.c: New file.
7522         * testsuite/ifuncmain3.c: New file.
7523         * testsuite/ifuncmod3.c: New file.
7524         * testsuite/ifuncmain4.c: New file.
7525         * testsuite/ifuncmain5.c: New file.
7526         * testsuite/ifuncmod5.c: New file.
7527         * testsuite/ifuncmain6pie.c: New file.
7528         * testsuite/ifuncmod6.c: New file.
7529         * testsuite/ifuncmain7.c: New file.
7530         * configure, testsuite/Makefile.in: Rebuild.
7531
7532 2010-08-18  Ian Lance Taylor  <iant@google.com>
7533
7534         * incremental.cc
7535         (Output_section_incremental_inputs::write_input_files): Add cast
7536         to avoid signed/unsigned comparison warning.
7537         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7538
7539 2010-08-12  Cary Coutant  <ccoutant@google.com>
7540
7541         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7542
7543 2010-08-13  Ian Lance Taylor  <iant@google.com>
7544
7545         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7546
7547 2010-08-12  Cary Coutant  <ccoutant@google.com>
7548             Doug Kwan  <dougkwan@google.com>
7549
7550         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7551         defintion overrides non-weak undef, remember that the original undef
7552         is not weak.
7553         * symtab.cc (Symbol_table::sized_write_global): For undef without
7554         an original weak binding, set binding to global in output.
7555         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7556         * testsuite/Makefile.in: Regenerate.
7557         * testsuite/strong_ref_weak_def.sh: New file.
7558         * testsuite/strong_ref_weak_def_1.c: Ditto.
7559         * testsuite/strong_ref_weak_def_2.c: Ditto.
7560
7561 2010-08-12  Cary Coutant  <ccoutant@google.com>
7562
7563         * testsuite/incremental_test.sh: Rewrite.
7564         * testsuite/incremental_test_1.c: Rewrite.
7565         * testsuite/incremental_test_2.c: Rewrite.
7566
7567 2010-08-12  Cary Coutant  <ccoutant@google.com>
7568
7569         * arm.cc (Target_arm::got_size): Add const.
7570         (Target_arm::got_entry_count): New function.
7571         (Target_arm::plt_entry_count): New function.
7572         (Target_arm::first_plt_entry_offset): New function.
7573         (Target_arm::plt_entry_size): New function.
7574         (Output_data_plt_arm::entry_count): New function.
7575         (Output_data_plt_arm::first_plt_entry_offset): New function.
7576         (Output_data_plt_arm::get_plt_entry_size): New function.
7577         * i386.cc (Target_i386::got_size): Add const.
7578         (Target_i386::got_entry_count): New function.
7579         (Target_i386::plt_entry_count): New function.
7580         (Target_i386::first_plt_entry_offset): New function.
7581         (Target_i386::plt_entry_size): New function.
7582         (Output_data_plt_i386::entry_count): New function.
7583         (Output_data_plt_i386::first_plt_entry_offset): New function.
7584         (Output_data_plt_i386::get_plt_entry_size): New function.
7585         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7586         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7587         * incremental.cc: Include target.h.
7588         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7589         parameter.  Adjust all callers.  Find incremental_got_plt section.
7590         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7591         section.
7592         (Output_section_incremental_inputs::set_final_data_size): Calculate
7593         size of incremental_got_plt section.
7594         (Output_section_incremental_inputs::do_write): Write the
7595         incremental_got_plt section.
7596         (Got_plt_view_info): New struct.
7597         (Local_got_offset_visitor): New class.
7598         (Global_got_offset_visitor): New class.
7599         (Global_symbol_visitor_got_plt): New class.
7600         (Output_section_incremental_inputs::write_got_plt): New function.
7601         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7602         Add parameter.  Adjust all callers.
7603         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7604         (Incremental_inputs::got_plt_section): New function.
7605         (Incremental_inputs::got_plt_section_): New data member.
7606         (Incremental_got_plt_reader): New class.
7607         * layout.cc (Layout::create_incremental_info_sections): Add the
7608         incremental_got_plt section.
7609         * object.h (Got_offset_list::get_list): New function.
7610         (Got offset_list::for_all_got_offsets): New function.
7611         (Sized_relobj::local_got_offset_list): New function.
7612         * powerpc.cc (Target_powerpc::got_size): Add const.
7613         (Target_powerpc::got_entry_count): New function.
7614         (Target_powerpc::plt_entry_count): New function.
7615         (Target_powerpc::first_plt_entry_offset): New function.
7616         (Target_powerpc::plt_entry_size): New function.
7617         (Output_data_plt_powerpc::entry_count): New function.
7618         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7619         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7620         * sparc.cc (Target_sparc::got_size): Add const.
7621         (Target_sparc::got_entry_count): New function.
7622         (Target_sparc::plt_entry_count): New function.
7623         (Target_sparc::first_plt_entry_offset): New function.
7624         (Target_sparc::plt_entry_size): New function.
7625         (Output_data_plt_sparc::entry_count): New function.
7626         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7627         (Output_data_plt_sparc::get_plt_entry_size): New function.
7628         * symtab.h (Symbol::got_offset_list): New function.
7629         (Symbol_table::for_all_symbols): New function.
7630         * target.h (Sized_target::got_entry_count): New function.
7631         (Sized_target::plt_entry_count): New function.
7632         (Sized_target::plt_entry_size): New function.
7633         * x86_64.cc (Target_x86_64::got_size): Add const.
7634         (Target_x86_64::got_entry_count): New function.
7635         (Target_x86_64::plt_entry_count): New function.
7636         (Target_x86_64::first_plt_entry_offset): New function.
7637         (Target_x86_64::plt_entry_size): New function.
7638         (Output_data_plt_x86_64::entry_count): New function.
7639         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7640         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7641
7642 2010-08-12  Cary Coutant  <ccoutant@google.com>
7643
7644         * archive.cc: Include incremental.h.
7645         (Archive::Archive): Initialize incremental_info_.
7646         (Archive::include_member): Record archive members in incremental info.
7647         (Add_archive_symbols::run): Record begin and end of an archive in
7648         incremental info.
7649         (Lib_group::include_member): Record objects in incremental info.
7650         * archive.h (Incremental_archive_entry): Forward declaration.
7651         (Archive::set_incremental_info): New member function.
7652         (Archive::incremental_info): New member function.
7653         (Archive::Unused_symbol_iterator): New class.
7654         (Archive::unused_symbols_begin): New member function.
7655         (Archive::unused_symbols_end): New member function.
7656         (Archive::incremental_info_): New data member.
7657         * incremental-dump.cc (find_input_containing_global): New function.
7658         (dump_incremental_inputs): Dump new incremental info sections.
7659         * incremental.cc: Include symtab.h.
7660         (Output_section_incremental_inputs): New class.
7661         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7662         new incremental info sections.
7663         (Sized_incremental_binary::do_check_inputs): Likewise.
7664         (Incremental_inputs::report_archive): Remove.
7665         (Incremental_inputs::report_archive_begin): New function.
7666         (Incremental_inputs::report_archive_end): New function.
7667         (Incremental_inputs::report_object): New function.
7668         (Incremental_inputs::finalize_inputs): Remove.
7669         (Incremental_inputs::report_input_section): New function.
7670         (Incremental_inputs::report_script): Rewrite.
7671         (Incremental_inputs::finalize): Do nothing but finalize string table.
7672         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7673         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7674         (Incremental_inputs::create_data_sections): New function.
7675         (Incremental_inputs::relocs_entsize): New function.
7676         (Output_section_incremental_inputs::set_final_data_size): New function.
7677         (Output_section_incremental_inputs::do_write): New function.
7678         (Output_section_incremental_inputs::write_header): New function.
7679         (Output_section_incremental_inputs::write_input_files): New function.
7680         (Output_section_incremental_inputs::write_info_blocks): New function.
7681         (Output_section_incremental_inputs::write_symtab): New function.
7682         * incremental.h (Incremental_script_entry): Forward declaration.
7683         (Incremental_object_entry): Forward declaration.
7684         (Incremental_archive_entry): Forward declaration.
7685         (Incremental_inputs): Forward declaration.
7686         (Incremental_inputs_header_data): Remove.
7687         (Incremental_inputs_header): Remove.
7688         (Incremental_inputs_header_write): Remove.
7689         (Incremental_inputs_entry_data): Remove.
7690         (Incremental_inputs_entry): Remove.
7691         (Incremental_inputs_entry_write): Remove.
7692         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7693         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7694         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7695         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7696         Likewise.
7697         (Incremental_input_entry): New class.
7698         (Incremental_script_entry): New class.
7699         (Incremental_object_entry): New class.
7700         (Incremental_archive_entry): New class.
7701         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7702         (Incremental_inputs::report_inputs): Remove.
7703         (Incremental_inputs::report_archive): Remove.
7704         (Incremental_inputs::report_archive_begin): New function.
7705         (Incremental_inputs::report_archive_end): New function.
7706         (Incremental_inputs::report_object): Change prototype.
7707         (Incremental_inputs::report_input_section): New function.
7708         (Incremental_inputs::report_script): Change prototype.
7709         (Incremental_inputs::get_reloc_count): New function.
7710         (Incremental_inputs::set_reloc_count): New function.
7711         (Incremental_inputs::create_data_sections): New function.
7712         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7713         (Incremental_inputs::inputs_section): New function.
7714         (Incremental_inputs::symtab_section): New function.
7715         (Incremental_inputs::relocs_section): New function.
7716         (Incremental_inputs::get_stringpool): Add const.
7717         (Incremental_inputs::command_line): Add const.
7718         (Incremental_inputs::inputs): Remove.
7719         (Incremental_inputs::command_line_key): New function.
7720         (Incremental_inputs::input_file_count): New function.
7721         (Incremental_inputs::input_files): New function.
7722         (Incremental_inputs::relocs_entsize): New function.
7723         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7724         (Incremental_inputs::finalize_inputs): Remove.
7725         (Incremental_inputs::Input_info): Remove.
7726         (Incremental_inputs::lock_): Remove.
7727         (Incremental_inputs::inputs_): Change type.
7728         (Incremental_inputs::inputs_map_): Remove.
7729         (Incremental_inputs::current_object_entry_): New data member.
7730         (Incremental_inputs::inputs_section_): New data member.
7731         (Incremental_inputs::symtab_section_): New data member.
7732         (Incremental_inputs::relocs_section_): New data member.
7733         (Incremental_inputs::reloc_count_): New data member.
7734         (Incremental_inputs_reader): New class.
7735         (Incremental_symtab_reader): New class.
7736         (Incremental_relocs_reader): New class.
7737         * layout.cc (Layout::finalize): Move finalization of incremental info
7738         and creation of incremental info sections to follow finalization of
7739         symbol table.  Set offsets for postprocessing sections.
7740         (Layout::create_incremental_info_sections): Call
7741         Incremental_inputs::create_data_sections.  Add incremental symtab
7742         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7743         sections to layout after input sections.
7744         * layout.h (struct Timespec): Forward declaration.
7745         (Layout::incremental_inputs): Add const.
7746         (Layout::create_incremental_info_sections): Add parameter.
7747         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7748         * object.cc: Include incremental.h.
7749         (Relobj::finalize_incremental_relocs): New function.
7750         (Sized_relobj::do_layout): Record input sections in incremental info.
7751         * object.h (Object::output_section): New function.
7752         (Object::output_section_offset): Moved from Relobj.
7753         (Object::get_incremental_reloc_base): New function.
7754         (Object::get_incremental_reloc_count): New function.
7755         (Object::do_output_section): New function.
7756         (Object::do_output_section_offset): Moved from Relobj.
7757         (Object::do_get_incremental_reloc_base): New function.
7758         (Object::do_get_incremental_reloc_count): New function.
7759         (Object::Object): Initialize new data members.
7760         (Relobj::output_section): Renamed do_output_section and moved to
7761         protected.
7762         (Relobj::output_section_offset): Moved to Object.
7763         (Relobj::do_get_incremental_reloc_base): New function.
7764         (Relobj::do_get_incremental_reloc_count): New function.
7765         (Relobj::allocate_incremental_reloc_counts): New function.
7766         (Relobj::count_incremental_reloc): New function.
7767         (Relobj::finalize_incremental_relocs): New function.
7768         (Relobj::next_incremental_reloc_index): New function.
7769         (Relobj::reloc_counts_): New data member.
7770         (Relobj::reloc_bases_): New data member.
7771         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7772         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7773         (Sized_relobj::incremental_relocs_scan): New function.
7774         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7775         (Sized_relobj::incremental_relocs_write): New function.
7776         (Sized_relobj::incremental_relocs_write_reltype): New function.
7777         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7778         incremental link.
7779         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7780         archives and object files elsewhere.
7781         (Add_symbols::run): Report object files here.
7782         (Finish_group::run): Report end of archive at end of group.
7783         * reloc.cc: Include layout.h, incremental.h.
7784         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7785         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7786         (Sized_relobj::incremental_relocs_scan): New function.
7787         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7788         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7789         (Sized_relobj::incremental_relocs_write): New function.
7790         (Sized_relobj::incremental_relocs_write_reltype): New function.
7791         * script.cc (read_input_script): Rewrite test for incremental link.
7792         Change call to Incremental_inputs::report_script.
7793         * symtab.h (Symbol_table::first_global_index): New function.
7794         (Symbol_table::output_count): New function.
7795
7796 2010-08-12  Doug Kwan  <dougkwan@google.com>
7797
7798         * arm.cc (Target_arm::merge_object_attributes): Check command line
7799         options --no-wchar-size-warning and --no-enum-size-warning.
7800         * options.h (General_options): Add ld-compatible options
7801         --no-enum-size-warning and --no-wchar-size-warning.
7802
7803 2010-08-04  Ian Lance Taylor  <iant@google.com>
7804
7805         * x86_64.cc (Target_x86_64::Scan::local): Use
7806         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7807         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7808         (Target_x86_64::Scan::global): Likewise.
7809         (Target_x86_64::Relocate::relocate): Likewise.
7810         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7811         Likewise.
7812
7813 2010-08-03  Cary Coutant  <ccoutant@google.com>
7814
7815         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7816         to reserve space in merged_strings vector. Keep total input size
7817         for stats.
7818         (Output_merge_string::do_print_merge_stats): Print total input size.
7819         * merge.h (Output_merge_string): Add input_size_ field.
7820         * stringpool.cc (Stringpool_template::string_length): Move
7821         implementations out of Stringpool_template class and place in
7822         stringpool.h.
7823         * stringpool.h (string_length): Move out of Stringpool_template.
7824
7825 2010-08-03  Ian Lance Taylor  <iant@google.com>
7826
7827         PR 11712
7828         * layout.cc (relaxation_loop_body): If address of load segment is
7829         set, adjust address to include headers if possible.
7830
7831 2010-08-03  Ian Lance Taylor  <iant@google.com>
7832
7833         * version.cc (version_string): Bump to 1.10.
7834
7835 2010-08-03  Ian Lance Taylor  <iant@google.com>
7836
7837         PR 11805
7838         * layout.h (enum Output_section_order): Define.
7839         (class Layout): Update declarations.
7840         * layout.cc (Layout::get_output_section): Add order parameter.
7841         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7842         is_first_non_relro parameters.  Change all callers.
7843         (Layout::choose_output_section): Likewise.
7844         (Layout::add_output_section_data): Likewise.
7845         (Layout::make_output_section): Likewise.  Set order.
7846         (Layout::default_section_order): New function.
7847         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7848         * output.cc (Output_section::Output_section): Initialize order_.
7849         Don't initialize deleted fields.
7850         (Output_segment::Output_segment): Don't initialize deleted
7851         fields.
7852         (Output_segment::add_output_section_to_load): New function
7853         replacing add_output_section.  Change all callers to call this or
7854         add_output_section_to_nonload.
7855         (Output_segment::add_output_section_to_nonload): New function.
7856         (Output_segment::remove_output_section): Rewrite.
7857         (Output_segment::add_initial_output_data): Likewise.
7858         (Output_segment::has_any_data_sections): Likewise.
7859         (Output_segment::is_first_section_relro): Likewise.
7860         (Output_segment::maximum_alignment): Likewise.
7861         (Output_segment::has_dynamic_reloc): New function replacing
7862         dynamic_reloc_count.  Change all callers.
7863         (Output_segment::has_dynamic_reloc_list): New function replacing
7864         dynamic_reloc_count_list.  Change all callers.
7865         (Output_segment::set_section_addresses): Rewrite.
7866         (Output_segment::set_offset): Rewrite.
7867         (Output_segment::find_first_and_last_list): Remove.
7868         (Output_segment::set_tls_offsets): Rewrite.
7869         (Output_segment::first_section_load_address): Likewise.
7870         (Output_segment::output_section_count): Likewise.
7871         (Output_segment::section_with_lowest_load_address): Likewise.
7872         (Output_segment::write_section_headers): Likewise.
7873         (Output_segment::print_sections_to_map): Likewise.
7874         * output.h (class Output_data): Remove dynamic_reloc_count_
7875         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7876         (Output_data::add_dynamic_reloc): Rewrite.
7877         (Output_data::has_dynamic_reloc): New function.
7878         (Output_data::dynamic_reloc_count): Remove.
7879         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7880         is_last_relro_, is_first_non_relro_, is_interp_,
7881         is_dynamic_linker_section_ fields.  Add order and set_order
7882         functions.  Remove is_relro_local, set_is_relro_local,
7883         is_last_relro, set_is_last_relro, is_first_non_relro,
7884         set_is_first_non_relro functions, is_interp, set_is_interp,
7885         is_dynamic_linker_section, and set_is_dynamic_linker_section
7886         functions.
7887         (class Output_segment): Change Output_data_list from std::list to
7888         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7889         output_bss_ fields.  Update declarations.
7890
7891 2010-08-02  Ian Lance Taylor  <iant@google.com>
7892
7893         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7894         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7895         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7896
7897 2010-08-02  Ian Lance Taylor  <iant@google.com>
7898
7899         PR 11855
7900         * script.cc (Script_options::Script_options): Initialize
7901         symbol_definitions_ and symbol_references_.
7902         (Script_options::add_symbol_assignment): Update
7903         symbol_definitions_ and symbol_references_.
7904         (Script_options::add_symbol_reference): New function.
7905         (script_symbol): New function.
7906         * script.h (class Script_options): Add symbol_definitions_ and
7907         symbol_references_ fields.
7908         (Script_options::referenced_const_iterator): New type.
7909         (Script_options::referenced_begin): New function.
7910         (Script_options::referenced_end): New function.
7911         (Script_options::is_referenced): New function.
7912         (Script_options::any_unreferenced): New function.
7913         * script-c.h (script_symbol): Declare.
7914         * yyscript.y (exp): Call script_symbol.
7915         * symtab.cc: Include "script.h".
7916         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7917         Change all callers.  Check symbols referenced by scripts.
7918         (Symbol_table::add_undefined_symbols_from_command_line): Add
7919         layout parameter.  Change all callers.
7920         (Symbol_table::do_add_undefined_symbols_from_command_line):
7921         Likewise.  Break out loop body.  Check symbols referenced by
7922         scripts.
7923         (Symbol_table::add_undefined_symbol_from_command_line): New
7924         function broken out of
7925         do_add_undefined_symbols_from_command_line.
7926         * symtab.h (class Symbol_table): Update declarations.
7927         * archive.cc: Include "layout.h".
7928         (Archive::should_include_member): Add layout parameter.  Change
7929         all callers.  Check for symbol mentioned in expression.
7930         * archive.h (class Archive): Update declaration.
7931         * object.cc (Sized_relobj::do_should_include_member): Add layout
7932         parameter.
7933         * object.h (Object::should_include_member): Add layout parameter.
7934         Change all callers.
7935         (Object::do_should_include_member): Add layout parameter.
7936         (class Sized_relobj): Update declaration.
7937         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7938         parameter.
7939         * dynobj.h (class Sized_dynobj): Update declaration.
7940         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7941         layout parameter.
7942         * plugin.h (class Sized_pluginobj): Update declaration.
7943
7944 2010-08-02  Ian Lance Taylor  <iant@google.com>
7945
7946         PR 11866
7947         * output.cc (Output_segment::set_offset): Search for the first and
7948         last sections rather than assuming that the list is in order.
7949         (Output_segment::find_first_and_last_list): New function.
7950         * output.h (class Output_segment): Update declarations.
7951         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7952         (relro_strip_test_SOURCES): New variable.
7953         (relro_strip_test_DEPENDENCIES): New variable.
7954         (relro_strip_test_LDFLAGS): New variable.
7955         (relro_strip_test_LDADD): New variable.
7956         (relro_strip_test.so): New target.
7957
7958 2010-08-02  Ian Lance Taylor  <iant@google.com>
7959
7960         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7961         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7962         (Target_i386::got_tlsdesc_section): New function.
7963         (Target_i386::got_section): Create space for GOT entries for
7964         TLSDESC relocations.
7965         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7966         R_386_TLS_GOTDESC.
7967         (Target_i386::Scan::global): Likewise.
7968         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7969         using TLSDESC GOT.
7970         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7971         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7972         (Target_x86_64::got_tlsdesc_section): New function.
7973         (Target_x86_64::got_section): Create space for GOT entries for
7974         TLSDESC relocations.
7975         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7976         R_386_TLS_GOTDESC.
7977         (Target_x86_64::Scan::global): Likewise.
7978         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7979         using TLSDESC GOT.
7980
7981 2010-08-02  Ian Lance Taylor  <iant@google.com>
7982
7983         * testsuite/final_layout.sh: Use dc to convert from hex to
7984         decimal.
7985
7986 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7987
7988         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7989         paramter to the call to gold::gc_process_relocs.
7990         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7991         paramter to the call to gold::gc_process_relocs.
7992         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7993         parameter to the call to gold::gc_process_relocs.
7994         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7995         template parameter to the call to gold::gc_process_relocs.
7996         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7997         paramter to the call to gold::gc_process_relocs.
7998         * gc.h (get_embedded_addend_size): New function.
7999         (gc_process_relocs): Save the size of the reloc for use by ICF.
8000         * icf.cc (get_section_contents): Get the addend from the text section
8001         for SHT_REL relocation sections.
8002         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8003         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8004         * int_encoding.h (read_from_pointer): New overloaded function.
8005         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8006         * testsuite/icf_sht_rel_addend_test.sh: New file.
8007         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8008         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8009
8010 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8011
8012         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8013         * Makefile.in: Regenerate.
8014         * testsuite/Makefile.in: Regenerate.
8015
8016 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8017
8018         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8019         * gold/testsuite/debug_msg.cc: Likewise.
8020         * gold/testsuite/odr_violation1.cc
8021         * gold/testsuite/odr_violation2.cc
8022
8023 2010-07-21  Cary Coutant  <ccoutant@google.com>
8024
8025         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8026         string, and length fields.
8027         (Output_merge_string::Merged_strings_list): New type.
8028         (Output_merge_string::Merged_strings_lists): New typedef.
8029         (Output_merge_string): Replace merged_strings_ with
8030         merged_strings_lists_.
8031         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8032         Merged_strings_list per input object and section.  Don't store pointer
8033         to the string.  Don't store length with each merged string entry.
8034         (Output_merge_string::finalize_merged_data): Loop over list of merged
8035         strings lists.  Recompute length of each merged string.
8036
8037 2010-07-15  Cary Coutant  <ccoutant@google.com>
8038
8039         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8040         here.
8041
8042 2010-07-14  Ian Lance Taylor  <iant@google.com>
8043
8044         * descriptors.cc (Descriptors::open): Report correct name in error
8045         message.
8046
8047 2010-07-13  Doug Kwan  <dougkwan@google.com>
8048
8049         * arm.cc (Arm_input_section::Arm_input_section): For a
8050         SHT_ARM_EXIDX section, always keeps the input sections.
8051         (Arm_input_section::set_exidx_section_link): New method.
8052         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8053         has_errors_ to false.
8054         (Arm_exidx_input_section::has_errors,
8055         Arm_exidx_input_section::set_has_errors): New methods.
8056         (Arm_exidx_input_section::has_errors_): New data member.
8057         (Arm_relobj::get_exidx_shndx_list): New method.
8058         (Arm_output_section::append_text_sections_to_list): Do not skip
8059         section without SHF_EXECINSTR.
8060         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8061         errors.
8062         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8063         section header.  Make error messages more verbose.  Check for
8064         a non-executable section linked to an EXIDX section.
8065         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8066         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8067         check that there is no deferred EXIDX section if we exit early.
8068         Instead of not making an EXIDX section in case of an error, make one
8069         and set the has_errors flag of it.
8070         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8071         in a relocatable link.
8072         (Target_arm::do_relax): Look for the EXIDX output section instead of
8073         assuming that it is called .ARM.exidx.
8074         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8075         section list.  Do not check for SHF_EXECINSTR section flags but
8076         skip any input section with errors.
8077         * output.cc (Output_section::Output_section): Initialize
8078         always_keeps_input_sections_ to false.
8079         (Output_section::add_input_section): Check for
8080         always_keeps_input_sections_.
8081         *  output.h (Output_section::always_keeps_input_sections,
8082         Output_section::set_always_keeps_input_sections): New methods.
8083         (Output_section::always_keeps_input_sections): New data member.
8084
8085 2010-07-13  Rafael Espindola  <espindola@google.com>
8086
8087         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8088         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8089
8090 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8091             Ian Lance Taylor  <iant@google.com>
8092
8093         * output.h (Output_section_lookup_maps::add_merge_section):
8094         Correct check of whether value was inserted.
8095         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8096         (Output_section_lookup_maps::add_relaxed_input_section):
8097         Likewise.
8098         * arm.cc (Target_arm::got_section): Remove used local os.
8099         * i386.cc (Target_i386::got_section): Likewise.
8100         * x86_64.cc (Target_x86_64::got_section): Likewise.
8101         * sparc.cc (Target_sparc::got_section): Likewise.
8102         (Target_sparc::relocate): Remove unused local have_got_offset.
8103         * powerpc.cc (Target_powerpc::relocate): Likewise.
8104
8105 2010-07-13  Ian Lance Taylor  <iant@google.com>
8106
8107         * compressed_output.cc (zlib_decompress): Fix signature in
8108         !HAVE_ZLIB_H case.
8109
8110         * archive.cc (Archive::include_member): Unlock an external member
8111         of a thin archive.  Don't bother to delete an object we know is
8112         NULL.
8113
8114 2010-07-12  Cary Coutant  <ccoutant@google.com>
8115
8116         * compressed_output.cc (zlib_decompress): New function.
8117         (get_uncompressed_size): New function.
8118         (decompress_input_section): New function.
8119         * compressed_output.h (get_uncompressed_size): New function.
8120         (decompress_input_section): New function.
8121         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8122         Handle compressed debug sections.
8123         * layout.cc (is_compressed_debug_section): New function.
8124         (Layout::output_section_name): Map compressed section names to
8125         canonical names.
8126         * layout.h (is_compressed_debug_section): New function.
8127         (is_debug_info_section): Recognize compressed debug sections.
8128         * merge.cc: Include compressed_output.h.
8129         (Output_merge_data::do_add_input_section): Handle compressed
8130         debug sections.
8131         (Output_merge_string::do_add_input_section): Handle compressed
8132         debug sections.
8133         * object.cc: Include compressed_output.h.
8134         (Sized_relobj::Sized_relobj): Initialize new data members.
8135         (build_compressed_section_map): New function.
8136         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8137         * object.h (Object::section_is_compressed): New method.
8138         (Object::do_section_is_compressed): New method.
8139         (Sized_relobj::Compressed_section_map): New type.
8140         (Sized_relobj::do_section_is_compressed): New method.
8141         (Sized_relobj::compressed_sections_): New data member.
8142         * output.cc (Output_section::add_input_section): Handle compressed
8143         debug sections.
8144         * reloc.cc: Include compressed_output.h.
8145         (Sized_relobj::write_sections): Handle compressed debug sections.
8146
8147 2010-07-08  Cary Coutant  <ccoutant@google.com>
8148
8149         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8150         weak when resolving to a dynamic def.
8151         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8152         for weak undef/dynamic def cases. Adjust callers.
8153         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8154         undef_binding_weak_.
8155         (Symbol_table::sized_write_globals): Adjust symbol binding.
8156         (Symbol_table::sized_write_symbol): Add binding parameter.
8157         * symtab.h (Symbol::set_undef_binding): New method.
8158         (Symbol::is_undef_binding_weak): New method.
8159         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8160         (Symbol_table::should_override): Add new parameter.
8161         (Symbol_table::sized_write_symbol): Add new parameter.
8162
8163         * testsuite/weak_undef_file1.cc: Add new test case.
8164         * testsuite/weak_undef_file2.cc: Fix header comment.
8165         * testsuite/weak_undef_test.cc: Add new test case.
8166
8167 2010-06-29  Doug Kwan  <dougkwan@google.com>
8168
8169         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8170         Initialize USE_SYMBOL_.
8171         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8172         definition.
8173         (Arm_reloc_property::uses_symbol_): New data member declaration.
8174         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8175         uses symbol value and symbol is undefined but not weakly undefined.
8176
8177 2010-06-28  Rafael Espindola  <espindola@google.com>
8178
8179         * plugin.cc (Plugin::load): Use dlerror.
8180
8181 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8182
8183         * symtab.cc (detect_odr_violations): When reporting an ODR
8184         violation, report an object where the symbol is defined.
8185
8186 2010-06-25  Doug Kwan  <dougkwan@google.com>
8187
8188         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8189         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8190         definition.
8191         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8192         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8193         target hook to detect function points.
8194         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8195         * icf.h (Icf::check_section_for_function_pointers): Change type of
8196         parameter SECTION_NAME to const reference to std::string.  Use
8197         target hook to determine if section may have unsafe pointers.
8198         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8199         method definition.
8200
8201 2010-06-21  Rafael Espindola  <espindola@google.com>
8202
8203         * fileread.cc (Input_file::find_fie): New
8204         (Input_file::open): Use Input_file::find_fie.
8205         * fileread.h (Input_file::find_fie): New
8206         * plugin.cc (set_extra_library_path): New.
8207         (Plugin::load): Add set_extra_library_path to the transfer vector.
8208         (Plugin_manager::set_extra_library_path): New.
8209         (Plugin_manager::add_input_file): Use the extra search path if set.
8210         (set_extra_library_path(): New.
8211         * plugin.h (Plugin_manager): Add set_extra_library_path and
8212         extra_search_path_.
8213
8214 2010-06-19  Cary Coutant  <ccoutant@google.com>
8215
8216         * layout.cc (gdb_sections): Add .debug_types.
8217         (lines_only_debug_sections): Likewise.
8218
8219 2010-06-18  Rafael Espindola  <espindola@google.com>
8220
8221         * plugin.cc (add_input_file,add_input_library)
8222         (Plugin_manager::add_input_file): Make filename arguments const.
8223         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8224         const.
8225
8226 2010-06-16  Doug Kwan  <dougkwan@google.com>
8227
8228         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8229         .ARM.attributes section if we have not merged any input
8230         attributes sections.
8231
8232 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8233
8234         * arm.cc: Allow combining objects with no EABI version
8235         information.
8236
8237 2010-06-15  Rafael Espindola  <espindola@google.com>
8238
8239         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8240
8241 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8242
8243         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8244         (struct iovec): Correct !HAVE_READV definition.
8245
8246 2010-06-10  Cary Coutant  <ccoutant@google.com>
8247
8248         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8249         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8250         reloc sections.
8251         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8252
8253         PR 11683
8254         * symtab.h (Symbol::is_placeholder): New member function.
8255         * target-reloc.h (relocate_section): Check for placeholder symbols.
8256
8257         * testsuite/Makefile.am (plugin_test_8): New test.
8258         (plugin_test_9): New test.
8259         * testsuite/Makefile.in: Regenerate.
8260
8261 2010-06-09  Nick Clifton  <nickc@redhat.com>
8262
8263         * yyscript.y (input_list_element): Allow strings prefixed with
8264         the '-' character.  Treat these as libraries.
8265         * script.cc (script_add_library): New function.  Adds a library
8266         specified by "-l<name>" found in an input script.
8267         * script-c.h: Add prototype for script_add_library.
8268
8269 2010-06-07  Doug Kwan  <dougkwan@google.com>
8270
8271         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8272         Restrict stub-group size to be within long conditional branch
8273         range when working around cortex-A8 erratum.
8274
8275 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8276
8277         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8278         #ifdef typo.
8279
8280 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8281
8282         PR gold/11658
8283         * output.cc
8284         (Output_section::Input_section_sort_entry::compare_section_ordering):
8285         Change to return non-zero correctly.
8286         (Output_section::Input_section_sort_section_order_index_compare
8287         ::operator()): Change to fix ambiguity in comparisons.
8288
8289 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8290
8291         * gold.h (is_wildcard_string): New function.
8292         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8293         (Layout::layout_eh_frame): Ditto.
8294         (Layout::find_section_order_index): New method.
8295         (Layout::read_layout_from_file): New method.
8296         * layout.h (Layout::find_section_order_index): New method.
8297         (Layout::read_layout_from_file): New method.
8298         (Layout::input_section_position_): New private member.
8299         (Layout::input_section_glob_): New private member.
8300         * main.cc (main): Call read_layout_from_file here.
8301         * options.h (--section-ordering-file): New option.
8302         * output.cc (Output_section::input_section_order_specified_): New
8303         member.
8304         (Output_section::Output_section): Initialize new member.
8305         (Output_section::add_input_section): Add new parameter.
8306         Keep input sections when --section-ordering-file is used.
8307         (Output_section::set_final_data_size): Sort input sections when
8308         section ordering file is specified.
8309         (Output_section::Input_section_sort_entry): Add new parameter.
8310         Check sorting type.
8311         (Output_section::Input_section_sort_entry::compare_section_ordering):
8312         New method.
8313         (Output_section::Input_section_sort_compare::operator()): Change to
8314         consider section_order_index.
8315         (Output_section::Input_section_sort_init_fini_compare::operator()):
8316         Change to consider section_order_index.
8317         (Output_section::Input_section_sort_section_order_index_compare
8318         ::operator()): New method.
8319         (Output_section::sort_attached_input_sections): Change to sort
8320         according to section order when specified.
8321         (Output_section::add_input_section<32, true>): Add new parameter.
8322         (Output_section::add_input_section<64, true>): Add new parameter.
8323         (Output_section::add_input_section<32, false>): Add new parameter.
8324         (Output_section::add_input_section<64, false>): Add new parameter.
8325         * output.h (Output_section::add_input_section): Add new parameter.
8326         (Output_section::input_section_order_specified): New
8327         method.
8328         (Output_section::set_input_section_order_specified): New method.
8329         (Input_section::Input_section): Initialize section_order_index_.
8330         (Input_section::section_order_index): New method.
8331         (Input_section::set_section_order_index): New method.
8332         (Input_section::section_order_index_): New member.
8333         (Input_section::Input_section_sort_section_order_index_compare): New
8334         struct.
8335         (Output_section::input_section_order_specified_): New member.
8336         * script-sections.cc (is_wildcard_string): Delete and move modified
8337         method to gold.h.
8338         (Output_section_element_input::Output_section_element_input): Modify
8339         call to is_wildcard_string.
8340         (Output_section_element_input::Input_section_pattern
8341         ::Input_section_pattern): Ditto.
8342         (Output_section_element_input::Output_section_element_input): Ditto.
8343         * testsuite/Makefile.am (final_layout): New test case.
8344         * testsuite/Makefile.in: Regenerate.
8345         * testsuite/final_layout.cc: New file.
8346         * testsuite/final_layout.sh: New file.
8347
8348 2010-06-01  Rafael Espindola  <espindola@google.com>
8349
8350         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8351
8352 2010-06-01  Rafael Espindola  <espindola@google.com>
8353
8354         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8355         visibility of symbols.
8356
8357 2010-05-27  Doug Kwan  <dougkwan@google.com>
8358
8359         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8360         from start of output section instead of address for a local symbol
8361         in a merged or relaxed section when doing a relocatable link.
8362
8363 2010-05-26  Rafael Espindola  <espindola@google.com>
8364
8365         PR 11604
8366         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8367         adding sections the garbage collector removed.
8368         * gold/testsuite/Makefile.am: Add test.
8369         * gold/testsuite/Makefile.in: Regenerate.
8370         * gold/testsuite/plugin_test_7.sh: New.
8371         * gold/testsuite/plugin_test_7_1.c: New.
8372         * gold/testsuite/plugin_test_7_2.c: New.
8373
8374 2010-05-26  Rafael Espindola  <espindola@google.com>
8375
8376         * script-sections.cc (Output_section_definition::set_section_addresses):
8377         Check for --section-start.
8378
8379 2010-05-26  Doug Kwan  <dougkwan@google.com>
8380
8381         * arm.cc (Arm_scan_relocatable_relocs): New class.
8382         (Target_arm::relocate_special_relocatable): New method.
8383         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8384         (Arm_relocate_functions::thumb_branch_common): Same.
8385         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8386         instead of Default_scan_relocatable_relocs.
8387         * target-reloc.h (relocate_for_relocatable): Let target handle
8388         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8389         * target.h (Sized_target::relocate_special_relocatable): New method.
8390
8391 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8392
8393         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8394
8395 2010-05-23  Doug Kwan  <dougkwan@google.com>
8396
8397         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8398         instead of a cast.
8399         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8400         with a direct branch, not a conditional branch, to a stub.
8401         * merge.cc (Output_merge_base::record_input_section): New method
8402         defintion.
8403         (Output_merge_data::do_add_input_section): Record input section if
8404         keeps-input-sections flag is set.
8405         (Output_merge_string::do_add_input_section): Ditto.
8406         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8407         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8408         INPUT_SECTIONS_.
8409         (Output_merge_base::keeps_input_sections,
8410         Output_merge_base::set_keeps_input_sections,
8411         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8412         method definitions.
8413         (Output_merge_base::Input_sections): New type declaration.
8414         (Output_merge_base::input_sections_begin,
8415         Output_merge_base::input_sections_end,
8416         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8417         (Output_merge_base::bool keeps_input_sections_,
8418         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8419         Output_merge_base::input_sections_): New data members.
8420         (Output_merge_data::do_set_keeps_input_sections): New method
8421         defintion.
8422         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8423         * output.cc (Output_section::Input_section::relobj): Move method
8424         defintion from class declaration to here and handle merge sections.
8425         (Output_section::Input_section::shndx): Ditto.
8426         (Output_section::Output_section): Remove initializations of removed
8427         data members and initialize new data member LOOKUP_MAPS_.
8428         (Output_section::add_input_section): Set keeps-input-sections flag
8429         for a newly created merge output section as appropriate.  Adjust code
8430         to use Output_section_lookup_maps class.
8431         (Output_section::add_relaxed_input_section): Adjst code for lookup
8432         maps code refactoring.
8433         (Output_section::add_merge_input_section): Add a new parameter
8434         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8435         class.  If adding input section to a newly created merge output
8436         section fails, remove the new merge section.
8437         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8438         Adjust code for use of the Output_section_lookup_maps class.
8439         (Output_section::find_merge_section): Ditto.
8440         (Output_section::build_lookup_maps): New method defintion.
8441         (Output_section::find_relaxed_input_section): Adjust code to use
8442         Output_section_lookup_maps class.
8443         (Output_section::get_input_sections): Export merge sections.  Adjust
8444         code to use Output_section_lookup_maps class.
8445         (Output_section:::add_script_input_section): Adjust code to use
8446         Output_section_lookup_maps class.  Update lookup maps for merge
8447         sections also.
8448         (Output_section::discard_states): Use Output_section_lookup_maps.
8449         (Output_section::restore_states): Same.
8450         * output.h (Merge_section_properties): Move class defintion out of
8451         Output_section.
8452         (Output_section_lookup_maps): New class.
8453         (Output_section::Input_section::is_merge_section): New method
8454         defintion.
8455         (Output_section::Input_section::relobj): Move defintion out of class
8456         defintion.  Declare method only.
8457         (Output_section::Input_section::shndx): Ditto.
8458         (Output_section::Input_section::output_merge_base): New method defintion.
8459         (Output_section::Input_section::u2_.pomb): New union field.
8460         (Output_section::Merge_section_by_properties_map,
8461         Output_section::Output_section_data_by_input_section_map,
8462         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8463         Remove types.
8464         (Output_section::add_merge_input_section): Add new parameter
8465         KEEPS_INPUT_SECTIONS.
8466         (Output_section::build_lookup_maps): New method declaration.
8467         (Output_section::merge_section_map_,
8468         Output_section::merge_section_by_properties_map_,
8469         Output_section::relaxed_input_section_map_,
8470         Output_section::is_relaxed_input_section_map_valid_): Remove data
8471         members.
8472         (Output_section::lookup_maps_): New data member.
8473
8474 2010-05-21  Doug Kwan  <dougkwan@google.com>
8475
8476         PR gold/11619
8477         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8478         avoid a compilation error.
8479
8480 2010-05-19  Rafael Espindola  <espindola@google.com>
8481
8482         * script-sections.cc (Output_section_definition::allocate_to_segment):
8483         Update the phdrs_list even when the output section is NULL.
8484         * testsuite/Makefile.am: Add test.
8485         * testsuite/Makefile.in: Regenerate.
8486         * testsuite/script_test_9.cc: New.
8487         * testsuite/script_test_9.sh: New.
8488         * testsuite/script_test_9.t: New.
8489
8490 2010-05-19  Doug Kwan  <dougkwan@google.com>
8491
8492         * arm.cc (Arm_input_section::original_size): New method.
8493         (Arm_input_section::do_addralign): Add a cast.
8494         (Arm_input_section::do_output_offset): Remove static cast.
8495         (Arm_input_section::original_addralign,
8496          Arm_input_section::original_size_): Change type to uint32_t.
8497         (Arm_input_section::init): Add safe casts for section alignment
8498         and size.
8499         (Arm_input_section::set_final_data_size): Do not set address and
8500         offset of stub table.
8501         (Arm_output_section::fix_exidx_coverage): Change use of of
8502         Output_section::Simple_input_section to that of
8503         Output_section::Input_section.
8504         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8505         except for the first pass.
8506         * output.cc (Output_section::get_input_sections): Change type of
8507         input_sections to std::list<Input_section>.
8508         (Output_section::add_script_input_section): Rename from
8509         Output_section::add_simple_input_section.  Change type of SIS
8510         parameter from Simple_input_section to Input_section.
8511         * output.h (Output_section::Simple_input_section): Remove class.
8512         (Output_section::Input_section): Change class visibility to public.
8513         (Output_section::Input_section::addralign): Use stored alignments
8514         for special input sections if set.
8515         (Output_section::Input_section::set_addralign): New method.
8516         (Output_section::get_input_sections): Change parameter type from
8517         list of Simple_input_section to list of Input_section.
8518         (Output_section::add_script_input_section): Rename from
8519         Output_section::add_simple_input_section. Change first parameter's
8520         type from Simple_input_section to Input_section and remove the
8521         second and third parameters.
8522         * script-sections.cc (Input_section::Input_section_list): Change
8523         type to list of Output_section::Input_section/
8524         (Input_section_info::Input_section_info): Change parameter type of
8525         INPUT_SECTION to Output_section::Input_section.
8526         (Input_section_info::input_section): Change return type.
8527         (Input_section_info::input_section_): Change type to
8528         Output_section::Input_section.
8529         (Output_section_element_input::set_section_addresses): Adjust code
8530         to use Output_section::Input_section instead of
8531         Output_section::Simple_input_section.  Adjust code for renaming
8532         of Output_section::add_simple_input_section.
8533         (Orphan_output_section::set_section_addresses): Ditto.
8534
8535 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8536
8537         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8538         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8539
8540 2010-05-18  Rafael Espindola  <espindola@google.com>
8541
8542         * options.cc (General_options::finalize): Handle -nostdlib.
8543         * options.h (nostdlib): New option.
8544         * script.cc (script_add_search_dir): Handle -nostdlib.
8545
8546 2010-05-12  Doug Kwan  <dougkwan@google.com>
8547
8548         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8549         attributes section only if there no attributes section after merging.
8550         (Target_arm::merge_object_attributes): Move value of
8551         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8552         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8553         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8554         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8555         and arm_attr_merge_7.stdout.
8556         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8557         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8558         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8559         arm_attr_merge_7b.o): New rules.
8560         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8561         arm_attr_merge_7
8562         * testsuite/Makefile.in: Regenerate.
8563         * testsuite/arm_attr_merge.sh: New file.
8564         * testsuite/arm_attr_merge_[67][ab].s: Same.
8565
8566 2010-05-05  Nick Clifton  <nickc@redhat.com>
8567
8568         * po/es.po: Updated Spanish translation.
8569
8570 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8571
8572         * Makefile.am (install-exec-local): Properly install gold as
8573         default cross linker.
8574         * Makefile.in: Regenerated.
8575
8576 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8577             Nick Clifton  <nickc@redhat.com>
8578
8579         * configure.ac (install_as_default): Define and set to false
8580         unless --enable-gold or --enable-gold=both/gold has been
8581         specified.
8582         * configure: Regenerate.
8583
8584         * Makefile.am (install-exec-local): Install the executable as
8585         'ld.gold'.  If install_as_default is true then also install it as
8586         'ld'.
8587         * Makefile.in: Regenerated.
8588
8589 2010-04-24  Ian Lance Taylor  <iant@google.com>
8590
8591         * layout.cc (Layout::layout_reloc): In relocatable link don't
8592         combine reloc sections for grouped sections.
8593
8594 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8595
8596         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8597         sections that are not ordinary to icf.
8598         * icf.cc (get_section_contents): Handle relocation pointing to section
8599         with no object or shndx information.
8600         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8601         * testsuite/Makefile.in: Regenerate.
8602         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8603         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8604
8605 2010-04-22  Ian Lance Taylor  <iant@google.com>
8606
8607         * expression.cc (Expression::Expression_eval_info): Add
8608         result_alignment_pointer field.
8609         (Expression::eval_with_dot): Add result_alignment_pointer
8610         parameter.  Change all callers.
8611         (Expression::eval_maybe_dot): Likewise.
8612         (class Binary_expression): Add alignment_pointer parameter to
8613         left_value and right_value.  Change all callers.
8614         (BINARY_EXPRESSION): Set result alignment.
8615         (class Trinary_expression): Add alignment_pointer parameter to
8616         arg2_value and arg3_value.  Change all callers.
8617         (Trinary_cond::value): Set result alignment.
8618         (Max_expression::value, Min_expression::value): Likewise.
8619         (Align_expression::value): Likewise.
8620         * script-sections.cc (class Sections_element): Add dot_alignment
8621         parameter to set_section_addresses virtual function.  Update
8622         instantiations.
8623         (class Output_section_element): Likewise.
8624         (Script_sections::create_segments): Add dot_alignment parameter.
8625         Change all callers.
8626         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8627         (Script_sections::set_phdrs_clause_addresses): Likewise.
8628         * script-sections.h: Update declarations.
8629         * script.h: Update declarations.
8630         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8631         min_p_align.
8632         * testsuite/script_test_3.t: Set large alignment.
8633         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8634         segment has expected alignment.
8635
8636 2010-04-22  Nick Clifton  <nickc@redhat.com>
8637
8638         * po/gold.pot: Updated by the Translation project.
8639         * po/vi.po: Updated Vietnamese translation.
8640
8641 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8642
8643         * testsuite/Makefile.am (check_PROGRAMS): Add
8644         icf_virtual_function_folding_test.
8645         * testsuite/Makefile.in: Regenerated.
8646
8647 2010-04-15  Andrew Haley  <aph@redhat.com>
8648
8649         * options.h (merge_exidx_entries): New option.
8650         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8651         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8652         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8653         (Target_arm::merge_exidx_entries): New function.
8654         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8655         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8656         to Arm_exidx_fixup constructor.
8657         Add new arg, merge_exidx_entries.
8658         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8659         Arm_output_section::fix_exidx_coverage.
8660
8661 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8662
8663         * icf.cc (get_section_contents): Check for preemptible functions.
8664         Ignore addend when appropriate.
8665         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8666         section folded.
8667         (add_from_relobj): Check for section folded.
8668         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8669         * symtab.h (should_add_dynsym_entry): Add new parameter.
8670         * target-reloc.h (scan_relocs): Check for section folded.
8671         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8672         Check reloc types for function pointers in shared objects.
8673         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8674         case.
8675         (icf_preemptible_functions_test): New test case.
8676         (icf_string_merge_test): New test case.
8677         * testsuite.Makefile.in: Regenerate.
8678         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8679         bar_glob.  Refactor code.
8680         * testsuite/icf_preemptible_functions_test.cc: New file.
8681         * testsuite/icf_preemptible_functions_test.sh: New file.
8682         * testsuite/icf_string_merge_test.cc: New file.
8683         * testsuite/icf_string_merge_test.sh: New file.
8684         * testsuite/icf_virtual_function_folding_test.cc: New file.
8685         * testsuite/icf_virtual_function_folding_test.sh: New file.
8686
8687 2010-04-14  Doug Kwan  <dougkwan@google.com>
8688
8689         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8690         for local symbol recounting if we remove a section due to ICF.
8691         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8692         there are no regular objects in input.
8693
8694 2010-04-13  Doug Kwan  <dougkwan@google.com>
8695
8696         * arm.cc (Arm_input_section::set_final_data_size): Compute
8697         accurate final data size instead of using current data size.
8698
8699 2010-04-09  Doug Kwan  <dougkwan@google.com>
8700
8701         * layout.cc (Layout::choose_output_section): Handle script section
8702         types.
8703         (Layout::make_output_section_for_script): Add section type parameter.
8704         Handle script section types.
8705         * layout.h (Layout::make_output_section_for_script): Add section
8706         type parameter.
8707         * output.cc (Output_section::Output_section): Initialize data member
8708         is_noload_.
8709         (Output_section::do_reset_address_and_file_offset): Do not set address
8710         to 0 if section is a NOLOAD section.
8711         * output.h (Output_section::is_noload): New method.
8712         (Output_section::set_is_noload): Ditto.
8713         (Output_section::is_noload_): New data member.
8714         * script-c.h (Script_section_type): New enum type.
8715         (struct Parser_output_section_header): Add new file section_type.
8716         * script-sections.cc (Sections_element::output_section_name): Add
8717         parameter for returning script section type.
8718         (Output_section_definition::output_section_name): Ditto.
8719         (Output_section_definition::section_type)P; New method.
8720         (Output_section_definiton::script_section_type_name): Ditto.
8721         (Output_section_definition::script_section_type_): New data member.
8722         (Output_section_definition::Output_section_definition): Initialize
8723         data member Output_section_definition::script_section_type_.
8724         (Output_section_definition::create_sections): Pass script section type
8725         to Layout::make_output_section_for_script.
8726         (Output_section_definition::output_section_name): Return script
8727         section type to caller.
8728         (Output_section_definition::set_section_address): Do not advance
8729         dot value and load address if section type is NOLOAD.  Set address
8730         of NOLOAD sections regardless of section flags.
8731         (Output_section_definition::print): Print section type if it is
8732         not SCRIPT_SECTION_TYPE_NONE.
8733         (Output_section_definition::section_type): New method.
8734         (Output_section_definition::script_section_type_name): Ditto.
8735         (Script_sections::output_section_name): Add new parameter
8736         PSECTION_TYPE for returning script section type.  Pass it to
8737         section elements.  Handle discard sections.
8738         (Sort_output_sections::operator()): Handle NOLOAD sections.
8739         * script-sections.h (Script_sections::Section_type): New enum type.
8740         (Script_sections::output_section_name): Add a new parameter for
8741         returning script section type.
8742         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8743         INFO and NOLOAD.
8744         * yyscript.y (union): Add new field SECTION_TYPE.
8745         (COPY, DSECT, INFO, NOLOAD): New tokens.
8746         (opt_address_and_section_type): Change type to output_section_header.
8747         (section_type): New non-terminal
8748         (section_header): Handle section type.
8749         (opt_address_and_section_type): Return section type value.
8750
8751 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8752
8753         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8754         * testsuite/plugin_common_test_2.c (foo): Likewise.
8755
8756 2010-04-08  Doug Kwan  <dougkwan@google.com>
8757
8758         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8759         Output_merge_data.
8760         * output.cc (Output_section::add_merge_input_section): Simplify
8761         code and return status of Output_merge_base::add_input_section.
8762         Update merge section map only if Output_merge_base::add_input_section
8763         returns true.
8764
8765 2010-04-07  Doug Kwan  <dougkwan@google.com>
8766
8767         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8768         if section is marked as containing instructions but has no mapping
8769         symbols.
8770         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8771         correct section index.
8772         (Arm_relobj::find_linked_text_section): Ditto.
8773
8774 2010-04-07  Cary Coutant  <ccoutant@google.com>
8775
8776         * archive.cc (include_member): Destroy Read_symbols_data object before
8777         releasing file.
8778         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8779         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8780         (Read_symbols_data::~Read_symbols_data) New destructor.
8781         (Section_relocs::Section_relocs) New constructor.
8782         (Section_relocs::~Section_relocs) New destructor.
8783         (Read_relocs_data::Read_relocs_data) New constructor.
8784         (Read_relocs_data::~Read_relocs_data) New destructor.
8785         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8786         pointers to NULL after deleting.
8787
8788 2010-04-07  Doug Kwan  <dougkwan@google.com>
8789
8790         * arm.cc: Replace "endianity" with "endianness" in comments.
8791         (Arm_exidx_cantunwind): Ditto.
8792         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8793         (Arm_relobj::merge_flags_and_attributes): New method.
8794         (Arm_relobj::merge_flags_and_attributes_): New data member.
8795         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8796         (Arm_relobj::scan_sections_for_stubs): Ditto.
8797         (Arm_relobj::do_read_symbols): Check to see if we really want to
8798         merge processor-specific flags and attributes.  Exit early if
8799         an object is empty except for section names and the undefined symbol.
8800         (Target_arm::do_finalize_sections): Move check for ELF format to
8801         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8802         attributes from a regular object only when we have determined that
8803         it is aapropriate.  Do not create an .ARM.attributes section in
8804         output if there is no regular input object.
8805         (Target_arm::merge_processor_specific_flags): Check
8806         --warn-mismatch before printing any error.
8807         (Target_arm::merge_object_attributes): Ditto.
8808         * gold.cc (queue_middle_tasks): Handle the case in which there is
8809         no regular object in input.
8810         * options.cc (General_options::parse_EB): New method.
8811         (General_options::parse_EL): Same.
8812         (General_options::General_options): Initialize endianness_.
8813         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8814         New options.
8815         (General_options::Endianness): New enum.
8816         (General_options::endianness): New method.
8817         (General_options::endianness_): New data member.
8818         * parameters.cc (Parameters::set_options): Check target endianness.
8819         (Parameters::set_target_once): Ditto.
8820         (Parameters::check_target_endianness): New method.
8821         (parameters_force_valid_target): If either -EL or -EB is specified,
8822         use it to define endianness of default target.
8823         * parameters.h (Parameters::check_target_endianness): New method
8824         declaration.
8825         * target.h (class Target): Change "endianity" to "endianness"
8826         in comments.
8827
8828 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8829
8830         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8831         * configure: Regenerate.
8832         * Makefile.in: Regenerate.
8833         * testsuite/Makefile.in: Regenerate.
8834
8835 2010-04-06  Cary Coutant  <ccoutant@google.com>
8836
8837         gcc PR lto/42757
8838         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8839         prevailing definitions of common symbols.
8840         * testsuite/plugin_test_6.sh: New test case.
8841         * testsuite/plugin_common_test_1.c: New test case.
8842         * testsuite/plugin_common_test_2.c: New test case.
8843         * testsuite/Makefile.am (plugin_test_6): New test case.
8844         * testsuite/Makefile.in: Regenerate.
8845
8846 2010-04-06  Nick Clifton  <nickc@redhat.com>
8847
8848         * po/vi.po: New Vietnamese translation.
8849
8850 2010-03-30  Doug Kwan  <dougkwan@google.com>
8851
8852         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8853
8854 2010-03-25  Doug Kwan  <dougkwan@google.com>
8855
8856         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8857         to avoid a conversion warning on a 32-bit host.
8858
8859 2010-03-24  Ian Lance Taylor  <iant@google.com>
8860
8861         * testsuite/script_test_3.t: Add a TLS segment.
8862         * testsuite/Makefile.am (check_PROGRAMS): Add
8863         tls_phdrs_script_test.
8864         (tls_phdrs_script_test_SOURCES): Define.
8865         (tls_phdrs_script_test_DEPENDENCIES): Define.
8866         (tls_phdrs_script_test_LDFLAGS): Define.
8867         (tls_phdrs_script_test_LDADD): Define.
8868         * testsuite/Makefile.in: Rebuild.
8869
8870 2010-03-23  Cary Coutant  <ccoutant@google.com>
8871
8872         * fileread.cc (find_or_make_view): Fix comment.
8873
8874 2010-03-23  Ian Lance Taylor  <iant@google.com>
8875
8876         * script-sections.cc (class Orphan_section_placement): Define
8877         PLACE_TLS and PLACE_TLS_BSS.
8878         (Orphan_section_placement::Orphan_section_placement): Initialize
8879         new places.
8880         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8881         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8882         (tls_script_test_SOURCES): Define.
8883         (tls_script_test_DEPENDENCIES): Define.
8884         (tls_script_test_LDFLAGS): Define.
8885         (tls_script_test_LDADD): Define.
8886         * testsuite/Makefile.in: Rebuild.
8887
8888 2010-03-22  Doug Kwan  <dougkwan@google.com>
8889
8890         * arm.cc (Arm_relocate_functions::abs8,
8891         Arm_relocate_functions::abs16): Use correct check for overflow
8892         specified in the ARM ELF specs.
8893         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8894         target of a BLX instruction specially.
8895         (Reloc_stub::stub_type_for_reloc): Ditto.
8896         (Relocate::relocate): Use symbolic names instead of numeric relocation
8897         codes to report error.
8898         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8899         workaround.
8900         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8901         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8902         thumb2_blx_out_of_range.stdout
8903         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8904         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8905         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8906         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8907         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8908         thumb2_blx_in_range, thumb2_blx_in_range.o,
8909         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8910         thumb2_blx_out_of_range.o): New rules.
8911         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8912         thumb2_blx_in_range and thumb2_blx_out_of_range.
8913         * testsuite/Makefile.in: Regenerate.
8914         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8915         * testsuite/thumb_blx_in_range.s: New file.
8916         * testsuite/thumb_blx_out_of_range.s: New file.
8917
8918 2010-03-22  Rafael Espindola  <espindola@google.com>
8919
8920         * archive.cc (Should_include): Move to archive.h.
8921         (should_include_member): Make it a member of Archive.
8922         (Lib_group): New.
8923         (Add_lib_group_symbols): New.
8924         * archive.h: Include options.h.
8925         (Archive_member): Moved from Archive.
8926         (Should_include): Moved from archive.cc.
8927         (Lib_group): New.
8928         (Add_lib_group_symbols): New.
8929         * dynobj.cc (do_should_include_member): New.
8930         * dynobj.h (do_should_include_member): New.
8931         * gold.cc (queue_initial_tasks): Update call to queue.
8932         * main.cc (main): Print lib group stats.
8933         * object.cc (do_should_include_member): New.
8934         * object.h: Include archive.h.
8935         (Object::should_include_member): New.
8936         (Object::do_should_include_member): New.
8937         (Sized_relobj::do_should_include_member): New.
8938         * options.cc (General_options::parse_start_lib): New.
8939         (General_options::parse_end_lib): New.
8940         (Input_arguments::add_file): Handle lib groups.
8941         (Input_arguments::start_group): Check we are not in a lib.
8942         (Input_arguments::start_lib): New.
8943         (Input_arguments::end_lib): New.
8944         * options.h (General_options): Add start_lib and end_lib.
8945         (Input_argument::lib_): New.
8946         (Input_argument::lib): New.
8947         (Input_argument::is_lib): New.
8948         (Input_file_lib): New.
8949         (Input_arguments::in_lib_): New.
8950         (Input_arguments::in_lib): New.
8951         (Input_arguments::start_lib): New.
8952         (Input_arguments::end_lib_): New.
8953         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8954         in unused members as preempted.
8955         (Sized_pluginobj::do_should_include_member): New.
8956         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8957         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8958         return the blocker.
8959         (Read_symbols::do_whole_lib_group): New.
8960         (Read_symbols::do_lib_group): New.
8961         (Read_symbols::do_read_symbols): Handle lib groups.
8962         (Read_symbols::get_name): Handle lib groups.
8963         * readsyms.h (Read_symbols): Add an archive member pointer.
8964         (Read_symbols::do_whole_lib_group): New.
8965         (Read_symbols::do_lib_group): New.
8966         (Read_symbols::member_): New.
8967         * script.cc (read_input_script): Update call to queue_soon.
8968
8969 2010-03-19  Doug Kwan  <dougkwan@google.com>
8970
8971         * arm.cc (Stub_table::Stub_table): Initialize new data members
8972         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8973         (Stub_table::add_reloc_stub): Assign stub offset and update
8974         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8975         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8976         New data members.
8977         (Stub_table::update_data_size_and_addralign): Use
8978         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8979         instead of going over all reloc stubs.
8980         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8981         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8982         Stringpool_template::offset_ to size of Stringpool_char.
8983         (Stringpool_template::new_key_offset): Remove code to initialize
8984         Stringpool_template::offset_.
8985         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8986         Stringpool_template::offset_ to zero.
8987
8988 2010-03-15  Doug Kwan  <dougkwan@google.com>
8989
8990         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8991         offset_.
8992         (Stringpool_template::new_key_offset): New method.
8993         (Stringpool_template::add_string): Assign offsets when adding new
8994         strings.
8995         (Stringpool_template::set_string_offsets): Do not set string offsets
8996         when not optimizing.
8997         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8998         member size_.
8999         (Chunked_vector::clear): Clear size_.
9000         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9001         (Chunked_vector::size): Return size_.
9002         (Chunked_vector::push_back): Use size_ to find insert position.
9003         (Chunked_vector::size_): New data member.
9004         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9005         (Stringpool_template::new_key_offset): New method declaration.
9006         (Stringpool_template::offset_): New data member.
9007
9008 2010-03-15   Rafael Espindola  <espindola@google.com>
9009
9010         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9011         Add_symbols' constructor.
9012         * readsyms.h (Add_symbols): Remove the input_group member.
9013
9014 2010-03-10  Ian Lance Taylor  <iant@google.com>
9015
9016         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9017         target to ask whether a reference to a symbol requires a stack
9018         split.
9019         * target.h (Target::is_call_to_non_split): New function.
9020         (Target::do_is_call_to_non_split): Declare virtual function.
9021         * target.cc: Include "symtab.h".
9022         (Target::do_is_call_to_non_split): New function.
9023         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9024
9025 2010-03-10  Cary Coutant  <ccoutant@google.com>
9026
9027         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9028         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9029         (File_read::open[2]): Add whole_file_view_ to list of views.
9030         (File_read::make_view): Remove test of whole_file_view_.
9031         (File_read::find_or_make_view): Create whole_file_view_ if
9032         necessary.
9033         (File_read::clear_views): Replace bool parameter with enum;
9034         adjust all callers.  Don't delete views with permanent data;
9035         do delete cached views and views from archives if
9036         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9037         if clearing the corresponding view.
9038         * fileread.h (File_read::Clear_views_mode): New enum.
9039         (File_read::View::is_permanent_view): New method.
9040         (File_read::clear_views): Replace bool parameter
9041         with enum; adjust all callers.
9042         * options.h (General_options): Change keep_files_mapped option;
9043         add map_whole_files.
9044         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9045         releasing the file.
9046         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9047         the file.
9048
9049 2010-03-10  David S. Miller  <davem@davemloft.net>
9050
9051         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9052
9053 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9054
9055         * icf.cc (get_section_contents): Add '@' marker after processing the
9056         merge reloc.
9057
9058 2010-03-08  Doug Kwan  <dougkwan@google.com>
9059
9060         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9061         due to a conversion warning.
9062         (Arm_relobj::update_output_local_symbol_count): Check for local
9063         symbol with unset output index.
9064
9065 2010-03-05  Ian Lance Taylor  <iant@google.com>
9066
9067         * options.h (class General_options): Add --spare-dynamic-tags.
9068         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9069         --spare-dynamic-tags.
9070
9071 2010-03-05  Ian Lance Taylor  <iant@google.com>
9072
9073         * incremental.cc: Include "libiberty.h".
9074
9075 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9076
9077         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9078         function, is_info_ member.
9079         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9080         (Versions::Versions): Update caller.
9081         (Versions::define_base_version): Likewise.
9082         (Versions::add_def): Likewise.
9083
9084 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9085
9086         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9087         (Scan::possible_function_pointer_reloc): New function.
9088         (Scan::local_reloc_may_be_function_pointer): Change to call
9089         possible_function_pointer_reloc.
9090         (Scan::global_reloc_may_be_function_pointer): Ditto.
9091         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9092         relocations in ".data.rel.ro._ZTV" section.
9093         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9094         * testsuite/icf_safe_so_test.cc: Ditto.
9095         * testsuite/icf_safe_test.cc: Ditto.
9096         * testsuite/icf_safe_test.sh: Ditto.
9097
9098 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9099             Ian Lance Taylor  <iant@google.com>
9100
9101         * target-reloc.h (relocate_section): Check the symbol table index
9102         for -1U before setting the local symbol index.
9103         (scan_relocatable_relocs): If copying the relocation, record that
9104         the local symbol is required.
9105         * object.h (Symbol_value::is_output_symtab_index_set): New
9106         function.
9107         (Symbol_value::may_be_discarded_from_output_symtab): New
9108         function.
9109         (Symbol_value::has_output_symtab_entry): New function.
9110         (Symbol_value::needs_output_symtab_entry): Remove.
9111         (Symbol_value::output_symtab_index): Make sure the symbol index is
9112         set.
9113         (Symbol_value::set_output_symtab_index): Make sure the symbol
9114         index is not set.  Make sure the new index is valid.
9115         (Symbol_value::set_must_have_output_symtab_entry): New function.
9116         (Symbol_value::has_output_dynsym_entry): New function.
9117         (Symbol_value::set_output_dynsym_index): Make sure the new index
9118         is valid.
9119         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9120         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9121         local symbol if permitted.
9122         (Sized_relobj::do_finalize_local_symbols): Call
9123         is_output_symtab_index_set rather than needs_output_symtab_entry.
9124         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9125         rather than needs_output_symtab_entry.  Call
9126         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9127         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9128         is_output_symtab_index_set rather than needs_output_symtab_entry.
9129         * testsuite/discard_locals_relocatable_test.c: New file.
9130         * testsuite/discard_locals_test.sh: Test -r.
9131         * testsuite/Makefile.am (check_DATA): Add
9132         discard_locals_relocatable_test1.syms,
9133         discard_local_relocatable_test2.syms.
9134         (MOSTLYCLEANFILES): Likewise.  Also add
9135         discard_locals_relocatable_test1.lout and
9136         discard_locals_relocatable_test2.out.
9137         (discard_locals_relocatable_test1.syms): New target.
9138         (discard_locals_relocatable_test.o): New target.
9139         (discard_locals_relocatable_test1.out): New target.
9140         (discard_locals_relocatable_test2.syms): New target.
9141         (discard_locals_relocatable_test2.out): New target.
9142         (various): Add missing ../ld-new dependencies.
9143         * testsuite/Makefile.in: Rebuild.
9144
9145 2010-03-03  Nick Clifton  <nickc@redhat.com>
9146
9147         * po/fi.po: New Finnish translation.
9148
9149 2010-03-01  Doug Kwan  <dougkwan@google.com>
9150
9151         * layout.cc (Layout::Layout): Force section types of .init_array*,
9152         .preinit_array* and .fini_array* sections.
9153         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9154         Fix check of return value of std::string::find.().
9155         (Output_section::Input_section_sort_compare::operator()): Remove
9156         comment about .init_array.
9157         (Output_section::Input_section_sort_init_fini_compare::operator()):
9158         New method.
9159         (Output_section::sort_attached_input_sections): Handle .init_array
9160         and .fini_array specially.
9161         * output.h (Output_section::Inut_section_sort_compare): Update
9162         comment.
9163         (Output_section::Input_section_sort_init_fini_compare): New struct.
9164
9165 2010-02-26  Doug Kwan  <dougkwan@google.com>
9166
9167         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9168         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9169         * testsuite/debug_msg.sh: Avoid matching source line number for
9170         use of global variable undef_int.
9171
9172 2010-02-26  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9175         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9176         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9177         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9178         * options.cc (General_options::General_options): Initialize member
9179         fix_v4bx_.
9180         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9181         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9182         and rm_no_fix_v4bx.stdout
9183         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9184         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9185         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9186         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9187         and arm_no_fix_v4bx.
9188         * Makefile.in: Regenerate.
9189         * testsuite/arm_fix_v4bx.s: New file.
9190         * testsuite/arm_fix_v4bx.sh: Ditto.
9191
9192 2010-02-24  Doug Kwan  <dougkwan@google.com>
9193
9194         * arm.cc (Target_arm::got_section): Make the .got section the first
9195         non RELRO section in the data segment.
9196         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9197         suffixes of section names.
9198
9199 2010-02-24  Doug Kwan  <dougkwan@google.com>
9200
9201         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9202         flags and attributes merging if an input file is a binary file.
9203         * fileread.cc (Input_file::open): Record format of original file.
9204         * fileread.h (Input_file::Format): New enum type.
9205         (Input_file::Input_file): Initialize data member format_.
9206         (Input_file::format): New method definition.
9207         (Input_file::format_):: New data member.
9208
9209 2010-02-24  Doug Kwan  <dougkwan@google.com>
9210
9211         * arm.cc (Arm_output_data_got): New class.
9212         (ARM_TCB_SIZE): New constant
9213         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9214         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9215         If user uses a script with a SECTIONS clause, issue only a warning
9216         for a misplaced EXIDX input section.  Otherwise, issue an error.
9217         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9218         garbage collection.
9219         (Target_arm::got_mode_index_entry): Handle static linking.
9220         (Target_arm::Scan::local): Ditto.
9221         (Target_arm::Scan::global): Ditto.
9222         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9223         all incorrectly implemented relocations.
9224         (Target_arm::fix_exidx_coverage): Pass layout to
9225         Arm_output_section::fix_exidx_coverage.
9226         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9227         from ".ARM.exidx." and ".ARM.extab.".
9228
9229 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9230
9231         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9232         section if it does not already exist.
9233         * attributes.cc (Attributes_section_data::Attributes_section_data):
9234         Don't crash if size is zero.
9235
9236 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9237             Ian Lance Taylor  <iant@google.com>
9238
9239         * gold.cc (queue_middle_tasks): If no input files were opened,
9240         exit.
9241         * workqueue.h (Task_function::Task_function): Assert that there is
9242         a blocker.
9243
9244 2010-02-22  Doug Kwan  <dougkwan@google.com>
9245
9246         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9247         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9248         types to avoid warnings due to different uint64_t implementations
9249         on different hosts.
9250
9251 2010-02-21  Doug Kwan  <dougkwan@google.com>
9252
9253         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9254         handling of the maximum backward branch offset.
9255         (Arm_relocate_functions::thumb_branch_common): Ditto.
9256         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9257         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9258         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9259         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9260         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9261         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9262         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9263         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9264         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9265         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9266         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9267         thumb2_bl_out_of_range.o): New rules.
9268         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9269         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9270         thumb2_bl_out_of_range
9271         * testsuite/Makefile.in: Regenerate.
9272         * testsuite/arm_bl_in_range.s: New file.
9273         * testsuite/arm_bl_out_of_range.s: Ditto.
9274         * testsuite/arm_branch_in_range.sh: Ditto.
9275         * testsuite/arm_branch_range.t: Ditto.
9276         * testsuite/thumb2_branch_range.t: Ditto.
9277         * testsuite/thumb_bl_in_range.s: Ditto.
9278         * testsuite/thumb_bl_out_of_range.s: Ditto.
9279         * testsuite/thumb_branch_range.t: Ditto.
9280
9281 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9282
9283         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9284         Add reloc offset information.
9285         * icf.cc (get_section_contents): Change iterators to point to the new
9286         vectors. Add reloc offset information to the contents.
9287         * icf.h (Icf::Sections_reachable_info): New typedef.
9288         (Icf::Sections_reachable_list): New typedef.
9289         (Icf::Offset_info): New typedef.
9290         (Icf::Reloc_info): New struct typedef.
9291         (Icf::Reloc_info_list): New typedef.
9292         (Icf::symbol_reloc_list): Delete method.
9293         (Icf::addend_reloc_list): Delete method.
9294         (Icf::section_reloc_list): Delete method.
9295         (Icf::reloc_info_list): New method.
9296         (Icf::reloc_info_list_): New member.
9297
9298 2010-02-19  Doug Kwan  <dougkwan@google.com>
9299
9300         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9301         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9302         * arm.cc (Arm_relocation_functions): New forward declaration.
9303         (Target_arm::Target_arm): Initialize new data members
9304         got_mod_index_offset_ and tls_base_symbol_defined_.
9305         (Target_arm::Relocate::relocate_tls): New method.
9306         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9307          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9308         New methods.
9309         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9310         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9311         (Target_arm::got_mod_index_offset_,
9312         Target_arm::tls_base_symbol_defined_): New data members.
9313         (Target_arm::Scan::local, Target::Scan::global,
9314         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9315         relocations.
9316
9317 2010-02-18  Doug Kwan  <dougkwan@google.com>
9318
9319         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9320         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9321         text section as a parameter becuase some broken tools may not set
9322         the link in section header.
9323         (Target_arm::has_got_section): New method.
9324         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9325         without any mapping symbol as data only.  Remove warning.
9326         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9327         link in its section header, try to discover the link by inspecting the
9328         REL31 relocation at the beginning of the section.
9329         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9330         in error message.
9331         (Target_arm::Scan::global): Treat any reference to the symbol
9332         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9333
9334 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9335
9336         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9337         (Scan::global_reloc_may_be_function_pointer): New function.
9338         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9339         (Scan::global_reloc_may_be_function_pointer): New function.
9340         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9341         (Scan::global_reloc_may_be_function_pointer): New function.
9342         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9343         (Scan::global_reloc_may_be_function_pointer): New function.
9344         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9345         (Scan::global_reloc_may_be_function_pointer): New function.
9346         (Scan::possible_function_pointer_reloc): New function.
9347         (Target_x86_64::can_check_for_function_pointers): New function.
9348         * gc.h (gc_process_relocs): Scan relocation types to determine if
9349         function pointers were taken for targets that support it.
9350         * icf.cc (Icf::find_identical_sections): Include functions for
9351         folding in safe ICF whose pointer is not taken.
9352         * icf.h (Secn_fptr_taken_set): New typedef.
9353         (fptr_section_id_): New member.
9354         (section_has_function_pointers): New function.
9355         (set_section_has_function_pointers): New function.
9356         (check_section_for_function_pointers): New function.
9357         * options.h: Fix comment for safe ICF option.
9358         * target.h (can_check_for_function_pointers): New function.
9359         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9360         Modify icf_safe_test for X86-64.
9361         * testsuite/Makefile.in: Regenerate.
9362         * testsuite/icf_safe_so_test.cc: New file.
9363         * testsuite/icf_safe_so_test.sh: New file.
9364         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9365         (main): Change to take pointer to function kept_func_3.
9366         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9367         folding is done correctly for X86-64.
9368
9369 2010-02-12  David S. Miller  <davem@davemloft.net>
9370
9371         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9372         is_symbolless parameter.
9373         (Output_reloc<SHT_REL>::is_symbolless): New.
9374         (Output_reloc<SHT_REL>::is_symbolless_): New.
9375         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9376         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9377         (Output_reloc<SHT_RELA>::is_symbolless): New.
9378         (Output_data_reloc::add_global): Handle is_symbolless.
9379         (Output_data_reloc::add_global_relative): Likewise.
9380         (Output_data_reloc::add_local): Likewise.
9381         (Output_data_reloc::add_local_relative): Likewise.
9382         (Output_data_reloc::add_symbolless_global_addend): New.
9383         (Output_data_reloc::add_symbolless_local_addend): New.
9384         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9385         is_symbolless.
9386         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9387         instead of ->is_relative_
9388         (Output_reloc::write): Likewise.
9389         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9390         (Output_reloc::write_rel): Simplify.
9391
9392         * sparc.cc (Target_sparc::Scan::local): Use
9393         ->add_symbolless_local_addend as needed.
9394         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9395         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9396         based upon relocation offset.
9397
9398 2010-02-11  Doug Kwan  <dougkwan@google.com>
9399
9400         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9401         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9402         beginning of function.
9403         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9404         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9405         parameter is_32bit in calls to should_apply_static_reloc.
9406         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9407         (check_DATA): Add arm_abs_global.stdout.
9408         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9409         arm_abs_global.stdout): New rules.
9410         (MOSTLLYCLEANFILES): Add arm_abs_global
9411         * Makefile.in: Regenerate.
9412         * testsuite/arm_abs_global.s: New file.
9413         * testsuite/arm_abs_global.sh: Ditto.
9414         * testsuite/arm_abs_lib.s: Ditto.
9415
9416 2010-02-11  Ian Lance Taylor  <iant@google.com>
9417
9418         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9419         Read_relocs task.
9420         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9421         Allocate_commons_task first.
9422         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9423         task, rather than symtab_lock_.
9424         (Gc_process_relocs::~Gc_process_relocs): New function.
9425         (Gc_process_relocs::is_runnable): Check this_blocker_.
9426         (Gc_process_relocs::locks): Use next_blocker_ rather than
9427         blocker_.
9428         (Scan_relocs::~Scan_relocs): New function.
9429         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9430         symtab_lock_.
9431         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9432         next_blocker_.
9433         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9434         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9435         constructor accordingly.
9436         (class Gc_process_relocs): Likewise.
9437         (class Scan_relocs): Likewise.
9438         * common.h (class Allocate_commons_task): Remove symtab_lock_
9439         field, and corresponding constructor parameter.
9440         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9441         symtab_lock_.
9442         (Allocate_commons_task::locks): Likewise.
9443
9444 2010-02-11  Ian Lance Taylor  <iant@google.com>
9445
9446         * gold-threads.h (class Once): Define.
9447         (class Initialize_lock): Rewrite as child of Once.
9448         * gold-threads.cc (class Once_initialize): Define.
9449         (once_pointer_control): New static variable.
9450         (once_pointer, once_arg): New static variables.
9451         (c_run_once): New static function.
9452         (Once::Once, Once::run_once, Once::internal_run): New functions.
9453         (class Initialize_lock_once): Remove.
9454         (initialize_lock_control): Remove.
9455         (initialize_lock_pointer): Remove.
9456         (initialize_lock_once): Remove.
9457         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9458         (Initialize_lock::initialize): Rewrite.
9459         (Initialize_lock::do_run_once): New function.
9460         * archive.cc (Archive::interpret_header): Only clear name if it is
9461         not already empty.
9462         * fileread.cc: Include "gold-threads.h"
9463         (file_counts_lock): New static variable.
9464         (file_counts_initialize_lock): Likewise.
9465         (File_read::release): Only increment counts when using --stats.
9466         Use a lock around the increment.
9467         * parameters.cc (class Set_parameters_target_once): Define.
9468         (set_parameters_target_once): New static variable.
9469         (Parameters::Parameters): Move here from parameters.h.
9470         (Parameters::set_target): Rewrite.
9471         (Parameters::set_target_once): New function.
9472         (Parameters::clear_target): Move here and rewrite.
9473         * parameters.h (class Parameters): Update declarations.  Add
9474         set_parameters_target_once_ field.
9475         (Parameters::Parameters): Move to parameters.cc.
9476         (Parameters::clear_target): Likewise.
9477         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9478         task.
9479         (Start_group::~Start_group): New function.
9480         (Start_group::is_runnable): New function.
9481         (Start_group::locks, Start_group::run): New functions.
9482         (Finish_group::run): Change saw_undefined to size_t.
9483         * readsyms.h (class Start_group): Define.
9484         (class Finish_group): Change saw_undefined_ field to size_t.
9485         (Finish_group::Finish_group): Remove saw_undefined and
9486         this_blocker parameters.  Change all callers.
9487         (Finish_group::set_saw_undefined): New function.
9488         (Finish_group::set_blocker): New function.
9489         * symtab.h (class Symbol_table): Change saw_undefined to return
9490         size_t.  Change saw_undefined_ field to size_t.
9491         * target-select.cc (Set_target_once::do_run_once): New function.
9492         (Target_selector::Target_selector): Initialize set_target_once_
9493         field.  Don't initialize lock_ and initialize_lock_ fields.
9494         (Target_selector::instantiate_target): Rewrite.
9495         (Target_selector::set_target): New function.
9496         * target-select.h (class Set_target_once): Define.
9497         (class Target_selector): Update declarations.  Make
9498         Set_target_once a friend.  Remove lock_ and initialize_lock_
9499         fields.  Add set_target_once_ field.
9500
9501 2010-02-10  Ian Lance Taylor  <iant@google.com>
9502
9503         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9504         queueing any tasks.
9505         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9506         (queue_middle_tasks): Add all blockers before queueing any tasks.
9507         (queue_final_tasks): Likewise.
9508         * token.h (Task_token::add_blockers): New function.
9509         * object.h (Input_objects::number_of_relobjs): New function.
9510
9511 2010-02-10  Ian Lance Taylor  <iant@google.com>
9512
9513         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9514         shared, not if not position independent.
9515         * x86_64.cc (Relocate::relocate_tls): Likewise.
9516         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9517         (tls_pie_pic_test): New target.
9518         * testsuite/Makefile.in: Rebuild.
9519
9520         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9521         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9522         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9523         * testsuite/Makefile.in: Rebuild.
9524
9525 2010-02-09  David S. Miller  <davem@davemloft.net>
9526
9527         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9528         R_SPARC_RELATIVE using ->add_local_relative().
9529         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9530
9531         * output.h (Output_data_dynamic::add_section_size): New method
9532         that takes two Output_data objects.
9533         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9534         entry param.  Handle it in initializers.
9535         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9536         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9537         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9538         arg.
9539         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9540         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9541         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9542         for dynrel_includes_plt.
9543         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9544         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9545         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9546         before .rela.plt
9547         (Target_sparc::do_finalize_sections): Update to pass true for
9548         dynrel_includes_plt.
9549         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9550         output before .rela.plt
9551         (Target_powerpc::do_finalize_sections): Update to pass true for
9552         dynrel_includes_plt when 32-bit.
9553
9554 2010-02-08  Doug Kwan  <dougkwan@google.com>
9555
9556         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9557         method.
9558         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9559         Arm_relobj::scan_section_for_cortex_a8_stubs,
9560         Arm_relobj::do_relocation_section): Instead of calling
9561         Output_section::output_address, use faster
9562         Arm_relobj::simple_input_section_output_address.
9563
9564 2010-02-08  David S. Miller  <davem@davemloft.net>
9565
9566         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9567         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9568         relocation helper function.
9569
9570         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9571         just like R_SPARC_GOT{10,13,22}.
9572         (Target_sparc::Scan::local): Likewise.
9573         (Target_sparc::Relocate:relocate): Likewise.
9574
9575 2010-02-06  Ian Lance Taylor  <iant@google.com>
9576
9577         * configure.ac: Rewrite targetobjs duplicate removal code to use
9578         only shell constructs.
9579         * configure: Rebuild.
9580
9581 2010-02-05  Doug Kwan  <dougkwan@google.com>
9582
9583         PR 11247
9584         * arm.cc (Arm_relobj::section_is_scannable): New method.
9585         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9586         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9587
9588 2010-02-04  Doug Kwan  <dougkwan@google.com>
9589
9590         PR 11247
9591         * arm-reloc-property.cc (cstdio): Include.
9592         * configure.ac (targetobjs): Remove duplicates.
9593         * configure: Regenerate.
9594         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9595         big and little endian version for a given address size.
9596
9597 2010-02-03  Doug Kwan  <dougkwan@google.com>
9598
9599         * arm-reloc-property.cc
9600         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9601         definition.
9602         * arm-reloc-property.h
9603         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9604         New method definition.
9605         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9606         declaration.
9607         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9608         overflow to N.
9609         (GOT_PREL): Change implemented to Y.
9610         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9611         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9612         (Arm_relocate_functions::movw_abs_nc): Remove method.
9613         (Arm_relocate_functions::movt_abs): Ditto.
9614         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9615         (Arm_relocate_functions::thm_movt_abs): Ditto.
9616         (Arm_relocate_functions::movw_rel_nc): Ditto.
9617         (Arm_relocate_functions::movw_rel): Ditto.
9618         (Arm_relocate_functions::movt_rel): Ditto.
9619         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9620         (Arm_relocate_functions:thm_movw_rel): Ditto.
9621         (Arm_relocate_functions:thm_movt_rel): Ditto.
9622         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9623         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9624         New method definitions.
9625         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9626         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9627         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9628         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9629         (Target_arm::Relocate::relocate): Check for non-static or
9630         unimplemented relocation code and exit early.  Change calls to
9631         Target_arm::reloc_uses_thumb_bit and
9632         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9633         instead.  Refactor code to handle similar relocations to increase
9634         code sharing.  Remove check for unsupported relocation code in switch
9635         statement.
9636         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9637         relocation property table to find out size.  Change error message to
9638         print out the name of a relocation code instead of the numeric value.
9639         (Target_arm::scan_reloc_for_stub): Use relocation property table
9640         instead of calling Target_arm::reloc_uses_thumb_bit().
9641
9642 2010-02-02  Doug Kwan  <dougkwan@google.com>
9643
9644         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9645         types of relaxed input section.
9646
9647 2010-02-02  Doug Kwan  <dougkwan@google.com>
9648
9649         * Makefile.am (HFILES): Add arm-reloc-property.h.
9650         (DEFFILES): New.
9651         (TARGETSOURCES): Add arm-reloc-property.cc
9652         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9653         (libgold_a_SOURCES): $(DEFFILES)
9654         * Makefile.in: Regenerate.
9655         * arm-reloc-property.cc: New file.
9656         * arm-reloc-property.h: New file.
9657         * arm-reloc.def: New file.
9658         * arm.cc: Update comments.
9659         (arm-reloc-property.h): New included header.
9660         (arm_reloc_property_table): New global variable.
9661         (Target_arm::do_select_as_default_target): New method definition.
9662         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9663         arm-reloc-property to targ_extra_obj.
9664         * parameters.cc (set_parameters_target): Call
9665         Target::select_as_default_target().
9666         * target.h (Target::select_as_default_target): New method definition.
9667         (Target::do_select_as_default_target): Same.
9668
9669 2010-02-01  Doug Kwan  <dougkwan@google.com>
9670
9671         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9672         first_output_text_section_.
9673         (Arm_exidx_fixup::first_output_text_section): New method definition.
9674         (Arm_exidx_fixup::first_output_text_section_): New data member.
9675         (Arm_exidx_fixup::process_exidx_section): Record the first text
9676         output section seen.
9677         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9678         and entsize in output section header.
9679
9680 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9681
9682         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9683         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9684         (Arm_relocate_functions::thm_alu11): New Method.
9685         (Arm_relocate_functions::thm_pc8): New Method.
9686         (Arm_relocate_functions::thm_pc12): New Method.
9687         (Target_arm::Scan::local): Handle the relocations.
9688         (Target_arm::Scan::global): Likewise.
9689         (Target_arm::Relocate::relocate): Likewise.
9690         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9691
9692 2010-01-29  Doug Kwan  <dougkwan@google.com>
9693
9694         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9695         of relocation types as ld.
9696
9697 2010-01-29  Doug Kwan  <dougkwan@google.com>
9698
9699         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9700         to public.
9701         (Arm_relocate_functions::thumb_branch_common): Ditto.
9702         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9703         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9704         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9705         Arm_relocate_functions::jump24): Remove.
9706         (Target_arm::Relocate::relocate): Adjust code to call
9707         Arm_relocation_functions::arm_branch_common and
9708         Arm_relocation_functions::thumb_branch_common instead of their removed
9709         wrappers.  Merge switch-cases together to reduce source code size.
9710
9711 2010-01-29  Doug Kwan  <dougkwan@google.com>
9712
9713         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9714         output_local_symbol_count_needs_update_.
9715         (Arm_relobj::output_local_symbol_count_needs_update,
9716          Arm_relobj::set_output_local_symbol_count_needs_update,
9717          Arm_relobj::update_output_local_symbol_count): New methods.
9718         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9719         member.
9720         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9721         of pointed function as in a R_ARM_PREL31 relocation.
9722         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9723         for output local symbol count updating.
9724         (Target_arm::do_relax): Update output local symbol counts in objects
9725         if necessary.
9726         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9727
9728 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9729
9730         * arm.cc: Added support for the ARM relocations:
9731         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9732         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9733         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9734         movw_prel_nc).
9735         (Arm_relocate_functions::movw_rel): New method.
9736         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9737         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9738         thm_movw_prel_nc).
9739         (Arm_relocate_functions::thm_movw_rel): New method.
9740         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9741         thm_movt_prel).
9742         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9743         relocations.
9744         (Target_arm::Scan::global): Likewise.
9745         (Target_arm::Relocate::relocate): Likewise.
9746         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9747         Likewise.
9748
9749 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9750
9751         * arm.cc: Added support for ARM group relocations.
9752         (Target_arm::reloc_needs_sym_origin): New method.
9753         (Arm_relocate_functions::calc_grp_kn): New method.
9754         (Arm_relocate_functions::calc_grp_residual): New method.
9755         (Arm_relocate_functions::calc_grp_gn): New method.
9756         (Arm_relocate_functions::arm_grp_alu): New Method.
9757         (Arm_relocate_functions::arm_grp_ldr): New Method.
9758         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9759         (Arm_relocate_functions::arm_grp_ldc): New Method.
9760         (Target_arm::Scan::local): Handle the ARM group relocations.
9761         (Target_arm::Scan::global): Likewise.
9762         (Target_arm::Relocate::relocate): Likewise.
9763         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9764         Likewise.
9765
9766 2010-01-26  Doug Kwan  <dougkwan@google.com>
9767
9768         * arm.cc (set): Include.
9769         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9770         pointer type.
9771         (Arm_output_section::Text_section_list): New type.
9772         (Arm_output_section::append_text_sections_to_list): New method.
9773         (Arm_output_section::fix_exidx_coverage): Ditto.
9774         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9775         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9776         Relobj::set_section_offset() instead of
9777         Sized_relobj::invalidate_section_offset().
9778         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9779         parameter for section headers. Ignore relocation sections for
9780         unallocated sections and EXIDX sections.
9781         (Target_arm::fix_exidx_coverage): New method.
9782         (Target_arm::output_section_address_less_than): New type.
9783         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9784         linked text section instead of the EXIDX section.
9785         (Arm_output_section::create_stub_group): Add an assertion to check
9786         that this is not an EXIDX output section.
9787         (Arm_output_section::append_text_sections_to_list): New method.
9788         (Arm_output_section::fix_exidx_coverage): Ditto.
9789         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9790         Arm_relobj::section_needs_reloc_stub_scanning.
9791         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9792         first pass.
9793         (Target_arm::fix_exidx_coverage): New method.
9794         * object.h (Relobj::set_output_section): New method.
9795         (Sized_relobj::invalidate_section_offset): Remove method.
9796         (Sized_relobj::do_invalidate_section_offset): Remove method.
9797         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9798
9799 2010-01-25  Doug Kwan  <dougkwan@google.com>
9800
9801         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9802         Fix warning due to signed and unsigned comparison on a 32-bit host.
9803
9804 2010-01-22  Doug Kwan  <dougkwan@google.com>
9805
9806         * arm.cc (Target_arm::do_relax): Record an output section for section
9807         offset adjustment it contains any stub table that has changed.
9808         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9809         offsets in an output section if necessary.
9810         * output.cc (Output_section::Output_section): Initialize
9811         section_offsets_need_adjustments_.
9812         (Output_section::add_input_section_for_script): Renamed to
9813         Output_section::add_simple_input_section.
9814         (Output_section::save_states): Add a comment.
9815         (Output_section::discard_states): New method defintion.
9816         (Output_section::adjust_section_offsets): Same.
9817         * output.h (Output_section::add_input_section_for_script): Renamed to
9818         Output_section::add_simple_input_section.
9819         (Output_section::discard_states): New method declaration.
9820         (Output_section::adjust_section_offsets): Same.
9821         (Output_section::section_offsets_need_adjustment,
9822         Output_section::set_section_offsets_need_adjustment): New method
9823         definitions.
9824         (Output_section::section_offsets_need_adjustment_): New data member.
9825         * script-sections.cc
9826         (Output_section_element_input::set_section_address): Adjust code for
9827         renaming of Output_section::add_input_section_for_script.
9828         (Orphan_output_section::set_section_address): Same.
9829
9830 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9831
9832         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9833         Fix_v4bx enum values .
9834         * gold/options.h (General_options): New option definitions.
9835         (General_options::fix_v4bx): New method.
9836         (General_options::Fix_v4bx): New enum.
9837         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9838         (General_options::parse_fix_v4bx_interworking): New method.
9839
9840 2010-01-22  Doug Kwan  <dougkwan@google.com>
9841
9842         * arm.cc (Arm_exidx_fixup): New class.
9843
9844 2010-01-21  Doug Kwan  <dougkwan@google.com>
9845
9846         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9847         classes.
9848         (Arm_exidx_section_offset_map): New type.
9849
9850 2010-01-21  Doug Kwan  <dougkwan@google.com>
9851
9852         * arm.cc (Arm_exidx_input_section): New class.
9853         (Arm_relobj::exidx_input_section_by_link,
9854         Arm_relobj::exidx_input_section_by_shndx,
9855         Arm_relobj::make_exidx_input_section): New methods.
9856         (read_arm_attributes_section): Remove.
9857         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9858         information about them.
9859         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9860         to here.
9861
9862 2010-01-20  Doug Kwan  <dougkwan@google.com>
9863
9864         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9865         Input_section_specifier to Section_id.
9866         (Target_arm::new_arm_input_section: Adjust code for change of key
9867         type.
9868         (Target_arm::find_arm_input_section): Ditto.
9869         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9870         (Section_id): Remove.
9871         (Garbage_collection::Section_id_hash): Remove.
9872         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9873         (Section_id): Remove.
9874         (Icf::Section_id_hash): Remove.
9875         * object.h (Section_id, Const_section_id, Section_id_hash,
9876         Const_section_id_hash): New type definitions.
9877         * output.cc (Output_section::add_relaxed_input_section): Change to
9878         use Const_section_id instead of Input_section_specifier as key type.
9879         (Output_section::add_merge_input_section): Ditto.
9880         (Output_section::build_relaxation_map): Change to use Section_id
9881         instead of Input_section_specifier as key type.
9882         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9883         Ditto.
9884         (Output_section::convert_input_sections_to_relaxed_sections): Change
9885         to use Const_section_id instead of Input_section_specifier as key type.
9886         (Output_section::find_merge_section): Ditto.
9887         (Output_section::find_relaxed_input_section): Ditto.
9888         * output.h (Input_section_specifier): Remove class.
9889         (Output_section::Output_section_data_by_input_section_map): Change
9890         key type to Const_section_id.
9891         (Output_section::Output_relaxed_input_section_by_input_section_map):
9892         Ditto.
9893         (Output_section::Relaxation_map): Change key type to Section_id.
9894
9895 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9896
9897         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9898         (class Arm_v4bx_stub): New class.
9899         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9900         (Stub_factory::make_arm_v4bx_stub): New method.
9901         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9902         (Stub_table::empty): Handle v4bx stubs.
9903         (Stub_table::add_arm_v4bx_stub): New method.
9904         (Stub_table::find_arm_v4bx_stub): New method.
9905         (Arm_relocate_functions::v4bx): New method.
9906         (Target_arm::fix_v4bx): New method.
9907         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9908         (Stub_table::relocate_stubs): Likewise.
9909         (Stub_table::do_write): Likewise.
9910         (Stub_table::update_data_size_and_addralign): Likewise.
9911         (Stub_table::finalize_stubs):  Likewise.
9912         (Target_arm::Scan::local): Likewise.
9913         (Target_arm::Scan::global): Likewise.
9914         (Target_arm::do_finalize_sections): Likewise.
9915         (Target_arm::Relocate::relocate): Likewise.
9916         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9917         Likewise.
9918         (Target_arm::scan_reloc_for_stub): Likewise.
9919         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9920
9921 2010-01-19  Ian Lance Taylor  <iant@google.com>
9922
9923         * output.cc (Output_section_headers::do_sized_write): Write large
9924         segment count to sh_info field.
9925         (Output_file_header::do_sized_write): For large segment count,
9926         write PN_XNUM to e_phnum field.
9927
9928 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9929
9930         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9931         (Arm_relocate_functions::thm_jump8): New function.
9932         (Arm_relocate_functions::thm_jump11): New function.
9933         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9934         R_ARM_THM_JUMP11.
9935         (Target_arm::Scan::global): Likewise.
9936         (Target_arm::Relocate::relocate): Likewise.
9937         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9938         Likewise.
9939
9940 2010-01-14  Doug Kwan  <dougkwan@google.com>
9941
9942         * arm.cc (map, utility): Include headers.
9943         (Target_arm::apply_cortex_a8_workaround): New method.
9944         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9945         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9946         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9947         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9948         the --[no-]fix-cortex-a8 command line options.
9949         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9950         (Target_arm::relocate_stub): Use addend in instruction template.
9951         * options.h (DEFINE_bool): Set the user-set flag.
9952         (General_options): Add --[no-]-fix-cortex options.
9953         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9954         : Update fast look-up map after conversion.
9955
9956 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9957
9958         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9959         in the first pass of do_layout.
9960
9961 2010-01-13  Doug Kwan  <dougkwan@google.com>
9962
9963         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9964         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9965         apparent compiler problem of not folding static constant integral
9966         data members of elfcpp::Elf_sizes<32>.
9967
9968 2010-01-13  Doug Kwan  <dougkwan@google.com>
9969
9970         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9971         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9972         Arm_relobj::scan_section_for_cortex_a8_erratum,
9973         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9974         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9975         sections to scan for relocation stubs into a new method
9976         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9977         relocation and Cortex-A8 stub scanning.
9978         (Target_arm::do_relax): Force stubs to be after stubbed sections
9979         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9980         the beginning of a new relaxation pass.  Update a comment.
9981         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9982
9983 2010-01-12  Ian Lance Taylor  <iant@google.com>
9984
9985         * target-reloc.h (visibility_error): New inline function.
9986         (relocate_section): Call visibility_error.
9987         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9988         (MOSTLYCLEANFILES): Likewise.
9989         (protected_4_pic.o, protected_3.err): New targets.
9990         * testsuite/protected_4.cc: New file.
9991
9992 2010-01-12  Doug Kwan  <dougkwan@google.com>
9993
9994         * arm.cc (Cortex_a8_reloc): New class.
9995         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9996         and cortex_a8_relocs_info_.
9997         (Target_arm::fix_cortex_a8): New method definition.
9998         (Target_arm::Cortex_a8_relocs_info): New type.
9999         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10000         New data member declarations.
10001         (Target_arm::scan_reloc_for_stub): Record information about
10002         relocations for THUMB branches that might be exempted from the
10003         Cortex-A8 workaround.
10004         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10005         at the beginning of a relaxation pass.
10006
10007 2010-01-12  Doug Kwan  <dougkwan@google.com>
10008
10009         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10010         (Arm_relobj::Mapping_symbol_position,
10011          Arm_reloj::Mapping_symbol_position_less,
10012          Arm_relobj::Mapping_symbols_info): New types.
10013         (Target_arm::is_mapping_symbol_name): New method definition.
10014         (Arm_relobj::do_count_local_symbols): Save information about mapping
10015         symbols.
10016
10017 2010-01-11  Doug Kwan  <dougkwan@google.com>
10018
10019         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10020         Arm_relocate_functions::thumb32_branch_upper,
10021         Arm_relocate_functions::thumb32_branch_lower,
10022         Arm_relocate_functions::thumb32_cond_branch_offset,
10023         Arm_relocate_functions::thumb32_cond_branch_upper,
10024         Arm_relocate_functions::thumb32_cond_branch_lower,
10025         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10026         branch offset encoding.
10027         (Arm_relocate_functions::thumb_branch_common): Use new branch
10028         offset encoding methods to avoid code duplication.
10029         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10030         (Stub_addend_reader::operator()): Use new branch encoding method
10031         to avoid code duplication.
10032
10033 2010-01-11  Doug Kwan  <dougkwan@google.com>
10034
10035         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10036         (Target_arm::do_finalize_sections): Define special EXIDX section
10037         symbols only if referenced.
10038         * gc.h (Garbage_collection::add_reference): New method.
10039         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10040         code duplication.
10041
10042 2010-01-11  Ian Lance Taylor  <iant@google.com>
10043
10044         * script.cc (Version_script_info::build_expression_list_lookup):
10045         Change complaing about duplicate wildcard match from error to
10046         warning.
10047
10048         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10049         of 2009-12-30.
10050         (Version_script_info::Version_script_info): Initialize globs_,
10051         default_version_, default_is_global_, and exact_.  Don't
10052         initialize globals_ or locals_.
10053         (Version_script_info::build_lookup_tables): Build local symbols
10054         first.
10055         (Version_script_info::unquote): New function.
10056         (Version_script_info::add_exact_match): New function.
10057         (Version_script_info::build_expression_list_lookup): Remove lookup
10058         parameter.  Add is_global parameter.  Change all callers.  Handle
10059         wildcard pattern specially.  Unquote pattern.  Call
10060         add_exact_match.
10061         (Version_script_info::get_name_to_match): New function.
10062         (Version_script_info::get_symbol_version): New function.
10063         (Version_script_info::get_symbol_version_helper): Remove.
10064         (Version_script_info::check_unmatched_names): Call unquote.
10065         * script.h (class Version_script_info): Change get_symbol_version
10066         to be non-inline and add is_global parameter; change all callers.
10067         Rewrite symbol_is_local.  Update declarations.  Define struct
10068         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10069         Remove globals_ and locals_ members.  Add exact_, globs_,
10070         default_version_, is_global_.
10071         (Version_script_info::Glob): Remove pattern, add expression and
10072         is_global.  Update constructor.  Change all callers.
10073         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10074         default version.
10075         (Versions::symbol_section_contents): If a symbol is undefined, or
10076         defined in a dynamic object, set the version index to
10077         VER_NDX_LOCAL.
10078         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10079         symbol_is_local.
10080         (Symbol_table::add_from_pluginobj): Likewise.
10081         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10082
10083 2010-01-11  Doug Kwan  <dougkwan@google.com>
10084
10085         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10086         (incremental_dump_LDADD): Add linking option for libintl.
10087         * Makefile.in: Regenerate.
10088
10089 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10090
10091         PR gold/11144
10092         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10093         instead of -Ds.
10094         * testsuite/Makefile.in: Regenerated.
10095
10096 2010-01-10  Doug Kwan  <dougkwan@google.com>
10097
10098         * options.h (DEFINE_var): Use parentheses around argument varname__
10099         in macro body to avoid any unintended subsequent substitutions.
10100
10101 2010-01-10  Ian Lance Taylor  <iant@google.com>
10102
10103         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10104         candidates before doing symbol resolution.
10105
10106         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10107         ODR candidates if only one is weak.
10108
10109 2010-01-08  Ian Lance Taylor  <iant@google.com>
10110
10111         * script.cc (Version_script_info::build_expression_list_lookup):
10112         Don't warn about ambiguous version, just record the ambiguity.
10113         (Version_script_info::get_symbol_version_helper): Give error if
10114         version is ambiguous.
10115
10116 2010-01-08  Doug Kwan  <dougkwan@google.com>
10117
10118         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10119         prev_data_size_ and prev_addralign_.  Remove initializer for
10120         deleted data member has_been_changed_.
10121         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10122         to determine if the table is empty.
10123         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10124         Remove.
10125         (Stub_table::add_reloc_stub): Define method in class definition
10126         instead of just declaring it there.
10127         (Stub_table::add_cortex_a8_stub): New method definition.
10128         (Stub_table::update_data_size_and_addralign): Ditto.
10129         (Stub_table::finalize_stubs): Ditto.
10130         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10131         (Stub_table::do_addralign_): Return address alignment in the
10132         (Stub_table::do_reset_address_and_file_offset): Define method in
10133         class definition instead of declaring it there.  Set current data
10134         size to be the data size of the previous pass.
10135         (Stub_table::set_final_data_size): Use current data size as the
10136         final data size.
10137         (Stub_table::relocate_stub): Change parameter type of stub from
10138         Reloc_stub pointer to Stub pointer.
10139         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10140         (Stub_table::Cortex_a8_stub_list): New typedef.
10141         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10142          Stub_table::prev_addralign_): New data member.
10143         (Arm_relobj::Arm_relobj): Initialize data member
10144         section_has_cortex_a8_workaround_.
10145         (Arm_relobj::section_has_cortex_a8_workaround,
10146          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10147          definitions.
10148         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10149         declarations.
10150         (Target_arm::relocate_stub): Change parameter type of stub from
10151         Reloc_stub pointer to Stub pointer.
10152         (Insn_template::size, Insn_template::alignment): Handle
10153         THUMB16_SPECIAL_TYPE.
10154         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10155          Stub_table::update_data_size_and_addralign,
10156          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10157         definitions.
10158         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10159         (Stub_table::do_write): Ditto.
10160         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10161
10162 2010-01-08  Ian Lance Taylor  <iant@google.com>
10163
10164         PR 11108
10165         * symtab.h (class Symbol): Remove fields is_target_special_ and
10166         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10167         (Symbol::is_defined_in_discarded_section): New function.
10168         (Symbol::set_is_defined_in_discarded_section): New function.
10169         (Symbol::has_plt_offset): Rewrite.
10170         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10171         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10172         Don't initialize is_target_special_ or has_plt_offset_.
10173         Initialize is_defined_in_discarded_section_.
10174         (Symbol_table::add_from_relobj): If appropriate, set
10175         is_defined_in_discarded_section.
10176         * resolve.cc (Symbol::override_base_with_special): Don't test
10177         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10178         * target-reloc.h (relocate_section): Do special handling for
10179         symbols defined in discarded sections for global symbols as well
10180         as local symbols.
10181
10182 2010-01-08  Ian Lance Taylor  <iant@google.com>
10183
10184         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10185         the SHT_SYMTAB case.
10186
10187 2010-01-08  Ian Lance Taylor  <iant@google.com>
10188
10189         * object.cc (Sized_relobj::do_layout): Don't get confused if
10190         layout_eh_frame returns NULL.
10191
10192 2010-01-08  Ian Lance Taylor  <iant@google.com>
10193
10194         PR 11084
10195         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10196         dynamic symbol table, use the normal symbol table.
10197         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10198         symbol table.
10199
10200 2010-01-08  Ian Lance Taylor  <iant@google.com>
10201
10202         PR 11072
10203         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10204         sections.
10205
10206 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10207
10208         * version.cc (print_version): Change to "Copyright 2010".
10209
10210 2010-01-08  Ian Lance Taylor  <iant@google.com>
10211
10212         PR 10287
10213         PR 11063
10214         * i386.cc (class Target_i386): Change return type of plt_section
10215         to be non-const.
10216         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10217         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10218         tls_desc_rel_ field.
10219         (Output_data_plt_i386::rel_tls_desc): New function.
10220         (Target_i386::rel_tls_desc_section): New function.
10221         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10222         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10223         R_386_TLS_DESC reloc in rel_tls_desc_section.
10224         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10225         Define struct Tlsdesc_info.
10226         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10227         (Target_x86_64::do_reloc_symbol_index): New function.
10228         (Target_x86_64::add_tlsdesc_info): New function.
10229         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10230         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10231         tlsdesc_rel_ field.
10232         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10233         all callers.
10234         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10235         (Target_x86_64::rela_tlsdesc_section): New function.
10236         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10237         handling.
10238         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10239         (Target_x86_64::do_reloc_addend): New function.
10240         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10241         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10242         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10243         (Output_reloc::type): New function.
10244         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10245         (Output_reloc::is_target_specific): New function.
10246         (Output_reloc::target_arg): New function.
10247         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10248         absolute relocs and target specific relocs.
10249         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10250         add_target_specific.
10251         (class Output_data_reloc) [SHT_RELA]: Likewise.
10252         * output.cc (Output_reloc::Output_reloc): Add four new versions
10253         for absolute relocs and target specific relocs.
10254         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10255         (Output_reloc::get_symbol_index): Likewise.
10256         (Output_reloc::local_section_offset): Check that local_sym_index_
10257         is not TARGET_CODE or 0.
10258         (Output_reloc::symbol_value): Likewise.
10259         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10260         reloc.
10261         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10262         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10263         functions.
10264         * layout.cc (add_target_dynamic_tags): Use output section for
10265         DT_PLTRELSZ and DT_JMPREL.
10266
10267 2010-01-07  Ian Lance Taylor  <iant@google.com>
10268
10269         PR 11061
10270         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10271         function.
10272         (class Output_data_reloc_generic): Define.
10273         (class Output_data_reloc_base): Change base class to
10274         Output_data_reloc_generic.  Change add() method to call
10275         bump_relative_reloc_count for a relative reloc.  Remove
10276         sort_relocs_ field.
10277         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10278         to sort_relocs().
10279         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10280         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10281         appropriate.
10282         * layout.h (class Layout): Update declaration.
10283
10284 2010-01-07  Ian Lance Taylor  <iant@google.com>
10285
10286         * output.h (class Output_data): Add const version of
10287         output_section and do_output_section.
10288         (class Output_section_data): Add const version of
10289         do_output_section.
10290         (class Output_section): Likewise.
10291         * layout.cc (Layout::add_target_dynamic_tags): New function.
10292         * layout.h (class Layout): Update declarations.
10293         * arm.cc (Target_arm::do_finalize_sections): Use
10294         add_target_dynamic_tags.
10295         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10296         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10297         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10298         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10299
10300 2010-01-07  Ian Lance Taylor  <iant@google.com>
10301
10302         PR 11042
10303         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10304         object as needed.
10305
10306 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10307             Ian Lance Taylor  <iant@google.com>
10308
10309         PR 11019
10310         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10311         Xindex::read_symtab_xindex.
10312
10313 2010-01-07  Doug Kwan  <dougkwan@google.com>
10314
10315         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10316         (Insn_template::thumb16_bcond_insn): New method declaration.
10317         (Insn_template): Fix spelling.
10318         (Stub::thumb16_special): New method declaration.
10319         (Stub::do_write): Define virtual method which was previously pure
10320         virtual.
10321         (Stub::do_thumb16_special): New method declaration.
10322         (Stub::do_fixed_endian_write): New template member.
10323         (Reloc_stub::do_write): Remove.
10324         (Reloc_stub::do_fixed_endian_write): Remove.
10325         (Cortex_a8_stub): New class definition.
10326         (Stub_factory::make_cortex_a8_stub): New method definition.
10327         (Stub_factory::Stub_factory): Add missing static storage class
10328         qualifier for elf32_arm_stub_a8_veneer_blx.
10329
10330 2010-01-07  Ian Lance Taylor  <iant@google.com>
10331
10332         PR 10980
10333         * options.h (class General_options): Add --warn-unresolved-symbols
10334         and --error-unresolved-symbols.
10335         * errors.cc (Errors::undefined_symbol): Implement
10336         --warn-unresolved-symbols.
10337
10338         * options.h (class General_options): Add -z text and -z textoff.
10339         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10340
10341 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10342
10343         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10344         (Garbage_collection::cident_sections): New function.
10345         (Garbage_collection::add_cident_section): New function.
10346         (Garbage_collection::cident_sections_): New member.
10347         (gc_process_relocs): Add references to sections whose names are C
10348         identifiers.
10349         * gold.h (cident_section_start_prefix): New constant.
10350         (cident_section_stop_prefix): New constant.
10351         (is_cident): New function.
10352         * layout.cc (Layout::define_section_symbols): Replace string constants
10353         with the newly defined constants.
10354         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10355         C identifiers.
10356         * testsuite/Makefile.am: Add gc_orphan_section_test.
10357         * testsuite/Makefile.in: Regenerate.
10358         * testsuite/gc_orphan_section_test.cc: New file.
10359         * testsuite/gc_orphan_section_test.sh: New file.
10360
10361 2010-01-06  Ian Lance Taylor  <iant@google.com>
10362
10363         PR 10980
10364         * options.h (class General_options): Add --warn-shared-textrel.
10365         * layout.cc (Layout::finish_dynamic_section): Implement
10366         --warn-shared-textrel.
10367
10368         PR 10980
10369         * options.h (class General_options): Add --warn-multiple-gp.
10370
10371 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10372
10373         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10374         $(THREADSLIB) and $(LIBDL).
10375         * Makefile.in: Rebuild.
10376
10377 2010-01-06  Ian Lance Taylor  <iant@google.com>
10378
10379         PR 10980
10380         * options.cc (General_options::parse_section_start): New function.
10381         (General_options::section_start): New function.
10382         (General_options::General_options): Initialize all members.
10383         * options.h: Include <map>
10384         (class General_options): Add --section-start.  Add section_starts_
10385         member.
10386         * layout.cc (Layout::attach_allocated_section_to_segment): If
10387         --section-start was used, set the address of the segment.  Remove
10388         local sort_sections.
10389         (Layout::relaxation_loop_body): If the address of the load segment
10390         has been set by --section-start, don't use it.
10391         * output.h (Output_segment::update_flags_for_output_section): New
10392         function.
10393         * output.cc (Output_segment::add_output_section): Call
10394         update_flags_for_output_section.
10395
10396 2010-01-05  Ian Lance Taylor  <iant@google.com>
10397
10398         PR 10980
10399         * options.h (class General_options): Add --undefined-version.
10400         * script.cc (struct Version_expression): Add was_matched_by_symbol
10401         field.
10402         (Version_script_info::matched_symbol): New function.
10403         (Version_script_info::get_symbol_version_helper): Call
10404         matched_symbol.
10405         (Version_script_info::check_unmatched_names): New function.
10406         * script.h (class Version_script_info): Update declarations.
10407         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10408
10409         * options.h (class General_options): Use DEFINE_bool_alias for
10410         allow_multiple_definition.
10411         * resolve.cc (Symbol_table::should_override): Don't test
10412         allow_multiple_definition.
10413
10414         PR 10980
10415         * options.h (class General_options): Add --cref.
10416         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10417         until after printing cref table.
10418         * cref.cc: Include "symtab.h".
10419         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10420         (Cref_table_compare::operator()): New function.
10421         (Cref_inputs::gather_cref): New function.
10422         (filecol): New static const.
10423         (Cref_inputs::print_cref): New function.
10424         (Cref::print_cref): New function.
10425         * cref.h: Include <cstdio>.
10426         (class Cref): Update declarations.
10427         * mapfile.h (Mapfile::file): New function.
10428         * object.h (class Object): Define Symbols.  Declare virtual
10429         do_get_global_symbols.
10430         (Object::get_global_symbols): New function.
10431         * object.cc (Input_objects::add_object): Pass object to cref_ if
10432         --cref.
10433         (Input_objects::archive_start): Likewise.
10434         (Input_objects::archive_stop): Likewise.
10435         (Input_objects::print_cref): New function.
10436         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10437         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10438         --cref.
10439         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10440         function.
10441         * plugin.h (class Sized_pluginobj): Update declarations.
10442
10443 2010-01-05  Ian Lance Taylor  <iant@google.com>
10444
10445         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10446         to is_default_version.  Rename insdef to insdefault.
10447         (Symbol_table::add_from_relobj): Rename def to is_default_version
10448         and local to is_forced_local.
10449         (Symbol_table::add_from_pluginobj): Likewise.
10450         (Symbol_table::add_from_dynobj): Likewise.
10451         (Symbol_table::define_special_symbol): Rename insdef to
10452         insdefault.
10453
10454 2010-01-04  Ian Lance Taylor  <iant@google.com>
10455
10456         PR 10980
10457         * options.h (class General_options): Add
10458         --allow-multiple-definition and -z muldefs.
10459         * resolve.cc (Symbol_table::should_override): Don't warn about a
10460         multiple symbol definition if --allow-multiple-definition or -z
10461         muldefs.
10462
10463         PR 10980
10464         * options.h (class General_options): Add --add-needed and
10465         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10466         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10467         error if --copy-dt-needed-entries aka --add-needed is used and
10468         would cause a change in behaviour.
10469
10470         PR 10980
10471         * options.h (class General_options): Add -G as a short version of
10472         --shared.  Add no-op options -assert, -g, and -i.
10473
10474 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10475
10476         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10477         check for .text or .gnu.linkonce.t sections.
10478         * icf.cc (Icf::find_identical_sections): Ditto.
10479         Change the detection for mangled function name within the section
10480         name.
10481         * icf.h (is_section_foldable_candidate): New function.
10482
10483 2009-12-30  Ian Lance Taylor  <iant@google.com>
10484
10485         PR 10980
10486         * options.h (class General_options): Permit two dashes with
10487         --retain-symbols-file.
10488
10489 2009-12-30  Ian Lance Taylor  <iant@google.com>
10490
10491         PR 10979
10492         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10493         don't put the file header and segment headers in the text
10494         segment.
10495
10496         PR 10979
10497         * common.cc (Sort_commons::operator()): Stabilize sort when both
10498         entries are NULL.
10499         (Symbol_table::do_allocate_commons_list): When allocating common
10500         symbols, skip a symbol which is no longer common.
10501         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10502         an object before checking its type.
10503         * testsuite/common_test_2.c: New file.
10504         * testsuite/common_test_3.c: New file.
10505         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10506         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10507         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10508         (common_test_2_pic.o, common_test_2.so): New targets.
10509         (common_test_3_pic.o, common_test_3.so): New targets.
10510         * testsuite/Makefile.in: Rebuild.
10511
10512         PR 10979
10513         * script.cc (read_input_script): If we see a new SECTIONS clause,
10514         and we have added an input section, give an error.
10515         * layout.h (class Layout): Add have_added_input_section function.
10516         Add have_added_input_section_ field.
10517         * layout.cc (Layout::Layout): Initialize
10518         have_added_input_section_.
10519         (Layout::layout): Set have_added_input_section_.
10520         (Layout::layout_eh_frame): Likewise.
10521
10522 2009-12-30  Ian Lance Taylor  <iant@google.com>
10523
10524         PR 10931
10525         * options.h (class General_options): Add --sort-common option.
10526         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10527         * common.cc (Sort_common): Add sort_order parameter to
10528         constructor.  Add sort_order_ field.
10529         (Sort_commons::operator): Check sort_order_.
10530         (Symbol_table::allocate_commons): Determine the sort order.
10531         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10532         Change all callers.
10533         (Symbol_table::do_allocate_commons_list): Likewise.
10534
10535 2009-12-30  Ian Lance Taylor  <iant@google.com>
10536
10537         PR 10916
10538         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10539         symbols from this object, don't change the visibility of an
10540         undefined symbol.
10541         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10542
10543 2009-12-30  Ian Lance Taylor  <iant@google.com>
10544
10545         PR 10861
10546         * script.h (class Version_script_info): Define Language enum.
10547         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10548         new fields globals_, locals_, and is_finalized_.
10549         * script.cc: Various formatting fixes.
10550         (class Parser_closure): Change language_stack_ from a vector of
10551         std::string to one of Version_script_info::Language.  Adjust all
10552         uses accordingly.
10553         (class Lazy_demangler): Remove.
10554         (struct Version_expression): Change language from std::string to
10555         Version_script_info::Language.
10556         (Version_script_info::Version_script_info): New function.
10557         (Version_script_info::~Version_script_info): Don't call clear.
10558         (Version_script_info::finalize): New function.
10559         (Version_script_info::build_lookup_tables): New function.
10560         (Version_script_info::build_expression_list_lookup): New
10561         function.
10562         (Version_script_info::get_symbol_version_helper): Rewrite to use
10563         lookup tables.
10564         (Version_script_info::print_expression_list): Adjust to use
10565         Version_script_info::Language.
10566         (script_push_lex_into_version_mode): Check that the version script
10567         has not been finalized.
10568         (version_script_push_lang): Change language string to
10569         Version_script_info::Language.
10570         * options.cc (Command_line::version_script): New function.
10571         * options.h (class General_options): Add finalize_dynamic_list
10572         function.  Change version_script from declaration to definition.
10573         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10574         * testsuite/version_script.map: Remove duplicate def of foo.
10575         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10576         version_script.map.
10577         * testsuite/Makefile.in: Rebuild.
10578
10579 2009-12-30  Ian Lance Taylor  <iant@google.com>
10580
10581         PR 10843
10582         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10583         if the input symbol index is 0, make the output symbol index 0.
10584
10585 2009-12-30  Ian Lance Taylor  <iant@google.com>
10586
10587         PR 10670
10588         * options.h (class General_options): Add -x/--discard-all.
10589         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10590         --discard-all.  If the local symbol needs a dynamic entry, check
10591         that before handling --discard-locals.
10592
10593 2009-12-30  Ian Lance Taylor  <iant@google.com>
10594
10595         PR 10450
10596         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10597         flags to PF_R.
10598         (Output_segment::add_output_section): Don't change the flags if
10599         the type is PT_TLS.
10600
10601         PR 10450
10602         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10603         GNU hash table if they need a dynamic value.  Otherwise, don't add
10604         them if they are defined in a dynamic object or are forced local.
10605
10606 2009-12-29  Ian Lance Taylor  <iant@google.com>
10607
10608         PR 10450
10609         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10610         .gnu.hash table for a 32-bit target.
10611
10612         PR 10450
10613         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10614         regular and a dynamic object only needs a dynamic symbol table
10615         entry if it is externally visible.
10616
10617         PR 10450
10618         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10619         constructor.  Add global_offset_table_ field.
10620         (Target_i386::got_section): Set global_offset_table_.
10621         (Target_i386::do_finalize_sections): Set global_offset_table_
10622         size.
10623         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10624         in constructor.  Add global_offset_table_ field.
10625         (Target_x86_64::got_section): Set global_offset_table_.
10626         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10627         size.
10628
10629         * layout.cc (Layout::Layout): Initialize increase_relro_.
10630         (Layout::get_output_section): Add is_relro, is_last_relro, and
10631         is_first_non_relro parameters.  Change all callers.
10632         (Layout::choose_output_section): Likewise.
10633         (Layout::add_output_section_data): Likewise.
10634         (Layout::make_output_section): Likewise.
10635         (Layout::set_segment_offsets): Clear increase_relro when using a
10636         linker script.
10637         * layout.h (class Layout): Add increase_relro method.  Add
10638         increase_relro_ field.  Update declarations.
10639         * output.cc (Output_section::Output_section): Initialize
10640         is_last_relro_ and is_first_non_relro_.
10641         (Output_segment::add_output_section): Group relro sections is
10642         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10643         (Output_segment::maximum_alignment): Remove relro handling.
10644         (Output_segment::set_section_addresses): Add increase_relro
10645         parameter.  Change all callers.  Add initial alignment to align
10646         relro sections on separate page.  Remove old relro handling.
10647         (Output_segment::set_section_list_addresses): Remove in_relro
10648         parameter.  Change all callers.
10649         (Output_segment::set_offset): Add increase parameter.  Change all
10650         callers.  Remove old relro handling.
10651         * output.h (class Output_section): Add new methods: is_last_relro,
10652         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10653         Add is_last_relro_ and is_first_non_relro_ fields.
10654         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10655         Create separate .got.plt section.  Call increase_relro.
10656         * x86_64.cc (Target_x86_64::got_section): Likewise.
10657         * testsuite/relro_script_test.t: Add .got.plt.
10658
10659         PR 10450
10660         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10661         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10662         (Layout::finalize): Call set_dynamic_symbol_size.
10663         (Layout::set_dynamic_symbol_size): New function.
10664         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10665         set_dynamic_symbol_size.
10666
10667         PR 10450
10668         * output.h (class Output_section): Add is_entsize_zero_ field.
10669         * output.cc (Output_section::Output_section): Initialize
10670         is_entsize_zero_.
10671         (Output_section::set_entsize): If two different entsizes are
10672         requested, force it to zero.
10673         (Output_section::add_input_section): Set flags for .debug_str
10674         before updating section flags.  Set entsize.
10675         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10676         and SHF_STRING if all input sections have those flags.
10677
10678 2009-12-29   Rafael Espindola  <espindola@google.com>
10679
10680         * main.cc (main): Fix the sys time reporting.
10681         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10682         reporting.
10683
10684 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10685
10686         * options.cc (General_options::parse_version): Allow -v to exit
10687         without an error if there is nothing to link.
10688
10689 2009-12-29  Ian Lance Taylor  <iant@google.com>
10690
10691         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10692         using a version of gcc before 4.1.
10693         * configure: Rebuild.
10694
10695 2009-12-28  Chris Demetriou  <cgd@google.com>
10696
10697         * attributes.cc (Output_attributes_section_data::do_write): Use
10698         std::vector::front rather than std::vector::data.
10699
10700 2009-12-28  Ian Lance Taylor  <iant@google.com>
10701
10702         * symtab.h (class Symbol_table): Add enum Defined.
10703         * resolve.cc (Symbol_table::should_override): Add defined
10704         parameter.  Change all callers.  Test whether object is NULL
10705         before calling a method on it.
10706         (Symbol_table::report_resolve_problem): Add defined parameter.
10707         Change all callers.
10708         (Symbol_table::should_override_with_special): Likewise.
10709         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10710         parameter.  Change all callers.
10711         (Symbol_table::do_define_in_output_data): Likewise.
10712         (Symbol_table::define_in_output_segment): Likewise.
10713         (Symbol_table::do_define_in_output_segment): Likewise.
10714         (Symbol_table::define_as_constant): Likewise.
10715         (Symbol_table::do_define_as_constant): Likewise.
10716         * script.h (class Symbol_assignment): Add is_defsym parameter to
10717         constructor; change all callers.
10718         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10719         parameter.  Change all callers.  Add is_defsym_ field.
10720         (class Parser_closure): Add parsing_defsym parameter to
10721         constructor; change all callers.  Add parsing_defsym accessor
10722         function.  Add parsing_defsym_ field.
10723
10724 2009-12-28  Ian Lance Taylor  <iant@google.com>
10725
10726         * gold.cc (queue_middle_tasks): Fix formatting.
10727         * object.cc (Relobj::is_section_name_included): Likewise.
10728
10729 2009-12-23  Ian Lance Taylor  <iant@google.com>
10730
10731         * i386.cc (Target_i386::do_calls_non_split): Recognize
10732         -fsplit-stack prologue for a function with a static chain.
10733         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10734         -fsplit-stack prologue when using %r11.
10735
10736 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10737
10738         * options.cc (General_options::parse_version): Make -v continue and do
10739         the link like GNU ld does.
10740
10741 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10742
10743         * Makefile.am (CCFILES): Add timer.cc.
10744         (HFILES): Add timer.h.
10745         * configure.ac: Check for sysconf and times.
10746         * main.cc: include timer.h.
10747         (main): Use Timer instead of get_run_time.
10748         * timer.cc: New.
10749         * timer.h: New.
10750         * workqueue.cc: include timer.h.
10751         (Workqueue::find_and_run_task):
10752         Report user, sys and wall time.
10753         * Makefile.in: Regenerate.
10754         * config.in: Regenerate.
10755         * configure: Regenerate.
10756
10757 2009-12-16  Doug Kwan  <dougkwan@google.com>
10758
10759         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10760         sections.
10761         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10762         relaxed input sections.
10763         * output.cc (Output_section::find_relaxed_input_section): Change
10764         return type to Output_relaxed_input_section pointer.  Adjust code
10765         for new type of relaxed_input_section_map_.
10766         * output.h (Output_section::find_relaxed_input_section): Change
10767         return type to Output_relaxed_input_section pointer.
10768         (Output_section::Output_relaxed_input_section_by_input_section_map):
10769         New type.
10770         (Output_section::relaxed_input_section_map_): Change type to
10771         Output_section::Output_relaxed_input_section_by_input_section_map.
10772         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10773         input section.
10774
10775 2009-12-15  Ian Lance Taylor  <iant@google.com>
10776
10777         * layout.cc (Layout::create_shstrtab): Only write out after input
10778         sections if we are compressing debug sections.
10779
10780 2009-12-15  Ian Lance Taylor  <iant@google.com>
10781
10782         * archive.cc (Archive::add_symbols): Only look up a symbol without
10783         a version if there is, in fact, a version.
10784
10785 2009-12-14  Ian Lance Taylor  <iant@google.com>
10786
10787         Revert -Wshadow changes, all changes from:
10788         2009-12-11  Doug Kwan  <dougkwan@google.com>
10789         2009-12-11  Nick Clifton  <nickc@redhat.com>
10790         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10791
10792 2009-12-11  Doug Kwan  <dougkwan@google.com>
10793
10794         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10795         due to -Wshadow.
10796         * attributes.cc (Object_attribute::size): Ditto.
10797         (Attributes_section_data::size): Ditto.
10798         (Attributes_section_data::Attributes_section_data): Ditto.
10799         (Output_attributes_section_data::do_write): Ditto.
10800         * attributes.h (Object_attribute::set_type): Ditto.
10801         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10802
10803 2009-12-11  Nick Clifton  <nickc@redhat.com>
10804
10805         * archive.cc: Fix shadowed variable warnings.
10806         * arm.cc: Likewise.
10807         * compressed_output.cc: Likewise.
10808         * compressed_output.h: Likewise.
10809         * configure: Likewise.
10810         * dwarf_reader.cc: Likewise.
10811         * dynobj.cc: Likewise.
10812         * dynobj.h: Likewise.
10813         * ehframe.cc: Likewise.
10814         * ehframe.h: Likewise.
10815         * errors.cc: Likewise.
10816         * expression.cc: Likewise.
10817         * fileread.cc: Likewise.
10818         * fileread.h: Likewise.
10819         * freebsd.h: Likewise.
10820         * i386.cc: Likewise.
10821         * icf.cc: Likewise.
10822         * incremental.h: Likewise.
10823         * layout.cc: Likewise.
10824         * layout.h: Likewise.
10825         * mapfile.cc: Likewise.
10826         * merge.cc: Likewise.
10827         * merge.h: Likewise.
10828         * object.cc: Likewise.
10829         * object.h: Likewise.
10830         * options.h: Likewise.
10831         * output.cc: Likewise.
10832         * output.h: Likewise.
10833         * parameters.cc: Likewise.
10834         * plugin.cc: Likewise.
10835         * powerpc.cc: Likewise.
10836         * reduced_debug_output.cc: Likewise.
10837         * reduced_debug_output.h: Likewise.
10838         * reloc.cc: Likewise.
10839         * reloc.h: Likewise.
10840         * resolve.cc: Likewise.
10841         * script-sections.cc: Likewise.
10842         * script.cc: Likewise.
10843         * script.h: Likewise.
10844         * sparc.cc: Likewise.
10845         * symtab.cc: Likewise.
10846         * symtab.h: Likewise.
10847         * target-select.cc: Likewise.
10848         * target-select.h: Likewise.
10849         * token.h: Likewise.
10850         * workqueue.cc: Likewise.
10851         * workqueue.h: Likewise.
10852         * x86_64.cc: Likewise.
10853
10854 2009-12-10  Doug Kwan  <dougkwan@google.com>
10855
10856         * arm.cc (attributes.h): New include.
10857         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10858         (Arm_relobj::~Arm_relobj): Delete object pointed by
10859         attributes_section_data_.
10860         (Arm_relobj::attributes_section_data): New method definition.
10861         (Arm_relobj::attributes_section_data_): New data member declaration.
10862         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10863         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10864         attributes_section_data_.
10865         (Arm_dynobj::attributes_section_data): New method definition.
10866         (Arm_dynobj::attributes_section_data_): New data member declaration.
10867         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10868         initialization value of may_use_blx_ to false.
10869         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10870         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10871         object attributes to compute results instead of hard-coding.
10872         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10873         Target_arm::get_secondary_compatible_arch,
10874         Target_arm::set_secondary_compatible_arch
10875         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10876         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10877         New method declarations.
10878         (Target_arm::get_aeabi_object_attribute): New method definition.
10879         (Target_arm::attributes_section_data_): New data member declaration.
10880         (read_arm_attributes_section): New template definition.
10881         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10882         (Arm_dynobj::do_read_symbols): Ditto.
10883         (Target_arm::do_finalize_sections): Merge attributes sections from
10884         input.  Check for BLX use after attributes section merging.
10885         Fix __exidx_start and __exidx_end visibility.  Create an
10886         .ARM.attributes section if necessary.
10887         (Target_arm::get_secondary_compatible_arch,
10888         Target_arm::set_secondary_compatible_arch,
10889         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10890         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10891         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10892         New method definitions.
10893
10894 2009-12-09  Ian Lance Taylor  <iant@google.com>
10895
10896         * plugin.cc (Plugin::load): Don't cast from void* to a function
10897         pointer.
10898
10899 2009-12-09  Ian Lance Taylor  <iant@google.com>
10900
10901         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10902         information fields.
10903
10904 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10905
10906         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10907         Replace two_file_shared_1.so with two_file_shared_2.so.
10908         * testsuite/Makefile.in: Regenerated.
10909
10910 2009-12-08  Doug Kwan  <dougkwan@google.com>
10911
10912         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10913         (HFILES): Add attributes.h and int_encoding.h.
10914         * Makefile.in: Regenerate.
10915         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10916         function definitions to int_encoding.cc
10917         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10918         prototypes to int_encoding.h
10919         * reduced_debug_output.cc (int_encoding.h): New include.
10920         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10921         function definitions to int_encoding.cc
10922         (insert_into_vector, read_from_pointer): Move template definitions to
10923         int_encoding.h
10924         * attributes.cc: New file.
10925         * attributes.h: New file.
10926         * int_encoding.cc: New file.
10927         * int_encoding.h: New file.
10928
10929 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10930
10931         PR gold/11055
10932         * incremental-dump.cc (dump_incremental_inputs): New.
10933         (main): Use dump_incremental_inputs.
10934
10935 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10936
10937         PR gold/10893
10938         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10939         checking elfcpp::STT_FUNC.
10940         (Target_i386::Relocate::relocate): Likewise.
10941         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10942
10943         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10944         symbols from shared libraries into normal FUNC symbols.
10945
10946         * symtab.h (Symbol): Add is_func and use it.
10947
10948 2009-12-05  Doug Kwan  <dougkwan@google.com>
10949
10950         * arm.cc (Target_arm::arm_info): Initialize new fields
10951         attributes_section and attributes_vendor.
10952         * i386.cc (Target_i386::i386_info): Same.
10953         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10954         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10955         fields attributes_section and attributes_vendor.
10956         * sparc.cc (Target_sparc::sparc_info): Same.
10957         * target.h (Target::attributes_section, Target::attributes_vendor,
10958         Target::is_attributes_section, Target::attribute_arg_type,
10959         Target::attributes_order): New method definitions.
10960         (Target::Target_info::attributes_section,
10961         Target::Target_info::attributes_vendor): New fields.
10962         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10963         virtual method definitions.
10964         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10965         attributes_section and attributes_vendor.
10966         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10967
10968 2009-12-05  Doug Kwan  <dougkwan@google.com>
10969
10970         * arm.cc: Update comments about interworking and stub generation.
10971         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10972         considered as non-PIC.
10973         (Arm_relocate_functions::base_abs): Fix formatting.
10974         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10975         of function to use GOT entry address instead of offset.
10976         (Target_arm::Scan::global): Issue an error if a symbol would need a
10977         PLT does not get one because it is untyped.  Remove code to create
10978         dynamic symbols for relative branches.
10979         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10980         takes unsigned integer instead of boolean.
10981
10982 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10983
10984         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10985         (two_file_test_LDADD): Likewise.
10986         (common_test_1_LDADD): Likewise.
10987         (exception_test_LDADD) Likewise.
10988         (weak_test_LDADD): Likewise.
10989         (many_sections_test_LDADD): Likewise.
10990         (initpri1_LDADD): Likewise.
10991         (script_test_1_LDADD): Likewise.
10992         (script_test_2_LDADD): Likewise.
10993         (justsyms_LDADD): Likewise.
10994         (binary_test_LDADD): Likewise.
10995         (large_LDADD): Likewise.
10996         * testsuite/Makefile.in: Regenerated.
10997
10998 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10999
11000         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11001         (Symbol_table::override_with_special): Likewise.
11002         (Symbol_table::add_from_object): Likewise.
11003
11004 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11005
11006         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11007         Don't set the data_offset twice.
11008
11009 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11010
11011         * testsuite/Makefile.in: Regenerate.
11012
11013 2009-12-03  Doug Kwan  <dougkwan@google.com>
11014
11015         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11016         (Target_arm::do_finalize_sections): Add parameter for symbol table
11017         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11018         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11019         parameter for symbol table pointer.
11020         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11021         an additional parameter for a pointer to symbol table.
11022         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11023         parameter for a symbol table pointer.
11024         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11025         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11026         Ditto.
11027         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11028         parameter for a symbol table pointer.
11029
11030 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11031
11032         * incremental.cc (Incremental_inputs_header)
11033         (Incremental_inputs_header_write, Incremental_inputs_entry)
11034         (Incremental_inputs_entry_write): Move ...
11035         * incremental.h (Incremental_inputs_header)
11036         (Incremental_inputs_header_write, Incremental_inputs_entry)
11037         (Incremental_inputs_entry_write): here.
11038
11039 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11040
11041         * incremental.cc (make_sized_incremental_binary): Set the target.
11042         Error if it is incompatible.
11043         * output.h (Output_file): Add filename method.
11044
11045 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11046
11047         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11048         from the get_* methods.
11049
11050 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11051
11052         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11053         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11054         Write 0 for the data_offset of scripts.
11055
11056 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11057
11058         * testsuite/Makefile.am: Add the incremental_test.sh test.
11059         * testsuite/incremental_test.sh: New.
11060         * testsuite/incremental_test_1.c: New.
11061         * testsuite/incremental_test_2.c: New.
11062
11063 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11064
11065         * incremental-dump.cc (main): Fix typos.
11066
11067 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11068
11069         PR gold/11025
11070         * incremental-dump.cc (main): Use llu to print 64 bit values.
11071
11072 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11073             H.J. Lu  <hongjiu.lu@intel.com>
11074
11075         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11076         $(LIBDL).
11077         (incremental_dump_LDADD): Likewise.
11078         * Makefile.in: Regenerated.
11079
11080 2009-11-25  Doug Kwan  <dougkwan@google.com>
11081
11082         Revert:
11083
11084         2009-11-25  Doug Kwan  <dougkwan@google.com>
11085
11086                 * arm.cc (Target_arm::Target_arm): Move method definition
11087                 outside of class definition.  Add code to handle
11088                 --target1-rel, --target1-abs and --target2= options.
11089                 (Target_arm::get_reloc_reloc_type): Change method to be
11090                 non-static and const.
11091                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11092                 New data member declaration.
11093                 (Target_arm::Scan::local, Target_arm::Scan::global,
11094                 Target_arm::Relocate::relocate,
11095                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11096                 Adjust call to Target_arm::get_real_reloc_type.
11097                 (Target_arm::get_real_reloc_type): Use command line options
11098                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11099                 * options.h (--target1-rel, --target1-abs, --target2): New
11100                 ARM-only options.
11101
11102 2009-11-25  Doug Kwan  <dougkwan@google.com>
11103
11104         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11105         class definition.  Add code to handle --target1-rel, --target1-abs
11106         and --target2= options.
11107         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11108         and const.
11109         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11110         member declaration.
11111         (Target_arm::Scan::local, Target_arm::Scan::global,
11112         Target_arm::Relocate::relocate,
11113         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11114         call to Target_arm::get_real_reloc_type.
11115         (Target_arm::get_real_reloc_type): Use command line options to
11116         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11117         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11118         options.
11119
11120 2009-11-25  Doug Kwan  <dougkwan@google.com>
11121
11122         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11123         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11124         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11125         formatting.
11126         (Arm_relocate_functions::thm_call): Replace body with a call to
11127         Arm_relocate_functions::thumb_branch_common.
11128         (Arm_relocate_functions::thm_jump24,
11129         Arm_relocate_functions::thm_xpc22): New method definitions.
11130         (Arm_relocate_functions::thumb_branch_common): New method definition.
11131         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11132         operator.
11133         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11134         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11135
11136 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11137
11138         * Makefile.am: Build incremental-dump
11139         * Makefile.in: Regenerate.
11140         * incremental-dump.cc: New.
11141         * incremental.cc (Incremental_inputs_header_data,
11142         Incremental_inputs_entry_data): Move to incremental.h
11143         * incremental.h: (Incremental_inputs_header_data,
11144         Incremental_inputs_entry_data): Move from incremental.cc
11145
11146 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11147
11148         * incremental.cc (Incremental_inputs_header,
11149         Incremental_inputs_header_write, Incremental_inputs_entry,
11150         Incremental_inputs_entry_write): Add a typedef with the data type.
11151
11152 2009-11-24  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): Update comment about which
11157         type has the filed descriptions.
11158
11159 2009-11-15  Doug Kwan  <dougkwan@google.com>
11160
11161         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11162         (Arm_relocate_functions::arm_branch_common): Change method defintion
11163         in class definition to a method declaration and update list of formal
11164         parameters.
11165         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11166         Arm_relocation_functions::jump24): Adjust call to
11167         Arm_relocate_functions::arm_branch_common.  Update list of formal
11168         parameters.
11169         (Arm_relocate_functions::xpc25): New method definition.
11170         (Arm_relocate_functions::arm_branch_common): Move method defintion
11171         out from class definition.  Use stubs for mode-switching and extending
11172         branch ranges.
11173         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11174         specially.  Change code to enable use of stubs in ARM branches.
11175
11176 2009-11-10  Doug Kwan  <dougkwan@google.com>
11177
11178         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11179         in method declaration.
11180         (Target_arm::relocate_stub): New method declaration.
11181         (Target_arm::default_target): Change to return a pointer instead of
11182         a const reference.
11183         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11184         Target_arm::default_target.
11185         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11186         method definition.
11187         (Target_arm::relocate_section): Adjust view.
11188         (Target_arm::relocate_stub): New method definition.
11189
11190 2009-11-10  Doug Kwan  <dougkwan@google.com>
11191
11192         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11193         a format warning.
11194         * incremental.cc (open_incremental_binary): Initialized local
11195         variables to avoid warnings.
11196         * object.cc (make_elf_object): Ditto.
11197         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11198         a format warning.
11199
11200 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11201
11202         PR gold/10930
11203         * testsuite/plugin_test.c: Include "config.h".
11204
11205 2009-11-09  Doug Kwan  <dougkwan@google.com>
11206
11207         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11208         (arm_symbol_value): Remove.
11209         (Arm_relocate_functions::arm_branch_common,
11210         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11211         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11212         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11213         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11214         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11215         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11216         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11217         Arm_relocate_functions::thm_mobw_abs_nc,
11218         Arm_relocate_functions::thm_mov_abs,
11219         Arm_relocate_functions::movw_prel_nc,
11220         Arm_relocate_functions::thm_movt_abs,
11221         Arm_relocate_functions::movt_prel,
11222         Arm_relocate_functions::thm_movw_prel_nc,
11223         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11224         (Target_arm::Relocate::relocate): Only decompose address into two
11225         parts if relocation type uses the thumb-bit and pass the actual
11226         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11227         calls to methods in Arm_relocate_functions for this change.
11228
11229 2009-11-08  Ian Lance Taylor  <iant@google.com>
11230
11231         PR 10925
11232         * reloc.cc: Instantiate
11233         Sized_relobj::initialize_input_to_output_maps and
11234         Sized_relobj:free_input_to_output_maps.
11235
11236 2009-11-06  Ian Lance Taylor  <iant@google.com>
11237
11238         PR 10876
11239         * defstd.cc (in_segment): Set only_if_ref true for "end".
11240
11241 2009-11-06  Doug Kwan  <dougkwan@google.com>
11242
11243         * arm.cc (class Reloc_stub): Correct a comment.
11244         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11245         (Target_arm::scan_section_for_stubs): New method declaration.
11246         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11247         Change methods from private to protected.
11248         (Target_arm::do_may_relax): New method definition.
11249         (Target_arm::do_relax, Target_arm::group_sections,
11250         Target_arm::scan_reloc_for_stub,
11251         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11252         (Target_arm::arm_input_section_map_): New data member declaration.
11253         (Target_arm::scan_reloc_for_stub,
11254         Target_arm::scan_reloc_section_for_stubs,
11255         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11256         Target_arm::do_relax): New method definitions.
11257
11258 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11259
11260         * configure.ac: Check for (struct stat)::st_mtim
11261         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11262         * config.in: Regenerate.
11263         * configure: Regenerate.
11264
11265 2009-11-05  Ian Lance Taylor  <iant@google.com>
11266
11267         PR 10910
11268         * output.cc (Output_segment::add_output_section): Add missing
11269         return statement.
11270
11271 2009-11-04  Ian Lance Taylor  <iant@google.com>
11272
11273         PR 10880
11274         * object.h (class Object): Add is_needed and set_is_needed
11275         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11276         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11277         defined in a dynamic object and referenced by a regular object,
11278         set is_needed for the dynamic object.
11279         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11280         if the file is marked with as_needed and it is not needed.
11281
11282 2009-11-04  Ian Lance Taylor  <iant@google.com>
11283
11284         PR 10887
11285         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11286         tags if data is discarded by linker script.
11287         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11288         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11289         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11290         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11291
11292 2009-11-04  Ian Lance Taylor  <iant@google.com>
11293
11294         * layout.cc (Layout::get_output_section): Add is_interp and
11295         is_dynamic_linker_section parameters.  Change all callers.
11296         (Layout::choose_output_section): Likewise.
11297         (Layout::make_output_section): Likewise.
11298         (Layout::add_output_section_data): Add is_dynamic_linker_section
11299         parameter.  Change all callers.
11300         * layout.h (class Layout): Update declarations.
11301         * output.h (class Output_section): Add is_interp, set_is_interp,
11302         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11303         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11304         generate_code_fills_at_write_ to a bitfield.
11305         * output.cc (Output_section::Output_sections): Initialize new
11306         fields.
11307         (Output_segment::add_output_section): Add do_sort parameter.
11308         Change all callers.
11309
11310 2009-11-03  Ian Lance Taylor  <iant@google.com>
11311
11312         PR 10860
11313         * options.h (class General_options): Add --warn-common.
11314         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11315         merging two common symbols.
11316         (Symbol_table::should_override): Handle --warn-common when merging
11317         a common symbol with a defined symbol.  Use report_resolve_problem
11318         for multiple definitions.
11319         (Symbol_table::report_resolve_problem): New function.
11320         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11321
11322 2009-11-03  Doug Kwan  <dougkwan@google.com>
11323
11324         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11325         stub_factory_.
11326         (Target_arm::stub_factory): New method definition.
11327         (Target_arm::new_arm_input_section,
11328         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11329         Target_arm::reloc_uses_thumb_bit): New method declarations.
11330         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11331         New type definitions.
11332         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11333         member declarations.
11334         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11335         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11336         New method definitions.
11337
11338 2009-11-03  Ian Lance Taylor  <iant@google.com>
11339
11340         * options.h (class General_options): Add --warn_constructors.
11341
11342 2009-11-03  Ian Lance Taylor  <iant@google.com>
11343
11344         PR 10893
11345         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11346         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11347
11348 2009-11-03  Ian Lance Taylor  <iant@google.com>
11349
11350         PR 10895
11351         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11352         --msgid-bugs-address.
11353         (install-pdf): New target.
11354         (install-data_yes): Look up one directory to find mkinstalldirs.
11355
11356 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11357
11358         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11359         tree.
11360
11361 2009-10-30  Doug Kwan  <dougkwan@google.com>
11362
11363         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11364
11365 2009-10-30  Doug Kwan  <dougkwan@google.com>
11366
11367         * arm.cc (Stub_addend_reader): New struct template definition
11368         and partial specializations.
11369         (Stub_addend_reader::operator()): New method definition for a
11370         partially specialized template.
11371
11372 2009-10-30  Doug Kwan  <dougkwan@google.com>
11373
11374         * arm.cc (Arm_relobj::processor_specific_flags): New method
11375         definition.
11376         (Arm_relobj::do_read_symbols): New method declaration.
11377         (Arm_relobj::processor_specific_flags_): New data member declaration.
11378         (Arm_dynobj): New class definition.
11379         (Target_arm::do_finalize_sections): Add input_objects parameter.
11380         (Target_arm::do_adjust_elf_header): New method declaration.
11381         (Target_arm::are_eabi_versions_compatible,
11382         (Target_arm::merge_processor_specific_flags): New method declaration.
11383         (Target_arm::do_make_elf_object): New overloaded method definitions
11384         and declaration.
11385         (Arm_relobj::do_read_symbols): New method definition.
11386         (Arm_dynobj::do_read_symbols): Ditto.
11387         (Target_arm::do_finalize_sections): Add input_objects parameters.
11388         Merge processor-specific flags from all input objects.
11389         (Target_arm::are_eabi_versions_compatible,
11390         Target_arm::merge_processor_specific_flags,
11391         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11392         New method definitions.
11393         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11394         Input_objects pointer type parameter.
11395         * layout.cc (Layout::finalize): Pass input objects to target's.
11396         finalize_sections function.
11397         * output.cc (Output_file_header::do_sized_write): Set ELF file
11398         header's processor-specific flags.
11399         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11400         Input_objects pointer type parameter.
11401         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11402         * target.h (Input_objects): New forward class declaration.
11403         (Target::processor_specific_flags,
11404         Target::are_processor_specific_flags_sect): New method definitions.
11405         (Target::finalize_sections): Add input_objects parameter.
11406         (Target::Target): Initialize processor_specific_flags_ and
11407         are_processor_specific_flags_set_.
11408         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11409         parameter.
11410         (Target::set_processor_specific_flags): New method definition.
11411         (Target::processor_specific_flags_,
11412         Target::are_processor_specific_flags_set_): New data member
11413         declarations.
11414         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11415         Input_objects pointer type parameter.
11416
11417 2009-10-30  Doug Kwan  <dougkwan@google.com>
11418
11419         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11420
11421 2009-10-28  Ian Lance Taylor  <iant@google.com>
11422
11423         * object.h (class Relobj): Drop options parameter from
11424         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11425         do_scan_relocs, do_relocate.  Change all callers.
11426         (class Sized_relobj): Drop options parameters from
11427         do_gc_process_relocs, do_scan_relocs, do_relocate,
11428         do_relocate_sections, relocate_sections, emit_relocs_scan,
11429         emit_relocs_scan_reltype.  Change all callers.
11430         (struct Relocate_info): Remove options field and all references to
11431         it.
11432         * reloc.h (class Read_relocs): Remove options constructor
11433         parameter and options_ field.  Change all callers.
11434         (class Gc_process_relocs, class Scan_relocs): Likewise.
11435         (class Relocate_task): Likewise.
11436         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11437         all callers.
11438         (scan_relocatable_relocs): Likewise.
11439         * target.h (class Sized_target): Remove options parameter from
11440         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11441         all callers.
11442         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11443         callers.
11444         * arm.cc: Update functions to remove options parameters.
11445         * i386.cc: Likewise.
11446         * powerpc.cc: Likewise.
11447         * sparc.cc: Likewise.
11448         * x86_64.cc: Likewise.
11449         * testsuite/testfile.cc: Likewise.
11450
11451 2009-10-28  Doug Kwan  <dougkwan@google.com>
11452
11453         * arm.cc (Arm_relobj): New class definition.
11454         (Arm_relobj::scan_sections_for_stubs,
11455         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11456         New method definitions.
11457
11458 2009-10-28  Cary Coutant  <ccoutant@google.com>
11459
11460         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11461         (Plugin::cleanup_done_): New member.
11462         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11463         (Plugin_manager::cleanup_done_): Remove.
11464         (Plugin_manager::add_input_file): Edit error message.
11465         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11466         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11467
11468 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11469
11470         * fileread.cc: (File_read::View::~View): Use the new
11471         data_ownership_ filed.
11472         (File_read::~File_read): Dispose the new whole_file_view_.
11473         (File_read::open): Mmap the whole file if needed.
11474         (File_read::open): Use whole_file_view_ instead of contents_.
11475         (File_read::find_view): Use whole_file_view_ if applicable.
11476         (File_read::do_read): Use whole_file_view_ instead of contents_.
11477         (File_read::make_view): Use whole_file_view_ instead of contents_,
11478         update File_read::View::View call.
11479         (File_read::find_or_make_view): Update File_read::View::View
11480         call.
11481         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11482         remove contents_
11483         (File_read::View::Data_ownership): New enum.
11484         (File_read::View::View): Replace bool mapped_ with Data_ownership
11485         argument.
11486         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11487         (File_read::View::data_ownership_): New field.
11488         (File_read::contents_): Remove (replaced by whole_file_view_).
11489         (File_read::whole_file_view_): New field.
11490         * options.h (class General_options): Add --keep-files-mapped.
11491
11492 2009-10-27  Cary Coutant  <ccoutant@google.com>
11493
11494         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11495         * testsuite/Makefile.am (plugin_test_5): New test case.
11496         * testsuite/Makefile.in: Regenerate.
11497
11498 2009-10-25  Doug Kwan  <dougkwan@google.com>
11499
11500         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11501         from private to protected to allow access by child class.
11502         (Sized_relobj::do_relocate_sections): New method declaration.
11503         (Sized_relobj::relocate_sections): Virtualize.
11504         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11505         Sized_relobj::relocate_sections.  Instantiate template explicitly
11506         for different target sizes and endianity.
11507
11508 2009-10-24  Doug Kwan  <dougkwan@google.com>
11509
11510         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11511         (Arm_input_section::as_arm_input_section): New method.
11512         (Arm_output_section): New class definition.
11513         (Arm_output_section::create_stub_group,
11514         Arm_output_section::group_sections): New method definitions.
11515
11516 2009-10-22  Doug Kwan  <dougkwan@google.com>
11517
11518         * arm.cc (Arm_input_section): New class definition.
11519         (Arm_input_section::init, Arm_input_section:do_write,
11520         Arm_input_section::set_final_data_size,
11521         Arm_input_section::do_reset_address_and_file_offset): New method
11522         definitions.
11523
11524 2009-10-21  Doug Kwan  <dougkwan@google.com>
11525
11526         * arm.cc (Stub_table, Arm_input_section): New forward class
11527         declarations.
11528         (Stub_table): New class defintion.
11529         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11530         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11531         New method definition.
11532
11533 2009-10-21  Doug Kwan  <dougkwan@google.com>
11534
11535         * arm.cc: Update copyright comments.
11536         (Target_arm): New forward class template declaration.
11537         (Arm_address): New type.
11538         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11539         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11540         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11541         constants.
11542         (Insn_template): Same.
11543         (DEF_STUBS): New macro.
11544         (Stub_type): New enum type.
11545         (Stub_template): New class definition.
11546         (Stub): Same.
11547         (Reloc_stub): Same.
11548         (Stub_factory): Same.
11549         (Target_arm::Target_arm): Initialize may_use_blx_ and
11550         should_force_pic_veneer_.
11551         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11552         Target_arm::should_force_pic_veneer,
11553         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11554         Target_arm::using_thumb_only, Target_arm:;default_target): New
11555         method defintions.
11556         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11557         New data member declarations.
11558         (Insn_template::size, Insn_template::alignment): New method defintions.
11559         (Stub_template::Stub_template): New method definition.
11560         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11561         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11562         (Stub_factory::Stub_factory): New method definition.
11563         * gold.h (string_hash): New template.
11564         * output.h (Input_section_specifier::hash_value): Use
11565         gold::string_hash.
11566         (Input_section_specifier::string_hash): Remove.
11567         * stringpool.cc (Stringpool_template::string_hash): Use
11568         gold::string_hash.
11569
11570 2009-10-20  Doug Kwan  <dougkwan@google.com>
11571
11572         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11573         symbols of relaxed input sections.
11574         * output.h (Output_section::find_relaxed_input_section): Make
11575         method public.
11576
11577 2009-10-16  Doug Kwan  <dougkwan@google.com>
11578
11579         * dynobj.cc (Versions::Versions): Initialize version_script_.
11580         Only insert base version symbol definition for a shared object
11581         if version script defines any version versions.
11582         (Versions::define_base_version): New method definition.
11583         (Versions::add_def): Check that base version is not needed.
11584         (Versions::add_need): Define base version lazily.
11585         * dynobj.h (Versions::define_base_version): New method declaration.
11586         (Versions::needs_base_version_): New data member declaration.
11587         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11588         (check_DATA): Add no_version_test.stdout.
11589         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11590         New make rules.
11591         * testsuite/Makefile.in: Regenerate.
11592         * testsuite/no_version_test.c: New file.
11593         * testsuite/no_version_test.sh: Ditto.
11594
11595 2009-10-16  Doug Kwan  <dougkwan@google.com>
11596
11597         * expression.cc (class Segment_start_expression): New class definition.
11598         (Segment_start_expression::value): New method definition.
11599         (script_exp_function_segment_start): Return a new
11600         Segment_start_expression.
11601         * gold/script-c.h (script_saw_segment_start_expression): New function
11602         prototype.
11603         * script-sections.cc (Script_sections::Script_sections): Initialize
11604         SAW_SEGMENT_START_EXPRESSION_ to false.
11605         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11606         and -Tbbs options to specify section addresses if given in
11607         command line and no SEGMENT_START expression is seen in a script.
11608         * script-sections.h (Script_sections::saw_segment_start_expression,
11609         Script_sections::set_saw_segment_start_expression): New method
11610         definition.
11611         (Script_sections::saw_segment_start_expression_): New data member
11612         declaration.
11613         * script.cc (script_saw_segment_start_expression): New function.
11614         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11615         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11616         script_test_7.sh and script_test_8.sh.
11617         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11618         script_test_8.stdout.
11619         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11620         (script_test_6, script_test_6.stdout, script_test_7,
11621         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11622         * Makefile.in: Regenerate.
11623         * testsuite/script_test_6.sh: New file.
11624         * testsuite/script_test_6.t: Same.
11625         * testsuite/script_test_7.sh: Same.
11626         * testsuite/script_test_7.t: Same.
11627         * testsuite/script_test_8.sh: Same.
11628
11629 2009-10-16  Doug Kwan  <dougkwan@google.com>
11630
11631         * output.cc (Output_segment::set_section_list_address): Cast
11632         expressions to unsigned long long type to avoid format warnings.
11633
11634 2009-10-15  Ian Lance Taylor  <iant@google.com>
11635
11636         * script.cc (Script_options::add_symbol_assignment): Always add a
11637         dot assignment to script_sections_.
11638         * script-sections.cc (Script_sections::add_dot_assignment):
11639         Initialize if necessary.
11640
11641         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11642         program headers with no load segment if there is a linker script.
11643
11644         * layout.cc (Layout::set_segment_offsets): Align the file offset
11645         to the segment aligment for -N or -n with no load segment.
11646         * output.cc (Output_segment::add_output_section): Don't crash if
11647         the first section is a TLS section.
11648         (Output_segment::set_section_list_addresses): Print an error
11649         message if the address moves backward in a linker script.
11650         * script-sections.cc
11651         (Output_section_element_input::set_section_addresses): Don't
11652         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11653         (Orphan_output_section::set_section_addresses): Likewise.
11654
11655 2009-10-15  Doug Kwan  <dougkwan@google.com>
11656
11657         * layout.cc (Layout::finish_dynamic_section): Generate tags
11658         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11659         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11660         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11661
11662 2009-10-14  Ian Lance Taylor  <iant@google.com>
11663
11664         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11665         fields.
11666         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11667         data_shdr fields of relinfo.
11668         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11669         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11670         R_386_TLS_LDO_32, adjust based on section flags.
11671         (Target_i386::Relocate::fix_up_ldo): Remove.
11672
11673 2009-10-13  Ian Lance Taylor  <iant@google.com>
11674
11675         Add support for -pie.
11676         * options.h (class General_options): Add -pie and
11677         --pic-executable.
11678         (General_options::output_is_position_independent): Test -pie.
11679         (General_options::output_is_executable): Return true if not shared
11680         and not relocatable.
11681         (General_options::output_is_pie): Remove.
11682         * options.cc (General_options::finalize): Reject incompatible uses
11683         of -pie.
11684         * gold.cc (queue_middle_tasks): A -pie link is not static.
11685         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11686         * symtab.cc (Symbol::final_value_is_known): Return false if
11687         output_is_position_independent.
11688         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11689         output_is_position_independent.
11690         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11691         output_is_position_independent.
11692         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11693         output_is_position_independent.
11694         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11695         two_file_pie_test.
11696         (basic_pie_test.o, basic_pie_test): New targets.
11697         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11698         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11699         (two_file_pie_test): New target.
11700         * testsuite/Makefile.in: Rebuild.
11701         * README: Remove note saying that -pie is not supported.
11702
11703 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11704
11705         * options.h (class General_options): Add -init and -fini.
11706         * layout.cc (Layout::finish_dynamic_section): Emit
11707         given init and fini functions.
11708
11709 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11710
11711         * gc.h (gc_process_relocs): Check if icf is enabled using new
11712         function.
11713         * gold.cc (queue_initial_tasks): Likewise.
11714         (queue_middle_tasks): Likewise.
11715         * object.cc (do_layout): Likewise.
11716         * symtab.cc (is_section_folded): Likewise.
11717         * main.cc (main): Likewise.
11718         * reloc.cc (Read_relocs::run): Likewise.
11719         (Sized_relobj::do_scan_relocs): Likewise.
11720         * icf.cc (is_function_ctor_or_dtor): New function.
11721         (Icf::find_identical_sections): Check if function is ctor or dtor when
11722         safe icf is chosen.
11723         * options.h (General_options::icf): Change option to be an enum.
11724         (Icf_status): New enum.
11725         (icf_enabled): New method.
11726         (icf_safe_folding): New method.
11727         (set_icf_status): New method.
11728         (icf_status_): New variable.
11729         * (options.cc) (General_options::finalize): Set icf_status_.
11730         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11731         icf_test and icf_keep_unique_test to use the --icf enum flag.
11732         * testsuite/icf_safe_test.sh: New file.
11733         * testsuite/icf_safe_test.cc: New file.
11734
11735 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11736
11737         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11738         includes to gc.h and icf.h.
11739         * arm.cc: Include gc.h.
11740         * gold.cc: Likewise.
11741         * i386.cc: Likewise.
11742         * powerpc.cc: Likewise.
11743         * sparc.cc: Likewise.
11744         * x86_64.cc: Likewise.
11745         * gc.h: Include icf.h.
11746
11747 2009-10-11  Ian Lance Taylor  <iant@google.com>
11748
11749         * plugin.cc: Include "gold.h" before other header files.
11750
11751 2009-10-10  Chris Demetriou  <cgd@google.com>
11752
11753         * options.h (Input_file_argument::Input_file_type): New enum.
11754         (Input_file_argument::is_lib_): Replace with...
11755         (Input_file_argument::type_): New member.
11756         (Input_file_argument::Input_file_argument): Take Input_file_type
11757         'type' rather than boolean 'is_lib' as second argument.
11758         (Input_file_argument::is_lib): Use type_.
11759         (Input_file_argument::is_searched_file): New function.
11760         (Input_file_argument::may_need_search): Handle is_searched_file.
11761         * options.cc (General_options::parse_library): Support -l:filename.
11762         (General_options::parse_just_symbols): Update for Input_file_argument
11763         changes.
11764         (Command_line::process): Likewise.
11765         * archive.cc (Archive::get_file_and_offset): Likewise.
11766         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11767         * script.cc (read_script_file, script_add_file): Likewise.
11768         * fileread.cc (Input_file::Input_file): Likewise.
11769         (Input_file::will_search_for): Handle is_searched_file.
11770         (Input_file::open): Likewise.
11771         * readsyms.cc (Read_symbols::get_name): Likewise.
11772         * testsuite/Makefile.am (searched_file_test): New test.
11773         * testsuite/Makefile.in: Regenerate.
11774         * testsuite/searched_file_test.cc: New file.
11775         * testsuite/searched_file_test_lib.cc: New file.
11776
11777 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11778             Ian Lance Taylor  <iant@google.com>
11779
11780         * descriptor.cc: Include <cstdio> and "binary-io.h".
11781         (Descriptors::open): Open the files in binary mode always.
11782         * script.cc (Lex::get_token): Treat \r as whitespace.
11783
11784 2009-10-09  Ian Lance Taylor  <iant@google.com>
11785
11786         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11787
11788 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11789             Ian Lance Taylor  <iant@google.com>
11790
11791         * configure.ac: Check for readv function also.
11792         * fileread.cc (readv): Define if not HAVE_READV.
11793         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11794         does not exist.
11795         * config.in: Regenerate.
11796         * configure: Regenerate.
11797
11798 2009-10-09  Doug Kwan  <dougkwan@google.com>
11799
11800         * layout.cc (Layout::make_output_section): Call target hook to make
11801         ordinary output section.
11802         (Layout::finalize): Adjust parameter list of call the
11803         Target::may_relax().
11804         * layout.h (class Layout::section_list): New method.
11805         * merge.h (Output_merge_base::entsize): Change visibility to public.
11806         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11807         New methods.
11808         (Output_merge_string::do_is_string): New method.
11809         * object.cc (Sized_relobj::do_setup): renamed from
11810         Sized_relobj::set_up.
11811         * object.h (Sized_relobj::adjust_shndx,
11812         Sized_relobj::initializ_input_to_output_maps,
11813         Sized_relobj::free_input_to_output_maps): Change visibilities to
11814         protected.
11815         (Sized_relobj::setup): Virtualize.
11816         (Sized_relobj::do_setup): New method declaration.
11817         (Sized_relobj::invalidate_section_offset,
11818         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11819         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11820         * options.cc (parse_int): New function.
11821         * options.h (parse_int): New declaration.
11822         (DEFINE_int): New macro.
11823         (stub_group_size): New option.
11824         * output.cc (Output_section::Output_section): Initialize memebers
11825         merge_section_map_, merge_section_by_properties_map_,
11826         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11827         (Output_section::add_input_section): Handled deferred code-fill
11828         generation and remove an old comment.
11829         (Output_section::add_relaxed_input_section): New method definition.
11830         (Output_section::add_merge_input_section): Use merge section by
11831         properties map to speed to search.  Update merge section maps
11832         as appropriate.
11833         (Output_section::build_relaxation_map): New method definition.
11834         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11835         Same.
11836         (Output_section::relax_input_section): Renamed to
11837         Output_section::convert_input_sections_to_relaxed_sections and change
11838         interface to take a vector of pointers to relaxed sections.
11839         (Output_section::find_merge_section,
11840         Output_section::find_relaxed_input_section): New method definitions.
11841         (Output_section::is_input_address_mapped,
11842         Output_section::output_offset, Output_section::output_address):
11843         Use output section data maps to speed up searching.
11844         (Output_section::find_starting_output_address): Add comments.
11845         (Output_section::do_write,
11846         Output_section::write_to_postprocessing_buffer): Do code-fill
11847         generation as appropriate.
11848         (Output_section::get_input_sections): Invalidate relaxed input section
11849         map.
11850         (Output_section::restore_states): Adjust type of checkpoint .
11851         Invalidate relaxed input section map.
11852         * output.h (Output_merge_base): New class declaration.
11853         (Input_section_specifier): New class defintion.
11854         (class Output_relaxed_input_section) Change base class to
11855         Output_section_data_build.
11856         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11857         base class initializer.
11858         (Output_section::add_relaxed_input_section): New method declaration.
11859         (Output_section::Input_section): Change visibility to protected.
11860         (Output_section::Input_section::relobj,
11861         Output_section::Input_section::shndx): Handle relaxed input sections.
11862         Output_section::input_sections) Change visibility to protected.  Also
11863         define overload to return a non-const pointer.
11864         (Output_section::Merge_section_properties): New class defintion.
11865         (Output_section::Merge_section_by_properties_map,
11866         Output_section::Output_section_data_by_input_section_map,
11867         Output_section::Relaxation_map): New types.
11868         (Output_section::relax_input_section): Rename method to
11869         Output_section::convert_input_sections_to_relaxed_sections and change
11870         interface to take a vector of relaxed section pointers.
11871         (Output_section::find_merge_section,
11872         Output_section::find_relaxed_input_section,
11873         Output_section::build_relaxation_map,
11874         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11875         New method declarations.
11876         (Output_section::merge_section_map_
11877         Output_section::merge_section_by_properties_map_,
11878         Output_section::relaxed_input_section_map_,
11879         Output_section::is_relaxed_input_section_map_valid_,
11880         Output_section::generate_code_fills_at_write_): New data members.
11881         * script-sections.cc
11882         (Output_section_element_input::set_section_addresses): Call
11883         current_data_size and addralign methods of relaxed input sections.
11884         (Orphan_output_section::set_section_addresses): Call current_data_size
11885         and addralign methods of relaxed input sections.
11886         * symtab.cc (Symbol_table::compute_final_value): Extract template
11887         from the body of Symbol_table::sized_finalize_symbol.
11888         (Symbol_table::sized_finalized_symbol): Call
11889         Symbol_table::compute_final_value.
11890         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11891         (Symbol_table::compute_final_value): New templated method declaration.
11892         * target.cc (Target::do_make_output_section): New method defintion.
11893         * target.h (Target::make_output_section): New method declaration.
11894         (Target::relax): Add more parameters for input objects, symbol table
11895         and layout.  Adjust call to do_relax.
11896         (Target::do_make_output_section): New method declaration.
11897         (Target::do_relax): Add parameters for input objects, symbol table
11898         and layout.
11899
11900 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11901
11902         * pread.c: Include stdio.h.
11903
11904 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11905
11906         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11907         defined.
11908
11909 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11910
11911         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11912         Change read_shndx type to unsigned int.
11913         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11914         int.
11915         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11916         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11917         Change read_shndx type to unsigned int.
11918         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11919         int.
11920         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11921         * layout.cc (Layout::create_symtab_sections): Cast the result of
11922         local_symcount * symsize to off_t in the gold_assert.
11923
11924 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11925
11926         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11927         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11928         R_ARM_BASE_ABS.
11929         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11930         (Arm_relocate_functions::thm_abs5): New function.
11931         (Arm_relocate_functions::abs12): New function.
11932         (Arm_relocate_functions::abs16): New function.
11933         (Arm_relocate_functions::base_abs): New function.
11934         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11935         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11936         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11937         R_ARM_BASE_ABS.
11938         (Scan::global): Likewise.
11939         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11940         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11941         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11942         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11943         R_ARM_BASE_ABS.
11944
11945 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11946
11947         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11948         (Arm_relocate_functions::movt_prel): New function.
11949         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11950         (Arm_relocate_functions::thm_movt_prel): New function.
11951         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11952         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11953         (Scan::global, Relocate::relocate): Likewise.
11954         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11955
11956 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11957
11958         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11959         Incremental_checker.
11960         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11961         unsigned int.
11962         (class Incremental_inputs_header): New class.
11963         (Incremental_inputs_header_writer): Edit comment.
11964         (Incremental_inputs_entry): New class.
11965         (Incremental_inputs_entry_writer): Edit comment.
11966         (Sized_incremental_binary::do_find_incremental_inputs_section):
11967         Add *strtab_shndx parameter, fill it.
11968         (Sized_incremental_binary::do_check_inputs): New method.
11969         (Incremental_checker::can_incrementally_link_output_file): Use
11970         Sized_incremental_binary::check_inputs.
11971         (Incremental_inputs::report_command_line): Save command line in
11972         command_line_.
11973         * incremental.h:
11974         (Incremental_binary::find_incremental_inputs_section): New
11975         method.
11976         (Incremental_binary::do_find_incremental_inputs_section): Add
11977         strtab_shndx parameter.
11978         (Incremental_binary::do_check_inputs): New pure virtual method.
11979         (Sized_incremental_binary::do_check_inputs): Declare.
11980         (Incremental_checker::Incremental_checker): Add incremental_inputs
11981         parameter, use it to initialize incremental_inputs_.
11982         (Incremental_checker::incremental_inputs_): New field.
11983         (Incremental_checker::command_line): New method.
11984         (Incremental_checker::inputs): New method.
11985         (Incremental_checker::command_line_): New field.
11986
11987 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11988
11989         * incremental.cc: Include <cstdarg> and "target-select.h".
11990         (vexplain_no_incremental): New function.
11991         (explain_no_incremental): New function.
11992         (Incremental_binary::error): New method.
11993         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11994         method.
11995         (make_sized_incremental_binary): New function.
11996         (open_incremental_binary): New function.
11997         (can_incrementally_link_file): Add checks if output is ELF and has
11998         inputs section.
11999         * incremental.h: Include "elfcpp_file.h" and "output.h".
12000         (Incremental_binary): New class.
12001         (Sized_incremental_binary): New class.
12002         (open_incremental_binary): Declare.
12003         * object.cc (is_elf_object): Use
12004         elfcpp::Elf_recognizer::is_elf_file.
12005         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12006         * output.h (Output_file::filesize): New method.
12007
12008 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12009
12010         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12011         New function.
12012         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12013         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12014         function.
12015         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12016         function.
12017         (Arm_relocate_functions::movw_abs_nc): New function.
12018         (Arm_relocate_functions::movt_abs): New function.
12019         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12020         (Arm_relocate_functions::thm_movt_abs): New function.
12021         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12022         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12023         (Scan::global): Likewise.
12024         (Relocate::relocate): Likewise.
12025         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12026
12027 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12028
12029         * arm.cc (Arm_relocate_functions::got_prel) New function.
12030         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12031         (Relocate::relocate): Likewise.
12032         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12033
12034 2009-10-06  Ian Lance Taylor  <iant@google.com>
12035
12036         * options.h (class General_options): Define
12037         split_stack_adjust_size parameter.
12038         * object.h (class Object): Add uses_split_stack_ and
12039         has_no_split_stack_ fields.  Add uses_split_stack and
12040         has_no_split_stack accessor functions.  Declare
12041         handle_split_stack_section.
12042         (class Reloc_symbol_changes): Define.
12043         (class Sized_relobj): Define Function_offsets.  Declare
12044         split_stack_adjust, split_stack_adjust_reltype, and
12045         find_functions.
12046         * object.cc (Object::handle_split_stack_section): New function.
12047         (Sized_relobj::do_layout): Call handle_split_stack_section.
12048         * dynobj.cc (Sized_dynobj::do_layout): Call
12049         handle_split_stack_section.
12050         * reloc.cc (Sized_relobj::relocate_sections): Call
12051         split_stack_adjust for executable sections in split_stack
12052         objects.  Pass reloc_map to relocate_section.
12053         (Sized_relobj::split_stack_adjust): New function.
12054         (Sized_relobj::split_stack_adjust_reltype): New function.
12055         (Sized_relobj::find_functions): New function.
12056         * target-reloc.h: Include "object.h".
12057         (relocate_section): Add reloc_symbol_changes parameter.  Change
12058         all callers.
12059         * target.h (class Target): Add calls_non_split method.  Declare
12060         do_calls_non_split virtual method.  Declare match_view and
12061         set_view_to_nop.
12062         * target.cc: Include "elfcpp.h".
12063         (Target::do_calls_non_split): New function.
12064         (Target::match_view): New function.
12065         (Target::set_view_to_nop): New function.
12066         * gold.cc (queue_middle_tasks): Give an error if mixing
12067         split-stack and non-split-stack objects with -r.
12068         * i386.cc (Target_i386::relocate_section): Add
12069         reloc_symbol_changes parameter.
12070         (Target_i386::do_calls_non_split): New function.
12071         * x86_64.cc (Target_x86_64::relocate_section): Add
12072         reloc_symbol_changes parameter.
12073         (Target_x86_64::do_calls_non_split): New function.
12074         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12075         parameter.
12076         * powerpc.cc (Target_powerpc::relocate_section): Add
12077         reloc_symbol_changes parameter.
12078         * sparc.cc (Target_sparc::relocate_section): Add
12079         reloc_symbol_changes parameter.
12080         * configure.ac: Call AM_CONDITIONAL for the default target.
12081         * configure: Rebuild.
12082         * testsuite/Makefile.am (TEST_AS): New variable.
12083         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12084         (check_DATA): Add split_i386 and split_x86_64 files.
12085         (SPLIT_DEFSYMS): Define.
12086         (split_i386_[1234n].o): New targets.
12087         (split_i386_[124]): New targets.
12088         (split_i386_[1234r].stdout): New targets.
12089         (split_x86_64_[1234n].o): New targets.
12090         (split_x86_64_[124]): New targets.
12091         (split_x86_64_[1234r].stdout): New targets.
12092         (MOSTLYCLEANFILES): Add new executables.
12093         * testsuite/split_i386.sh: New file.
12094         * testsuite/split_x86_64.sh: New file.
12095         * testsuite/split_i386_1.s: New file.
12096         * testsuite/split_i386_2.s: New file.
12097         * testsuite/split_i386_3.s: New file.
12098         * testsuite/split_i386_4.s: New file.
12099         * testsuite/split_i386_n.s: New file.
12100         * testsuite/split_x86_64_1.s: New file.
12101         * testsuite/split_x86_64_2.s: New file.
12102         * testsuite/split_x86_64_3.s: New file.
12103         * testsuite/split_x86_64_4.s: New file.
12104         * testsuite/split_x86_64_n.s: New file.
12105         * testsuite/testfile.cc (Target_test): Update relocation_section
12106         function.
12107         * testsuite/Makefile.in: Rebuild.
12108
12109 2009-10-06  Ian Lance Taylor  <iant@google.com>
12110
12111         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12112         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12113         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12114         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12115         the address on ldo_addrs_.
12116         (Target_i386::Relocate::fix_up_ldo): New function.
12117
12118 2009-10-06   Rafael Espindola  <espindola@google.com>
12119
12120         * plugin.cc (add_input_library): New.
12121         (Plugin::load): Add add_input_library to tv.
12122         (Plugin_manager::add_input_file): Add the is_lib argument.
12123         (add_input_file): Update call to Plugin_manager::add_input_file.
12124         (add_input_library): New.
12125         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12126
12127 2009-09-30  Doug Kwan  <dougkwan@google.com>
12128
12129         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12130         symbol and call Symbol::may_need_copy_reloc to determine if
12131         a copy reloc is needed.
12132         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12133         nocopyreloc is given in command line.
12134         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12135         given in command line.
12136         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12137         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12138         of the removed Target_i386::may_need_copy_reloc.
12139         * options.h (copyreloc): New option with default value false.
12140         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12141         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12142         instead of the removed Target_powerpc::may_need_copy_reloc.
12143         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12144         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12145         instead of the removed Target_sparc::may_need_copy_reloc.
12146         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12147         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12148         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12149         instead of the removed Target_x86_64::may_need_copy_reloc.
12150
12151 2009-09-30  Ian Lance Taylor  <iant@google.com>
12152
12153         * object.h (class Object): Remove target_ field, and target,
12154         sized_target, and set_target methods.
12155         (Object::sized_target): Remove.
12156         (class Sized_relobj): Update declarations.  Remove sized_target.
12157         * object.cc (Sized_relobj::setup): Remove target parameter.
12158         Change all callers.
12159         (Input_objects::add_object): Don't do anything with the target.
12160         (make_elf_sized_object): Add punconfigured parameter.  Change all
12161         callers.  Set or test parameter target.
12162         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12163         Change all callers.
12164         * parameters.cc (Parameters::set_target): Change parameter type to
12165         be non-const.
12166         (Parameters::default_target): Remove.
12167         (set_parameters_target): Change parameter type to be non-const.
12168         (parameters_force_valid_target): New function.
12169         (parameters_clear_target): New function.
12170         * parameters.h (class Parameters): Update declarations.  Remove
12171         default_target method.  Add sized_target and clear_target
12172         methods.  Change target_ to be non-const.
12173         (set_parameters_target): Update declaration.
12174         (parameters_force_valid_target): Declare.
12175         (parameters_clear_target): Declare.
12176         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12177         as NULL if we aren't searching.
12178         (Add_symbols::run): Don't check for compatible target.
12179         * fileread.cc (Input_file::open_binary): Call
12180         parameters_force_valid_target.
12181         * gold.cc (queue_middle_tasks): Likewise.
12182         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12183         set_target on object.
12184         * dynobj.h (class Sized_dynobj): Update declarations.
12185         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12186         make_elf_object returns NULL.
12187         (Archive::include_member): Don't check whether object target is
12188         compatible.
12189         * output.cc (Output_section::add_input_section): Get target from
12190         parameters.
12191         (Output_section::relax_input_section): Likewise.
12192         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12193         parameters.
12194         (Sized_relobj::do_scan_relocs): Likewise.
12195         (Sized_relobj::relocate_sections): Likewise.
12196         * resolve.cc (Symbol_table::resolve): Likewise.
12197         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12198         parameter.  Change all callers.
12199         (Symbol_table::add_from_object): Get target from parameters.
12200         (Symbol_table::add_from_relobj): Don't check object target.
12201         (Symbol_table::add_from_dynobj): Likewise.
12202         (Symbol_table::define_special_symbol): Get target from
12203         parameters.
12204         * symtab.h (class Symbol_table): Update declaration.
12205         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12206         parameter.  Change all callers.  Clear parameter target.
12207         (Binary_test): Test target here.
12208         * testsuite/object_unittest.cc (gold_testsuite): Remove
12209         target_test_pointer parameter.  Change all callers.
12210         (Object_test): Test target here.
12211
12212 2009-09-26  Ian Lance Taylor  <iant@google.com>
12213
12214         * testsuite/initpri1.c: Don't try to use constructor priorities if
12215         compiling with gcc before 4.3.
12216
12217 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12218
12219         * testsuite/retain_symbols_file_test.sh (check_present): Change
12220         output file name to retain_symbols_file_test.stdout.
12221         (check_absent): Likewise.
12222
12223 2009-09-18  Craig Silverstein  <csilvers@google.com>
12224
12225         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12226         * options.cc: Include <cerrno> and <fstream>.
12227         (General_options::finalize): Parse -retain-symbols-file tag.
12228         * options.h: New flag.
12229         (General_options): New method should_retain_symbol, new
12230         variable symbols_to_retain.
12231         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12232         should_retain_symbol map.
12233         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12234         * testsuite/Makefile.in: Regenerate.
12235         * testsuite/retain_symbols_file_test.sh: New file.
12236
12237 2009-09-18  Nick Clifton  <nickc@redhat.com>
12238
12239         * po/es.po: Updated Spanish translation.
12240
12241 2009-09-17  Doug Kwan  <dougkwan@google.com>
12242
12243         * debug.h (DEBUG_RELAXATION): New constant.
12244         (DEBUG_ALL): Add DEBUG_RELAXATION.
12245         (debug_string_to_enum): Add relaxation debug option.
12246         * layout.cc
12247         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12248         Layout::Relaxation_debug_check::read_sections,
12249         Layout::Relaxation_debug_check::read_sections): New method definitions.
12250         (Layout::Layout): Initialize data members
12251         record_output_section_data_from_scrips_,
12252         script_output_section_data_list_ and relaxation_debug_check_.
12253         (Layout::save_segments, Layout::restore_segments,
12254         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12255         Layout::relaxation_loop_body): New method definitions.
12256         (Layout::finalize): Support relaxation.  Move section layout code to
12257         Layout::relaxation_loop_body.
12258         (Layout::set_asection_address_from_script): Move code for orphan
12259         section placement out.
12260         (Layout::place_orphan_sections_in_script): New method definition.
12261         * layout.h (Output_segment_headers, Output_file_header):
12262         New forward class declarations.
12263         (Layout::~Layout): Define.
12264         (Layout::new_output_section_data_from_script): New method definition.
12265         (Layout::place_orphan_sections_in_script): New method declaration.
12266         (Layout::Segment_states): New type declaration.
12267         (Layout::save_segments, Layout::restore_segments,
12268         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12269         Layout::relaxation_loop_body): New method declarations.
12270         (Layout::Output_section_data_list): New type declaration.
12271         (Layout::Relaxation_debug_check): New class definition.
12272         (Layout::record_output_section_data_from_script_,
12273         Layout::script_output_section_data_list_, Layout::segment_states_,
12274         Layout::relaxation_debug_check_): New data members.
12275         * output.cc: (Output_section_headers::do_size): New method definition.
12276         (Output_section_headers::Output_section_headers): Move size
12277         computation to Output_section_headers::do_size.
12278         (Output_segment_headers::do_size): New method definition.
12279         (Output_file_header::Output_file_header): Move size computation to
12280         Output_file_header::do_size and call it.
12281         (Output_file_header::do_size): New method definition.
12282         (Output_data_group::Output_data_group): Adjust call to
12283         Output_section_data.
12284         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12285         (Output_symtab_xindex::do_write): Add array bound check.
12286         (Output_section::Input_section::print_to_mapfile): Handle
12287         RELAXED_INPUT_SECTION_CODE.
12288         (Output_section::Output_section): Initialize data member checkpoint_.
12289         (Output_section::~Output_section): Delete checkpoint object pointed
12290         by checkpoint_.
12291         (Output_section::add_input_section): Always add an Input_section if
12292         relaxing.
12293         (Output_section::add_merge_input_section): Add assert.
12294         (Output_section::relax_input_section): New method definition.
12295         (Output_section::set_final_data_size): Set load address to zero for
12296         an unallocated section.
12297         (Output_section::do_address_and_file_offset_have_reset_values):
12298         New method definition.
12299         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12300         Handle relaxed input section.
12301         (Output_section::sort_attached_input_sections): Checkpoint input
12302         section list lazily.
12303         (Output_section::get_input_sections): Change type of input_sections to
12304         list of Simple_input_section pointers.  Checkpoint input section list
12305         lazily.  Also handle relaxed input sections.
12306         (Output_section::add_input_section_for_script): Take a reference to
12307         a Simple_input_section object instead of Relobj pointer and section
12308         index as parameter.  Handle relaxed input sections.
12309         (Output_section::save_states, Output_section::restore_states): New
12310         method definitions.
12311         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12312         (Output_data::is_data_size_fixed): New method definition.
12313         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12314         if it is fixed.
12315         (Output_data::address_and_file_offset_have_reset_values): New method
12316         definition.
12317         (Output_data::do_address_and_file_offset_have_reset_values): New method
12318         definition.
12319         (Output_data::set_data_size): Check that data size is not fixed.
12320         (Output_data::fix_data_size): New method definition.
12321         (Output_data::is_data_size_fixed_): New data member.
12322         (Output_section_headers::set_final_data_size): New method definition.
12323         (Output_section_headers::do_size): New method declaration.
12324         (Output_segment_headers::set_final_data_size): New method definition.
12325         (Output_segment_headers::do_size): New method declaration.
12326         (Output_file_header::set_final_data_size)::New method definition.
12327         (Output_file_header::do_size)::New method declaration.
12328         (Output_section_data::Output_section_data): Add new parameter
12329         is_data_size_fixed and use it to fix data size.
12330         (Output_data_const::Output_data_const): Adjust call to base class
12331         constructor and fix data size.
12332         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12333         base class constructor and fix data size.
12334         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12335         base class constructor and fix data size.
12336         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12337         class constructor and fix data size.
12338         (Output_data_group::set_final_data_size): New method definition.
12339         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12340         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12341         class constructor and fix data size.
12342         (Output_relaxed_input_section): New class definition.
12343         (Output_section::Simple_input_section): New class definition.
12344         (Output_section::get_input_sections): Adjust parameter list.
12345         (Output_section::add_input_section_for_script): Same.
12346         (Output_section::save_states, Output_section::restore_states,
12347         Output_section::do_address_and_file_offset_have_reset_values,
12348         (Output_section::Input_section::Input_section): Handle
12349         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12350         Output_relaxed_input_section.
12351         (Output_section::Input_section::is_input_section,
12352         Output_section::Input_section::set_output_section): Handle relaxed
12353         input section.
12354         (Output_section::Input_section::is_relaxed_input_section,
12355         Output_section::Input_section::output_section_data,
12356         Output_section::Input_section::relaxed_input_section): New method
12357         definitions.
12358         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12359         value.
12360         (Output_section::Input_section::u1_): Update comments.
12361         (Output_section::Input_section::u2_): Add new union member poris.
12362         (Output_section::Checkpoint_output_section): New classs definition.
12363         (Output_section::relax_input_section): New method declaration.
12364         (Output_section::checkpoint_): New data member.
12365         (Output_segment): Update comments.
12366         (Output_segment::Output_segment): Un-privatize copy constructor.
12367         (Output_segment::operator=): Un-privatize.
12368         * script-sections.cc (Output_section_element::Input_section_list):
12369         Change element type to Output_section::Simple_input_section.
12370         (Output_section_element_dot_assignment::set_section_addresses):
12371         Register output section data for relaxation clean up.
12372         (Output_data_exression::Output_data_expression): Adjust call to base
12373         constructor to fix data size.
12374         (Output_section_element_data::set_section_addresses): Register
12375         Output_data_expression object for relaxation clean up.
12376         (struct Input_section_info): Replace Relobj pointer and section index
12377         pair with Output_section::Simple_input_section and Convert struct to a
12378         class.
12379         (Input_section_sorter::operator()): Adjust access to
12380         Input_section_info data member to use accessors.
12381         (Output_section_element_input::set_section_addresses): Use layout
12382         parameter.  Adjust code to use Output_section::Simple_input_section
12383         and Input_secction_info classes.  Register filler for relaxation
12384         clean up.
12385         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12386         and section index pair with Output_section::Simple_input_section
12387         class.  Adjust code accordingly.
12388         (Phdrs_element::release_segment): New method definition.
12389         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12390         segment list.
12391         (Script_sections::release_segments): New method definition.
12392         * gold/script-sections.h (Script_sections::release_segments): New
12393         method declaration.
12394         * gold/target.h (Target::may_relax, Target::relax,
12395         Target::do_may_relax, Target::do_relax): New method definitions.
12396
12397 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12398
12399         * arm.cc (has_signed_unsigned_overflow): New function.
12400         (Arm_relocate_functions::abs8): New function.
12401         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12402         (Target_arm::Scan::global): Likewise.
12403         (Target_arm::relocate::relocate): Likewise.
12404         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12405         Likewise.
12406
12407 2009-09-16  Cary Coutant  <ccoutant@google.com>
12408
12409         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12410         * testsuite/Makefile.in: Regenerate.
12411
12412 2009-09-11  Nick Clifton  <nickc@redhat.com>
12413
12414         * po/gold.pot: Updated by the Translation project.
12415
12416 2009-09-08  Cary Coutant  <ccoutant@google.com>
12417
12418         * output.cc (Output_file::open): Add execute permission to empty file.
12419         * testsuite/Makefile.am (permission_test): New test.
12420         * testsuite/Makefile.in: Regenerate.
12421
12422 2009-09-02  Ian Lance Taylor  <iant@google.com>
12423
12424         * output.cc (Output_file::resize): Call map_no_anonymous rather
12425         than map.
12426
12427 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12428
12429         * gold.cc: Include "incremental.h".
12430         (queue_initial_tasks): Call Incremental_checker methods.
12431         * incremental.cc: Include "output.h".
12432         (Incremental_checker::can_incrementally_link_output_file): New
12433         method.
12434         * incremental.h (Incremental_checker): New class.
12435
12436         * output.cc (Output_file::open_for_modification): New method.
12437         (Output_file::map_anonymous): Changed return type to bool.  Record
12438         map in base_ field.
12439         (Output_file::map_no_anonymous): New method, broken out of map.
12440         (Output_file::map): Use map_no_anonymous and map_anonymous.
12441         * output.h (class Output_file): Update declarations.
12442
12443 2009-08-24  Cary Coutant  <ccoutant@google.com>
12444
12445         * options.h (Command_line::Pre_options): New class.
12446         (Command_line::pre_options): New member.
12447         * options.cc (gold::options::ready_to_register): New variable.
12448         (One_option::register_option): Do nothing if not registering options.
12449         Assert if same short option registered twice.
12450         (General_options::General_options): Turn off option registration when
12451         done constructing.
12452         (Command_line::Pre_options::Pre_options): New constructor.
12453
12454 2009-08-24  Cary Coutant  <ccoutant@google.com>
12455
12456         * options.h (General_options::no_keep_memory): Remove incorrect
12457         short option.
12458
12459 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12460
12461         * Makefile.am (am__skiplex, am__skipyacc): New.
12462         * Makefile.in: Regenerate.
12463
12464 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12465
12466         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12467         (INCLUDES): ... this.
12468         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12469         (AM_CPPFLAGS): Renamed from ...
12470         (INCLUDE): ... this.
12471         * Makefile.in, testsuite/Makefile.in: Regenerate.
12472
12473         * Makefile.in: Regenerate.
12474         * aclocal.m4: Likewise.
12475         * config.in: Likewise.
12476         * configure: Likewise.
12477         * testsuite/Makefile.in: Likewise.
12478
12479         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12480         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12481         * Makefile.in: Regenerate.
12482         * testsuite/Makefile.in: Regenerate.
12483
12484 2009-08-19  Cary Coutant  <ccoutant@google.com>
12485
12486         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12487         symbols in shared libraries overridden by hidden or internal symbols
12488         in the main program.
12489
12490 2009-08-19  Chris Demetriou  <cgd@google.com>
12491
12492         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12493         checking source file names in error messages.
12494
12495 2009-08-18  Doug Kwan  <dougkwan@google.com>
12496
12497         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12498         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12499         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12500         an elfcpp::Ehdr as parameter.
12501         * object.cc (Object::set_target): Remove the version that looks up
12502         a target and sets it.
12503         (Sized_relobj::setup): Take a Target object instead of
12504         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12505         (make_elf_sized_object): Find target and ask target to
12506         make an ELF object.
12507         * object.h: (Object::set_target): Remove the version that looks up
12508         a target and sets it.
12509         (Sized_relobj::setup): Take a Target object instead of
12510         an elfcpp:Ehdr as parameter.
12511         * target.cc: Include dynobj.h.
12512         (Target::do_make_elf_object_implementation): New.
12513         (Target::do_make_elf_object): New.
12514         * target.h (Target::make_elf_object): New template declaration.
12515         (Target::do_make_elf_object): New method declarations.
12516         (Target::do_make_elf_object_implementation): New template declaration.
12517
12518 2009-08-14  Ian Lance Taylor  <iant@google.com>
12519
12520         * gold.h (FUNCTION_NAME): Define.
12521         (gold_unreachable): Use FUNCTION_NAME.
12522
12523 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12524
12525         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12526         symbol in the --keep-unique list is not found.
12527
12528 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12529
12530         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12531         been maked as --keep-unique.
12532         (Icf::unfold_section): New function.
12533         * icf.h (Icf::unfold_section): New function.
12534         * options.h (General_options::keep_unique): New option.
12535         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12536         * testsuite/Makefile.in: Regenerate.
12537         * testsuite/icf_keep_unique_test.sh: New file.
12538         * testsuite/icf_keep_unique_test.cc: New file.
12539
12540 2009-08-12  Cary Coutant  <ccoutant@google.com>
12541
12542         PR 10471
12543         * resolve.cc (Symbol_table::resolve): Check for references from
12544         dynamic objects to hidden and internal symbols.
12545         * testsuite/Makefile.am (hidden_test.sh): New test.
12546         * testsuite/Makefile.in: Regenerate.
12547         * testsuite/hidden_test.sh: New script.
12548         * testsuite/hidden_test_1.c: New test source.
12549         * testsuite/hidden_test_main.c: New test source.
12550
12551 2009-08-11  Doug Kwan  <dougkwan@google.com>
12552
12553         * arm.cc: Update comments.
12554         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12555         segment to locate the .ARM.exidx section if present.
12556
12557 2009-08-09  Doug Kwan  <dougkwan@google.com>
12558
12559         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12560         patch.
12561
12562 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12563         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12564         compiler warnings.
12565
12566 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12567
12568         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12569         valid tls_segment only for non-debug-section relocations.
12570         * testsuite/Makefile.am: Add gc_tls_test.
12571         * testsuite/Makefile.in: Regenerate.
12572         * testsuite/gc_tls_test.cc: New file.
12573         * testsuite/gc_tls_test.sh: New file.
12574
12575 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12576
12577         * icf.cc: New file.
12578         * icf.h: New file.
12579         * Makefile.am (CCFILES): Add icf.cc.
12580         (HFILES): Add icf.h
12581         * Makefile.in: Regenerate.
12582         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12583         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12584         section, symbol and addend information for the relocs.
12585         * gold.cc (queue_middle_tasks): Call identical code folding.
12586         * gold.h: Add defines for multimap.
12587         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12588         to the call of finalize_local_symbols.
12589         * main.cc (main): Create object of class Icf.
12590         * object.cc (Sized_relobj::do_layout): Allow this function to be
12591         called twice during icf.
12592         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12593         to sections marked as identical by icf.
12594         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12595         when available.
12596         (Sized_relobj::do_section_entsize): New function.
12597         * object.h (Object::section_entsize): New function.
12598         (Object::do_section_entsize): New pure virtual function.
12599         (Relobj::finalize_local_symbols): Add new parameter.
12600         (Relobj::do_section_entsize): New function.
12601         * options.h (General_options::icf): New option.
12602         (General_options::icf_iterations): New option.
12603         (General_options::print_icf_sections): New option.
12604         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12605         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12606         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12607         icf.
12608         * symtab.cc (Symbol_table::is_section_folded): New function.
12609         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12610         to sections marked as identical by icf.
12611         * symtab.h (Symbol_table::set_icf): New function.
12612         (Symbol_table::icf): New function.
12613         (Symbol_table::is_section_folded): New function.
12614         (Symbol_table::icf_): New data member.
12615         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12616         * testsuite/Makefile.am: Add commands to build icf_test.
12617         * testsuite/Makefile.in: Regenerate.
12618         * testsuite/icf_test.sh: New file.
12619         * testsuite/icf_test.cc: New file.
12620
12621 2009-07-24  Chris Demetriou  <cgd@google.com>
12622
12623         * layout.cc (is_compressible_debug_section): Fix incorrect
12624         comment about compressed section names.
12625
12626 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12627
12628         PR 10419
12629         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12630
12631 2009-07-16  Ian Lance Taylor  <iant@google.com>
12632
12633         PR 10400
12634         * layout.h: #include <map>.
12635         (class Kept_section): Change from struct to class.  Add accessors
12636         and setters.  Add section size to Comdat_group mapping.  Change
12637         Comdat_group to std::map.  Add is_comdat_ field.  Add
12638         linkonce_size field in union.
12639         (class Layout): Update declaration of find_or_add_kept_section.
12640         Don't declare find_kept_object.
12641         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12642         parameter.  Add object, shndx, is_comdat, and is_group_name
12643         parameters.  Change all callers.  Adjust for new Kept_section.
12644         (Layout::find_kept_object): Remove.
12645         * object.cc (Sized_relobj::include_section_group): Update use of
12646         Kept_section.  Rename secnum to shndx.  Only record
12647         Kept_comdat_section if sections are the same size.
12648         (Sized_relobj::include_linkonce_section): Update use of
12649         Kept_section.  Only record Kept_comdat_section if sections are the
12650         same size.  Set size of linkonce section.
12651         (Sized_relobj::map_to_kept_section): Update call to
12652         get_kept_comdat_section.
12653         * object.h (class Sized_relobj): Rename fields in
12654         Kept_comdat_section to drop trailing underscores; change object
12655         field to Relobj*.  Change Kept_comdat_section_table to store
12656         struct rather than pointer.
12657         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12658         Add kept_object and kept_shndx parameters.  Change all callers.
12659         (Sized_relobj::get_kept_comdat_section): Change return type to
12660         bool.  Add kept_object and kept_shndx parameters.  Change all
12661         callers.
12662         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12663         Layout::find_or_add_kept_section.
12664
12665 2009-07-09  Ian Lance Taylor  <iant@google.com>
12666
12667         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12668         Reserve space in the hash table.
12669
12670 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12671
12672         * fileread.cc (File_read::get_mtime): New method.
12673         * fileread.h (Timespec): New structure.
12674         (File_read::get_mtime): New method.
12675         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12676         Renamed from timestamp_nsec.
12677         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12678         Elf_Xword.
12679         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12680         timestamp_nsec.
12681         (Incremental_inputs::report_archive): Save mtime; style fix.
12682         (Incremental_inputs::report_obejct): Save mtime; style fix.
12683         (Incremental_inputs::report_script): Save mtime; style fix.
12684         (Incremental_inputs::finalize_inputs): Style fix.
12685         (Incremental_inputs::finalize): Style fix.
12686         (Incremental_inputs::create_input_section_data): Store inputs
12687         mtime.
12688         * incremental.h (Incremental_inputs::report_script): Add mtime
12689         argument.
12690         (Incremental_inputs::Input_info::Input_info): Intialize only one
12691         union member.
12692         (Incremental_inputs::Input_info::archive): Move to nameless
12693         union.
12694         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12695         (Incremental_inputs::Input_info::script): Move to nameless union.
12696         (Incremental_inputs::mtime): New field.
12697         * script.cc (read_input_script): Pass file mtime to
12698         Incremental_input.
12699         * script.h (Script_info::inputs): Style fix.
12700
12701 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12702
12703         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12704         instead of 32.
12705
12706 2009-06-24  Ian Lance Taylor  <iant@google.com>
12707
12708         PR 10156
12709         * layout.cc (Layout::choose_output_section): If we find an
12710         existing section, update the flags.
12711         (Layout::create_notes): New function, broken out of
12712         Layout::finalize.
12713         (Layout::finalize): Don't create note sections.
12714         (Layout::create_note): Don't crash if linker script discards
12715         section.
12716         (Layout::create_gold_note): Likewise.
12717         (Layout::create_build_id): Likewise.  Don't set
12718         after_input_sections on the section.
12719         (Layout::create_executable_stack_info): Remove target parameter.
12720         Change caller.
12721         * layout.h (class Layout): Declare create_notes.  Update
12722         declaration of create_executable_stack_info.
12723         * gold.cc (queue_middle_tasks): Call create_notes.
12724         * output.cc (Output_section::update_flags_for_input_section): Move
12725         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12726         invalid.
12727         * output.h (Output_data::mark_address_invalid): New function.
12728         (class Output_section): Only declare, not define,
12729         update_flags_for_input_section.  Remove set_flags.
12730
12731 2009-06-24  Ian Lance Taylor  <iant@google.com>
12732
12733         * script-sections.cc (Output_section_definition::
12734         set_section_addresses): Rename shadowing local load_address to
12735         laddr.
12736
12737 2009-06-24  Ian Lance Taylor  <iant@google.com>
12738
12739         PR 10244
12740         * reloc.cc (relocate_sections): Skip empty relocation sections.
12741
12742 2009-06-23  Ian Lance Taylor  <iant@google.com>
12743
12744         PR 10156
12745         * layout.cc (Layout::create_note): Use choose_output_section
12746         rather than make_output_section.
12747
12748 2009-06-23  Ian Lance Taylor  <iant@google.com>
12749
12750         PR 10237
12751         * options.cc (General_options::parse_V): Set printed_version_.
12752         (General_options::General_options): Initialize printed_version_.
12753         * options.h (class General_options): Add printed_version_ field.
12754         * gold.cc (queue_initial_tasks): If there are no input files,
12755         don't give a fatal error if we printed the version information.
12756         (queue_middle_tasks): If using -r with a shared object, give a
12757         fatal error rather than an ordinary error.
12758
12759 2009-06-23  Ian Lance Taylor  <iant@google.com>
12760
12761         PR 10219
12762         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12763         (Layout::make_output_section): Set have_stabstr_section_ if we see
12764         a .stab*str section.
12765         (Layout::finalize): Call link_stabs_sections.
12766         (Layout::link_stabs_sections): New file.
12767         * layout.h (class Layout): Add have_stabstr_section_ field.
12768         Declare link_stabs_sections.
12769
12770 2009-06-23  Doug Kwan  <dougkwan@google.com>
12771
12772         * Makefile.am (libgold_a_LIBADD): New.
12773         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12774         * Makefile.in: Regenerate.
12775         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12776         * configure: Regenerate.
12777         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12778         * fileread.cc: Include sys/state.h
12779         * gold.h: Declare memmem and strndup if found missing.
12780         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12781
12782 2009-06-23  Ian Lance Taylor  <iant@google.com>
12783
12784         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12785         * configure: Rebuild.
12786
12787 2009-06-23  Ian Lance Taylor  <iant@google.com>
12788
12789         PR 10147
12790         * object.cc (Object::section_contents): Don't try to get a view if
12791         the section has length zero.
12792         (Object::handle_gnu_warning_section): If the section is empty, use
12793         the name of the section as the warning.
12794
12795 2009-06-23  Ian Lance Taylor  <iant@google.com>
12796
12797         PR 10133
12798         * stringpool.h (class Stringpool_template): Add optimize_ field.
12799         (Stringpool_template::set_optimize): New function.
12800         * stringpool.cc (Stringpool_template::Stringpool_template):
12801         Initialize optimize_ field.
12802         (Stringpool_template::set_string_offsets): Test local optimize
12803         fild rather than parameter.
12804         * layout.cc (Layout::Layout): Call set_optimize on the section
12805         name stringpool.
12806
12807 2009-06-22  Ian Lance Taylor  <iant@google.com>
12808
12809         PR 10030
12810         * yyscript.y: Parse TARGET.
12811         * script.cc (script_set_target): New function.
12812         * script-c.h (script_set_target): Declare.
12813         * options.cc (General_options::string_to_object_format): Rename
12814         from string_to_object_format in anonymous namespace.  Change
12815         callers.
12816         * options.h (class General_options): Declare
12817         string_to_object_format.
12818
12819 2009-06-22  Ian Lance Taylor  <iant@google.com>
12820
12821         * script-sections.cc (Script_sections::create_segments): Don't put
12822         program headers in a PT_LOAD segment if -n or -N.
12823
12824 2009-06-22  Ian Lance Taylor  <iant@google.com>
12825
12826         PR 10141
12827         * options.h (class General_options): Add -z lazy and -z now.  Sort
12828         -z options into alphabetical order.
12829         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12830
12831 2009-06-21  Ian Lance Taylor  <iant@google.com>
12832
12833         * layout.cc (Layout::make_output_section): Call
12834         Target::new_output_section.
12835         (Layout::attach_allocated_section_to_segment): Put large section
12836         sections in a separate load segment with the large segment flag
12837         set.
12838         (Layout::segment_precedes): Sort large data segments after other
12839         load segments.
12840         (align_file_offset): New static function.
12841         (Layout::set_segment_offsets): Use align_file_offset.
12842         * output.h (class Output_section): Add is_small_section_ and
12843         is_large_section_ fields.
12844         (Output_section::is_small_section): New function.
12845         (Output_section::set_is_small_section):  New function.
12846         (Output_section::is_large_section): New function.
12847         (Output_section::set_is_large_section): New function.
12848         (Output_section::is_large_data_section): New function.
12849         (class Output_segment): Add is_large_data_segment_ field.
12850         (Output_segment::is_large_data_segment): New function.
12851         (Output_segment::set_is_large_data_segment): New function.
12852         * output.cc (Output_section::Output_section): Initialize new
12853         fields.
12854         (Output_segment::Output_segment): Likewise.
12855         (Output_segment::add_output_section): Add assertion that large
12856         data sections always go in large data segments.  Force small data
12857         sections to the end of the list of data sections.  Force small BSS
12858         sections to the start of the list of BSS sections.  For large BSS
12859         sections to the end of the list of BSS sections.
12860         * symtab.h (class Symbol): Declare is_common_shndx.
12861         (Symbol::is_defined): Check Symbol::is_common_shndx.
12862         (Symbol::is_common): Likewise.
12863         (class Symbol_table): Define enum Commons_section_type.  Update
12864         declarations.  Add small_commons_ and large_commons_ fields.
12865         * symtab.cc (Symbol::is_common_shndx): New function.
12866         (Symbol_table::Symbol_table): Initialize new fields.
12867         (Symbol_table::add_from_object): Put small and large common
12868         symbols in the right list.
12869         (Symbol_table::sized_finalized_symbol): Check
12870         Symbol::is_common_shndx.
12871         (Symbol_table::sized_write_globals): Likewise.
12872         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12873         common symbol lists.  Don't call do_allocate_commons_list if the
12874         list is empty.
12875         (Symbol_table::do_allocate_commons_list): Remove is_tls
12876         parameter.  Add comons_section_type parameter.  Change all
12877         callers.  Handle small and large common symbols.
12878         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12879         Symbol::is_common_shndx.
12880         * resolve.cc (symbol_to_bits): Likewise.
12881         * target.h (Target::small_common_shndx): New function.
12882         (Target::small_common_section_flags): New function.
12883         (Target::large_common_shndx): New function.
12884         (Target::large_common_section_flags): New function.
12885         (Target::new_output_section): New function.
12886         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12887         small_common_section_flags, and large_common_section_flags
12888         fields.
12889         (Target::do_new_output_section): New virtual function.
12890         * arm.cc (Target_arm::arm_info): Initialize new fields.
12891         * i386.cc (Target_i386::i386_info): Likewise.
12892         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12893         Likewise.
12894         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12895         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12896         (Target_x86_64::do_new_output_section): New function.
12897         * configure.ac: Define conditional MCMODEL_MEDIUM.
12898         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12899         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12900         (large_LDFLAGS): Define.
12901         * testsuite/large.c: New file.
12902         * testsuite/testfile.cc (Target_test::test_target_info):
12903         Initialize new fields.
12904         * configure, testsuite/Makefile.in: Rebuild.
12905
12906 2009-06-05  Doug Kwan  <dougkwan@google.com>
12907
12908         * Makefile.am (CCFILES): Add target.cc.
12909         * Makefile.in: Regenerate.
12910         * i386.cc (class Target_i386): Define new virtual method to
12911         override do_is_local_label_name in parent.
12912         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12913         local symbols if --discard-locals or -X is given.
12914         * options.h (class General_options): Declare new options
12915         '--discard-locals' and '-X' for discarding locals.
12916         * target.h (class Target): Define new methods is_local_label_name.
12917         Declare new virtual method do_is_local_label_name.
12918         * target.cc: New file.
12919         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12920         (check_SCRIPTS): Add discard_locals_test.sh.
12921         (check_DATA): Add discard_local_tests.syms.
12922         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12923         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12924         * testsuite/Makefile.in: Regenerate.
12925         * testsuite/discard_locals_test.c: New file.
12926         * testsuite/discard_locals_test.sh: Same.
12927
12928 2009-06-05  Doug Kwan  <dougkwan@google.com>
12929
12930         * object.cc (Sized_relobj::Sized_relobj): Initialize
12931         discarded_eh_frame_shndx_ to -1U.
12932         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12933         section.
12934         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12935         a discarded .eh_frame section.
12936         (Sized_relobj::do_finalize_local_symbols): Ditto.
12937         * object.h (class Sized_relobj): Declare new member
12938         discarded_eh_frame_shndx_.
12939         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12940         (local_labels_test.o, local_labels_test): New rules.
12941         * testsuite/Makefile.in: Regenerate.
12942
12943 2009-06-04  Doug Kwan  <dougkwan@google.com>
12944
12945         * layout.cc (Layout::section_name_mapping): Add mapping for
12946         special ARM sections.
12947
12948 2009-06-03  Doug Kwan  <dougkwan@google.com>
12949
12950         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12951         (utils::has_overflow): Same.
12952
12953 2009-06-03  Ian Lance Taylor  <iant@google.com>
12954
12955         * layout.cc (Layout::section_name_mapping): New array, replacing
12956         Layout::linkonce_mapping.
12957         (Layout::section_name_mapping_count): New variable, replacing
12958         Layout::linkonce_mapping_count.
12959         (Layout::linkonce_output_name): Remove.
12960         (Layout::output_section_name): Rewrite.
12961         * layout.h (class Layout): Rename Linkonce_mapping to
12962         Section_name_mapping, linkonce_mapping to section_name_mapping,
12963         linkonce_mapping_count to section_name_mapping_count.  Don't
12964         declare linkonce_output_name.
12965
12966 2009-06-03  Doug Kwan  <dougkwan@google.com>
12967
12968         * gold/arm.cc (namespace utils): New.
12969         (Target_arm::reloc_is_non_pic): Define new method.
12970         (class Arm_relocate_functions): New.
12971         (Target_arm::Relocate::relocate): Handle relocation types used by
12972         Android.
12973
12974 2009-06-03  Ian Lance Taylor  <iant@google.com>
12975
12976         * arm.cc (Target_arm::scan::global): Use || instead of |.
12977
12978 2009-06-02  Doug Kwan  <dougkwan@google.com>
12979
12980         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12981         issued_non_pic_error_.
12982         (class Target_arm::Scan): Declare new method check_non_pic.
12983         Define new method symbol_needs_plt_entry.
12984         Declare new data member issued_non_pic_error_.
12985         (class Target_arm::Relocate): Declare new method
12986         should_apply_static_reloc.
12987         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12988         (Target_arm::Scan::check_non_pic): Define new method.
12989         (Target_arm::Scan::local): Handle a small subset of reloc types used
12990         by Android.
12991         (Target_arm::Scan::local): Same.
12992         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12993
12994 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12995
12996         * incremental.cc (Incremental_inputs::report_command_line): Filter
12997         out --incremental-* options.
12998
12999 2009-05-29  Doug Kwan  <dougkwan@google.com>
13000
13001         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13002         template class.
13003         (class Target_arm): Update comment.
13004         (Target_arm::Target_arm): Initialize new data members GOT_,
13005         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13006         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13007         and Target_arm::rel_dyn_section.
13008         Declare new_enum Target_arm::Got_type.
13009         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13010         and DYNBSS_.
13011         Update commments for member do_dynsym_value.
13012         (Target_arm::got_size, Target_arm::plt_section,
13013         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13014         new methods inside class defintion.
13015         (Target_arm::got_section): Define new method.
13016         (Target_arm::rel_dyn_section): Same.
13017         (Output_data_plt_arm): New template class.
13018         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13019         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13020         (Output_data_plt_arm::add_entry): Same.
13021         (Output_data_plt_arm::first_plt_entry): Define new
13022         static data member for PLT instruction template.
13023         (Output_data_plt_arm::plt_entry): Same.
13024         (Output_data_plt_arm::do_write): Define new method.
13025         (Target_arm::make_plt_entry): Same.
13026         (Target_arm::do_finalize_sections): Same.
13027         (Target_arm::do_dynsym_value): Same.
13028
13029 2009-05-28  Doug Kwan  <dougkwan@google.com>
13030
13031         * Makefile.am (TARGETSOURCES): Add arm.cc.
13032         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13033         * Makefile.in: Regenerate.
13034         * arm.cc: New file.
13035         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13036
13037 2009-05-26  Doug Kwan  <dougkwan@google.com>
13038
13039         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13040         (General_options::check_excluded_libs): Strip off directories in
13041         archive name before matching like GNU ld does.
13042         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13043         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13044         (exclude_libs_test_LDFLAGS): Add linker option
13045         -Wl,--exclude-libs,libexclude_libs_test_3
13046         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13047         an explicit archive without using -l.
13048         (alt/libexclude_libs_test_3.a): New make rule.
13049         * testsuite/Makefile.in: Regenerate.
13050         * testsuite/exclude_libs_test.c : Declare lib3_default().
13051         (main): Call it.
13052         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13053         * exclude_libs_test_3.c: New file.
13054
13055 2009-05-26  Nick Clifton  <nickc@redhat.com>
13056
13057         * po/id.po: New Indonesian translation.
13058         * po/gold.pot: Updated template file.
13059
13060 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13061
13062         * testsuite/Makefile.am: Add -ffunction-sections to compile
13063         gc_comdat_test files.  Add -Wl,--gc-sections to build
13064         gc_comdat_test.
13065         * testsuite/Makefile.in: Regenerate.
13066         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13067
13068 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13069
13070         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13071         kept comdat section was garbage collected.
13072         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13073         * testsuite/Makefile.in: Regenerate.
13074         * testsuite/gc_comdat_test.sh: New file.
13075         * testsuite/gc_comdat_test_1.cc: New file.
13076         * testsuite/gc_comdat_test_2.cc: New file.
13077
13078 2009-05-19  Doug Kwan  <dougkwan@google.com>
13079
13080         * archive.cc (Archive::Archive): Move constructor from archive.h
13081         to here.  Initialize no_export_.
13082         (Archive::get_elf_object_for_member): Set no_export flag of object.
13083         * archive.h (Archive::Archive): Move constructor body to
13084         archive.cc.
13085         (Archive::no_export): New method.
13086         (Archive::no_export_): New field.
13087         * object.h (Object::Object): Initialize no_export_ to false.
13088         (Object::no_export, Object::set_no_export): New methods.
13089         (Object::no_export_): New field.
13090         * options.cc (General_options::parse_exclude_libs): New method.
13091         (General_options::check_excluded_libs) Same.
13092         * options.h (exclude_libs): New option.
13093         (General_options::check_excluded_libs): New method declaration.
13094         (General_options::excluded_libs_): New field.
13095         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13096         default or protected visibility if an object has no-export flag set.
13097         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13098         (check_SCRIPTS): Add exclude_libs_test.sh.
13099         (check_DATA): Add exclude_libs_test.syms.
13100         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13101         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13102         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13103         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13104         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13105         libexclude_libs_test_2.a): New rules.
13106         * testsuite/Makefile.in: Regenerate.
13107         * testsuite/exclude_libs_test.c: New file.
13108         * testsuite/exclude_libs_test.sh: Ditto.
13109         * testsuite/exclude_libs_test_1.c: Ditto.
13110         * testsuite/exclude_libs_test_2.c: Ditto.
13111
13112 2009-05-15  Ian Lance Taylor  <iant@google.com>
13113
13114         * configure.ac: Check for declarations for cases where libiberty.h
13115         checks HAVE_DECL_xxx.
13116         * configure, config.in: Rebuild.
13117
13118 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13119
13120         * gold.h (Incremental_argument_list): Remove (invalid) forward
13121         declaration.
13122         * incremental.cc (Incremental_inputs::report_achive): New method.
13123         (Incremental_inputs::report_object): New method.
13124         (Incremental_inputs::report_script): New method.
13125         (Incremental_inputs::finalize_inputs): New method.
13126         (Incremental_inputs::finalize): Call finalize_inputs().
13127         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13128         Create inputs entries.
13129         * incremental.h (Incremental_input_type): New enum.
13130         (Incremental_inputs::Incremental_input): Initialize new fields.
13131         (Incremental_inputs::report_inputs): New method.
13132         (Incremental_inputs::report_achive): New method.
13133         (Incremental_inputs::report_object): New method.
13134         (Incremental_inputs::report_script): New method.
13135         (Incremental_inputs::finalize_inputs): New method.
13136         (Incremental_inputs::Input_info): New struct.
13137         (Incremental_inputs::Input_info_map): New typedef.
13138         (Incremental_inputs::lock_): New field.
13139         (Incremental_inputs::Inputs_): New field.
13140         (Incremental_inputs::Inputs_map): New field.
13141         * main.cc (main): Call Incremental_input::report_inputs.
13142         * options.h (Input_argument_list): Typedef moved from
13143         Input_arguments.
13144         (Input_file_group::Files): Remove, use ::Input_argument_list.
13145         (Input_file_group::Input_argument_list): Remove, use
13146         ::Input_argument_list.
13147         * plugin.cc (Plugin_manager::add_input_file): Add error in
13148         incremental build.
13149         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13150         functions.
13151         * script.cc (read_input_script): Call
13152         Incremental_input::report_script.
13153         * script.h (Script_info): New class.
13154
13155 2009-04-27  Ian Lance Taylor  <iant@google.com>
13156
13157         * x86_64.cc (do_adjust_output_section): Set entsize to
13158         plt_entry_size.
13159
13160 2009-04-23  Elliott Hughes  <enh@google.com>
13161
13162         * output.cc (Output_file::close): After short writes, continue
13163         writing from the correct offset in the buffer being written.
13164
13165 2009-04-23  Chris Demetriou  <cgd@google.com>
13166
13167         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13168         * configure: Regenerate.
13169         * config.in: Regenerate.
13170         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13171         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13172
13173 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13174
13175         * incremental.cc (Incremental_inputs_header_data): Renamed from
13176         Incremental_input_header_data.
13177         (Incremental_inputs_header_data::data_size): New field.
13178         (Incremental_inputs_header_data::put_input_file_count): Renamed
13179         from input_file_count.
13180         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13181         from command_line_offset.
13182         (Incremental_inputs_header_data::put_reserved): Renamed from
13183         put_reserved.
13184         (Incremental_inputs_entry_data): Renamed from
13185         Incremental_input_entry_data.
13186         (Incremental_inputs_entry_data::data_size): New field.
13187         (Incremental_inputs::report_command_line): New method.
13188         (Incremental_inputs::finalize): New method.
13189         (Incremental_inputs::create_incremental_inputs_data): New method.
13190         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13191         * incremental.h: New file.
13192         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13193         (Layout::finalize): Create incremental inputs section in
13194         incremental builds.
13195         (Layout::create_incremental_info_sections): New method.
13196         * layout.h (Layout::incremental_inputs): New method.
13197         (Layout::create_incremental_info_sections): New method.
13198         (Layout::incremental_inputs_): New field.
13199         * main.cc (main): Notify Incremental_input of the command line.
13200
13201 2009-04-01  Ian Lance Taylor  <iant@google.com>
13202             Mikolaj Zalewski  <mikolajz@google.com>
13203
13204         * gold.h (reserve_unordered_map): Define, three versions, one for
13205         each version of Unordered_map.
13206         * layout.cc (Layout::Layout): Remove options parameter.  Add
13207         number_of_input_files parameter.  Don't initialize options_.
13208         Initialize number_of_input_files_ and resized_signatures_.  Move
13209         sections_are_attached_.
13210         (Layout::layout_group): Reserve space for group_signatures_.
13211         (Layout::find_or_add_kept_section): Change name parameter to be a
13212         reference.  Resize signatures_ map when it gets large enough.
13213         (Layout::layout_eh_frame): Use parameters->options() instead of
13214         this->options_.
13215         (Layout::make_output_section): Likewise.
13216         (Layout::attach_allocated_section_to_segment): Likewise.
13217         (Layout::finalize, Layout::create_executable_stack): Likewise.
13218         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13219         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13220         * layout.h (class Layout): Update declarations.  Remove options_
13221         field.  Add number_of_input_files_ and resized_signatures_
13222         fields.  Move sections_are_attached_ field.
13223         * main.cc (main): Pass number of input files to Layout
13224         constructor.  Don't pass options.
13225
13226 2009-03-30  Ian Lance Taylor  <iant@google.com>
13227
13228         * ffsll.c (ffsll): Correct implementation.
13229
13230 2009-03-27  Ian Lance Taylor  <iant@google.com>
13231
13232         * ffsll.c: New file.
13233         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13234         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13235         * ftruncate.c (ftruncate): Declare before definition.
13236         * mremap.c (mremap): Likewise.
13237         * pread.c (pread): Likewise.
13238         * configure, Makefile.in, config.in: Rebuild.
13239
13240         * mremap.c: New file.
13241         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13242         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13243         (mremap): Declare if HAVE_MREMAP is not defined.
13244         * configure, Makefile.in, config.in: Rebuild.
13245
13246 2009-03-27  Cary Coutant  <ccoutant@google.com>
13247
13248         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13249         position independent.
13250         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13251         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13252
13253 2009-03-24  Cary Coutant  <ccoutant@google.com>
13254
13255         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13256         an executable.
13257         (needs_dynamic_reloc): Likewise.
13258
13259 2009-03-24  Ian Lance Taylor  <iant@google.com>
13260
13261         * yyscript.y (file_cmd): Recognize EXTERN.
13262         (extern_name_list, extern_name_list_body): New nonterminals.
13263         * script.cc (script_add_extern): Define.
13264         * script-c.h (script_add_extern): Declare.
13265
13266 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13267
13268         * object.cc (is_elf_object): Define.
13269         * object.h (is_elf_object): Declare.
13270         * archive.cc (Archive::get_elf_object_for_member): Call
13271         is_elf_object.
13272         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13273
13274 2009-03-24  Elliott Hughes  <enh@google.com>
13275
13276         * output.cc (Output_file::map_anonymous): Define.
13277         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13278         try an anonymous one.  Report the size if the mmap fails.
13279         * output.h (class Output_file): Declare map_anonymous.
13280
13281 2009-03-24  Ian Lance Taylor  <iant@google.com>
13282
13283         * target-select.cc (instantiate_target): Don't acquire the lock if
13284         the instantiated_target_ field has already been set.
13285
13286 2009-03-23  Ian Lance Taylor  <iant@google.com>
13287
13288         * gold-threads.h (class Initialize_lock): Define.
13289         * gold-threads.cc (class Initialize_lock_once): Define.
13290         (initialize_lock_control): New static variable.
13291         (initialize_lock_pointer): New static variable.
13292         (initialize_lock_once): New static function.
13293         (Initialize_lock::Initialize_lock): Define.
13294         (Initialize_lock::initialize): Define.
13295         * target-select.h: Include "gold-threads.h".
13296         (class Target_selector): Add lock_ and initialize_lock_ fields.
13297         Don't define instantiate_target, just declare it.
13298         * target-select.cc (Target_selector::Target_selector): Initialize
13299         new fields.
13300         (Target_selector::instantiate_target): Define.
13301         * descriptors.h: Include "gold-threads.h".
13302         (class Descriptors): Add initialize_lock_ field.
13303         * descriptors.cc (Descriptors::Descriptors): Initialize new
13304         field.
13305         (Descriptors::open): Use initialize_lock_ field
13306         * errors.h (class Errors): Add initialize_lock_ field.
13307         * errors.cc (Errors::Errors): Initialize new field.
13308         (Errors::initialize_lock): Use initialize_lock_ field.
13309         * powerpc.cc (class Target_selector_powerpc): Remove
13310         instantiated_target_ field.  In do_recognize call
13311         instantiate_target rather than do_instantiate_target.  In
13312         do_instantiate_target just allocate a new target.
13313         * sparc.cc (class Target_selector_sparc): Likewise.
13314
13315         * freebsd.h: New file.
13316         * i386.cc: Include "freebsd.h".
13317         (Target_i386): Derive from Target_freebsd rather than
13318         Sized_target.
13319         (Target_selector_i386): Derive from Target_selector_freebsd rather
13320         than Target_selector.
13321         * x86_64.cc: Include "freebsd.h".
13322         (Target_x86_64): Derive from Target_freebsd rather than
13323         Sized_target.
13324         (Target_selector_x86_64): Derive from Target_selector_freebsd
13325         rather than Target_selector.
13326         * target.h (class Target): Add adjust_elf_header and
13327         do_adjust_elf_header.
13328         * output.cc (Output_file_header:: do_sized_write): Call target
13329         adjust_elf_header routine.
13330         * configure.tgt: Set targ_osabi.
13331         * configure.ac: Define GOLD_DEFAULT_OSABI.
13332         * parameters.cc (Parameters::default_target): Pass
13333         GOLD_DEFAULT_OSABI to select_target.
13334         * target-select.h (class Target_selector): Make instantiate_target
13335         protected rather than private.
13336         * Makefile.am (HFILES): Add freebsd.h.
13337         * configure, Makefile.in, config.in: Rebuild.
13338
13339         * merge.cc (do_add_input_section): Correct pend value.  Change
13340         message about last entry not being null terminated from error to
13341         warning.
13342
13343 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13344
13345         * incremental.cc: New file.
13346         * Makefile.am (CCFILES): Add incremental.cc.
13347         * Makefile.in: Rebuild.
13348
13349 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13350
13351         * layout.cc (Layout::output_section_name): Preserve names
13352         of '.note.' sections.
13353
13354 2009-03-19  Ian Lance Taylor  <iant@google.com>
13355
13356         * descriptors.cc (Descriptors::open): Check that the options are
13357         valid before using them.
13358
13359 2009-03-18  Ian Lance Taylor  <iant@google.com>
13360
13361         * script-sections.h: Include <list>.
13362         (class Script_sections): Change Sections_elements from std::vector
13363         to std::list.  Typedef public Elements_iterator.  Add
13364         orphan_section_placement_, data_segment_align_start_, and
13365         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13366         field.
13367         * script-sections.cc (class Orphan_section_placement): New class.
13368         (class Sections_element): Add virtual functions is_relro and
13369         orphan_section_init.  Remove virtual function place_orphan_here.
13370         (class Output_section_definition): Add is_relro and
13371         orphan_section_init.  Remove place_orphan_here.
13372         (class Orphan_output_section): Likewise.
13373         (Script_sections::Script_sections): Update for field changes.
13374         (Script_sections::data_segment_align): Set saw_data_segment_align_
13375         and data_segment_align_start_, not data_segment_align_index.
13376         (Script_sections::data_segment_relro_end): Check
13377         saw_data_segment_align_.  Use data_segment_align_start_ rather
13378         than data_segment_align_index_.
13379         (Script_sections::place_orphan): Rewrite to use
13380         Orphan_section_placement.
13381
13382 2009-03-17  Ian Lance Taylor  <iant@google.com>
13383
13384         * archive.cc (Archive::add_symbols): Check for a version attached
13385         to the symbol name in the archive map.
13386         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13387         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13388         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13389         (ver_test_11.a): New target.
13390         * testsuite/Makefile.in: Rebuild.
13391
13392         * configure.ac: Check for chsize and posix_fallocate.  Replace
13393         ftruncate.
13394         * ftruncate.c: New file, from gnulib.
13395         * output.cc (posix_fallocate): Define dummy version if not
13396         HAVE_POSIX_FALLOCATE.
13397         (Output_file::map): Call posix_fallocate rather than lseek and
13398         write.
13399         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13400         * configure, Makefile.in, config.in: Rebuild.
13401
13402 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13403
13404         * layout.h (Layout::create_note): Add section_name parameter.
13405         * layout.cc (Layout::create_note): Likewise.
13406         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13407
13408 2009-03-17  Ian Lance Taylor  <iant@google.com>
13409
13410         * descriptors.cc: Include "options.h".
13411         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13412         (Descriptors::open): Always use O_CLOEXEC when opening a new
13413         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13414         then set FD_CLOEXEC.
13415
13416         * sparc.cc (class Target_sparc): Add has_got_section.
13417         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13418         make sure we have a GOT section.
13419
13420         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13421         (Target_sparc::Scan::local): Likewise.
13422         (Target_sparc::Scan::global): Likewise.
13423         (Target_sparc::Relocate::relocate): Likewise.
13424         (Target_sparc::Relocate::relocate_tls): Likewise.
13425
13426         * symtab.cc (Symbol_table::define_default_version): New function,
13427         broken out of add_from_object.
13428         (Symbol_table::add_from_object): Call define_default_version.
13429         (Symbol_table::define_special_symbol): Add resolve_oldsym
13430         parameter.  Change all callers.  If the version for a symbol comes
13431         from a version script, resolve it with the symbol with the same
13432         name with no version.  Also add the symbol without a version if
13433         appropriate.
13434         (do_define_in_output_data): If resolving with oldsym, don't delete
13435         sym.
13436         (do_define_in_output_segment): Likewise.
13437         (do_define_as_constant): Likewise.
13438         * symtab.h (class Symbol_table): Update declarations.
13439
13440 2009-03-13  Ian Lance Taylor  <iant@google.com>
13441
13442         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13443         (Read_symbols::requeue): New function.
13444         (Read_symbols::do_read_symbols): If make_elf_object fails because
13445         the target type is not configured, and the file was searched for,
13446         issue a warning and retry with the next directory.
13447         (Add_symbols::run): If the file has an incompatible format, and
13448         it was searched for, requeue the Read_symbols task.  On error,
13449         release the object.
13450         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13451         dirindex parameter to constructor.  Change all callers.  Declare
13452         incompatible_warning and requeue.
13453         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13454         input_argument_ and input_group_ fields.  Add them to
13455         constructor.  Change all callers.
13456         (class Read_script): Add dirindex_ field.  Add it to constructor.
13457         Change all callers.
13458         * archive.cc (Archive::setup): Remove input_objects parameter.
13459         Change all callers.
13460         (Archive::get_file_and_offset): Likewise.
13461         (Archive::read_all_symbols): Likewise.
13462         (Archive::read_symbols): Likewise.
13463         (Archive::get_elf_object_for_member): Remove input_objects
13464         parameter.  Add punconfigured parameter.  Change all callers.
13465         (Archive::add_symbols): Change return type to bool.  Check return
13466         value of include_member.
13467         (Archive::include_all_members): Likewise.
13468         (Archive::include_member): Change return type to bool.  Return
13469         false if first included object has incompatible target.  Set
13470         included_member_ field.
13471         (Add_archive_symbols::run): If add_symbols returns false, requeue
13472         Read_symbols task.
13473         * archive.h (class Archive): Add included_member_ field.
13474         Initialize it in constructor.  Add input_file and searched_for
13475         methods.  Update declarations.
13476         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13477         input_argument_ fields.  Add them to constructor.  Change all
13478         callers.
13479         * script.cc: Include "target-select.h".
13480         (class Parser_closure): Add skip_on_incompatible_target_ and
13481         found_incompatible_target_ fields.  Add
13482         skip_on_incompatible_target parameter to constructor.  Change all
13483         callers.  Add methods skip_on_incompatible_target,
13484         clear_skip_on_incompatible_target, found_incompatible_target, and
13485         set_found_incompatible_target.
13486         (read_input_script): Add dirindex parameter.  Change all callers.
13487         If parser finds an incompatible target, requeue Read_symbols
13488         task.
13489         (script_set_symbol): Clear skip_on_incompatible_target in
13490         closure.
13491         (script_add_assertion, script_parse_option): Likewise.
13492         (script_start_sections, script_add_phdr): Likewise.
13493         (script_check_output_format): New function.
13494         * script.h (read_input_script): Update declaration.
13495         * script-c.h (script_check_output_format): Declare.
13496         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13497         (ignore_cmd): Remove OUTPUT_FORMAT.
13498         * fileread.cc (Input_file::Input_file): Add explicit this.
13499         (Input_file::will_search_for): New function.
13500         (Input_file::open): Add pindex parameter.  Change all callers.
13501         * fileread.h (class Input_file): Add input_file_argument method.
13502         Declare will_search_for.  Update declarations.
13503         * object.cc (make_elf_object): Add punconfigured parameter.
13504         Change all callers.
13505         * object.h (class Object): Make input_file public.  Add
13506         searched_for method.
13507         (make_elf_object): Update declaration.
13508         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13509         restart search.
13510         * dirsearch.h (class Dirsearch): Update declaration.
13511         * options.h (class General_options): Add --warn-search-mismatch.
13512         * parameters.cc (Parameters::is_compatible_target): New function.
13513         * parameters.h (class Parameters): Declare is_compatible_target.
13514         * workqueue.cc (Workqueue::add_blocker): New function.
13515         * workqueue.h (class Workqueue): Declare add_blocker.
13516
13517         * fileread.cc (Input_file::open): Remove options parameter.
13518         Change all callers.
13519         (Input_file::open_binary): Likewise.
13520         * script.cc (read_input_script): Likewise.
13521         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13522         options parameter from constructor.  Change all callers.
13523         (class Read_script): Likewise.
13524         * fileread.h (class Input_file): Update declarations.
13525         * script.h (read_input_script): Update declaration.
13526
13527 2009-03-10  Nick Clifton  <nickc@redhat.com>
13528
13529         * po/es.po: New Spanish translation.
13530
13531 2009-03-06  Cary Coutant  <ccoutant@google.com>
13532
13533         * options.cc (parse_short_option): Keep dash_z from registering itself.
13534
13535 2009-03-03  Ian Lance Taylor  <iant@google.com>
13536
13537         PR 9918
13538         * target-reloc.h (relocate_section): Pass output_section to
13539         relocate.
13540         * i386.cc (Target_i386::should_apply_static_reloc): Add
13541         output_section parameter.  Change all callers.
13542         (Target_i386::Relocate::relocate): Add output_section parameter.
13543         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13544         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13545         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13546         * testsuite/two_file_shared.sh: New script.
13547         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13548         (check_DATA): Add two_file_shared.dbg.
13549         (two_file_shared.dbg): New target.
13550         * testsuite/Makefile.in: Rebuild.
13551
13552 2009-03-01  Ian Lance Taylor  <iant@google.com>
13553
13554         * configure.ac: Check for byteswap.h.
13555         * configure: Rebuild.
13556         * config.in: Rebuild.
13557
13558 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13559
13560         * layout.cc (Layout::find_or_add_kept_section): New function.
13561         (Layout::add_comdat): Removed.
13562         * layout.h (struct Kept_section): Move out of class Layout.
13563         Remove trailing underscores from field names.  Add group_sections
13564         field.  Rename group_ field to is_group.  Change all uses.
13565         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13566         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13567         comdat_groups_ field.
13568         (Sized_relobj::include_section_group): Use
13569         find_or_add_kept_section and Kept_section::group_sections.
13570         (Sized_relobj::include_linkonce_section): Likewise.
13571         * object.cc (class Sized_relobj): Don't define Comdat_group or
13572         Comdat_group_table.  Remove find_comdat_group and
13573         add_comdat_group.  Remove comdat_groups_ field.
13574         * plugin.cc (include_comdat_group): Use
13575         Layout::find_or_add_kept_section.
13576
13577 2009-02-28  Ian Lance Taylor  <iant@google.com>
13578
13579         * README: --gc-sections and map files are now supported.  Document
13580         some build requirements.
13581
13582         PR 6992
13583         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13584         relocatable link set the value of the section symbol to zero.
13585         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13586         relocatable link don't include the section address in the local
13587         symbol value.
13588
13589 2009-02-27  Ian Lance Taylor  <iant@google.com>
13590
13591         PR 6811
13592         * options.h (class Search_directory): Add is_system_directory.
13593         (class General_options): Declare is_in_system_directory.
13594         * options.cc (get_relative_sysroot): Make static.
13595         (get_default_sysroot): Make static.
13596         (General_optoins::is_in_system_directory): New function.
13597         * fileread.cc (Input_file::is_in_system_directory): New function.
13598         * fileread.h (class Input_file): Declare is_in_system_directory.
13599         * object.h (class Object): Add is_in_system_directory.
13600         (class Input_objects): Remove system_library_directory_ field.
13601         * object.cc (Input_objects::add_object): Don't set
13602         system_library_directory_.
13603         (input_objects::found_in_system_library_directory): Remove.
13604         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13605         parameter.  Change all callers.
13606         (Symbol_table::sized_write_globals): Likewise.
13607         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13608         Call Object::is_in_system_directory.
13609         * symtab.h (class Symbol_table): Update declarations.
13610
13611         PR 5990
13612         * descriptors.h (Open_descriptor): Add is_on_stack field.
13613         * descriptors.cc (Descriptors::open): If the descriptor is on the
13614         top of the stack, remove it.  Initialize is_on_stack field.
13615         (Descriptors::release): Only add pod to stack if it is not on the
13616         stack already.
13617         (Descriptors::close_some_descriptor): Clear stack_next and
13618         is_on_stack fields.
13619
13620         PR 7091
13621         * output.cc (Output_section::find_starting_output_address): Rename
13622         from starting_output_address; add PADDR parameter; change return
13623         type.
13624         * output.h (class Output_section): Declare
13625         find_starting_output_address instead of starting_output_address.
13626         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13627         section symbol for which we can't find a merge section.
13628
13629         PR 9836
13630         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13631         hidden or internal, force the symbol to be local.
13632         * resolve.cc (Symbol::override_visibility): Define.
13633         (Symbol::override_base): Use override_visibility.
13634         (Symbol_table::resolve): Likewise.
13635         (Symbol::override_base_with_special): Likewise.
13636         (Symbol_table::override_with_special): If the visibility is hidden
13637         or internal, force the symbol to be local.
13638         * symtab.h (class Symbol): Add set_visibility and
13639         override_visibility.
13640         * testsuite/ver_test_1.sh: New file.
13641         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13642         (check_DATA): Add ver_test_1.syms.
13643         (ver_test_1.syms): New target.
13644         * testsuite/Makefile.in: Rebuild.
13645
13646 2009-02-25  Cary Coutant  <ccoutant@google.com>
13647
13648         * layout.cc (Layout::choose_output_section): Don't rename sections
13649         when using a linker script that has a SECTIONS clause.
13650         * Makefile.in: Regenerate.
13651
13652         * testsuite/Makefile.am (script_test_5.sh): New test case.
13653         * testsuite/Makefile.in: Regenerate.
13654         * testsuite/script_test_5.cc: New file.
13655         * testsuite/script_test_5.sh: New file.
13656         * testsuite/script_test_5.t: New file.
13657
13658 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13659
13660         * archive.cc (Archive::include_member): Update calls to add_symbols.
13661         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13662         the Layout argument.
13663         * dynobj.h (do_add_symbols): Add the Layout argument.
13664         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13665         Layout argument.
13666         * object.h (Object::add_symbols): Add the Layout argument.
13667         (Object::do_add_symbols): Add the Layout argument.
13668         (Sized_relobj::do_add_symbols): Add the Layout argument.
13669         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13670         Unify the two versions.
13671         (Add_plugin_symbols): Remove.
13672         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13673         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13674         (Add_plugin_symbols): Remove.
13675         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13676         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13677         (Add_symbols::run): Make it work with Pulginobj.
13678
13679 2009-02-06  Ian Lance Taylor  <iant@google.com>
13680
13681         * object.cc (Sized_relobj::do_layout): Make info message start
13682         with lower case letter.
13683
13684 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13685
13686         * binary.cc: Fix file comment.
13687
13688         * options.h (enum Incremental_disposition): Define.
13689         (class General_options): Add new options: --incremental,
13690         --incremental_changed, --incremental_unchanged,
13691         --incremental_unknown.  Add incremental_disposition_ and
13692         implicit_incremental_ fields.
13693         (General_options::incremental_disposition): New function.
13694         (class Position_dependent_options): Add incremental_disposition
13695         option.
13696         (Position_dependent_options::copy_from_options): Set incremental
13697         dispositions.
13698         * options.cc (General_options::parse_incremental_changed): New
13699         function.
13700         (General_options::parse_incremental_unchanged): New function.
13701         (General_options::parse_incremental_unknown): New function.
13702         (General_options::General_options): Initialize new fields
13703         incremental_disposition_ and implicit_incremental_.
13704         (General_options::finalize): Check for uasge of --incremental-*
13705         without --incremental.
13706
13707 2009-02-06  Chris Demetriou  <cgd@google.com>
13708
13709         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13710         pointer and to report location as the file name associated with
13711         the symbol.
13712         (gold_undefined_symbol_at_location): New function to replace the
13713         old gold_undefined_symbol functionality.
13714         * target-reloc.h (relocate_section): Update to use
13715         gold_undefined_symbol_at_location.
13716         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13717         Call gold_undefined_symbol function rather than gold_error.
13718         * errors.h (Errors::undefined_symbol): Take location as a
13719         string, rather than calculating it from a relocation.
13720         * errors.cc (Errors::fatal): Print "fatal error:" before the
13721         formatted message.
13722         (Errors::error, Errors::error_at_location): Print "error: "
13723         before the formatted message.
13724         (Errors::undefined_symbol): Take location as a string, rather
13725         than calculating it from a relocation.
13726         (gold_undefined_symbol_at_location): New function akin to
13727         old gold_undefined_symbol, calculates location from relocation.
13728         (gold_undefined_symbol): Change to take only a Symbol pointer
13729         and to report location as the file name associated with the symbol.
13730         * testsuite/debug_msg.sh: Update for changed error messages.
13731         * testsuite/undef_symbol.sh: Likewise.
13732
13733 2009-02-04  Duncan Sands  <baldrick@free.fr>
13734
13735         PR 9812
13736         * reduced_debug_output.h
13737         (Output_reduced_debug_abbrev_section::failed): Use format for
13738         gold_warning.
13739         (Output_reduced_debug_info_section::faild): Likewise.
13740
13741 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13742
13743         * script.cc (Lazy_demangler): New class.
13744         (Version_script_info::get_symbol_version_helper): Demangle a
13745         symbol only once.
13746
13747 2009-01-29  Cary Coutant  <ccoutant@google.com>
13748
13749         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13750         to __tls_get_addr.
13751         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13752
13753 2009-01-28  Ian Lance Taylor  <iant@google.com>
13754
13755         * version.cc (version_string): Bump to 1.9.
13756
13757         * gold.h: Include <cstring> and <stdint.h>.
13758         * version.cc: Include <cstdio>.
13759         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13760         warning.
13761         * reduced_debug_output.cc (insert_into_vector): Rename from
13762         Insert_into_vector; change all callers.  Use Swap_unaligned to
13763         avoid aliasing issue; remove union since it is unnecessary.
13764
13765 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13766
13767         * Makefile.am (CCFILES): Add gc.cc.
13768         (HFILES): Add gc.h.
13769         * Makefile.in: Regenerate.
13770         * gold.cc (Gc_runner): New class.
13771         (queue_initial_tasks): Call garbage collection related tasks
13772         when corresponding options are invoked.
13773         (queue_middle_gc_tasks): New function.
13774         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13775         processed early before laying out sections during garbage collection.
13776         * gold.h (queue_middle_gc_tasks): New function.
13777         (is_prefix_of): Move from "layout.cc".
13778         * i386.cc (Target_i386::gc_process_relocs): New function.
13779         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13780         * main.cc (main): Create object of class "Garbage_collection".
13781         * object.cc (Relobj::copy_symbols_data): New function.
13782         (Relobj::is_section_name_included): New function.
13783         (Sized_relobj::do_layout): Allow this function to be called twice
13784         during garbage collection and defer layout of section during the
13785         first call.
13786         * object.h (Relobj::get_symbols_data): New function.
13787         (Relobj::is_section_name_included): New function.
13788         (Relobj::copy_symbols_data): New function.
13789         (Relobj::set_symbols_data): New function.
13790         (Relobj::get_relocs_data): New function.
13791         (Relobj::set_relocs_data): New function.
13792         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13793         (Relobj::gc_process_relocs): New function.
13794         (Relobj::do_gc_process_relocs): New pure virtual function.
13795         (Relobj::sd_): New data member.
13796         (Sized_relobj::is_output_section_offset_invalid): New function.
13797         (Sized_relobj::do_gc_process_relocs): New function.
13798         * options.h (General_options::gc_sections): Modify to not be a no-op.
13799         (General_options::print_gc_sections): New option.
13800         * plugin.cc (Plugin_finish::run): Remove function call to
13801         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13802         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13803         * reloc.cc (Read_relocs::run): Add task to process relocs and
13804         determine unreferenced sections when doing garbage collection.
13805         (Gc_process_relocs): New class.
13806         (Sized_relobj::do_gc_process_relocs): New function.
13807         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13808         sections that are garbage collected.
13809         * reloc.h (Gc_process_relocs): New class.
13810         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13811         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13812         symbols whose corresponding sections are garbage collected.
13813         (Symbol_table::Symbol_table): Add new parameter for the garbage
13814         collection object.
13815         (Symbol_table::gc_mark_undef_symbols): New function.
13816         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13817         (Symbol_table::gc_mark_dyn_syms): New function.
13818         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13819         as garbage.
13820         (Symbol_table::add_from_object): Likewise.
13821         (Symbol_table::add_from_relobj): When building shared objects, do not
13822         treat externally visible symbols as garbage.
13823         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13824         table information for static and relocatable links.
13825         * symtab.h (Symbol_table::set_gc): New function.
13826         (Symbol_table::gc): New function.
13827         (Symbol_table::gc_mark_undef_symbols): New function.
13828         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13829         (Symbol_table::gc_mark_dyn_syms): New function.
13830         (Symbol_table::gc_): New data member.
13831         * target.h (Sized_target::gc_process_relocs): New pure virtual
13832         function.
13833         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13834         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13835
13836 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13837
13838         * options.h (General_options::gc_sections): Define as a no-op for now.
13839         (General_options::no_keep_memory): Ditto.
13840         (General_options::Bshareable): Define.
13841         * options.cc (General_options::finalize): Honor -Bshareable.
13842
13843 2009-01-20  Andreas Schwab  <schwab@suse.de>
13844
13845         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13846         read the value in the contents, since we don't use it.  Use the
13847         template endianness when writing.
13848         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13849
13850 2009-01-19  Andreas Schwab  <schwab@suse.de>
13851
13852         * configure.tgt (powerpc64-*): Fix targ_obj.
13853
13854 2009-01-15  Ian Lance Taylor  <iant@google.com>
13855
13856         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13857         local symbols when stripping all symbols.
13858
13859 2009-01-14  Cary Coutant  <ccoutant@google.com>
13860
13861         * output.cc (Output_reloc): Add explicit instantiations.
13862
13863 2009-01-14  Cary Coutant  <ccoutant@google.com>
13864
13865         * archive.cc (Archive::get_elf_object_for_member): Remove call
13866         to File_read::claim_for_plugin.
13867         * descriptors.cc (Descriptors::open): Remove reference to
13868         is_claimed.
13869         (Descriptors::claim_for_plugin): Remove.
13870         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13871         (Descriptors::is_claimed): Remove.
13872         (claim_descriptor_for_plugin): Remove.
13873         * fileread.cc (File_read::claim_for_plugin): Remove.
13874         * fileread.h (File_read::claim_for_plugin): Remove.
13875         (File_read::descriptor): Reopen descriptor if necessary.
13876         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13877         (Plugin_manager::all_symbols_read): Add task parameter. Change
13878         all callers.
13879         (Plugin_manager::get_input_file): New function.
13880         (Plugin_manager::release_input_file): New function.
13881         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13882         corresponding data member.
13883         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13884         and pass to base constructor. Change all callers.
13885         (get_input_file, release_input_file): New functions.
13886         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13887         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13888         (Plugin_manager::all_symbols_read): Add task parameter.
13889         (Plugin_manager::get_input_file): New function.
13890         (Plugin_manager::release_input_file): New function.
13891         (Plugin_manager::task_): New data member.
13892         (Pluginobj::Pluginobj): Add filesize parameter.
13893         (Pluginobj::filename): New function.
13894         (Pluginobj::descriptor): New function.
13895         (Pluginobj::filesize): New function.
13896         (Pluginobj::filesize_): New data member.
13897         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13898         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13899         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13900
13901         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13902         with archive libraries.
13903         * testsuite/Makefile.in: Regenerate.
13904         * testsuite/plugin_test.c (struct sym_info): New type.
13905         (get_input_file, release_input_file): New static variables.
13906         (onload): Capture new transfer vector entries.
13907         (claim_file_hook): Stop reading at end of file according to filesize.
13908         Factor out parsing of readelf output into separate function.
13909         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13910         APIs and get the source file name from the symbol table.  Convert
13911         source file name to corresponding object file name.  Print info
13912         message when adding new input files.
13913         (parse_readelf_line): New function.
13914         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13915         * testsuite/plugin_test_2.sh: Likewise.
13916         * testsuite/plugin_test_3.sh: Likewise.
13917         * testsuite/plugin_test_4.sh: New test case.
13918
13919 2009-01-07  Ian Lance Taylor  <iant@google.com>
13920
13921         * version.cc (version_string): Bump to 1.8.
13922
13923 2008-12-23  Cary Coutant  <ccoutant@google.com>
13924
13925         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13926         * plugin.cc (Plugin_manager::finish): Rename as
13927         layout_deferred_objects.  Move cleanup to separate function.
13928         (Plugin_manager::cleanup): New function.
13929         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13930         separately.
13931         * plugin.h (Plugin_manager::finish): Rename as
13932         layout_deferred_objects.
13933         (Plugin_manager::cleanup): New function.
13934         (Plugin_manager::cleanup_done): New field.
13935
13936 2008-12-23  Cary Coutant  <ccoutant@google.com>
13937
13938         * plugin.cc (is_visible_from_outside): New function.
13939         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13940         so we don't return "IR only" status for exported symbols or -r links.
13941
13942         * testsuite/Makefile.am (plugin_test_3): New test case.
13943         * testsuite/Makefile.in: Regenerate.
13944         * testsuite/plugin_test_3.sh: New file.
13945
13946 2008-12-22  Cary Coutant  <ccoutant@google.com>
13947
13948         * object.cc (Sized_relobj::layout_section): New function.
13949         (Sized_relobj::do_layout): Defer layout of input sections until after
13950         plugin has provided replacement files.
13951         (Sized_relobj::do_layout_deferred_sections): New function.
13952         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13953         (Relobj::layout_deferred_sections): New function.
13954         (Relobj::do_layout_deferred_sections): New function.
13955         (Sized_relobj::do_layout_deferred_sections): New function.
13956         (Sized_relobj::layout_section): New function.
13957         (Sized_relobj::Deferred_layout): New structure.
13958         (Sized_relobj::deferred_layout_): New field.
13959         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13960         Change all callers.  Layout deferred sections.
13961         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13962         references.
13963         (Plugin_hook::run): Move code from do_plugin_hook inline.
13964         (Plugin_hook::do_plugin_hook): Remove.
13965         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13966         (Plugin_manager::finish): Renamed, was cleanup.
13967         (Plugin_manager::should_defer_layout): New function.
13968         (Plugin_manager::add_deferred_layout_object): New function.
13969         (Plugin_manager::Deferred_layout_list): New type.
13970         (Plugin_manager::deferred_layout_objects_): New field.
13971         (Plugin_hook::do_plugin_hook): Remove.
13972
13973 2008-12-17  Ian Lance Taylor  <iant@google.com>
13974
13975         * options.h (class General_options): Add --no case for
13976         --export-dynamic.
13977
13978 2008-12-16  Cary Coutant  <ccoutant@google.com>
13979
13980         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13981         vector.
13982         (Plugin_manager::claim_file): Create plugin object even if
13983         plugin did not call the add_symbols callback.
13984         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13985         asking for more symbols than were added.
13986         * testsuite/Makefile.am (plugin_test_1): Add test case with
13987         no global symbols.
13988         (empty.syms): New target.
13989         * testsuite/Makefile.in: Regenerate.
13990         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13991         message. Don't call add_symbols if no globals.
13992         (all_symbols_read_hook): Don't provide replacement for empty
13993         claimed file.
13994
13995 2008-12-12  Ian Lance Taylor  <iant@google.com>
13996
13997         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13998         r_type == 0 for a local symbol with r_sym == 0.
13999         (scan_relocatable_relocs): Pass r_sym to
14000         local_non_section_strategy.
14001         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14002         r_sym parameter.
14003
14004         * configure.ac: Update test for TLS descriptors: they are
14005         supported as of glibc 2.9.
14006         * configure: Rebuild.
14007
14008 2008-12-11  Ian Lance Taylor  <iant@google.com>
14009
14010         PR 7091
14011         * target-reloc.h (Default_scan_relocatable_relocs): For each
14012         function, map r_type == 0 to RELOC_DISCARD.
14013
14014 2008-12-10  Cary Coutant  <ccoutant@google.com>
14015
14016         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14017         object to override a kept COMDAT group from a plugin object.
14018
14019 2008-12-09  Ian Lance Taylor  <iant@google.com>
14020
14021         PR 7088
14022         * yyscript.y (file_cmd): Handle INPUT.
14023
14024         * testsuite/initpri1.c: Change all declarations to be full
14025         prototypes by adding void, to avoid compiler warnings.
14026
14027 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14028
14029         * options.cc (General_options::parse_plugin_opt): New.
14030         (General_options::add_plugin): The argument now is just the filename.
14031         (General_options::add_plugin_option): New.
14032         * options.h (plugin_opt): New.
14033         (add_plugin): Change argument name.
14034         (add_plugin_option): New.
14035         * plugin.cc (Plugin::load): Don't parse the plugin option.
14036         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14037         (Plugin::add_option): New.
14038         (Plugin::args_): Change type.
14039         (Plugin::filename_): New.
14040         (Plugin_manager::add_plugin_option): New.
14041         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14042         * testsuite/Makefile.in: Regenerate.
14043
14044 2008-12-05  Cary Coutant  <ccoutant@google.com>
14045
14046         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14047         Handle --strip-lto-sections option.
14048         * options.h (strip_lto_sections): New option.
14049
14050 2008-12-01  Cary Coutant  <ccoutant@google.com>
14051
14052         * plugin.cc (ld_plugin_message): Change format parameter to const.
14053         Fix mismatch between new[] and delete.
14054
14055 2008-11-14  Cary Coutant  <ccoutant@google.com>
14056
14057         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14058         instead of -1U.
14059
14060 2008-11-05  Craig Silverstein  <csilvers@google.com>
14061
14062         * options.cc (General_options::parse_dynamic_list): New function.
14063         * options.h (General_options): New flags dynamic_list,
14064         dynamic_list_data, dynamic_list_cpp_new, and
14065         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14066         (General_options::in_dynamic_list): New function.
14067         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14068         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14069         (Lex::can_continue_name): Likewise.
14070         (yylex): Likewise.
14071         (read_script_file): New parameter script_options.
14072         (read_dynamic_list): New function.
14073         (Script_options::define_dynamic_list): New function.
14074         (dynamic_list_keyword_parsecodes): New variable.
14075         (dynamic_list_keywords): New variable.
14076         * script.h (Script_options::define_dynamic_list): New function
14077         prototype.
14078         (read_dynamic_list): New function prototype.
14079         * symtab.cc (strprefix): New macro.
14080         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14081         dynamic_list_data, dynamic_list_cpp_new, and
14082         dynamic_list_cpp_typeinfo.
14083         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14084         (dynamic_list_expr): New rule.
14085         (dynamic_list_nodes): Likewise.
14086         (dynamic_list_node): Likewise.
14087         * testsuite/Makefile.am (dynamic_list): New test.
14088         * testsuite/Makefile.in: Regenerated.
14089         * testsuite/dynamic_list.t: New file.
14090         * testsuite/dynamic_list.sh: New file.
14091
14092 2008-11-05  Craig Silverstein  <csilvers@google.com>
14093
14094         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14095         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14096         (t11_last): Likewise.
14097         * testsuite/ver_test_6.c (main): Likewise.
14098
14099 2008-10-07  Cary Coutant  <ccoutant@google.com>
14100
14101         * options.c (General_options::finalize): Add check for -static and
14102         -shared.
14103         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14104         is not empty.
14105
14106 2008-10-02  Cary Coutant  <ccoutant@google.com>
14107
14108         * plugin.cc (make_sized_plugin_object): Fix conditional
14109         compilation to work when not all targets are enabled.
14110
14111 2008-09-29  Cary Coutant  <ccoutant@google.com>
14112
14113         * archive.cc (Archive::get_file_and_offset): Use filename instead
14114         of name to get library path.
14115         (Archive::include_member): Unlock external member of a thin archive.
14116
14117         * testsuite/Makefile.am (TEST_AR): New variable.
14118         (thin_archive_test_1): New test.
14119         (thin_archive_test_2): New test.
14120         * testsuite/Makefile.in: Regenerate.
14121         * testsuite/thin_archive_main.cc: New file.
14122         * testsuite/thin_archive_test_1.cc: New file.
14123         * testsuite/thin_archive_test_2.cc: New file.
14124         * testsuite/thin_archive_test_3.cc: New file.
14125         * testsuite/thin_archive_test_4.cc: New file.
14126
14127 2008-09-29  Cary Coutant  <ccoutant@google.com>
14128
14129         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14130         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14131         instead of -1U.
14132         (Sized_relobj::do_finalize_local_symbols): Likewise.
14133         (Sized_relobj::map_to_kept_section): Likewise.
14134         * object.h (Sized_relobj::invalid_address): New constant.
14135         (Sized_relobj::do_output_section_offset): Check for invalid_address
14136         and return -1ULL.
14137         * output.cc (Output_reloc::local_section_offset): Use constant
14138         invalid_address instead of -1U.
14139         (Output_reloc::get_address): Likewise.
14140         (Output_section::output_address): Change -1U to -1ULL.
14141         * output.h (Output_reloc::invalid_address): New constant.
14142         * reloc.cc (Sized_relobj::write_sections): Use constant
14143         invalid_address instead of -1U.
14144         (Sized_relobj::relocate_sections): Likewise.
14145         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14146         values for merge sections.
14147         * target-reloc.h (relocate_for_relocatable): Use constant
14148         invalid_address instead of -1U.
14149
14150 2008-09-19  Cary Coutant  <ccoutant@google.com>
14151
14152         Add plugin functionality for link-time optimization (LTO).
14153         * configure.ac (plugins): Add --enable-plugins option.
14154         * configure: Regenerate.
14155         * config.in: Regenerate.
14156         * Makefile.am (LIBDL): New variable.
14157         (CCFILES): Add plugin.cc.
14158         (HFILES): Add plugin.h.
14159         (ldadd_var): Add LIBDL.
14160         * Makefile.in: Regenerate.
14161
14162         * archive.cc: Include "plugin.h".
14163         (Archive::setup): Don't preread archive symbols when using a plugin.
14164         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14165         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14166         files.
14167         (Archive::include_member): Add symbols from plugin objects.
14168         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14169         * descriptors.cc (Descriptors::open): Check for file descriptors
14170         abandoned by plugins.
14171         (Descriptors::claim_for_plugin): New function.
14172         * descriptors.h (Descriptors::claim_for_plugin): New function.
14173         (Open_descriptor::is_claimed): New field.
14174         (claim_descriptor_for_plugin): New function.
14175         * fileread.cc (File_read::claim_for_plugin): New function.
14176         * fileread.h (File_read::claim_for_plugin): New function.
14177         (File_read::descriptor): New function.
14178         * gold.cc: Include "plugin.h".
14179         (queue_initial_tasks): Add task to call plugin hooks for generating
14180         new object files.
14181         * main.cc: Include "plugin.h".
14182         (main): Load plugin libraries.
14183         * object.h (Pluginobj): Declare.
14184         (Object::pluginobj): New function.
14185         (Object::do_pluginobj): New function.
14186         (Object::set_target): New function.
14187         * options.cc: Include "plugin.h".
14188         (General_options::parse_plugin): New function.
14189         (General_options::General_options): Initialize plugins_ field.
14190         (General_options::add_plugin): New function.
14191         * options.h (Plugin_manager): Declare.
14192         (General_options): Add --plugin option.
14193         (General_options::has_plugins): New function.
14194         (General_options::plugins): New function.
14195         (General_options::add_plugin): New function.
14196         (General_options::plugins_): New field.
14197         * plugin.cc: New file.
14198         * plugin.h: New file.
14199         * readsyms.cc: Include "plugin.h".
14200         (Read_symbols::do_read_symbols): Check for archive before checking
14201         for ELF file.  Call plugin hooks to claim files.
14202         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14203         from a real object file; force override when processing replacement
14204         files.
14205         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14206         (Symbol::init_base_object): Likewise.
14207         (Symbol::init_base_output_data): Likewise.
14208         (Symbol::init_base_output_segment): Likewise.
14209         (Symbol::init_base_constant): Likewise.
14210         (Symbol::init_base_undefined): Likewise.
14211         (Symbol::output_section): Assert that object is not a plugin.
14212         (Symbol_table::add_from_pluginobj): New function.
14213         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14214         undefined.
14215         (Symbol_table::sized_write_globals): Likewise.
14216         (Symbol_table::add_from_pluginobj): Instantiate template.
14217         * symtab.h (Sized_pluginobj): Declare.
14218         (Symbol::in_real_elf): New function.
14219         (Symbol::set_in_real_elf): New function.
14220         (Symbol::in_real_elf_): New field.
14221         (Symbol_table::add_from_pluginobj): New function.
14222
14223         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14224         (LIBDL): New variable.
14225         (LDADD): Add LIBDL.
14226         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14227         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14228         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14229         (MOSTLYCLEANFILES): Likewise.
14230         * testsuite/Makefile.in: Regenerate.
14231         * testsuite/plugin_test.c: New file.
14232         * testsuite/plugin_test_1.sh: New file.
14233         * testsuite/plugin_test_2.sh: New file.
14234
14235 2008-09-16  Ian Lance Taylor  <iant@google.com>
14236
14237         * target-reloc.h (relocate_section): Check whether a symbol is
14238         defined by the ABI before reporting an undefined symbol error.
14239         * target.h (Target::is_defined_by_abi): Make parameter const.
14240         (Target::do_is_defined_by_abi): Likewise.
14241         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14242         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14243         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14244         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14245         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14246         * testsuite/Makefile.in: Rebuild.
14247
14248         * fileread.cc (make_view): Add casts to avoid warning.
14249
14250 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14251
14252         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14253         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14254
14255 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14256
14257         * options.h (General_options::output_is_executable): New.
14258         (General_options::output_is_pie): New.
14259         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14260         for shared libraries.
14261         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14262
14263 2008-09-11  Chris Demetriou  <cgd@google.com>
14264
14265         * options.h (origin): New -z option.
14266         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14267         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14268         in DT_FLAGS_1.
14269
14270 2008-09-05  Cary Coutant  <ccoutant@google.com>
14271
14272         * fileread.cc (File_read::make_view): Add check for attempt to map
14273         beyond end of file.
14274
14275 2008-09-05  Cary Coutant  <ccoutant@google.com>
14276
14277         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14278         explicit instantiations.
14279
14280 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14281
14282         PR gold/6858
14283         * options.cc (General_options::finalize): Allow undefined symbols
14284         in shlibs if linking -shared.
14285
14286         PR gold/6859
14287         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14288         symbols as not needing a dynsym entry.
14289
14290 2008-08-20  Craig Silverstein  <csilvers@google.com>
14291
14292         * fileread.cc (File_read::open): Do not lock the file unless it
14293         was successfully opened.
14294
14295 2008-08-14  Cary Coutant  <ccoutant@google.com>
14296
14297         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14298         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14299         * testsuite/tls_test.cc (struct int128): 128-bit struct
14300         for testing TLS relocs with non-zero addend.
14301         (v12): New TLS variable.
14302         (t12): New test.
14303         (t_last): Add check for v12.
14304         * testsuite/tls_test.h (t12): New function.
14305         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14306
14307 2008-08-13  Ian Lance Taylor  <iant@google.com>
14308
14309         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14310         set tls_segment_ or relro_segment_.
14311         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14312         when appropriate.
14313         * output.h (Output_section::clear_is_relro): New function.
14314         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14315         sections specially even when output_data_ is empty.
14316         (Output_segment::maximum_alignment): When first section is relro,
14317         only force alignment for PT_LOAD segments.
14318         * script.cc (script_data_segment_align): New function.
14319         (script_data_segment_relro_end): New function.
14320         * script-c.h (script_data_segment_align): Declare.
14321         (script_data_segment_relro_end): Declare.
14322         * script-sections.h (class Script_sections): Declare
14323         data_segment_align and data_segment_relro_end.  Add fields
14324         segment_align_index_ and saw_relro_end_.
14325         * script-sections.cc (class Sections_element): Add set_is_relro
14326         virtual function.  Add new bool* parameter to place_orphan_here.
14327         Add get_output_section virtual function.
14328         (class Output_section_definition): Add set_is_relro.  Add new
14329         bool* parameter to place_orphan_here.  Add get_output_section.
14330         Add is_relro_ field.
14331         (Output_section_definition::Output_section_definition): Initialize
14332         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14333         and is_relro_ fields.
14334         (Output_section_definition::place_orphan_here): Add is_relro
14335         parameter.
14336         (Output_section_definition::set_section_addresses): Set relro for
14337         output section.
14338         (Output_section_definition::alternate_constraint): Likewise.
14339         (class Orphan_output_section): Add new bool* parameter to
14340         place_orphan_here.  Add get_output_section.
14341         (Orphan_output_section::place_orphan_here): Add is_relro
14342         parameter.
14343         (Script_sections::Script_sections): Initialize
14344         data_segment_align_index_ and saw_relro_end_.
14345         (Script_sections::data_segment_align): New function.
14346         (Script_sections::data_segment_relro_end): New function.
14347         (Script_sections::place_orphan): Set or clear is_relro.
14348         (Script_sections::set_section_addresses): Force alignment of first
14349         TLS section.
14350         * yyscript.y (exp): Call script_data_segment_align and
14351         script_data_segment_relro_end.
14352         * testsuite/relro_script_test.t: New file.
14353         * testsuite/relro_test.cc (using_script): Declare.
14354         (t1, t2): Test using_script.
14355         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14356         (relro_script_test_SOURCES): Define.
14357         (relro_script_test_DEPENDENCIES): Define.
14358         (relro_script_test_LDFLAGS): Define.
14359         (relro_script_test_LDADD): Define.
14360         (relro_script_test.so): New target.
14361         * testsuite/Makefile.in: Rebuild.
14362
14363 2008-08-06  Cary Coutant <ccoutant@google.com>
14364
14365         * archive.cc (Archive::total_archives, Archive::total_members)
14366         (Archive::total_members_loaded): New variables.
14367         (Archive::setup): Add parameter.  Add option to preread
14368         archive symbols.
14369         (Archive::read_armap): Add counter.
14370         (Archive::get_file_and_offset): New function.
14371         (Archive::get_elf_object_for_member): New function.
14372         (Archive::read_all_symbols): New function.
14373         (Archive::read_symbols): New function.
14374         (Archive::add_symbols): Add counters.
14375         (Archive::include_all_members): Use armap to find members if it's
14376         already built.
14377         (Archive::include_member): Skip reading symbols if already read.
14378         Factored code into Archive::get_file_and_offset and
14379         Archive::get_elf_object_for_member.  Changed call to
14380         Mapfile::report_include_archive_member.
14381         (Archive::print_stats): New function.
14382         * archive.h: Declare Object and Read_symbols_data classes.
14383         (Archive::Archive): Add initializers for new members.
14384         (Archive::setup): Add parameter.
14385         (Archive::print_stats): New function.
14386         (Archive::total_archives, Archive::total_members)
14387         (Archive::total_members_loaded): New variables.
14388         (Archive::get_file_and_offset): New function.
14389         (Archive::get_elf_object_for_member): New function.
14390         (Archive::read_all_symbols): New function.
14391         (Archive::read_symbols): New function.
14392         (Archive::Archive_member): New class.
14393         (Archive::members_): New member.
14394         (Archive::num_members_): New member.
14395         * main.cc: Include archive.h.
14396         (main): Call Archive::print_stats.
14397         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14398         archive parameter; member_name is now the fully-decorated name.
14399         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14400         * options.h: (General_options): Add --preread-archive-symbols option.
14401         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14402         Archive::setup.
14403
14404 2008-08-04  Ian Lance Taylor  <iant@google.com>
14405
14406         * symtab.h (Symbol::use_plt_offset): New function.
14407         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14408         * powerpc.cc (Relocate::relocate): Likewise.
14409         * sparc.cc (Relocate::relocate): Likewise.
14410         * x86_64.cc (Relocate::relocate): Likewise.
14411         * testsuite/weak_plt.sh: New test.
14412         * testsuite/weak_plt_main.cc: New test.
14413         * testsuite/weak_plt_shared.cc: New test.
14414         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14415         (check_PROGRAMS): Add weak_plt.
14416         (check_DATA): Add weak_plt_shared.so.
14417         (weak_plt_main_pic.o, weak_plt): New targets.
14418         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14419         * testsuite/Makefile.in: Rebuild.
14420
14421         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14422         gcctestdir/ld.
14423         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14424         * testsuite/Makefile.in: Rebuild.
14425
14426 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14427
14428         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14429         * Makefile.in: Regenerate.
14430         * po/POTFILES.in: Regenerate.
14431
14432 2008-07-29  Ian Lance Taylor  <iant@google.com>
14433
14434         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14435         symbols before other symbols.
14436         * testsuite/script_test_2.cc (test_addr): Declare.
14437         (test_addr_alias): Declare.
14438         (main): Check that test_addr and test_addr_alias have the right
14439         values.
14440         * testsuite/script_test_2.t: Define test_addr_alias and
14441         test_addr.
14442
14443 2008-07-24  Ian Lance Taylor  <iant@google.com>
14444
14445         PR 5990
14446         * descriptors.cc: New file.
14447         * descriptors.h: New file.
14448         * gold-threads.h (class Hold_optional_lock): New class.
14449         * fileread.cc: Include "descriptors.h".
14450         (File_read::~File_read): Release descriptor rather than closing
14451         it.
14452         (File_read::open) [file]: Call open_descriptor rather than open.
14453         Set is_descriptor_opened_.
14454         (File_read::open) [memory]: Assert that descriptor is not open.
14455         (File_read::reopen_descriptor): New function.
14456         (File_read::release): Release descriptor.
14457         (File_read::do_read): Make non-const.  Reopen descriptor.
14458         (File_read::read): Make non-const.
14459         (File_read::make_view): Reopen descriptor.
14460         (File_read::do_readv): Likewise.
14461         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14462         Update declarations.
14463         * layout.cc: Include "descriptors.h".
14464         (Layout::create_build_id): Use open_descriptor rather than open.
14465         * output.cc: Include "descriptors.h".
14466         (Output_file::open): Use open_descriptor rather than open.
14467         * archive.cc (Archive::const_iterator): Change Archive to be
14468         non-const.
14469         (Archive::begin, Archive::end): Make non-const.
14470         (Archive::count_members): Likewise.
14471         * archive.h (class Archive): Update declarations.
14472         * object.h (Object::read): Make non-const.
14473         * Makefile.am (CCFILES): Add descriptors.cc.
14474         (HFILES): Add descriptors.h.
14475         * Makefile.in: Rebuild.
14476
14477         PR 6716
14478         * gold.h: Always include <clocale>.  Add Solaris workarounds
14479         following code in binutils/sysdep.h.
14480
14481         PR 6048
14482         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14483         this->eh_frame_hdr_ is NULL before using it.
14484
14485         * dynobj.cc (Versions::Versions): Update comment.
14486
14487         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14488         the base version name.
14489
14490         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14491         array size plus one.
14492         (Stringpool_template::set_string_offsets): Subtract one from key
14493         before using it as an array index.
14494         (Stringpool_template::get_offset_with_length): Likewise.
14495         (Stringpool_template::write_to_buffer): Likewise.
14496         * stringpool.h (Stringpool_template::get_offset_from_key):
14497         Likewise.
14498
14499 2008-07-23  Ian Lance Taylor  <iant@google.com>
14500
14501         PR 6658
14502         * object.h (Merged_symbol_value::value): Do our best to handle a
14503         negative addend.
14504
14505         PR 6647
14506         * script.cc (Version_script_info::get_versions): Don't add empty
14507         version tag to return value.
14508         (Version_script_info::get_symbol_version_helper): Change return
14509         type to bool.  Add pversion parameter.  Change all callers.
14510         (script_register_vers_node): Don't require a non-NULL tag.
14511         * script.h (class Version_script_info): Update declarations.
14512         (Version_script_info::get_symbol_version): Change return type to
14513         bool.  Add version parameter.  Change all callers.
14514         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14515         handling.  Handle an empty version from a version script.
14516         (Symbol_table::define_special_symbol): Likewise.
14517         * testsuite/ver_test_10.script: New file.
14518         * testsuite/ver_test_10.sh: New file.
14519         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14520         (check_DATA): Add ver_test_10.syms.
14521         (ver_test_10.syms, ver_test_10.so): New target.
14522         * testsuite/Makefile.in: Rebuild.
14523
14524 2008-07-23  Simon Baldwin  <simonb@google.com>
14525
14526         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14527         to zero for undefined symbols from dynamic libraries.
14528
14529 2008-07-23  Ian Lance Taylor  <iant@google.com>
14530
14531         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14532         Change all callers.
14533         * symtab.h (class Symbol_table): Update declaration.
14534         * testsuite/ver_test_9.cc: New file.
14535         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14536         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14537         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14538         (ver_test_9.so, ver_test_9.o): New targets.
14539         * testsuite/Makefile.in: Rebuild.
14540
14541 2008-07-22  Ian Lance Taylor  <iant@google.com>
14542
14543         * options.h (class General_options): Define --check-sections.
14544         * layout.cc (Layout::set_segment_offsets): Handle
14545         --check-sections.
14546
14547         * options.h (class General_options): Define -n/--nmagic and
14548         -N/--omagic.
14549         * options.cc (General_options::finalize): For -n/--nmagic or
14550         -N/--omagic, set -static.
14551         * layout.cc (Layout::attach_allocated_section_to_segment): If
14552         -N/--omagic, don't put read-only and read-write sections in
14553         different segments.
14554         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14555         finding a read-only segment.
14556         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14557         don't set the minimum segment alignment to the common page size,
14558         and don't set the file offset to the address modulo the page size.
14559         * script-sections.cc (Script_sections::create_segments): If
14560         -n/--omagic, don't put read-only and read-write sections in
14561         different segments.
14562
14563         * cref.cc: New file.
14564         * cref.h: New file.
14565         * options.h (class General_options): Add --print-symbol-counts.
14566         * main.cc (main): Issue defined symbol report if requested.
14567         * archive.cc (Archive::interpret_header): Make into a const member
14568         function.
14569         (Archive::add_symbols): Call Input_objects::archive_start and
14570         archive_stop.
14571         (Archive::const_iterator): Define new class.
14572         (Archive::begin, Archive::end): New functions.
14573         (Archive::include_all_members): Rewrite to use iterator.
14574         (Archive::count_members): New function.
14575         * archive.h (class Archive): Update declarations.
14576         (Archive::filename): New function.
14577         * object.cc: Include "cref.h".
14578         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14579         (Sized_relobj::do_get_global_symbol_counts): New function.
14580         (Input_objects::add_object): Add object to cross-referencer.
14581         (Input_objects::archive_start): New function.
14582         (Input_objects::archive_stop): New function.
14583         (Input_objects::print_symbol_counts): New function.
14584         * object.h: Declare Cref and Archive.
14585         (Object::get_global_symbol_counts): New function.
14586         (Object::do_get_global_symbol_counts): New pure virtual function.
14587         (class Sized_relobj): Add defined_count_ field.  Update
14588         declarations.
14589         (class Input_objects): Add cref_ field.  Update constructor.
14590         Update declarations.
14591         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14592         defined_count_.
14593         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14594         symbol counts.
14595         (Sized_dynobj::do_get_global_symbol_counts): New function.
14596         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14597         defined_count_.  Update declarations.  Define Symbols typedef.
14598         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14599         parameter.  Change all callers.
14600         (Symbol_table::add_from_dynobj): Add sympointers and defined
14601         parameters.  Change all callers.
14602         * symtab.h (class Symbol_table): Update declarations.
14603         * Makefile.am (CCFILES): Add cref.cc.
14604         (HFILES): Add cref.h.
14605         * Makefile.in: Rebuild.
14606
14607 2008-07-22  Simon Baldwin  <simonb@google.com>
14608
14609         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14610         to zero when writing undefined symbols.
14611
14612 2008-07-22  Ian Lance Taylor  <iant@google.com>
14613
14614         * output.cc (Output_section::add_input_section): Don't try to
14615         merge empty merge sections.
14616
14617 2008-07-21  Craig Silverstein  <csilvers@google.com>
14618
14619         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14620         Include symbol version in error message.
14621
14622 2008-07-20  Chris Demetriou  <cgd@google.com>
14623
14624         * configure.ac (gold_cv_c_random_seed): New configured variable.
14625         (RANDOM_SEED_CFLAGS): New substituted variable.
14626         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14627         * configure: Rebuild.
14628         * Makefile.in: Likewise.
14629         * testsuite/Makefile.in: Likewise.
14630
14631 2008-07-18  Ian Lance Taylor  <iant@google.com>
14632
14633         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14634         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14635         * testsuite/ver_test_main.cc (main): Call t4.
14636         (t4, t4_2a): Define.
14637         * testsuite/ver_test_2.cc (t4_2): Define.
14638         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14639         * testsuite/ver_test_4.cc (t4_2a): Define.
14640         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14641         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14642
14643 2008-07-17  Ian Lance Taylor  <iant@google.com>
14644
14645         * dynobj.cc (Versions::add_def): If we give an error about a
14646         missing version, go ahead and create the version anyhow.
14647
14648 2008-07-10  Ian Lance Taylor  <iant@google.com>
14649
14650         Handle output sections with more than 0x7fffffff bytes.
14651         * object.h (class Relobj): Change map_to_output_ to
14652         output_sections_, and just keep a section pointer.  Change all
14653         uses.  Move comdat group support to Sized_relobj.
14654         (Relobj::is_section_specially_mapped): Remove.
14655         (Relobj::output_section): Remove poff parameter.  Change all
14656         callers.
14657         (Relobj::output_section_offset): New function.
14658         (Relobj::set_section_offset): Rewrite.
14659         (Relobj::map_to_output): Remove.
14660         (Relobj::output_sections): New function.
14661         (Relobj::do_output_section_offset): New pure virtual function.
14662         (Relobj::do_set_section_offset): Likewise.
14663         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14664         group support from Relobj.  Update declarations.
14665         (Sized_relobj::get_output_section_offset): New function.
14666         (Sized_relobj::do_output_section_offset): New function.
14667         (Sized_relobj::do_set_section_offset): New function.
14668         * object.cc (Relobj::output_section_address): Remove.
14669         (Sized_relobj::Sized_relobj): Initialize new fields.
14670         (Sized_relobj::include_section_group): Cast find_kept_object to
14671         Sized_relobj.
14672         (Sized_relobj::include_linkonce_section): Likewise.
14673         (Sized_relobj::do_layout): Use separate arrays for output section
14674         and output offset.
14675         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14676         output_sections.
14677         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14678         output_sections and section_offsets.
14679         (Sized_relobj::write_local_symbols): Likewise.
14680         (map_to_kept_section): Compute output address directly.
14681         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14682         output_sections and section_offsets.
14683         (Sized_relobj::write_sections): Likewise.
14684         (Sized_relobj::relocate_sections): Likewise.
14685         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14686         * output.h (class Output_reloc): Update declarations.  Change
14687         u2_.relobj to Sized_relobj*.
14688         (class Output_data_reloc): Change add functions to use
14689         Sized_relobj*.
14690         * output.cc (Output_reloc::Output_reloc): Change relobj to
14691         Sized_relobj*.
14692         (Output_reloc::local_section_offset): Change return type to
14693         Elf_Addr.  Use get_output_section_offset.
14694         (Output_reloc::get_address): Likewise.
14695         (Output_section::is_input_address_mapped): Don't call
14696         is_section_specially_mapped.
14697         (Output_section::output_offset): Likewise.
14698         (Output_section::output_address): Likewise.
14699         (Output_section::starting_output_address): Likewise.
14700         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14701         parameter to Sized_relobj*.
14702         (Copy_relocs::need_copy_reloc): Likewise.
14703         (Copy_relocs::save): Likewise.
14704         * copy-relocs.h (class Copy_relocs): Update declarations.
14705         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14706         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14707         * target-reloc.h (relocate_for_relocatable): Change
14708         offset_in_output_section type to Elf_Addr.  Change code that uses
14709         it as well.
14710         * layout.cc (Layout::layout): Always set *off.
14711         * mapfile.cc (Mapfile::print_input_section): Use
14712         output_section_offset.
14713         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14714         Sized_relobj*.
14715         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14716         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14717         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14718
14719 2008-07-03  Ian Lance Taylor  <iant@google.com>
14720
14721         * layout.cc (Layout::include_section): Do not discard unrecognized
14722         SHT_STRTAB sections.
14723
14724 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14725
14726         * script.cc (Lex::can_continue_name): Make '?' allowable in
14727         version-script names.
14728         * testsuite/version_script.map: Change glob pattern to use '?'
14729
14730 2008-06-30  Manish Singh  <yosh@gimp.org>
14731
14732         PR 6585
14733         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14734         Correct typo.
14735
14736 2008-06-30  Ian Lance Taylor  <iant@google.com>
14737
14738         PR 6660
14739         PR 6682
14740         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14741         versions]: Don't try to read the value in the contents, since we
14742         don't use it.  Use the template endianness when writing.
14743
14744 2008-06-25  Cary Coutant  <ccoutant@google.com>
14745
14746         * fileread.cc (File_read::make_view): Assert on zero-length view.
14747         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14748         symbol table when there are no symbols to read.
14749
14750 2008-06-23  Craig Silverstein  <csilvers@google.com>
14751
14752         * version.cc (version_string): Bump to 1.7
14753
14754 2008-06-18  Craig Silverstein  <csilvers@google.com>
14755
14756         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14757         constant 0xFFFF to type Valtype.
14758         (Powerpc_relocate_functions::rel16_ha): Likewise.
14759
14760 2008-06-17  Ian Lance Taylor  <iant@google.com>
14761
14762         * output.h (Output_section::Input_section): Initialize p2align_ to
14763         zero for Output_section_data constructors.
14764         (Output_section::Input_section::addralign): If not an input
14765         section, return the alignment of the Output_section_data.
14766         * testsuite/copy_test.cc: New file.
14767         * testsuite/copy_test_1.cc: New file.
14768         * testsuite/copy_test_2.cc: New file.
14769         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14770         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14771         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14772         (copy_test_1_pic.o, copy_test_1.so): New targets.
14773         (copy_test_2_pic.o, copy_test_2.so): New targets.
14774         * testsuite/Makefile.in: Rebuild.
14775
14776         * script-sections.cc (Script_sections::place_orphan): Initialize
14777         local variable exact.
14778
14779 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14780
14781         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14782
14783 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14784             David S. Miller  <davem@davemloft.net>
14785
14786         * powerpc.cc: New file.
14787         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14788         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14789         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14790         * Makefile.in: Rebuild.
14791
14792 2008-06-09  Ian Lance Taylor  <iant@google.com>
14793
14794         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14795         <exception>.
14796         (throwing, orig_terminate): New static variables.
14797         (terminate_handler): New static function.
14798         (t2): Set terminate handler.
14799
14800 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14801
14802         PR 6584
14803         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14804         alignment.
14805
14806 2008-05-30  Cary Coutant  <ccoutant@google.com>
14807
14808         * archive.cc (Archive::include_all_members) Correct to step
14809         over symbol table and extended name table in thin archives.
14810
14811 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14812
14813         PR 6407
14814         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14815         calculation.
14816
14817 2008-05-28  Caleb Howe  <cshowe@google.com>
14818
14819         * reduced_debug_output.cc: New file.
14820         * reduced_debug_output.h: New file.
14821         * options.h (class General_options): Add --strip-debug-non-line.
14822         * options.cc (General_options::finalize): Add strip_debug_non_line
14823         to the strip heirarchy.
14824         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14825         fields.
14826         * layout.cc: Include "reduced_debug_output.h".
14827         (Layout::Layout): Initialize new fields.
14828         (line_only_debug_sections): New static array.
14829         (is_lines_only_debug_sections): New static inline function.
14830         (Layout::include_section): Handle --strip-debug-non-line.
14831         (Layout::make_output_section): If --strip-debug-non-line, build
14832         new output sections for .debug_abbrev and .debug_info.
14833         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14834         gold.  Warn about possible overflow.
14835         (read_signed_LEB_128): Likewise.
14836         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14837         (read_signed_LEB_128): Declare.
14838         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14839         (HFILES): Add reduced_debug_output.h.
14840         * Makefile.in: Rebuild.
14841
14842 2008-05-21  Ian Lance Taylor  <iant@google.com>
14843
14844         * mapfile.cc: New file.
14845         * mapfile.h: New file.
14846         * options.h (class General_options): Add -M/--print-map and -Map.
14847         * options.cc (General_options::finalize): Make -M equivalent to
14848         -Map -.
14849         * main.cc: Include <cstdio> and "mapfile.h".
14850         (main): Open mapfile if requested.
14851         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14852         constructor.  Change caller.
14853         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14854         (queue_middle_tasks): Likewise.
14855         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14856         declarations.
14857         * archive.cc: Include "mapfile.h".
14858         (Archive::add_symbols): Add mapfile parameter.  Change all
14859         callers.  Pass mapfile, symbol, and reason to include_member.
14860         (Archive::include_all_members): Add mapfile parameter.  Change all
14861         callers.
14862         (Archive::include_member): Add mapfile, sym, and why parameters.
14863         Change all callers.  Report inclusion to map file.
14864         * archive.h: Include "fileread.h".
14865         (class Archive): Update declarations.
14866         (Archive::file): New const method.
14867         (class Add_archive_symbols): Add mapfile_ field.  Update
14868         constructor.  Change all callers.
14869         * readsyms.h (class Read_symbols): Likewise.
14870         (class Finish_group): Likewise.
14871         (class Read_script): Likewise.
14872         * common.cc: Include "mapfile.h".
14873         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14874         all callers.
14875         (Symbol_table::do_allocate_commons): Likewise.
14876         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14877         symbol allocation to mapfile.
14878         * common.h (class Allocate_commons_task): Add mapfile_ field.
14879         Update constructor.  Change all callers.
14880         * symtab.h (class Symbol_table): Update declarations.
14881         * layout.cc: Include "mapfile.h".
14882         (Layout_task_runner::run): Print information to mapfile.
14883         (Layout::create_gold_note): Change Output_data_fixed_space to
14884         Output_data_zero_fill.
14885         (Layout::create_build_id): Likewise.
14886         (Layout::print_to_mapfile): New function.
14887         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14888         constructor.  Change caller.
14889         (class Layout): Declare print_to_mapfile.
14890         * output.cc (Output_section::Input_section::print_to_mapfile): New
14891         function.
14892         (Output_section::add_input_section): If producing a map, always
14893         add to input_sections_ list.
14894         (Output_section::do_print_to_mapfile): New function.
14895         (Output_segment::print_sections_to_mapfile): New function.
14896         (Output_segment::print_section_list_to_mapfile): New function.
14897         * output.h: Include "mapfile.h".
14898         (Output_data::print_to_mapfile): New function.
14899         (Output_data::do_print_to_mapfile): New virtual function.
14900         (Output_segment_headers::do_print_to_mapfile): New function.
14901         (Output_file_header::do_print_to_mapfile): New function.
14902         (Output_data_const::do_print_to_mapfile): New function.
14903         (class Output_data_const_buffer): Add map_name_ field.  Update
14904         constructor.  Change all callers.  Add do_print_to_mapfile
14905         function.
14906         (class Output_data_fixed_space): Likewise.
14907         (class Output_data_space): Likewise.
14908         (class Output_data_zero_fill): New class.
14909         (Output_data_strtab::do_print_to_mapfile): New function.
14910         (Output_data_reloc_base::do_print_to_mapfile): New function.
14911         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14912         (Output_data_group::do_print_to_mapfile): New function.
14913         (Output_data_got::do_print_to_mapfile): New function.
14914         (Output_data_dynamic::do_print_to_mapfile): New function.
14915         (Output_symtab_xindex::do_print_to_mapfile): New function.
14916         (class Output_section): Declare do_print_to_mapflie.  Declare
14917         print_to_mapfile in Input_section.
14918         (class Output_segment): Declare new functions.
14919         * object.h (Sized_relobj::symbol_count): New function.
14920         * script-sections.cc
14921         (Output_section_element_dot_assignment::set_section_addresses):
14922         Change Output_data_fixed_space to Output_data_zero_fill.
14923         (Output_data_expression::do_print_to_mapfile): New function.
14924         * script.cc (read_input_script): Add mapfile parameter.  Change
14925         all callers.
14926         * script.h (read_input_script): Update declaration.
14927         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14928         (Eh_frame::do_print_to_mapfile): New function.
14929         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14930         (Output_merge_string::do_print_to_mapfile): New function.
14931         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14932         function.
14933         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14934         function.
14935         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14936         function.
14937         * Makefile.am (CCFILES): Add mapfile.cc.
14938         (HFILES): Add mapfile.h.
14939         * Makefile.in: Rebuild.
14940
14941 2008-05-19  Ian Lance Taylor  <iant@google.com>
14942
14943         * options.h (class General_options): Add -z relro.
14944         * layout.cc (Layout::Layout): Initialize relro_segment_.
14945         (Layout::add_output_section_data): Return the output section.
14946         (Layout::make_output_section): Rcognize relro sections and mark
14947         them appropriately.
14948         (Layout::attach_allocated_section_to_segment): Put relro sections
14949         in a PT_GNU_RELRO segment.
14950         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14951         section as relro.
14952         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14953         PT_TLS segments.
14954         (Layout::linkonce_mapping): Map d.rel.ro.local to
14955         .data.rel.ro.local.
14956         (Layout::output_section_name): Us .data.rel.ro.local for any
14957         section which begins with that.
14958         * layout.h (class Layout): Update add_output_section_data
14959         declaration.  Add relro_segment_ field.
14960         * output.cc (Output_section::Output_section): Initialize is_relro_
14961         and is_relro_local_ fields.
14962         (Output_segment::add_output_section): Group relro sections.
14963         (Output_segment::is_first_section_relro): New function.
14964         (Output_segment::maximum_alignment): If there is a relro section,
14965         align the segment to the common page size.
14966         (Output_segment::set_section_addresses): Track whether we are
14967         looking at relro sections.  If the last section is a relro
14968         section, align to the common page size.
14969         (Output_segment::set_section_list_addresses): Add in_relro
14970         parameter.  Change all callers.  Align to the page size when
14971         moving from relro to non-relro section.
14972         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14973         segment.
14974         * output.h (class Output_section): Add is_relro_ and
14975         is_relro_local_ fields.
14976         (Output_section::is_relro): New function.
14977         (Output_section::set_is_relro): New function.
14978         (Output_section::is_relro_local): New function.
14979         (Output_section::set_is_relro_local): New function.
14980         (class Output_segment): Update declarations.
14981         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14982         * sparc.cc (Target_sparc::got_section): Likewise.
14983         * x86_64.cc (Target_x86_64::got_section): Likewise.
14984         * testsuite/relro_test_main.cc: New file.
14985         * testsuite/relro_test.cc: New file.
14986         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14987         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14988         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14989         (relro_test.so, relro_test_pic.o): New targets.
14990         * testsuite/Makefile.in: Rebuild.
14991
14992 2008-05-16  Ian Lance Taylor  <iant@google.com>
14993
14994         * output.cc (Output_segment::add_output_section): Remove front
14995         parameter.
14996         * output.h (class Output_segment): Remove
14997         add_initial_output_section and overloaded add_output_section.
14998         Update declaration of remaining add_output_section.
14999         * layout.cc (Layout::create_interp): Call add_output_section
15000         rather than add_initial_output_section.
15001         (Layout::finish_dynamic_section): Likewise.
15002
15003         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15004         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15005         know the dynamic type.
15006         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15007         field.  Initialize it in constructor.
15008         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15009         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15010         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15011         reloc.
15012
15013         * output.cc (Output_reloc::get_address): Change return type to
15014         Elf_Addr.
15015         * output.h (class Output_reloc): Update get_address declaration.
15016         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15017         for section addresses.
15018
15019 2008-05-09  Ian Lance Taylor  <iant@google.com>
15020
15021         PR 6493
15022         * gold.cc (gold_nomem): Use return value of write.
15023
15024 2008-05-08  Ian Lance Taylor  <iant@google.com>
15025
15026         * symtab.c (Symbol::init_base_output_data): Add version
15027         parameter.  Change all callers.
15028         (Symbol::init_base_output_segment): Likewise.
15029         (Symbol::init_base_constant): Likewise.
15030         (Symbol::init_base_undefined): Likewise.
15031         (Sized_symbol::init_output_data): Likewise.
15032         (Sized_symbol::init_output_segment): Likewise.
15033         (Sized_symbol::init_constant): Likewise.
15034         (Sized_symbol::init_undefined): Likewise.
15035         (Symbol_table::do_define_in_output_data): If the new symbol has a
15036         version, mark it as the default.
15037         (Symbol_table::do_define_in_output_segment): Likewise.
15038         (Symbol_table::do_define_as_constant): Likewise.
15039         * symtab.h (class Symbol): Update declarations.
15040         (class Sized_symbol): Likewise.
15041         * resolve.cc (Symbol::override_version): New function.
15042         (Symbol::override_base): Call override_version.
15043         (Symbol::override_base_with_special): Likewise.
15044         * testsuite/ver_script_8.script: New file.
15045         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15046         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15047         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15048         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15049
15050 2008-05-06  Ian Lance Taylor  <iant@google.com>
15051
15052         PR 6049
15053         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15054         functions.
15055         (class General_options): Remove existing --undefined, and add
15056         --no-undefined instead.  Add new --undefined as synonym for -u.
15057         * archive.cc (Archive::add_symbols): Check whether symbol was
15058         named with -u.
15059         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15060         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15061         all uses.  Add IS_UNDEFINED.  Update declarations to split
15062         different versions of init_base.  Declare init_base_undefined.
15063         (Symbol::is_defined): Handle IS_UNDEFINED.
15064         (Symbol::is_undefined): Likewise.
15065         (Symbol::is_weak_undefined): Call is_undefined.
15066         (Symbol::is_absolute): Handle IS_CONSTANT.
15067         (class Sized_symbol): Update declarations to split different
15068         versions of init.  Declare init_undefined.
15069         (class Symbol_table): Declare new functions.
15070         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15071         Change all callers.
15072         (Symbol::init_base_output_data): Likewise.
15073         (Symbol::init_base_output_segment): Likewise.
15074         (Symbol::init_base_constant): Likewise.
15075         (Symbol::init_base_undefined): New function.
15076         (Sized_symbol::init_object): Rename from init.  Change all
15077         callers.
15078         (Sized_symbol::init_output_data): Likewise.
15079         (Sized_symbol::init_output_segment): Likewise.
15080         (Sized_symbol::init_constant): Likewise.
15081         (Sized_symbol::init_undefined): New function.
15082         (Symbol_table::add_undefined_symbols_from_command_line): New
15083         function.
15084         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15085         function.
15086         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15087         (Symbol::output_section): Likewise.
15088         (Symbol::set_output_section): Likewise.
15089         (Symbol_table::sized_finalize_symbol): Likewise.
15090         (Symbol_table::sized_write_globals): Likewise.
15091         * resolve.cc (Symbol_table::should_override): Likewise.
15092         (Symbol::override_base_with_special): Likewise.
15093
15094         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15095         symbol, change it to have default visibility.
15096         * testsuite/protected_1.cc: New file.
15097         * testsuite/protected_2.cc: New file.
15098         * testsuite/protected_3.cc: New file.
15099         * testsuite/protected_main_1.cc: New file.
15100         * testsuite/protected_main_2.cc: New file.
15101         * testsuite/protected_main_3.cc: New file.
15102         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15103         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15104         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15105         (protected_1.so): New target.
15106         (protected_1_pic.o, protected_2_pic.o): New targets.
15107         (protected_3_pic.o): New target.
15108         (check_PROGRAMS): Add protected_2.
15109         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15110         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15111         * testsuite/Makefile.in: Rebuild.
15112
15113         * options.h (DEFINE_var): Add set_user_set_##varname__.
15114         (DEFINE_bool_alias): New macro.
15115         (class General_options): Define -Bstatic using DEFINE_bool_alias
15116         rather than DEFINE_special.  Add --undefined as an alias for -z
15117         defs.
15118         * options.cc (General_options::parse_Bstatic): Remove.
15119
15120         * options.h (class General_options): Add --fatal-warnings.
15121         * main.cc (main): Implement --fatal-warnings.
15122         * errors.h (Errors::warning_count): New function.
15123
15124         * options.h (class General_options): Add -Bsymbolic-functions.
15125         * symtab.h (Symbol::is_preemptible): Check for
15126         -Bsymbolic-functions.
15127
15128 2008-05-05  Ian Lance Taylor  <iant@google.com>
15129
15130         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15131         as noVARNAME rather than no-VARNAME.
15132         (class General_options): Add option -z combreloc.
15133         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15134         get_address.
15135         (Output_reloc::sort_before) [SHT_REL]: New function.
15136         (Output_reloc::sort_before) [SHT_RELA]: New function.
15137         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15138         Sort_relocs_comparison.
15139         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15140         parameter.  Change all callers.
15141         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15142         sort_relocs parameter.  Change all callers.
15143         * output.cc (Output_reloc::get_address): New function, broken out
15144         of write_rel.
15145         (Output_reloc::write_rel): Call it.
15146         (Output_reloc::compare): New function.
15147         (Output_data_reloc_base::do_write): Optionally sort relocs.
15148
15149         * configure.ac: If targ_extra_obj is set, link it in.
15150         * configure.tgt: Initialize all variables.
15151         (x86_64*): Set targ_extra_obj and targ_extra_size.
15152         * configure: Rebuild.
15153
15154         * object.cc (Sized_relobj::include_section_group): Adjust section
15155         indexes read from group data.  Build vector to pass to
15156         layout_group.
15157         * layout.cc (Layout::layout_group): Add flags and shndxes
15158         parameters.  Remove contents parameter.  Change caller.  Update
15159         explicit instantiations.
15160         * layout.h (class Layout): Update layout_group declaration.
15161         * output.cc (Output_data_group::Output_data_group): Add flags and
15162         input_shndxes parameters.  Remove contents parameter.  Change
15163         caller.
15164         (Output_data_group::do_write): Change input_sections_ to
15165         input_shndxes_.
15166         * output.h (class Output_data_group): Update constructor
15167         declaration.  Rename input_sections_ to input_shndxes_.
15168         * testsuite/many_sections_test.cc: Add template.
15169
15170 2008-04-30  Cary Coutant  <ccoutant@google.com>
15171
15172         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15173
15174         * layout.cc (Layout::include_section): Refactored check for debug
15175         info section.
15176         (Layout::add_comdat): Add new parameters.  Change type
15177         of signature parameter.  Add object and shndx to signatures table.
15178         (Layout::find_kept_object): New function.
15179         * layout.h: Include <cstring>.
15180         (Layout::is_debug_info_section): New function.
15181         (Layout::add_comdat): Add new parameters.
15182         (Layout::find_kept_object): New function.
15183         (Layout::Kept_section): New struct.
15184         (Layout::Signatures): Change type of map range.
15185         * object.cc (Relobj::output_section_address): New function.
15186         (Sized_relobj::include_section_group): Add new parameters.  Change
15187         calls to Layout::add_comdat.  Change to build table of kept comdat
15188         groups and table mapping discarded sections to kept sections.
15189         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15190         (Sized_relobj::do_layout): Change calls to include_section_group and
15191         include_linkonce_section.
15192         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15193         value to zero when section is discarded.
15194         (Sized_relobj::map_to_kept_section): New function.
15195         * object.h (Relobj::output_section_address): New function.
15196         (Relobj::Comdat_group): New type.
15197         (Relobj::find_comdat_group): New function.
15198         (Relobj::Comdat_group_table): New type.
15199         (Relobj::Kept_comdat_section): New type.
15200         (Relobj::Kept_comdat_section_table): New type.
15201         (Relobj::add_comdat_group): New function.
15202         (Relobj::set_kept_comdat_section): New function.
15203         (Relobj::get_kept_comdat_section): New function.
15204         (Relobj::comdat_groups_): New field.
15205         (Relobj::kept_comdat_sections_): New field.
15206         (Symbol_value::input_value): Update comment.
15207         (Sized_relobj::map_to_kept_section) New function.
15208         (Sized_relobj::include_linkonce_section): Add new parameter.
15209         * target-reloc.h (Comdat_behavior): New type.
15210         (get_comdat_behavior): New function.
15211         (relocate_section): Add code to map a discarded section to the
15212         corresponding kept section when applying a relocation.
15213
15214 2008-04-30  Craig Silverstein  <csilvers@google.com>
15215
15216         * dwarf_reader.cc (next_generation_count): New static var.
15217         (Addr2line_cache_entry): New struct.
15218         (addr2line_cache): New static var.
15219         (Dwarf_line_info::one_addr2line): Added caching.
15220         (Dwarf_line_info::clear_addr2line_cache): New function.
15221         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15222         cache-size parameter.
15223         (Dwarf_line_info::one_addr2line_cache): New function.
15224         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15225         new cache-size argument to one_addr2line(), and clear cache.
15226
15227 2008-04-28  Cary Coutant  <ccoutant@google.com>
15228
15229         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15230         R_386_PC8 relocations.
15231
15232 2008-04-23  Ian Lance Taylor  <iant@google.com>
15233
15234         * object.cc (Sized_relobj::include_section_group): Check for
15235         invalid section group.
15236
15237         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15238         header size.
15239
15240         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15241         than read for file header.
15242         * archive.cc (Archive::include_member): Likewise.
15243
15244 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15245
15246         * aclocal.m4: Regenerate.
15247         * configure: Regenerate.
15248
15249 2008-04-19  Ian Lance Taylor  <iant@google.com>
15250
15251         * version.cc (version_string): Bump to 1.6.
15252
15253         * testsuite/Makefile.am (many_sections_r_test): New target.
15254         (many_sections_r_test_SOURCES): Remove.
15255         (many_sections_r_test_DEPENDENCIES): Remove.
15256         (many_sections_r_test_LDFLAGS): Remove.
15257         (many_sections_r_test_LDADD): Remove.
15258
15259         * object.cc (Sized_relobj::do_add_symbols): Always pass
15260         local_symbol_count_ to add_from_relobj.
15261
15262         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15263         every thousand variables.
15264         * testsuite/Makefile.in: Rebuild.
15265
15266         * object.cc (Xindex::initialize_symtab_xindex): New function.
15267         (Xindex::read_symtab_xindex): New function.
15268         (Xindex::sym_xindex_to_shndx): New function.
15269         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15270         available.
15271         (Sized_relobj::do_initialize_xindex): New function.
15272         (Sized_relobj::do_read_symbols): Adjust section links.
15273         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15274         parameter.  Change all callers.
15275         (Sized_relobj::include_section_group): Adjust section links and
15276         symbol section indexes.
15277         (Sized_relobj::do_layout): Adjust section links.
15278         (Sized_relobj::do_count_local_symbols): Adjust section links and
15279         symbol section indexes.
15280         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15281         ordinary and special symbols.
15282         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15283         dynsym_xindex parameters.  Change all callers.  Adjust section
15284         links.  Use SHN_XINDEX when needed.
15285         (Sized_relobj::get_symbol_location_info): Adjust section links.
15286         Don't get fooled by special symbols.
15287         * object.h (class Xindex): Define.
15288         (class Object): Add xindex_ parameter.  Declare virtual functoin
15289         do_initialize_xindex.
15290         (Object::adjust_sym_shndx): New function.
15291         (Object::set_xindex): New protected function.
15292         (class Symbol_value): Add is_ordinary_shndx_ field.
15293         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15294         (Symbol_value::value): Assert ordinary section.
15295         (Symbol_value::initialize_input_to_output_map): Likewise.
15296         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15297         Change all callers.
15298         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15299         all callers.
15300         (class Sized_relobj): Update declarations.
15301         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15302         parameter.  Change all callers.
15303         (Sized_relobj::adjust_shndx): New function.
15304         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15305         field.
15306         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15307         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15308         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15309         (Sized_dynobj::read_dynsym_section): Adjust section links.
15310         (Sized_dynobj::read_dynamic): Likewise.
15311         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15312         section links.
15313         (Sized_dynobj::do_initialize_xindex): New function.
15314         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15315         do_initialize_xindex.
15316         (Sized_dynobj::adjust_shndx): New function.
15317         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15318         dynsym_xindex_ fields.
15319         (Layout::finalize): Add a call to set_section_indexes before
15320         creating the symtab sections.
15321         (Layout::set_section_indexes): Don't do anything if the section
15322         already has a section index.
15323         (Layout::create_symtab_sections): Add shnum parameter.  Change
15324         caller.  Create .symtab_shndx section if needed.
15325         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15326         caller.
15327         (Layout::allocated_output_section_count): New function.
15328         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15329         needed.
15330         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15331         fields.  Update declarations.
15332         (Layout::symtab_xindex): New function.
15333         (Layout::dynsym_xindex): New function.
15334         (class Write_symbols_task): Add layout_ field.
15335         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15336         Change caller.
15337         * output.cc (Output_section_headers::Output_section_headers): Add
15338         shstrtab_section parameter.  Change all callers.
15339         (Output_section_headers::do_sized_write): Store overflow values
15340         for section count and section string table section index in
15341         section header zero.
15342         (Output_file_header::do_sized_write): Check for overflow of
15343         section count and section string table section index.
15344         (Output_symtab_xindex::do_write): New function.
15345         (Output_symtab_xindex::endian_do_write): New function.
15346         * output.h (class Output_section_headers): Add shstrtab_section_.
15347         Update declarations.
15348         (class Output_symtab_xindex): Define.
15349         (Output_section::has_out_shndx): New function.
15350         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15351         field.
15352         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15353         Change all callers.
15354         (Sized_symbol::init): Likewise.
15355         (Symbol::output_section): Check for ordinary symbol.
15356         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15357         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15358         callers.
15359         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15360         Change all callers.  Simplify handling of symbols from sections
15361         not included in the link.
15362         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15363         distinction.
15364         (Weak_alias_sorter::operator()): Assert that symbols are
15365         ordinary.
15366         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15367         distinction.
15368         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15369         parameters.  Change all callers.
15370         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15371         symbol distinction.  Use SHN_XINDEX when needed.
15372         (Symbol_table::write_section_symbol): Add symtab_xindex
15373         parameter.  Change all callers.
15374         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15375         SHN_XINDEX when needed.
15376         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15377         declarations.
15378         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15379         (Symbol::is_defined): Check is_ordinary.
15380         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15381         (Symbol::is_absolute, Symbol::is_common): Likewise.
15382         (class Sized_symbol): Update declarations.
15383         (class Symbol_table): Update declarations.
15384         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15385         parameters.  Change all callers.
15386         (Sized_symbol::override): Likewise.
15387         (Symbol_table::override): Likewise.
15388         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15389         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15390         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15391         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15392         to be in an ordinary section.
15393         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15394         object and is_ordinary parameters.  Change all callers.
15395         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15396         Change all callers.  Don't add undefined or non-ordinary symbols
15397         to reloc_map_.
15398         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15399         Change all callers.
15400         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15401         declarations.
15402         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15403         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15404         (Sized_relobj::relocate_sections): Likewise.
15405         * target-reloc.h (scan_relocs): Adjust section symbol index.
15406         (scan_relocatable_relocs): Likewise.
15407         * i386.cc (Scan::local): Check for ordinary symbols.
15408         * sparc.cc (Scan::local): Likewise.
15409         * x86_64.cc (Scan::local): Likewise.
15410         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15411         to symbol_section_and_value.
15412         * testsuite/many_sections_test.cc: New file.
15413         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15414         (check_PROGRAMS): Add many_sections_test.
15415         (many_sections_test_SOURCES): Define.
15416         (many_sections_test_DEPENDENCIES): Define.
15417         (many_sections_test_LDFLAGS): Define.
15418         (BUILT_SOURCES): Add many_sections_define.h.
15419         (many_sections_define.h): New target.
15420         (BUILT_SOURCES): Add many_sections_check.h.
15421         (many_sections_check.h): New target.
15422         (check_PROGRAMS): Add many_sections_r_test.
15423         (many_sections_r_test_SOURCES): Define.
15424         (many_sections_r_test_DEPENDENCIES): Define.
15425         (many_sections_r_test_LDFLAGS): Define.
15426         (many_sections_r_test_LDADD): Define.
15427         (many_sections_r_test.o): New target.
15428         * testsuite/Makefile.in: Rebuild.
15429
15430 2008-04-17  Cary Coutant  <ccoutant@google.com>
15431
15432         * errors.cc (Errors::info): New function.
15433         (gold_info): New function.
15434         * errors.h (Errors::info): New function.
15435         * gold.h (gold_info): New function.
15436         * object.cc (Input_objects::add_object): Print trace output.
15437         * options.cc (options::parse_set): New function.
15438         (General_options::parse_wrap): Deleted.
15439         (General_options::General_options): Deleted initializer.
15440         * options.h (options::String_set): New typedef.
15441         (options::parse_set): New function.
15442         (DEFINE_set): New macro.
15443         (General_options::wrap): Changed to use DEFINE_set. Changed
15444         callers of any_wrap_symbols and is_wrap_symbol.
15445         (General_options::trace, General_options::trace_symbol):
15446         New options.
15447         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15448         (General_options::wrap_symbols_): Deleted.
15449         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15450
15451 2008-04-17  David S. Miller  <davem@davemloft.net>
15452
15453         * options.cc (General_options::parse_V): New function.
15454         * options.h: Add entries for -V and -Qy.
15455
15456 2008-04-17  Ian Lance Taylor  <iant@google.com>
15457
15458         * common.cc (Symbol_table::allocate_commons): Remove options
15459         parameter.  Change caller.
15460         (Symbol_table::do_allocate_commons): Remove options parameter.
15461         Change caller.  Just call do_allocate_commons_list twice.
15462         (Symbol_table::do_allocate_commons_list): New function, broken out
15463         of do_allocate_commons.
15464         * common.h (class Allocate_commons_task): Remove options_ field.
15465         Update constructor.
15466         * symtab.cc (Symbol_table::Symbol_table): Initialize
15467         tls_commons_.
15468         (Symbol_table::add_from_object): Put TLS common symbols on
15469         tls_commons_ list.
15470         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15471         which are IN_OUTPUT_DATA.
15472         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15473         allocate_commons and do_allocate_commons declarations.  Declare
15474         do_allocate_commons_list.
15475         * gold.cc (queue_middle_tasks): Update creation of
15476         Allocate_commons_task to not pass options.
15477         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15478         (TLS_TEST_C_FLAGS): New variable.
15479         (tls_test_c_pic.o): New target.
15480         (tls_test_shared.so): Link in tls_test_c_pic.o.
15481         (tls_test_c_pic_ie.o): New target.
15482         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15483         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15484         (tls_test_c.o): New target.
15485         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15486         (tls_pic_test_LDADD): Likewise.
15487         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15488         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15489         (tls_test_c_gnu2.o): New target.
15490         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15491         tls_test_c_gnu2.o.
15492         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15493         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15494         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15495         * testsuite/tls_test.cc: Include "config.h".
15496         (t_last): Call t11_last.
15497         * testsuite/tls_test.h (t11, t11_last): Declare.
15498         * testsuite/tls_test_c.c: New file.
15499         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15500         * configure.ac: Check for OpenMP support.
15501         * configure, config.in, Makefile.in: Rebuild.
15502         * testsuite/Makefile.in: Rebuild.
15503
15504 2008-04-16  Cary Coutant  <ccoutant@google.com>
15505
15506         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15507         (Target_i386::tls_base_symbol_defined_): New field.
15508         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15509         (Target_i386::Scan::global): Likewise.
15510         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15511         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15512         (Target_x86_64::tls_base_symbol_defined_): New field.
15513         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15514         (Target_x86_64::Scan::global): Likewise.
15515
15516 2008-04-16  Cary Coutant  <ccoutant@google.com>
15517
15518         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15519         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15520         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15521         building shared libraries.
15522         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15523         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15524         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15525         * testsuite/Makefile.in: Rebuild.
15526         * testsuite/weak_undef.h: New file.
15527         * testsuite/weak_undef_file1.cc: Add extra test cases.
15528         * testsuite/weak_undef_file2.cc: Likewise.
15529         * testsuite/weak_undef_test.cc: Likewise.
15530
15531 2008-04-16  David S. Miller  <davem@davemloft.net>
15532
15533         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15534         Add issued_non_pic_error_ field.  Declare check_non_pic.
15535         (Target_sparc::Scan::check_non_pic): New function.
15536         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15537         (Target_sparc::Scan::global): Likewise.
15538
15539         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15540         * configure: Rebuild.
15541
15542         * options.h (DEFINE_enable): New macro.
15543         (new_dtags): New enable option.
15544         (initfirst, interpose, loadfltr, nodefaultlib,
15545         nodelete, nodlopen, nodump): New -z options.
15546         * layout.cc (Layout:finish_dynamic_section): If new
15547         dtags enabled, emit DT_RUNPATH.  Also, emit a
15548         DT_FLAGS_1 containing any specified -z flags.
15549
15550 2008-04-16  Ian Lance Taylor  <iant@google.com>
15551
15552         * copy-relocs.cc: New file.
15553         * copy-relocs.h: New file.
15554         * reloc.cc: Remove Copy_relocs code.
15555         * reloc.h: Likewise.
15556         * reloc-types.h (struct Reloc_types) [both versions]: Add
15557         get_reloc_addend_noerror.
15558         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15559         variants of add_global which take an addend which must be zero.
15560         * i386.cc: Include "copy-relocs.h".
15561         (class Target_i386): Change type of copy_relocs_ to variable,
15562         update initializer.
15563         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15564         Change all callers.
15565         (Target_i386::do_finalize_sections): Change handling of
15566         copy_relocs_.
15567         * sparc.cc: Include "copy-relocs.h".
15568         (class Target_sparc): Change type of copy_relocs_ to variable,
15569         update initializer.
15570         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15571         Change all callers.
15572         (Target_sparc::do_finalize_sections): Change handling of
15573         copy_relocs_.
15574         * x86_64.cc: Include "copy-relocs.h".
15575         (class Target_x86_64): Change type of copy_relocs_ to variable,
15576         update initializer.
15577         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15578         class.  Change all callers.
15579         (Target_x86_64::do_finalize_sections): Change handling of
15580         copy_relocs_.
15581         * Makefile.am (CCFILES): Add copy-relocs.cc.
15582         (HFILES): Add copy-relocs.h.
15583
15584         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15585
15586         * testsuite/script_test_4.sh: Permit leading zeroes.
15587
15588 2008-04-15  Ian Lance Taylor  <iant@google.com>
15589
15590         * script-sections.cc (Script_sections::create_segments): Use
15591         header_size_adjustment even when there is enough room for the
15592         headers.
15593         * testsuite/script_test_4.sh: New file.
15594         * testsuite/script_test_4.t: New file.
15595         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15596         (check_DATA): Add script_test_4.stdout.
15597         (MOSTLYCLEANFILES): Likewise.
15598         (script_test_4): New target.
15599         (script_test_4.stdout): New target.
15600         * testsuite/Makefile.in: Rebuild.
15601
15602         * sparc.cc: Add definitions for Output_data_plt_sparc class
15603         constants.
15604
15605 2008-04-14  David S. Miller  <davem@davemloft.net>
15606
15607         * sparc.cc: New file.
15608         * Makefile.am (TARGETSOURCES): Add sparc.cc
15609         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15610         * configure.tgt: Document targ_extra_size and
15611         targ_extra_big_endian.  Add entries for sparc-* and
15612         sparc64-*.
15613         * configure.ac: Handle targ_extra_size and
15614         targ_extra_big_endian.
15615         * Makefile.in: Rebuild.
15616         * configure: Likewise.
15617         * po/POTFILES.in: Likewise.
15618         * po/gold.pot: Likewise.
15619
15620 2008-04-14  Ian Lance Taylor  <iant@google.com>
15621
15622         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15623         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15624         in the name/type/flags to section mapping.  Don't call
15625         allocate_output_section.
15626         (Layout::choose_output_section): Change parameter from adjust_name
15627         to is_input_section.  Don't permit input sections after sections
15628         are attached to segments.  Don't call allocate_output_section.
15629         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15630         not write_enable_output_section.
15631         (Layout::make_output_section): Don't push to
15632         unattached_section_list_ nor call attach_to_segment.  Call
15633         attach_section_to_segment if sections are attached.
15634         (Layout::attach_sections_to_segments): New function.
15635         (Layout::attach_section_to_segment): New function.
15636         (Layout::attach_allocated_section_to_segment): Rename from
15637         attach_to_segment.  Remove flags parameter.
15638         (Layout::allocate_output_section): Remove function.
15639         (Layout::write_enable_output_section): Remove function.
15640         * layout.h (class Layout): Update for above changes.  Add new
15641         field sections_are_attached_.
15642         * output.h (Output_section::update_flags_for_input_section): New
15643         function.
15644         * output.cc (Output_section::add_input_section): Call
15645         update_flags_for_input_section.
15646         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15647
15648 2008-04-11  Cary Coutant  <ccoutant@google.com>
15649
15650         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15651         thought unnecessary.
15652         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15653
15654 2008-04-11  Ian Lance Taylor  <iant@google.com>
15655
15656         * output.h (class Output_section_data): Remove inline definition
15657         of set_addralign.
15658         * output.cc (Output_section_data::set_addralign): New function.
15659
15660 2008-04-11  Cary Coutant  <ccoutant@google.com>
15661
15662         Add support for TLS descriptors for i386 and x86_64.
15663         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15664         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15665         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15666         GOT_TYPE_TLS_DESC.
15667         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15668         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15669         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15670         relocations.
15671         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15672         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15673         Fix problem with initial-exec relocations.
15674         (Target_i386::Relocate::relocate_tls): Likewise.
15675         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15676         relaxation.
15677         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15678         support for section-plus-offset dynamic table entries.
15679         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15680         (Output_data_dynamic::Dynamic_entry): Add support for
15681         section-plus-offset dynamic table entries.
15682         (Output_data_dynamic::Classification): Likewise.
15683         (Output_data_dynamic::classification_): Renamed offset_.
15684         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15685         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15686         (Target_x86_64::make_plt_section): New function.
15687         (Target_x86_64::reserve_tlsdesc_entries): New function.
15688         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15689         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15690         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15691         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15692         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15693         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15694         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15695         add extra PLT entry for TLS descriptors.
15696         (Output_data_plt_x86_64::got_): New field.
15697         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15698         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15699         fields.
15700         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15701         descriptors.
15702         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15703         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15704         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15705         R_386_TLS_DESC_CALL relocations.
15706         (Target_x86_64::Scan::global): Likewise.
15707         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15708         for TLS descriptors.
15709         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15710         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15711         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15712         GD-to-IE relaxation.
15713         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15714         and TLS_DESCRIPTORS.
15715         * Makefile.in: Rebuild.
15716         * configure: Rebuild.
15717         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15718         (tls_test_shared2.so): New target.
15719         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15720         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15721         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15722         (tls_shared_gd_to_ie_test_LDADD): New variable.
15723         (tls_shared_gnu2_gd_to_ie_test): New target.
15724         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15725         New targets.
15726         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15727         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15728         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15729         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15730         (tls_shared_gnu2_test): New target.
15731         (tls_test_gnu2_shared.so): New target.
15732         (tls_shared_gnu2_test_SOURCES): New variable.
15733         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15734         (tls_shared_gnu2_test_LDFLAGS): New variable.
15735         (tls_shared_gnu2_test_LDADD): New variable.
15736         * testsuite/Makefile.in: Rebuild.
15737         * testsuite/Makefile.
15738
15739 2008-04-11  Ian Lance Taylor  <iant@google.com>
15740
15741         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15742         justsyms.t.
15743         * testsuite/Makefile.in: Rebuild.
15744
15745         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15746         long.
15747         * testsuite/script_test_2.cc (main): Adjust test.
15748
15749 2008-04-11  David S. Miller  <davem@davemloft.net>
15750             Ian Lance Taylor  <iant@google.com>
15751
15752         * options.h (General_options): Add entries for '-Y' and
15753         '-relax'.
15754         * options.cc (General_options:finalize): If -Y was used, add those
15755         entries to the library path instead of the default "/lib" and
15756         "/usr/lib".
15757
15758 2008-04-11  David S. Miller  <davem@davemloft.net>
15759
15760         * testsuite/justsyms.t: Start at 0x100.
15761         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15762         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15763         long.
15764         * testsuite/script_test_2.cc: Adjust string and section length
15765         checks.
15766
15767 2008-04-09  Ian Lance Taylor  <iant@google.com>
15768
15769         PR gold/5996
15770         * script-sections.cc (Sections_element::allocate_to_segment): Add
15771         orphan parameter.
15772         (Output_section_definition::allocate_to_segment): Likewise.
15773         (Orphan_output_section::allocate_to_segment): Likewise.
15774         (Script_sections::attach_sections_using_phdrs_clause): Don't
15775         propagate non-PT_LOAD segments to orphan sections.
15776         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15777         readelf rather than objdump.
15778         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15779         .interp section and PT_INTERP segment are the same size.
15780         * testsuite/Makefile.in: Rebuild.
15781
15782         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15783         aliases for symbols defined in the same object.
15784         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15785         (weak_alias_test_SOURCES): New variable.
15786         (weak_alias_test_DEPENDENCIES): New variable.
15787         (weak_alias_test_LDFLAGS): New variable.
15788         (weak_alias_test_LDADD): New variable.
15789         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15790         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15791         (weak_alias_test_3.o): New target.
15792         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15793         * testsuite/weak_alias_test_main.cc: New file.
15794         * testsuite/weak_alias_test_1.cc: New file.
15795         * testsuite/weak_alias_test_2.cc: New file.
15796         * testsuite/weak_alias_test_3.cc: New file.
15797
15798 2008-04-08  Ian Lance Taylor  <iant@google.com>
15799
15800         * options.h (class General_options): Add --noinhibit-exec option.
15801         * main.cc (main): Check --noinhibit-exec.
15802
15803         * options.h (class General_options): Define --wrap as a special
15804         option.  Add wrap_symbols_ field.
15805         (General_options::any_wrap_symbols): New function.
15806         (General_options::is_wrap_symbol): New function.
15807         * options.cc (General_options::parse_wrap): New function.
15808         (General_options::General_options): Initialize wrap_symbols_.
15809         * symtab.cc (Symbol_table::wrap_symbol): New function.
15810         (Symbol_table::add_from_object): Handle --wrap.
15811         * symtab.h (class Symbol_table): Declare wrap_symbol.
15812         * target.h (Target::wrap_char): New function.
15813         (Target::Target_info): Add wrap_char field.
15814         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15815         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15816         * testsuite/testfile.cc (Target_test::test_target_info):
15817         Likewise.
15818
15819         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15820         there is one.
15821
15822         * layout.h (class Layout): Add added_eh_frame_data_ field.
15823         * layout.cc (Layout::Layout): Initialize new field.
15824         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15825         output section until we find a section we merged successfully.
15826         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15827         that the size be non-zero.
15828
15829         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15830         qualifier.
15831
15832 2008-04-08  Craig Silverstein  <csilvers@google.com>
15833
15834         * configure.ac: Export new conditional variable HAVE_ZLIB.
15835         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15836         on HAVE_ZLIB.
15837         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15838         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15839
15840 2008-04-07  Ian Lance Taylor  <iant@google.com>
15841
15842         * version.cc (version_string): Set to "1.5".
15843
15844         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15845         Add issued_non_pic_error_ field.  Declare check_non_pic.
15846         (Target_x86_64::Scan::check_non_pic): New function.
15847         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15848         (Target_x86_64::Scan::global): Likewise.
15849
15850         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15851         addend parameter.  Change caller.  Handle merge sections.
15852         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15853         Address to Addend.  Don't add in the result of
15854         local_section_offset, pass down the addend and use the returned
15855         value.
15856         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15857         Update declarations of local_section_offset and symbol_value.
15858         * testsuite/two_file_test_1.cc (t18): New function.
15859         * testsuite/two_file_test_2.cc (f18): New function.
15860         * testsuite/two_file_test_main.cc (main): Call t18.
15861         * testsuite/two_file_test.h (t18, f18): Declare.
15862
15863         * configure.ac: Don't test for objdump, c++filt, or readelf.
15864         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15865         conditionals.
15866         (TEST_READELF): New variable.
15867         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15868         (check_PROGRAMS): Add two_file_strip_test.
15869         (two_file_strip_test): New target.
15870         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15871         (two_file_same_shared_strip_test_SOURCES): New variable.
15872         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15873         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15874         (two_file_same_shared_strip_test_LDADD): New variable.
15875         (two_file_shared_strip.so): New target.
15876         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15877         (ver_test_5.syms, ver_test_7.syms): Likewise.
15878         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15879         (strip_test_3.stdout): Use TEST_OBJDUMP.
15880         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15881
15882 2008-04-04  Cary Coutant  <ccoutant@google.com>
15883
15884         * symtab.h (Symbol::is_weak_undefined): New function.
15885         (Symbol::is_strong_undefined): New function.
15886         (Symbol::is_absolute): New function.
15887         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15888         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15889         absolute symbols.
15890         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15891         (weak_undef_test): New target.
15892         * testsuite/Makefile.in: Rebuild.
15893         * testsuite/weak_undef_file1.cc: New file.
15894         * testsuite/weak_undef_file2.cc: New file.
15895         * testsuite/weak_undef_test.cc: New file.
15896
15897 2008-04-03  Craig Silverstein  <csilvers@google.com>
15898
15899         * compressed_output.h (class Output_compressed_section): Use
15900         unsigned buffer.
15901         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15902         add zlib header.
15903         (zlib_compressed_suffix): Removed.
15904         (Output_compressed_section::set_final_data_size): Use unsigned
15905         buffers.
15906         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15907         Fix linker invocation.
15908         (flagstest_o_specialfile_and_compress_debug_sections):
15909         Likewise.
15910         * testsuite/Makefile.in: Regenerated.
15911
15912 2008-04-02  David S. Miller  <davem@davemloft.net>
15913
15914         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15915         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15916
15917 2008-04-02  Craig Silverstein  <csilvers@google.com>
15918
15919         * TODO: New file.
15920
15921 2008-04-02  Ian Lance Taylor  <iant@google.com>
15922
15923         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15924         parameters.  Update for new key type to views_.  Change all
15925         callers.
15926         (File_read::read): Adjust for byteshift in returned view.
15927         (File_read::add_view): New function, broken out of
15928         find_and_make_view.
15929         (File_read::make_view): New function, broken out of
15930         find_and_make_view.
15931         (File_read::find_or_make_view): Add offset and aligned
15932         parameters.  Rewrite accordingly.  Change all callers.
15933         (File_read::get_view): Add offset and aligned parameters.  Adjust
15934         for byteshift in return value.
15935         (File_read::get_lasting_view): Likewise.
15936         * fileread.h (class File_read): Update declarations.
15937         (class File_read::View): Add byteshift_ field.  Add byteshift to
15938         constructor.  Add byteshift method.
15939         * archive.h (Archive::clear_uncached_views): New function.
15940         (Archive::get_view): Add aligned parameter.  Change all callers.
15941         * object.h (Object::get_view): Add aligned parameter.  Change all
15942         callers.
15943         (Object::get_lasting_view): Likewise.
15944
15945         * fileread.cc (File_read::release): Don't call clear_views if
15946         there are multiple objects.
15947         * fileread.h (File_read::clear_uncached_views): New function.
15948         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15949         on the archive.
15950
15951 2008-03-31  Cary Coutant  <ccoutant@google.com>
15952
15953         Add thin archive support.
15954         * archive.cc (Archive::armagt): New const.
15955         (Archive::setup): Remove task parameter and calls to unlock.
15956         (Archive::unlock_nested_archives): New function.
15957         (Archive::read_header): Add nested_off parameter. Change
15958         all callers.
15959         (Archive::interpret_header): Likewise.
15960         (Archive::include_all_members): Change to handle thin
15961         archives.
15962         (Archive::include_member): Likewise.
15963         * archive.h (Archive::Archive): Add new parameters and
15964         initializers.
15965         (Archive::armagt): New const.
15966         (Archive::setup): Remove task parameter.
15967         (Archive::unlock_nested_archives): New function.
15968         (Archive::read_header): Add nested_off parameter.
15969         (Archive::interpret_header): Likewise.
15970         (Archive::Nested_archive_table): New typedef.
15971         (Archive::is_thin_archive_): New field.
15972         (Archive::nested_archives_): New field.
15973         (Archive::options_): New field.
15974         (Archive::dirpath_): New field.
15975         (Archive::task_): New field.
15976         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15977         for thin archives.  Pass additional parameters to
15978         Archive::Archive.  Unlock the archive file after calling
15979         Archive::setup.
15980
15981 2008-03-29  Ian Lance Taylor  <iant@google.com>
15982
15983         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15984         version symbol to be local.
15985         * testsuite/ver_test_4.sh: New file.
15986         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15987         (check_DATA): Add ver_test_4.syms.
15988         (ver_test_4.syms): New target.
15989         * testsuite/Makefile.in: Rebuild.
15990
15991         * output.cc
15992         (Output_section::Input_section_sort_entry::has_priority): New
15993         function.
15994         (Output_section::Input_section_sort_entry::match_file_name): New
15995         function.
15996         (Output_section::Input_section_sort_entry::match_section_name):
15997         Remove.
15998         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15999         Remove.
16000         (Output_section::Input_section_sort_entry::match_section_file):
16001         Remove.
16002         (Output_section::Input_section_sort_compare::operator()): Rewrite
16003         using new Input_section_sort_entry functions.  Sort crtbegin and
16004         crtend first.  Sort sections with no priority before sections with
16005         a priority.
16006         * testsuite/initpri1.c (d3): Check j != 4.
16007         (cd5): New constructor/destructor function.
16008         (main): Check j != 2.
16009
16010         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16011         new symbol when resolving, don't call set_is_default.
16012         * testsuite/ver_test_7.cc: New file.
16013         * testsuite/ver_test_7.sh: New file.
16014         * testsuite/Makefile.am (ver_test_7.so): New target.
16015         (ver_test_7.o): New target.
16016         (check_SCRIPTS): Add ver_test_7.sh.
16017         (check_DATA): Add ver_test_7.syms.
16018         (ver_test_7.syms): New target.
16019
16020 2008-03-28  Ian Lance Taylor  <iant@google.com>
16021
16022         * layout.cc (Layout::layout): If we see an input section with a
16023         name that needs sorting, set the must_sort flag for the output
16024         section.
16025         (Layout::make_output_section): If the name of the output section
16026         indicates that it might require sorting, set the may_sort flag.
16027         * output.h (Output_section::may_sort_attached_input_sections): New
16028         function.
16029         (Output_section::set_may_sort_attached_input_sections): New
16030         function.
16031         (Output_section::must_sort_attached_input_sections): New
16032         function.
16033         (Output_section::set_must_sort_attached_input_sections): New
16034         function.
16035         (class Output_section): Declare Input_section_sort_entry.  Define
16036         Input_section_sort_compare.  Declare
16037         sort_attached_input_sections.  Add new fields:
16038         may_sort_attached_input_sections_,
16039         must_sort_attached_input_sections_,
16040         attached_input_sections_are_sorted_.
16041         * output.cc (Output_section::Output_section): Initialize new
16042         fields.
16043         (Output_section::add_input_section): Add an entry to
16044         input_sections_ if may_sort or must_sort are true.
16045         (Output_section::set_final_data_size): Call
16046         sort_attached_input_sections if necessary.
16047         (Output_section::Input_section_sort_entry): Define new class.
16048         (Output_section::Input_section_sort_compare::operator()): New
16049         function.
16050         (Output_section::sort_attached_input_sections): New function.
16051         * configure.ac: Check whether the compiler supports constructor
16052         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16053         * testsuite/initpri1.c: New file.
16054         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16055         CONSTRUCTOR_PRIORITY.
16056         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16057         (initpri1_LDFLAGS): New variable.
16058         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16059
16060 2008-03-27  Ian Lance Taylor  <iant@google.com>
16061
16062         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16063         * testsuite/common_test_1.c: New file.
16064         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16065         (common_test_1_SOURCES): New variable.
16066         (common_test_1_DEPENDENCIES): New variable.
16067         (common_test_1_LDFLAGS): New variable.
16068
16069         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16070         and commons_ correctly when NAME/VERSION does not override
16071         NAME/NULL.
16072         * testsuite/ver_test_6.c: New file.
16073         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16074         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16075         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16076
16077 2008-03-26  Ian Lance Taylor  <iant@google.com>
16078
16079         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16080         of an undefined symbol from a version script.
16081         * testsuite/Makefile.am (ver_test_5.so): New target.
16082         (ver_test_5.o): New target.
16083         (check_SCRIPTS): Add ver_test_5.sh.
16084         (check_DATA): Add ver_test_5.syms.
16085         (ver_test_5.syms): New target.
16086         * testsuite/ver_test_5.cc: New file.
16087         * testsuite/ver_test_5.script: New file.
16088         * testsuite/ver_test_5.sh: New file.
16089         * Makefile.in, testsuite/Makefile.in: Rebuild.
16090
16091         PR gold/5986
16092         Fix problems building gold with gcc 4.3.0.
16093         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16094         (gold_error_at_location, gold_warning_at_location): Use it.
16095         * configure.ac: Check whether we can compile and use a template
16096         function with a printf attribute.
16097         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16098         when jumping over bytes.
16099         * object.cc: Instantiate Object::read_section_data.
16100         * debug.h: Include <cstring>
16101         * dwarf_reader.cc: Include <algorithm>
16102         * main.cc: Include <cstring>.
16103         * options.cc: Include <cstring>.
16104         * output.cc: Include <cstring>.
16105         * script.cc: Include <cstring>.
16106         * script.h: Include <string>.
16107         * symtab.cc: Include <cstring> and <algorithm>.
16108         * target-select.cc: Include <cstring>.
16109         * version.cc: Include <string>.
16110         * testsuite/testmain.cc: Include <cstdlib>.
16111         * configure, config.in: Rebuild.
16112
16113 2008-03-25  Ian Lance Taylor  <iant@google.com>
16114
16115         * options.cc: Include "../bfd/bfdver.h".
16116         (options::help): Print bug reporting address.
16117
16118         * version.cc (print_version): Adjust output for current value of
16119         BFD_VERSION_STRING.
16120
16121         * NEWS: New file.
16122
16123         * options.cc (options::help): Print list of supported targets.
16124         * target-select.h: Include <vector>.
16125         (class Target_selector): Make machine_, size_, and is_big_endian_
16126         fields const.  Add bfd_name_ and instantiated_target_ fields.
16127         (Target_selector::Target_selector): Add bfd_name parameter.
16128         (Target_selector::recognize): Make non-virtual, call
16129         do_recognize.
16130         (Target_selector::recognize_by_name): Make non-virtual, call
16131         do_recognize_by_name.
16132         (Target_selector::supported_names): New function.
16133         (Target_selector::bfd_name): New function.
16134         (Target_selector::do_instantiate_target): New pure virtual
16135         function.
16136         (Target_selector::do_recognize): New virtual function.
16137         (Target_selector::do_recognize_by_name): New virtual function.
16138         (Target_selector::instantiate_target): New private function.
16139         (supported_target_names): Declare.
16140         * target-select.cc (Target_selector::Target_selector): Update for
16141         new parameter and fields.
16142         (select_target_by_name): Check that the name matches before
16143         calling recognize_by_name.
16144         (supported_target_names): New function.
16145         * i386.cc (class Target_selector_i386): Update Target_selector
16146         constructor call.  Remove recognize and recognize_by_name.  Add
16147         do_instantiate_target.
16148         * x86_64.cc (class Target_selector_x86_64): Likewise.
16149         * testsuite/testfile.cc (class Target_selector_test): Update for
16150         changes to Target_selector.
16151
16152         * README: Rewrite, with some notes on unsupported features.
16153
16154 2008-03-24  Cary Coutant  <ccoutant@google.com>
16155
16156         * i386.cc (Target_i386::Got_type): New enum declaration.
16157         (Target_i386::Scan::local): Updated callers of Output_data_got
16158         member functions.
16159         (Target_i386::Scan::global): Likewise.
16160         (Target_i386::Relocate::relocate): Likewise.
16161         (Target_i386::Relocate::relocate_tls): Likewise.
16162         * object.h (Got_offset_list): New class.
16163         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16164         (Sized_relobj::local_got_offset): Likewise.
16165         (Sized_relobj::set_local_got_offset): Likewise.
16166         (Sized_relobj::local_has_tls_got_offset): Removed.
16167         (Sized_relobj::local_tls_got_offset): Removed.
16168         (Sized_relobj::set_local_tls_got_offset): Removed.
16169         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16170         * output.cc (Output_data_got::add_global): Added got_type parameter.
16171         (Output_data_got::add_global_with_rel): Likewise.
16172         (Output_data_got::add_global_with_rela): Likewise.
16173         (Output_data_got::add_global_pair_with_rel): New function.
16174         (Output_data_got::add_global_pair_with_rela): New function.
16175         (Output_data_got::add_local): Added got_type parameter.
16176         (Output_data_got::add_local_with_rel): Likewise.
16177         (Output_data_got::add_local_with_rela): Likewise.
16178         (Output_data_got::add_local_pair_with_rel): New function.
16179         (Output_data_got::add_local_pair_with_rela): New function.
16180         (Output_data_got::add_global_tls): Removed.
16181         (Output_data_got::add_global_tls_with_rel): Removed.
16182         (Output_data_got::add_global_tls_with_rela): Removed.
16183         (Output_data_got::add_local_tls): Removed.
16184         (Output_data_got::add_local_tls_with_rel): Removed.
16185         (Output_data_got::add_local_tls_with_rela): Removed.
16186         * output.h (Output_data_got::add_global): Added got_type parameter.
16187         (Output_data_got::add_global_with_rel): Likewise.
16188         (Output_data_got::add_global_with_rela): Likewise.
16189         (Output_data_got::add_global_pair_with_rel): New function.
16190         (Output_data_got::add_global_pair_with_rela): New function.
16191         (Output_data_got::add_local): Added got_type parameter.
16192         (Output_data_got::add_local_with_rel): Likewise.
16193         (Output_data_got::add_local_with_rela): Likewise.
16194         (Output_data_got::add_local_pair_with_rel): New function.
16195         (Output_data_got::add_local_pair_with_rela): New function.
16196         (Output_data_got::add_global_tls): Removed.
16197         (Output_data_got::add_global_tls_with_rel): Removed.
16198         (Output_data_got::add_global_tls_with_rela): Removed.
16199         (Output_data_got::add_local_tls): Removed.
16200         (Output_data_got::add_local_tls_with_rel): Removed.
16201         (Output_data_got::add_local_tls_with_rela): Removed.
16202         * resolve.cc (Symbol::override_base_with_special): Removed
16203         reference to has_got_offset_ field.
16204         * symtab.cc (Symbol::init_fields): Replaced initialization
16205         of got_offset_ with got_offsets_.  Removed initialization
16206         of has_got_offset_
16207         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16208         (Symbol::got_offset): Likewise.
16209         (Symbol::set_got_offset): Likewise.
16210         (Symbol::has_tls_got_offset): Removed.
16211         (Symbol::tls_got_offset): Removed.
16212         (Symbol::set_tls_got_offset): Removed.
16213         (Symbol::got_offset_): Removed.
16214         (Symbol::tls_mod_got_offset_): Removed.
16215         (Symbol::tls_pair_got_offset_): Removed.
16216         (Symbol::got_offsets_): New field.
16217         (Symbol::has_got_offset): Removed.
16218         (Symbol::has_tls_mod_got_offset): Removed.
16219         (Symbol::has_tls_pair_got_offset): Removed.
16220         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16221         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16222         member functions.
16223         (Target_x86_64::Scan::global): Likewise.
16224         (Target_x86_64::Relocate::relocate): Likewise.
16225         (Target_x86_64::Relocate::relocate_tls): Likewise.
16226
16227 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16228
16229         * yyscript.y: Fix spelling error in comment.
16230
16231 2008-03-24  Ian Lance Taylor  <iant@google.com>
16232
16233         * options.h (class General_options): Define build_id option.
16234         * layout.h (class Layout): Declare write_build_id, create_note,
16235         create_build_id.  Add build_id_note_ member.
16236         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16237         "libiberty.h", "md5.h", "sha1.h".
16238         (Layout::Layout): Initialize eh_frame_data_,
16239         eh_frame_hdr_section_, and build_id_note_.
16240         (Layout::finalize): Call create_build_id.
16241         (Layout::create_note): New function, broken out of
16242         Layout::create_gold_note.
16243         (Layout::create_gold_note): Call create_note.
16244         (Layout::create_build_id): New function.
16245         (Layout::write_build_id): New function.
16246         (Close_task_runner::run): Call write_build_id.
16247
16248         * x86_64.cc: Correct license to GPLv3.
16249
16250 2008-03-23  Ian Lance Taylor  <iant@google.com>
16251
16252         * options.cc: Include "demangle.h".
16253         (parse_optional_string): New function.
16254         (parse_long_option): Handle takes_optional_argument.
16255         (parse_short_option): Update dash_z initializer.  Handle
16256         takes_optional_argument.
16257         (General_options::General_options): Initialize do_demangle_.
16258         (General_options::finalize): Set do_demangle_.  Handle demangling
16259         style.
16260         * options.h (parse_optional_string): Declare.
16261         (struct One_option): Add optional_arg field.  Update constructor.
16262         Update call constructor calls.  Add takes_optional_argument
16263         function.
16264         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16265         (DEFINE_optional_string): Define.
16266         (General_options::demangle): Change from DEFINE_bool to
16267         DEFINE_optional_string.
16268         (General_options::no_demangle): New function.
16269         (General_options::do_demangle): New function.
16270         (General_options::set_do_demangle): New function.
16271         (General_options::execstack_status_): Move definition to end of
16272         class definition.
16273         (General_options::static_): Likewise.
16274         (General_options::do_demangle_): New field.
16275         * object.cc (big_endian>::get_symbol_location_info): Call
16276         Options::do_demangle, not Options::demangle.
16277         * symtab.cc (demangle): Likewise.
16278
16279 2008-03-22  Ian Lance Taylor  <iant@google.com>
16280
16281         * gold.h: Include <cstddef> and <sys/types.h>
16282         * options.h: Include <cstring>.
16283
16284 2008-03-21  Ian Lance Taylor  <iant@google.com>
16285
16286         * Added source code to GNU binutils.
16287 \f
16288 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16289
16290 Copying and distribution of this file, with or without modification,
16291 are permitted in any medium without royalty provided the copyright
16292 notice and this notice are preserved.
16293
16294 Local Variables:
16295 mode: change-log
16296 left-margin: 8
16297 fill-column: 74
16298 version-control: never
16299 End: