Fix internal error in gold when -Map and --compress-debug-sections are used
[external/binutils.git] / gold / ChangeLog
1 2014-12-16  Cary Coutant  <ccoutant@google.com>
2
3         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
4         (Mapfile::print_output_data): Use current_data_size() to avoid
5         assert for sections requiring postprocessing; if address is not valid,
6         print 0.
7         (Mapfile::print_output_section): Use current_data_size(); print note
8         that addresses and sizes are before compression.
9
10 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
11
12         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
13         Cast current_group_size to unsigned long when reporting error.
14
15 2014-12-10  Jing Yu  <jingyu@google.com>
16
17         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
18         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
19         Update error message.
20         (Target_aarch64::do_relax): Use absolute value of option
21         stub_group_size. Replace local variable with class member
22         stub_group_size_.
23
24 2014-12-04  Alan Modra  <amodra@gmail.com>
25
26         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
27         addend of PLTREL24 reloc when not generating a plt stub.  Make
28         max_branch_offset an "Address".
29         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
30         (Target_powerpc::Relocate::relocate): Likewise.
31
32 2014-12-04  Alan Modra  <amodra@gmail.com>
33
34         PR 17670
35         * symtab.cc (Symbol::set_undefined): Remove assertion.
36         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
37         on symbols defined in discarded sections, instead return false.
38         Rearrange params, update all callers.
39         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
40         branches to syms in discarded sections.
41         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
42         undefined and flag as discarded.
43         (Target_powerpc::Relocate::relocate): Localize variable.
44
45 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
46
47         PR gold/17675
48         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
49         * testsuite/Makefile.in: Regenerated.
50
51 2014-12-03  Alan Modra  <amodra@gmail.com>
52
53         PR 17566
54         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
55         when adding dynamic relocations against section symbols.
56
57 2014-12-01  Dimitry Ivanov <dimitry@google.com>
58
59         * layout.cc (Layout::finish_dynamic_section): When '-z global'
60         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
61         * options.h (General_options): New -z option (global).
62
63 2014-12-01  Cary Coutant  <ccoutant@google.com>
64
65         PR gold/17578
66         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
67         is given.
68         (Layout::create_executable_stack_info): Warn when -z noexecstack is
69         given but some inputs require executable stack.
70
71 2014-11-26  Cary Coutant  <ccoutant@google.com>
72
73         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
74         .debug_str_offsets; strip .debug_gnu_pubnames and
75         .debug_gnu_pubtypes.
76         (lines_only_debug_sections): Strip all four new sections.
77
78 2014-11-26  Jing Yu  <jingyu@google.com>
79
80         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
81         register to be x0 when to relax TLSDESC_LD64_LO12.
82
83 2014-11-26  Alan Modra  <amodra@gmail.com>
84
85         * powerpc.cc (struct Stub_table_owner): New.
86         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
87         unsigned int vector.  Update all references.
88         (powerpc_relobj::set_stub_table): Take an unsigned int param
89         rather than a Stub_table.  Update callers.
90         (Powerpc_relobj::clear_stub_table): New function.
91         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
92         stub_group_size_ vars.
93         (Target_powerpc::new_stub_table): Delete.
94         (max_branch_delta): New function, extracted from..
95         (Target_powerpc::Relocate::relocate): ..here..
96         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
97         status on whether stub created successfully.
98         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
99         default sizing to..
100         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
101         reduce on relax failure.
102         (Target_powerpc::group_sections): Add "no_size_errors" param.
103         Use stub_group_size_.  Set up group info in a temp vector,
104         before building Stub_table vector.  Account for input sections
105         possibly already converted to relaxed sections.
106         (Stub_table::init): Delete.  Merge into..
107         (Stub_table::Stub_table): ..here.
108         (Stub_table::can_reach_stub): New function.
109         (Stub_table::add_plt_call_entry): Add "from" parameter and
110         return true iff stub could be reached.
111         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
112         param too.
113         (Stub_table::clear_stubs): Add "all" param.
114
115 2014-11-26  Alan Modra  <amodra@gmail.com>
116
117         * powerpc.cc (Stub_control::set_output_and_owner): New function.
118         (Target_powerpc::group_sections): Use it.
119
120 2014-11-25  Cary Coutant  <ccoutant@google.com>
121
122         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
123         (Binary_to_elf::write_symbol): Add st_size parameter.
124         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
125
126 2014-11-25  Cary Coutant  <ccoutant@google.com>
127
128         PR gold/17639
129         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
130         (Sized_relobj_file::do_layout): Handle deferred sections properly
131         during GC pass 1. Don't add reloc sections to deferred list twice.
132         * object.h (Sized_relobj_file::is_deferred_layout): New function.
133         (Sized_relobj_file::is_deferred_layout_): New data member.
134
135 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
136
137         PR gold/17619
138         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
139         Check PC-relative offset overflow in PLT entry.
140
141 2014-11-21  Alan Modra  <amodra@gmail.com>
142
143         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
144         for undefined weaks.
145
146 2014-11-20  Alan Modra  <amodra@gmail.com>
147
148         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
149         from --stub-group-size parameter divided by 1024.
150         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
151         template parameter.  Update all uses.
152         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
153         has_stub_value.  Set for long branches.  Don't report overflow for
154         branch to undefined weak symbols.  Print info message on
155         overflowing branch to stub.
156
157 2014-11-20  Alan Modra  <amodra@gmail.com>
158
159         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
160
161 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
162
163         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
164         entry for R_X86_64_GOTPLT64.
165         (Target_x86_64<size>::Relocate::relocate): Update comments for
166         R_X86_64_GOTPLT64.
167
168 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
169
170         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
171         * plugin.h: add lock definition
172
173 2014-10-29  Han Shen  <shenhan@google.com>
174             Jing Yu   <jingyu@google.com>
175
176         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
177         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
178         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
179         Symbol::TLS_REF.
180         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
181         method.
182         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
183         (Target_aarch64::tls_ld_to_le): New method.
184         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
185         for 64bit targets.
186         (Output_data_plt_aarch64::irelative_rel_): New data member.
187         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
188         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
189         (Output_data_plt_aarch64::add_relocation): New method.
190         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
191         offset. Add got_irelative size to got size.
192         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
193         type string with the new typename.
194         (AArch64_relocate_functions::update_adr): Replace parameter x with
195         immed.
196         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
197         (AArch64_relocate_functions::reloc_common): New method.
198         (AArch64_relocate_funcsions::rela_general): Extract common part out
199         into reloc_common method.
200         (AArch64_relocate_functions::rela_general): Likewise.
201         (AArch64_relocate_functions::pcrela_general): Likewise.
202         (AArch64_relocate_functions::adr): New method.
203         (AArch64_relocate_functions::adrp): Calculate immed before calling
204         update_adr.
205         (AArch64_relocate_functions::adrp): Likewise.
206         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
207         comparing x to 0. Calculate immed from ~x when x < 0.
208         (Target_aarch64::optimize_tls_reloc): Add new cases for
209         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
210         TLSLD_MOVW_DTPREL_G0_NC.
211         (Target_aarch64::possible_function_pointer_reloc): Implement this
212         method.
213         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
214         comment.
215         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
216         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
217         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
218         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
219         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
220         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
221         (Target_aarch64::make_plt_entry): Call add_entry with two more
222         parameters.
223         (Target_aarch64::make_local_ifunc_plt_entry): New method.
224         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
225         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
226         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
227         (Target_aarch64::Relocate::relocate_tls): Add cases for
228         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
229         TLSLD_MOVW_DTPREL_G0_NC.
230         * testsuite/icf_safe_so_test.cc: Correct test comment.
231         * testsuite/icf_safe_test.sh: Add AArch64 arch.
232
233 2014-10-22  Alan Modra  <amodra@gmail.com>
234
235         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
236         thread_starter.
237
238 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
239
240         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
241
242 2014-10-17  Cary Coutant  <ccoutant@google.com>
243
244         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
245         Add "typename" keyword.
246
247 2014-10-15  Han Shen  <shenhan@google.com>
248             Jing Yu   <jingyu@google.com>
249
250         Patch for gold aarch64 backend to support relaxation.
251         * aarch64-reloc.def: Change format.
252         * aarch64.cc (class Reloc_stub): New class.
253         (class Stub_table): New class.
254         (class AArch64_relobj): New class.
255         (class AArch64_input_section): New class.
256         (class AArch64_output_section): New class.
257         (Target_aarch64::new_stub_table): New method.
258         (Target_aarch64::new_aarch64_input_section): New method.
259         (Target_aarch64::find_aarch64_input_section): New method.
260         (Target_aarch64::scan_section_for_stubs): New method.
261         (Target_aarch64::scan_reloc_section_for_stubs): New method.
262         (Target_aarch64::relocate_stub): New method.
263         (Target_aarch64::current_target): New method.
264         (Target_aarch64::do_make_elf_object): New method.
265         (Target_aarch64::do_may_relax): New method.
266         (Target_aarch64::do_relax): New method.
267         (Target_aarch64::group_sections): New method.
268         (Target_aarch64::scan_reloc_for_stub): New method.
269         (Target_aarch64::do_make_output_section): New method.
270         (Target_aarch64::stub_tables_): New data member.
271         (Target_aarch64::aarch64_input_section_map_): New data member.
272         (AArch64_relocate_functions::maybe_apply_stub): New method.
273
274 2014-09-30  Cary Coutant  <ccoutant@google.com>
275
276         PR gold/17432
277         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
278
279 2014-09-30  Kito Cheng  <kito@0xlab.org>
280
281         PR gold/13597
282         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
283         hash table before sysv-style hash table.
284
285 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
286
287         * options.h (--pic-executable): Add negative to alias to -no-pie.
288
289 2014-09-26  Cary Coutant  <ccoutant@google.com>
290
291         PR gold/16773
292         * object.cc (Sized_relobj_file): Compute value of section symbols
293         for TLS sections the same as TLS symbols.
294
295 2014-09-25  Cary Coutant  <ccoutant@google.com>
296
297         PR gold/17432
298         * resolve.cc (Symbol_table::resolve): Override common placeholder
299         symbols, but adjust sizes.
300         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
301         symbols to common lists.
302
303 2014-09-24  Alan Modra  <amodra@gmail.com>
304
305         * po/POTFILES.in: Regenerate.
306
307 2014-09-23  Taiju Tsuiki  <tzik@google.com>
308             Cary Coutant  <ccoutant@google.com>
309
310         PR gold/14860
311         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
312         on input_sections_blocker.
313         * layout.cc (Write_sections_task::locks): Unblock
314         input_sections_blocker_.
315         * layout.h (Write_sections_task::Write_sections_task): Add
316         input_sections_blocker.
317         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
318         to DEPENDENCIES.
319         * testsuite/Makefile.in: Regenerate.
320
321 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
322
323         * testsuite/Makefile.am (plugin_test_10): New test.
324         * testsuite/Makefile.in: Regenerate
325         * testsuite/plugin_common_test_2.c (c1): Align to 8.
326         * testsuite/plugin_test_10.sh: New file.
327
328 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
329
330         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
331         * resolve.cc (Symbol_table::resolve): Don't override common symbols
332         during the replacement phase.
333
334 2014-09-17  Han Shen  <shenhan@google.com>
335             Jing Yu  <jingyu@google.com>
336
337         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
338         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
339         * aarch64.cc (Target_aarch64): Add data members
340         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
341         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
342         constructor.
343         (Target_aarch64::do_reloc_symbol_index): New method.
344         (Target_aarch64::do_reloc_addend): New method.
345         (Target_aarch64::add_tlsdesc_info): New method.
346         (Target_aarch64::do_dynsym_value): New method.
347         (Target_aarch64::do_make_data_plt): Add new parameters: got,
348         got_irelative. Pass them to Output_data_plt_aarch64_standard.
349         (Target_aarch64::make_data_plt): Add new parameters: got,
350         got_irelative. Pass them to do_make_data_plt.
351         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
352         (Target_aarch64::Relocate:tls_gd_to_le): New method.
353         (Target_aarch64::Relocate:tls_ie_to_le): New method.
354         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
355         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
356         (Target_aarch64::got_tlsdesc_section): New method.
357         (Target_aarch64::make_local_ifunc_plt_entry): New method.
358         (Target_aarch64::define_tls_base_symbol): New method.
359         (Target_aarch64::reserve_tlsdesc_entries): New method.
360         (Target_aarch64::got_mod_index_entry): New method.
361         (Target_aarch64::rela_tlsdesc_section): New method.
362         (Target_aarch64::rela_irelative_section): New method.
363         (Target_aarch64::Tlsdesc_info): New struct.
364         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
365         relocations and tlsdesc relocations.
366         (Target_aarch64::optimize_tls_reloc): Implement method.
367         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
368         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
369         in constructor.
370         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
371         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
372         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
373         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
374         (Output_data_plt_aarch64::rela_tlsdesc): New method.
375         (Output_data_plt_aarch64::rela_irelative): New method.
376         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
377         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
378         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
379         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
380         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
381         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
382         (Output_data_plt_aarch64_standard): New member variables:
383         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
384         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
385         New parameter: got, got_irelative.
386         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
387         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
388         (Output_data_plt_aarch64::do_write): Replace got_address with
389         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
390         (AArch64_relocate_functions::update_movnz): New method.
391         (AArch64_relocate_functions): Correct format.
392         (AArch64_relocate_functions::movnz): New method.
393         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
394         before the switch. Add new cases to switch.
395         Check ie_to_le relaxation on tlsie relocations. Add code handling
396         tlsgd tlsdesc cases.
397         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
398         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
399         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
400         Call reloc_name_in_error_message to print unsupported reloc.
401         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
402         make_data_plt.
403         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
404         relocs. Fill in some more dynamic tags.
405         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
406         Skip call tls_get_addr when tlsgd is relaxed.
407         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
408         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
409         tlsdesc->ie relaxation.
410
411 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
412
413         * mips.cc (Target_mips_nacl): New class.
414         (Target_selector_mips_nacl): New class.
415         (target_selector_mips32): Rename from target_selector_mips32be and use
416         Target_selector_mips_nacl instead of Target_selector_mips.
417         (target_selector_mips32el): Rename from target_selector_mips32 and use
418         Target_selector_mips_nacl instead of Target_selector_mips.
419         (target_selector_mips64): Rename from target_selector_mips64be and use
420         Target_selector_mips_nacl instead of Target_selector_mips.
421         (target_selector_mips64el): Rename from target_selector_mips64 and use
422         Target_selector_mips_nacl instead of Target_selector_mips.
423         (Target_mips::mips_info): Add const attribute.
424
425 2014-09-02  Cary Coutant  <ccoutant@google.com>
426
427         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
428         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
429         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
430         (Sized_incr_dynobj::do_section_name): Likewise.
431         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
432         (Sized_incr_dynobj::do_section_name): Likewise.
433         * object.h (Object::section_name): Likewise.
434         (Object::do_section_name): Likewise.
435         (Sized_relobj_file::do_section_name): Likewise.
436         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
437         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
438
439 2014-09-02  Cary Coutant  <ccoutant@google.com>
440
441         PR gold/17005
442         * ehframe.cc (Fde::write): Add output_offset parameter.
443         (Cie::write): Likewise.
444         (Eh_frame::set_final_data_size): Account for offset within output
445         section.
446         (Eh_frame::do_sized_write): Likewise.
447         * ehframe.h (Fde::write): Add output_offset parameter.
448         (Cie::write): Likewise.
449         * output.cc (Output_section::Input_section_sort_entry): Remove
450         section_has_name_; add output_section_name parameter. Use
451         output section name for non-input sections.
452         (Output_section::Input_section_sort_entry::section_has_name): Remove.
453         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
454         (Output_section::Input_section_sort_compare): Remove logic for
455         sections without names.
456         (Output_section::Input_section_sort_init_fini_compare): Likewise.
457         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
458         Likewise.
459         (Output_section::Input_section_sort_section_name_compare): Likewise.
460
461 2014-08-29 Han Shen <shenhan@google.com>
462            Jing Yu <jingyu@google.com>
463
464         * aarch64-reloc-property.cc
465         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
466         reference reloc property in the table.
467         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
468         3 other entries.
469         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
470         2 new overloaded methods.
471         (Output_data_got_aarch64::do_write): Add code to write out
472         static relocs.
473         (class Output_data_got_aarch64::Static_reloc): New class to wrap
474         static relocs.
475         (Output_data_got_aarch64::static_relocs): New vector to
476         hold static relocs.
477         (Target_aarch64::TCB_SIZE): New const static memeber.
478         (Target_aarch64::tcb_size): New method.
479         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
480         (Target_aarch64::Relocate::relocate_tls): New method.
481         (Target_aarch64::Scan::local): Add code handling new reloc types.
482         (Target_aarch64::Scan::global): Add code handling new reloc types.
483
484 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
485
486         * options.h (-no-pie): Add option.
487
488 2014-08-08  Jing Yu  <jingyu@google.com>
489             Han Shen  <shenhan@google.com>
490
491         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
492         (DEFFILES): add aarch64-reloc.def.
493         (TARGETSOURCES): Add aarch64-reloc-property.cc.
494         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
495         * Makefile.in: Regenerate.
496         * aarch64-reloc-property.cc: New file.
497         * aarch64-reloc-property.h: New file.
498         * aarch64-reloc.def: New file.
499         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
500         with tab to make the format consistent.
501         (Output_data_got_aarch64::symbol_table_): New method.
502         (Target_aarch64::do_plt_address_for_global): New method.
503         (Target_aarch64::do_plt_address_for_local): New method.
504         (Target_aarch64::do_select_as_default_target): New method.
505         (Target_aarch64::do_make_data_plt): New method.
506         (Target_aarch64::make_data_plt): New method.
507         (Output_data_plt_aarch64::has_irelative_section): New method.
508         (Output_data_plt_aarch64::address_for_global): New method.
509         (Output_data_plt_aarch64::address_for_local): New method.
510         (Output_data_plt_aarch64::irelative_rel_): New parameter.
511         (Output_data_plt_aarch64::add_entry): Implement contents.
512         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
513         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
514         the got_pov entry to plt0.
515         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
516         Implement contents.
517         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
518         (AArch64_howto): New struct.
519         (aarch64_howto[]): New static const array.
520         (AArch64_relocate_functions): New class.
521         (Target_aarch64::Scan::get_reference_flags): Remove method.
522         (Target_aarch64::Scan::local): Implement to support a few relocations.
523         (Target_aarch64::Scan::global): Implement to support a few relocations.
524         (Target_aarch64::make_plt_section): Implement contents.
525         (Target_aarch64::make_plt_entry): Implement contents.
526         (Target_aarch64::do_finalize_sections): Implement contents.
527         (Target_aarch64::Relocate::relocate): Implement a few relocations.
528         (Target_aarch64::relocate_section): Implement contents.
529
530 2014-08-06  Alan Modra  <amodra@gmail.com>
531
532         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
533
534 2014-08-06  Alan Modra  <amodra@gmail.com>
535
536         PR 13227
537         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
538
539 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
540
541         * object.cc (Relobj::is_section_name_included): Add
542         ".rodata.nptl_version" to not garbage collect this section.
543
544 2014-07-08  Cary Coutant  <ccoutant@google.com>
545
546         * expression.cc (struct Expression::Expression_eval_info): Add
547         new fields type_pointer, vis_pointer, and nonvis_pointer.
548         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
549         nonvis_pointer parameters. Adjust all calls.
550         (Symbol_expression::value): Update type, visibility, and nonvis bits
551         in caller.
552         * script.cc (Symbol_assignment::sized_finalize): Update type,
553         visibility, and remaining st_other bits for new symbol.
554         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
555         vis_pointer, and nonvis_pointer parameters.
556         * symtab.h (Symbol::set_type): New method.
557
558         * testsuite/Makefile.am (defsym_test): New test.
559         * testsuite/Makefile.in: Regenerate.
560         * testsuite/defsym_test.c: New file.
561         * testsuite/defsym_test.sh: New file.
562
563 2014-07-08  Cary Coutant  <ccoutant@google.com>
564
565         PR gold/15639
566         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
567         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
568         (Sized_dynobj::base_read_symbols): ...new method.
569         * object.h (Sized_relobj_file::base_read_symbols): New method.
570         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
571         (Sized_relobj_file::base_read_symbols): ...new method.
572         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
573         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
574         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
575
576 2014-07-04  Alan Modra  <amodra@gmail.com>
577
578         * po/POTFILES.in: Regenerate.
579
580 2014-07-02  Jing Yu  <jingyu@google.com>
581
582         * aarch64.cc: New file
583         * Makefile.am (TARGETSOURCES): Add aarch64.cc
584         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
585         * Makefile.in: Regenerate.
586         * configure.tgt: Add entries for aarch64*.
587         * configure.ac:  Likewise.
588         * configure: Likewise.
589
590 2014-06-27  Alan Modra  <amodra@gmail.com>
591
592         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
593
594 2014-06-24  Cary Coutant  <ccoutant@google.com>
595
596         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
597         sections.
598         (Dwo_file::sized_read_unit_index): Likewise.
599
600 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
601
602         * mips.cc: New file.
603         * Makefile.am (TARGETSOURCES): Add mips.cc
604         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
605         * configure.tgt: Add entries for mips*.
606         * configure.ac: Likewise.
607         * Makefile.in: Regenerate.
608         * configure: Likewise.
609
610 2014-06-09  Cary Coutant  <ccoutant@google.com>
611
612         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
613         unit_length is within section bounds.
614
615 2014-06-09  Cary Coutant  <ccoutant@google.com>
616
617         PR gold/16980
618         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
619         map.
620
621 2014-06-07  Alan Modra  <amodra@gmail.com>
622
623         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
624
625 2014-06-06  Cary Coutant  <ccoutant@google.com>
626
627         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
628         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
629         (Dwarf_pubnames_table::read_header): Likewise.
630         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
631         .debug_gnu_pubtypes.
632
633 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
634
635         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
636         * Makefile.in, configure: Regenerate.
637
638 2014-06-03  Alan Modra  <amodra@gmail.com>
639
640         * powerpc.cc (addis_12_2): Define.
641         (Stub_table::do_write): Support fusion on ELFv2 stubs.
642
643 2014-06-03  Alan Modra  <amodra@gmail.com>
644
645         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
646         st_other output.
647
648 2014-06-02  Alan Modra  <amodra@gmail.com>
649
650         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
651         Only ignore relocs on ELFv1.
652         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
653
654 2014-05-30  Cary Coutant  <ccoutant@google.com>
655
656         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
657         * testsuite/Makefile.in: Regenerate.
658         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
659
660 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
661
662         PR gold/16945
663         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
664         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
665
666 2014-05-15  Alan Modra  <amodra@gmail.com>
667
668         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
669         Compare FDE contents with DW_CFA_nop rather than 0.
670
671 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
672
673         * symtab.h (may_need_copy_reloc): Remove check for position independent
674         code.
675         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
676         position independence before pc absolute may_need_copy_reloc call.
677         Add check for executable output befor pc relative may_need_copy_reloc
678         call.
679         * i386.cc: Ditto.
680         * arm.cc: Ditto.
681         * sparc.cc: Ditto.
682         * tilegx.cc: Ditto.
683         * powerpc.cc: Add check for no position independence before
684         may_need_copy_reloc calls.
685         * testsuite/pie_copyrelocs_test.cc: New file.
686         * testsuite/pie_copyrelocs_shared_test.cc: New file.
687         * Makefile.am (pie_copyrelocs_test): New test.
688         * Makefile.in: Regenerate.
689
690 2014-05-08  Martin Liška  <mliska@suse.cz>
691
692         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
693
694 2014-05-06  Cary Coutant  <ccoutant@google.com>
695
696         PR gold/16900
697         * i386.cc (Output_data_got_plt_i386): New class.
698         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
699         parameter. Change all callers.
700         (Output_data_plt_i386::layout_): Remove.
701         (Output_data_plt_i386::got_plt_): Change type.
702         (Target_i386::got_plt_): Change type. Change all references.
703         (Target_i386::got_section): Create instance of new class.
704         (Output_data_got_plt_i386::do_write): New function.
705         * x86_64.cc (Output_data_got_plt_x86_64): New class.
706         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
707         parameter. Change all callers.
708         (Output_data_plt_x86_64::layout_): Remove.
709         (Output_data_plt_x86_64::got_plt_): Change type.
710         (Target_x86_64::got_plt_): Change type. Change all references.
711         (Target_x86_64::got_section): Create instance of new class.
712         (Output_data_got_plt_x86_64::do_write): New function.
713         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
714         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
715         class.
716
717 2014-05-05  Cary Coutant  <ccoutant@google.com>
718
719         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
720         if we have pubnames/pubtypes.
721
722 2014-05-02  Cary Coutant  <ccoutant@google.com>
723
724         * defstd.cc (in_segment): Define __ehdr_start here...
725         * layout.cc (Layout::finalize): ...Instead of here.  Set the
726         output segment when known.
727         * resolve.cc (Symbol::override_base_with_special): Remember
728         the original binding.
729         * symtab.cc (Symbol::set_output_segment): New function.
730         (Symbol::set_undefined): New function.
731         * symtab.h (Symbol::is_weak_undefined): Check original undef
732         binding.
733         (Symbol::is_strong_undefined): New function.
734         (Symbol::set_output_segment): New function.
735         (Symbol::set_undefined): New function.
736         * target-reloc.h (is_strong_undefined): Remove.
737         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
738         Check for hidden undefs.
739         (relocate_section): Call Symbol::is_strong_undefined.
740
741         * testsuite/Makefile.am (ehdr_start_test_1)
742         (ehdr_start_test_2, ehdr_start_test_3)
743         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
744         * testsuite/Makefile.in: Regenerate.
745         * testsuite/ehdr_start_def.cc: New source file.
746         * testsuite/ehdr_start_test.cc: New source file.
747         * testsuite/ehdr_start_test.t: New linker script.
748         * testsuite/ehdr_start_test_4.sh: New shell script.
749
750 2014-04-23  Cary Coutant  <ccoutant@google.com>
751
752         PR gold/16870
753         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
754
755 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
756
757         * layout.cc (Layout::include_section): Allow a target to decide
758         whether to include a section.
759         * target.h (Target::should_include_section): New function.
760         (Target::do_should_include_section): New function.
761
762 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
763
764         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
765         inline into ...
766         (Copy_relocs::emit): ... here.
767         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
768         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
769         (Copy_reloc_entry::entries_): Change from private to protected.
770
771 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
772
773         * icf.cc (get_section_contents): Replace copies of reloc
774         vectors with const references.
775
776 2014-04-02  Cary Coutant  <ccoutant@google.com>
777
778         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
779         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
780         * configure: Regenerate.
781         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
782         -fno-use-linker-plugin.
783         (LINK1, CXXLINK1): Add it to the link command.
784         * testsuite/Makefile.in: Regenerate.
785
786 2014-03-12  Alan Modra  <amodra@gmail.com>
787
788         * Makefile.in: Regenerate.
789
790 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
791
792         * symtab.h (Symbol::set_nonvis): New function.
793
794 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
795
796         * symtab.cc (Sized_symbol<32>::init_output_data):
797         Instantiate the template.
798         (Sized_symbol<64>::init_output_data): Likewise.
799
800 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
801
802         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
803         adjust dynamic symbol value.
804         * target.h (Target::adjust_dyn_symbol): New function.
805         (Target::do_adjust_dyn_symbol): New function.
806
807 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
808
809         * output.cc (Output_data_dynamic::Dynamic_entry::write):
810         Get the value of DYNAMIC_CUSTOM dynamic entry.
811         * output.h (Output_data_dynamic::add_custom): New function.
812         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
813         dynamic entry.
814         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
815         * target.h (Target::dynamic_tag_custom_value): New function.
816         (Target::do_dynamic_tag_custom_value): New function.
817
818 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
819
820         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
821         dynsym indexes.
822         * target.h (Target::has_custom_set_dynsym_indexes): New function.
823         (Target::do_has_custom_set_dynsym_indexes): New function.
824         (Target::set_dynsym_indexes): New function.
825         (Target::do_set_dynsym_indexes): New function.
826
827 2014-03-07  Alan Modra  <amodra@gmail.com>
828
829         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
830         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
831         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
832         (Powerpc_relocate_functions::has_overflow_bitfield,
833         overflowed): Use the above.
834         (Target_powerpc::Relocate::relocate): Correct overflow checking
835         for a number of relocations.  Modify overflow test for 16-bit
836         fields in instructions to signed/unsigned according to whether
837         the field takes a signed or unsigned value.
838
839 2014-03-05  Alan Modra  <amodra@gmail.com>
840
841         Update copyright years.
842
843 2014-03-05  Alan Modra  <amodra@gmail.com>
844
845         * powerpc.cc (Target_powerpc::Scan::local, global): Support
846         R_PPC64_ADDR64_LOCAL.
847         (Target_powerpc::Relocate::relocate): Likewise.
848
849 2014-03-03  Alan Modra  <amodra@gmail.com>
850
851         * dwp.cc (print_version): Update copyright year to current.
852
853 2014-02-10  Alan Modra  <amodra@gmail.com>
854
855         * po/gold.pot: Regenerate.
856
857 2014-02-06  Cary Coutant  <ccoutant@google.com>
858
859         Fix problem where -u is ignored when a weak undef is seen.
860
861         * archive.cc (Library_base::should_include_member): Reorder
862         code to check for -u option if a weak undef has already been seen.
863         * testsuite/Makefile.am (weak_undef_test_2): New test case.
864         * testsuite/Makefile.in: Regenerate.
865         * testsuite/weak_undef_file3.cc: New file.
866         * testsuite/weak_undef_file4.cc: New file.
867         * testsuite/weak_undef_test_2.cc: New file.
868
869 2014-02-05  Cary Coutant  <ccoutant@google.com>
870
871         Fix issues with gold undefined symbol diagnostics.
872
873         PR binutils/15435
874         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
875         check to here.
876         * target-reloc.h (is_strong_undefined): New function.
877         (relocate_section): Move undef vtable symbol check from here.
878         Check for is_strong_undefined.
879
880 2014-02-05  Cary Coutant  <ccoutant@google.com>
881
882         Fix problems with the --dynamic-list option.
883
884         PR gold/13577
885         * options.cc (General_options::parse_dynamic_list):
886         Set have_dynamic_list_.
887         (General_options::General_options): Initialize have_dynamic_list_.
888         (General_options::finalize): Turn off -Bsymbolic and
889         -Bsymbolic-functions if --dynamic-list provided.
890         * options.h (General_options::have_dynamic_list): New function.
891         (General_options::have_dynamic_list_): New data member.
892         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
893         correctly.
894
895         PR gold/16530
896         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
897         in --dynamic-list, mark it.
898
899         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
900         (dynamic_list_2): New test case.
901         * testsuite/Makefile.in: Regenerate.
902         * testsuite/dynamic_list_2.cc: New file.
903         * testsuite/dynamic_list_2.t: New file.
904         * testsuite/dynamic_list_lib1.cc: New file.
905         * testsuite/dynamic_list_lib2.cc: New file.
906         * testsuite/gc_dynamic_list_test.c: New file.
907         * testsuite/gc_dynamic_list_test.sh: New file.
908         * testsuite/gc_dynamic_list_test.t: New file.
909
910 2014-01-28  Cary Coutant  <ccoutant@google.com>
911
912         Add .gdb_index version 7 support.
913
914         * gold/dwarf_reader.cc: include <utility> (for make_pair).
915         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
916         debug sections.
917         (Dwarf_ranges_table::read_ranges_table): Likewise.
918         (Dwarf_pubnames_table::read_section): Check for GNU-style
919         sections, and for compressed debug sections.
920         (Dwarf_pubnames_table::read_header): Compute end address of table.
921         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
922         for end of list by offset, not by offset == 0.
923         (Dwarf_info_reader::do_read_string_table): Check for compressed
924         debug sections.
925         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
926         Initialize new data members.
927         (Dwarf_pubnames_table::next_name): return flag_byte.
928         (Dwarf_pubnames_table::end_of_table_): New data member.
929         (Dwarf_pubnames_table::is_gnu_style_): New data member.
930         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
931         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
932         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
933         read skeleton type unit DIEs.
934         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
935         (Gdb_index::do_write): Write flag_byte.
936         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
937         (Gdb_index::Cu_vector): Store flags along with cu indexes.
938         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
939         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
940
941 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
942
943         * version.cc (print_version): Update copyright year to 2014.
944
945 2013-12-19  Dimitry Andric  <dimitry@andric.com>
946
947         * stringpool.cc (Stringpool_template::reserve): Add
948         HAVE_UNORDERED_MAP case.
949         * stringpool.cc (Stringpool_template::print_stats): Likewise.
950
951 2013-12-18  Cary Coutant  <ccoutant@google.com>
952
953         * configure.ac: Check for <unordered_set> and <unordered_map>.
954         * config.in: Regenerate.
955         * configure: Regenerate.
956         * system.h: Use <unordered_set> and <unordered_map> if available.
957
958 2013-12-10  Roland McGrath  <mcgrathr@google.com>
959
960         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
961         with $(INSTALL_PROGRAM_ENV).
962         * Makefile.in: Regenerate.
963
964 2013-11-22  Cary Coutant  <ccoutant@google.com>
965
966         * configure.ac: Add check for which library is needed for
967         dlopen.
968         * configure: Regenerate.
969
970 2013-11-22  Cary Coutant  <ccoutant@google.com>
971
972         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
973         assembler.
974         * testsuite/Makefile.in: Regenerate.
975
976 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
977
978         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
979         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
980         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
981         (Target_x86_64<size>::Scan::local): Likewise.
982         (Target_x86_64<size>::Scan::global): Likewise.
983         (Target_x86_64<size>::Relocate::relocate): Likewise.
984         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
985         Likewise.
986         (Target_x86_64<size>::Scan::check_non_pic(): Handle
987         R_X86_64_PC32_BND.
988
989         * testsuite/Makefile.am (check_PROGRAMS): Add
990         exception_x86_64_bnd_test.
991         (exception_x86_64_bnd_test_SOURCES): New macro.
992         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
993         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
994         (exception_x86_64_bnd_test_LDADD): Likewise.
995         (exception_x86_64_bnd_1.o): New rule.
996         (exception_x86_64_bnd_2.o): Likewise.
997         * testsuite/Makefile.in: Regenerated.
998
999 2013-11-15  Alan Modra  <amodra@gmail.com>
1000
1001         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1002         accessor.
1003         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1004         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1005         symval_for_branch lookup to ELFv1.
1006         (Stub_table::add_plt_call_entry): Use unsigned int off.
1007         (Output_data_glink::Address, invalid_address): New.
1008         (Output_data_glink::add_eh_frame): Move out of line.  Add
1009         support for ELFv2.
1010         (Output_data_glink::add_global_entry, find_global_entry,
1011         global_entry_address): New functions.
1012         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1013         ge_size): New variables.
1014         (Output_data_glink::set_final_data_size): Add global entry
1015         stub sizing.
1016         (Output_data_glink::do_write): Write global entry stubs.
1017         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1018         parameter.  Return true for ELFv2.  Adjust callers.
1019         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1020         ELFv1.  Similarly for ifunc and dynamic relocation processing
1021         specific to ELFv1.  Recognize that symbols are defined on
1022         their plt entries for ELFv2.
1023         (Target_powerpc::symval_for_branch): Assert if called for
1024         ELFv2 or ppc32.
1025         (Target_powerpc::Relocate::relocate): Use global entry plt
1026         stub for symbol value if such exists on ELFv2.
1027         (Target_powerpc::Relocate::relocate): Don't call
1028         symval_for_branch when ELFv2.  Do adjust for local entry
1029         offset when ELFv2.
1030         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1031         plt stub for ELFv2.
1032         (Target_powerpc::do_plt_address_for_global): Similarly.
1033
1034 2013-11-14  Cary Coutant  <ccoutant@google.com>
1035
1036         Revert patch -- this did not fix the problem, and there is
1037         no race there.
1038
1039         2013-11-14  Cary Coutant  <ccoutant@google.com>
1040
1041             PR gold/14860
1042             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1043             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1044             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1045             updating fde_offsets_.
1046             (Eh_frame_hdr::lock_): New data member.
1047
1048 2013-11-14  Cary Coutant  <ccoutant@google.com>
1049
1050         * dwp.cc (Dwo_file_entry): New type.
1051         (File_list): Use Dwo_file_entry.
1052         (Dwo_file::verify): New function.
1053         (Dwo_file::verify_dwo_list): New function.
1054         (Dwo_file::sized_verify_dwo_list): New function.
1055         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1056         list.
1057         (Dwp_options): New enum type.
1058         (dwp_options): Add --verify-only.
1059         (usage): Likewise.
1060         (main): Likewise.
1061         * dwp.h (gold_info): Add declaration.
1062
1063 2013-11-14  Cary Coutant  <ccoutant@google.com>
1064
1065         PR gold/14860
1066         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1067         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1068         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1069         updating fde_offsets_.
1070         (Eh_frame_hdr::lock_): New data member.
1071
1072 2013-11-06  Cary Coutant  <ccoutant@google.com>
1073
1074         PR gold/15758
1075         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1076         before reloc sections.
1077
1078 2013-11-04  Alan Modra  <amodra@gmail.com>
1079
1080         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1081         (Symbol::needs_dynamic_reloc): Test new flag.
1082         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1083         (Target_powerpc::Scan::get_reference_flags): Add target param.
1084         Return FUNC_DESC_ABI for 64-bit ELFv1.
1085         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1086         call.
1087         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1088         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1089
1090 2013-10-31  Cary Coutant  <ccoutant@google.com>
1091
1092         Restore support for dwp v2 DWARF package file format.
1093
1094         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1095         tu_length parameter.  Adjust all callers.
1096         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1097         * dwp.cc: Include dwarf.h.
1098         (Section_bounds): New struct type.
1099         (Unit_set): New struct type.
1100         (Dwo_file::Dwo_file): Initialize new data member.
1101         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1102         Combine and rename to...
1103         (Dwo_file::read_unit_index): ...this.
1104         (Dwo_file::sized_read_compunit_index)
1105         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1106         (Dwo_file::sized_read_unit_index): ...this.
1107         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1108         parameters; add section_id parameter.
1109         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1110         (Dwo_file::add_unit_set): ...this.
1111         (Dwo_file::shndx_map_): Remove.
1112         (Dwo_file::sect_offsets_): New data member.
1113         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1114         (Dwp_output_file::add_section): Rename to...
1115         (Dwp_output_file::add_contribution): ...this.
1116         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1117         (Dwp_output_file::add_tu_set): Likewise.
1118         (Dwp_output_file::Contribution): New type.
1119         (Dwp_output_file::Section::contributions): New data member.
1120         (Dwp_output_file::Cu_or_tu_set): Remove.
1121         (Dwp_output_file::Section::Section): New ctor.
1122         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1123         (Dwp_output_file::Dwp_index::Section_table): New type.
1124         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1125         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1126         parameter.
1127         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1128         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1129         (Dwp_output_file::Dwp_index::section_table): New member function.
1130         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1131         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1132         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1133         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1134         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1135         (Dwp_output_file::Dwp_index::section_table_): New data member.
1136         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1137         (Dwp_output_file::add_output_section): New member function.
1138         (Dwp_output_file::write_new_section): New member function.
1139         (Dwp_output_file::write_contributions): New member function.
1140         (Dwp_output_file::section_id_map_): New data member.
1141         (class Dwo_id_info_reader): Remove.
1142         (class Unit_reader): New class.
1143         (get_dwarf_section_name): New function.
1144         (Dwo_file::read_executable): Adjust initializations of class data.
1145         (Dwo_file::read): Add support for v2 package file format.
1146         (Dwo_file::read_unit_index): Likewise.
1147         (Dwo_file::sized_read_unit_index): Likewise.
1148         (Dwo_file::copy_section): Likewise.
1149         (Dwo_file::add_unit_set): Likewise.
1150         (Dwp_output_file::add_output_section): Likewise.
1151         (Dwp_output_file::add_contribution): Likewise.
1152         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1153         for empty slot.
1154         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1155         file format.
1156         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1157         slot.
1158         (Dwp_output_file::initialize): Remove unused function.
1159         (Dwp_output_file::finalize): Add support for v2 package file format.
1160         (Dwp_output_file::write_index): Likewise.
1161         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1162         function prototype.
1163
1164 2013-10-31  Cary Coutant  <ccoutant@google.com>
1165
1166         * configure.ac: Fix check for -fmerge-constants.
1167         * configure.ac: Regenerate.
1168
1169 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1170
1171         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1172         Correct 9-byte nop sequence to match what the assembler generates.
1173
1174 2013-10-30  Alan Modra  <amodra@gmail.com>
1175
1176         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1177         ppc64_local_entry_offset, ppc64_local_entry_offset,
1178         do_read_symbols): New functions.
1179         (Powerpc_relobj::e_flags_, st_other_): New vars.
1180         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1181         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1182         (Powerpc_relobj::e_flags_): New var.
1183         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1184         and adjust for ELFv2.
1185         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1186         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1187         (Powerpc_dynobj::do_find_special_sections): Likewise.
1188         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1189         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1190         to ELFv2 local entry.
1191         (Target_powerpc::do_relax): No thread safe barriers needed for
1192         ELFv2.
1193         (Output_data_plt_powerpc::initial_plt_entry_size_,
1194         plt_entry_size): Delete.  Replace all uses with
1195         first_plt_entry_offset() and plt_entry_size().
1196         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1197         reserved_size parm.  Update callers.
1198         (Output_data_plt_powerpc::entry_count): Update.
1199         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1200         and use Target_powerpc::first_plt_entry_offset().
1201         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1202         rename to plt_entry_size.
1203         (Output_data_plt_powerpc::add_ifunc_entry,
1204         add_local_ifunc_entry): Adjust reloc for ELFv2.
1205         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1206         (glink_eh_frame_fde_64v2): New.
1207         (Stub_table::plt_call_size): Support ELFv2 sizing.
1208         (Output_data_glink::add_eh_frame): Use the new FDE.
1209         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1210         (Stub_table::do_write): Write ELFv2 stubs and glink.
1211         (Target_powerpc::Relocate::relocate): Replaces nop after call
1212         with ld 2,24(1) and adjust local offset destination for ELFv2.
1213
1214 2013-10-30  Alan Modra  <amodra@gmail.com>
1215
1216         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1217         (Target_powerpc::Scan::global, local): Likewise.
1218         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1219         on all ppc64 @h and @ha relocs.
1220
1221 2013-10-14  Alan Modra  <amodra@gmail.com>
1222
1223         * output.h (Output_data_got::add_constant): Tidy.
1224         (Output_data_got::add_constant_pair): New function.
1225         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1226         methods used so as to first call reserve_ent().
1227
1228 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1229
1230         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1231         add_got_entry and add_got_entry_pair.
1232
1233         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1234         (HAVE_PUBNAMES): Likewise.
1235         * configure: Regenerate.
1236
1237         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1238         * testsuite/Makefile.in: Regenerate.
1239
1240         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1241         Remove const from declaration.
1242         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1243         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1244         * output.h (Output_file_header): Remove const from member target_
1245         and corresponding constructor argument.
1246         * output.cc (Output_file_header::Output_file_header): Update prototype.
1247         (Output_file_header::do_sized_write): Use this->target_ in place
1248         of parameters()->target().
1249
1250         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1251
1252         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1253         * configure: Regenerate.
1254         * Makefile.in: Regenerate.
1255         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1256         * testsuite/merge_string_literals_2.c: Likewise.
1257         * testsuite/Makefile.am
1258         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1259         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1260         literal -fmerge-constants.
1261         * testsuite/Makefile.in: Regenerate.
1262
1263         * i386.cc (Target_i386): Remove unused member dynbss_.
1264         * arm.cc (Target_arm): Likewise.
1265         * powerpc.cc (Target_powerpc): Likewise.
1266         * sparc.cc (Target_sparc): Likewise.
1267         * tilegx.cc (Target_tilegx): Likewise.
1268         * x86_64.cc (Target_x86_64): Likewise.
1269         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1270         type_signature_, type_offset_.
1271         * plugin.h (Plugin_hook): Remove unused member layout_.
1272         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1273         mapfile_.
1274         (Read_member): Remove unused members input_objects_, symtab_,
1275         mapfile_, layout_.
1276         (Check_library): Remove unused member symtab_.
1277         * archive.h (Lib_group): Remove unused member lib_.
1278         * archive.cc (Lib_group::Lib_group): Update initializer.
1279         * incremental.h (Incremental_binary): Remove unused member target_.
1280         (Incremental_script_entry): Removed unused member script_.
1281         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1282         * icf.h (Icf): Remove unused member num_tracked_relocs.
1283
1284         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1285         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1286         its only use.
1287         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1288
1289         * archive.h: Use struct rather than class for forward declaration
1290         of Read_symbols_data.
1291
1292 2013-10-07  Cary Coutant  <ccoutant@google.com>
1293
1294         PR gold/16010
1295         * testsuite/Makefile.am (icf_test): Fix dependencies.
1296         (icf_safe_test): Likewise.
1297         (icf_safe_so_test): Likewise.
1298         (large_symbol_alignment): Add empty _LDADD rule.
1299         * testsuite/Makefile.in: Regenerate.
1300
1301 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1302
1303         PR gold/15927
1304         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1305         relocation for R_X86_64_32 on x32.
1306
1307 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1308
1309         * output.cc (Output_segment::set_section_addresses): Take new
1310         Target* argument.  If target->isolate_execinstr() and the segment
1311         is executable and starts at a target->abi_pagesize() boundary,
1312         pad its end out to a target->abi_pagesize() boundary with code fill.
1313         * output.h (Output_segment::set_section_addresses): Update decl.
1314         * layout.h (Layout::check_output_data_for_reset_values): Take new
1315         argument RELAX_OUTPUTS.
1316         (Layout): New member relax_output_list_.
1317         (Layout::add_relax_output): New method.
1318         * layout.cc (Layout::Layout): Update constructor.
1319         (Layout::reset_relax_output): New method.
1320         (Layout::clean_up_after_relaxation): Call it.
1321         (Layout::prepare_for_relaxation): Update caller.
1322         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1323         Call reset_relax_output before re-processing segments for
1324         isolate_execinstr case.
1325         (Layout::write_data): Handle relax_output_list_.
1326         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1327         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1328
1329 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1330
1331         PR binutils/15834
1332         * object.h: Fix typos.
1333
1334 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1335
1336         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1337         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1338
1339 2013-08-07  Cary Coutant  <ccoutant@google.com>
1340
1341         Revert support for v2 DWP files:
1342
1343         2013-03-01  Cary Coutant  <ccoutant@google.com>
1344
1345             Add dwp support for v2 DWARF package file format.
1346             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1347             tu_length parameter.  Adjust all callers.
1348             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1349             * dwp.cc: Include dwarf.h.
1350             (Section_bounds): New struct type.
1351             (Unit_set): New struct type.
1352             (Dwo_file::Dwo_file): Initialize new data member.
1353             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1354             Combine and rename to...
1355             (Dwo_file::read_unit_index): ...this.
1356             (Dwo_file::sized_read_compunit_index)
1357             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1358             (Dwo_file::sized_read_unit_index): ...this.
1359             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1360             parameters; add section_id parameter.
1361             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1362             (Dwo_file::add_unit_set): ...this.
1363             (Dwo_file::shndx_map_): Remove.
1364             (Dwo_file::sect_offsets_): New data member.
1365             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1366             (Dwp_output_file::add_section): Rename to...
1367             (Dwp_output_file::add_contribution): ...this.
1368             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1369             (Dwp_output_file::add_tu_set): Likewise.
1370             (Dwp_output_file::Contribution): New type.
1371             (Dwp_output_file::Section::contributions): New data member.
1372             (Dwp_output_file::Cu_or_tu_set): Remove.
1373             (Dwp_output_file::Section::Section): New ctor.
1374             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1375             (Dwp_output_file::Dwp_index::Section_table): New type.
1376             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1377             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1378             parameter.
1379             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1380             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1381             (Dwp_output_file::Dwp_index::section_table): New member function.
1382             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1383             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1384             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1385             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1386             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1387             (Dwp_output_file::Dwp_index::section_table_): New data member.
1388             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1389             (Dwp_output_file::add_output_section): New member function.
1390             (Dwp_output_file::write_new_section): New member function.
1391             (Dwp_output_file::write_contributions): New member function.
1392             (Dwp_output_file::section_id_map_): New data member.
1393             (class Dwo_id_info_reader): Remove.
1394             (class Unit_reader): New class.
1395             (get_dwarf_section_name): New function.
1396             (Dwo_file::read_executable): Adjust initializations of class data.
1397             (Dwo_file::read): Add support for v2 package file format.
1398             (Dwo_file::read_unit_index): Likewise.
1399             (Dwo_file::sized_read_unit_index): Likewise.
1400             (Dwo_file::copy_section): Likewise.
1401             (Dwo_file::add_unit_set): Likewise.
1402             (Dwp_output_file::add_output_section): Likewise.
1403             (Dwp_output_file::add_contribution): Likewise.
1404             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1405             for empty slot.
1406             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1407             file format.
1408             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1409             slot.
1410             (Dwp_output_file::initialize): Remove unused function.
1411             (Dwp_output_file::finalize): Add support for v2 package file format.
1412             (Dwp_output_file::write_index): Likewise.
1413             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1414             function prototype.
1415
1416 2013-07-31  Cary Coutant  <ccoutant@google.com>
1417
1418         * object.cc (Sized_relobj::do_output_section_address): New function.
1419         (Sized_relobj): Instantiate explicitly.
1420         * object.h (Object::output_section_address): New function.
1421         (Object::do_output_section_address): New function.
1422         (Sized_relobj::do_output_section_address): New function.
1423         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1424
1425 2013-07-30  Cary Coutant  <ccoutant@google.com>
1426             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1427
1428         * parameters.cc (Parameters::entry): Return target-specific entry
1429         symbol name.
1430         * target.h (Target::entry_symbol_name): New function.
1431         (Target_info::entry_symbol_name): New data member.
1432
1433         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1434         * i386.cc (Target_i386::i386_info): Likewise.
1435         (Target_i386_nacl::i386_nacl_info): Likewise.
1436         * sparc.cc (Target_sparc::sparc_info): Likewise.
1437         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1438         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1439         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1440         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1441
1442 2013-07-22  Sterling Augustine  <saugustine@google.com>
1443
1444         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1445         Convert parameter shndx to local variable. Add parameters symtab
1446         and symtab_size.  Scan over section names.  Find relocation
1447         section corresponding to current section.  Create and initialize
1448         reloc_mapper_ and reloc_type_.
1449         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1450         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1451         cu_offset_.
1452         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1453         Initialize new fields unit_length_ and cu_offset_.
1454         (Dwarf_pubnames_table::read_section): Update prototype.
1455         (Dwarf_pubnames_table::cu_offset): New member function.
1456         (Dwarf_pubnames_table::subsection_size): Likewise.
1457         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1458         New fields.
1459         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1460         member functions public.
1461         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1462         Update comment.  Rework logic.  Move repeated parts to...
1463         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1464         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1465         pubtypes_table_, and stmt_list_offset.
1466         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1467         Gdb_index::find_pubtype_offset,
1468         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1469         (Gdb_index::pubnames_read): Update prototype and rework logic.
1470         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1471         Forward declare.
1472         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1473         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1474         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1475         Gdb_index::map_pubtable_to_dies):
1476         Declare functions.
1477         (Gdb_index::pubnames_read): Update declaration.
1478         (Gdb_index::Pubname_offset_map): New type.
1479         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1480         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1481         Gdb_index::stmt_list_offset): Declare.
1482         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1483         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1484         Gdb_index::pubtypes_offset_): Remove.
1485
1486 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1487
1488         * options.h (General_options): Add -Trodata-segment option.
1489         * parameters.cc (Parameters::check_rodata_segment): New function.
1490         (Parameters::set_target_once): Call it.
1491         * parameters.h (Parameters): Declare it (private member function).
1492         * layout.cc (load_seg_unusable_for_headers): New function, broken
1493         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1494         then validate rodata segment rather than text segment.
1495         (relaxation_loop_body): Call that.
1496         (is_text_segment): New function.  Don't admit a non-executable
1497         segment if TARGET->isolate_execinstr().
1498         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1499
1500 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1501
1502         PR gold/15070
1503         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1504         * nacl.h (Sniff_file::View::View): Request aligned view.
1505
1506 2013-07-11  Cary Coutant  <ccoutant@google.com>
1507
1508         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1509         correct BRLT entry size.
1510
1511 2013-07-03  Alan Modra  <amodra@gmail.com>
1512
1513         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1514         comment.
1515
1516 2013-07-01  Cary Coutant  <ccoutant@google.com>
1517
1518         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1519         reloc_type_.
1520         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1521         (Dwarf_ranges_table::lookup_reloc): New function.
1522         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1523         reloc_type_.
1524         (Dwarf_ranges_table::lookup_reloc): New function.
1525         (Dwarf_ranges_table::reloc_type_): New data member.
1526
1527 2013-06-27  Jing Yu  <jingyu@google.com>
1528
1529         PR gold/15662
1530         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1531         function.
1532         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1533         (Target_powerpc::do_relax): Call the above.
1534
1535 2013-06-27  Cary Coutant  <ccoutant@google.com>
1536
1537         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1538         on garbage collected .opd section.
1539
1540 2013-06-27  Alan Modra  <amodra@gmail.com>
1541
1542         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1543         is non-zero.
1544         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1545         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1546
1547 2013-06-14  Cary Coutant  <ccoutant@google.com>
1548
1549         * resolve.cc (Symbol::override_base): Don't override st_type
1550         from plugin placeholder symbols.
1551         (Symbol_table::resolve): Likewise.
1552         (Symbol_table::should_override): Don't complain about TLS mismatch
1553         if the TO symbol is a plugin placeholder.
1554         * testsuite/Makefile.am (plugin_test_tls): New test.
1555         * testsuite/Makefile.in: Regenerate.
1556         * testsuite/plugin_test_tls.sh: New test script.
1557         * testsuite/two_file_test_2_tls.cc: New test source.
1558         * testsuite/two_file_test_tls.cc: New test source.
1559
1560 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1561
1562         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1563         the maximum segment alignment is larger than the page size.
1564         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1565         correctly aligns the symbols with large alignemnt.
1566         * testsuite/Makefile.in: Regenerate.
1567         * testsuite/large_symbol_alignment.cc: New file.
1568
1569 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1570             Sriraman Tallam  <tmsriram@google.com>
1571
1572         * options.h (sort_section): New option.
1573         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1574         Rename from Input_section_sort_section_name_special_ordering_compare.
1575         (Input_section_sort_section_name_compare): New struct.
1576         * output.cc (Output_section::Input_section_sort_section_name_compare::
1577         operator()): New function.
1578         (Output_section::sort_attached_input_sections): Use new sort function
1579         for .text if --sort-section=name is specified.
1580         * layout.cc (Layout::make_output_section):
1581         Add sorting by name when --sort-section=name is specified.
1582         * testsuite/Makefile.am (text_section_grouping): Test option
1583         --sort-section=name.
1584         * testsuite/Makefile.in: Regenerate.
1585         * testsuite/section_sorting_name.cc: New file.
1586         * testsuite/section_sorting_name.sh: New file.
1587
1588 2013-05-21  Cary Coutant  <ccoutant@google.com>
1589
1590         * symtab.h (Symbol::is_cxx_vtable): New function.
1591         * target-reloc.h (relocate_section): Check for vtable symbol.
1592         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1593         * testsuite/Makefile.in: Regenerate.
1594         * testsuite/missing_key_func.cc: New test source.
1595         * testsuite/missing_key_func.sh: New test script.
1596
1597 2013-05-21  Cary Coutant  <ccoutant@google.com>
1598
1599         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1600         type of enclosing symbol.
1601         (Relocate_info::location): Check symbol type when describing symbol.
1602         * object.h (Symbol_location_info): Remove unused line_number;
1603         add enclosing_symbol_type.
1604         * testsuite/debug_msg.sh: Adjust expected output.
1605
1606 2013-05-13  Cary Coutant  <ccoutant@google.com>
1607
1608         * configure.ac: Export DEFAULT_TARGET.
1609         * configure: Regenerate.
1610         * Makefile.in: Regenerate.
1611         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1612         * testsuite/Makefile.in: Regenerate.
1613         * testsuite/debug_msg.sh: Delete duplicate tests.
1614         Don't check undef_int error message match for powerpc where the
1615         source file and line number aren't available.
1616
1617 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1618
1619         * options.h (General_options): Add --rosegment-gap option.
1620         * options.cc (finalize): --rosegment-gap implies --rosegment.
1621         * layout.cc (set_segment_offsets): Let user option override
1622         target->rosegment_gap().
1623
1624 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1625
1626         * options.h (General_options): Remove leading space from help
1627         messages for -nostdlib and --rosegment.
1628
1629 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1630
1631         PR ld/15365
1632         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1633
1634 2013-05-03  Alan Modra  <amodra@gmail.com>
1635
1636         * merge.cc (Output_merge_string::do_add_input_section): Correct
1637         scan for number of strings.  Rename vars to avoid shadowing.
1638         Include missing terminator in input_size_.
1639
1640 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1641
1642         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1643         Restore empty string handling.
1644
1645 2013-05-01  Cary Coutant  <ccoutant@google.com>
1646
1647         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1648         uninitialized warning.
1649
1650 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1651
1652         * output.cc (Output_section::add_merge_input_section): Allow
1653         to merge sections if the alignment is more than character size.
1654         * merge.h (Output_merge_string::Output_merge_string): Remove
1655         assert.
1656         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1657         only not-null strings. Check the alignment of strings.
1658         * stringpool.h
1659         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1660         alignment as the argument.
1661         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1662         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1663         Align non-zero length strings according to the addralign_.
1664         (Stringpool_template<Stringpool_char>::set_string_offsets):
1665         Updating offsets according to the given alignment.
1666         * testsuite/Makefile.am (text_section_grouping): Test if string
1667         literals are getting merged.
1668         * testsuite/Makefile.in: Regenerate.
1669         * testsuite/merge_string_literals_1.c: New file.
1670         * testsuite/merge_string_literals_2.c: Ditto.
1671         * testsuite/merge_string_literals.sh: Ditto.
1672
1673 2013-04-26  Ian Lance Taylor  <iant@google.com>
1674
1675         * target-reloc.h (relocate_section): If the reloc offset is out of
1676         range, pass VIEW as NULL to relocate.relocate.
1677         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1678         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1679         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1680         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1681         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1682         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1683
1684 2013-04-26  Geoff Pike  <gpike@chromium.org>
1685
1686         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1687         * layout.cc (Hash_task): New class.
1688         (Layout::queue_build_id_tasks): New function.
1689         (Layout::write_build_id): Handle single-thread portion of build ID
1690         computation.  (In some cases, all of it is single-threaded.)  Replace
1691         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1692         functionality in fewer lines of code.
1693         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1694         * options.h (General_options): make "--build-id" default to tree
1695         rather than sha1.  Add two new options related to --build-id=tree:
1696         --build-id-chunk-size-for-treehash and
1697         --build-id-min-file-size-for-treehash.
1698         * Makefile.am: add testing of --build-id=tree and related new options
1699         (these tests will be invoked by "make check").
1700         * Makefile.in: Regenerate.
1701
1702 2013-04-25  Alan Modra  <amodra@gmail.com>
1703
1704         * configure.tgt: Add powerpcle and powerpc64le.
1705
1706 2013-04-22  Alan Modra  <amodra@gmail.com>
1707
1708         PR gold/15355
1709         * layout.cc (Layout::segment_precedes): Allow more than one
1710         segment with the same type and flags.
1711
1712 2013-04-15  Cary Coutant  <ccoutant@google.com>
1713
1714         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1715         allocate space in file for BSS sections.
1716
1717 2013-04-15  Cary Coutant  <ccoutant@google.com>
1718
1719         * script-sections.cc (Orphan_output_section): Reset address
1720         to zero after each orphaned section for relocatable links.
1721
1722 2013-04-15  Cary Coutant  <ccoutant@google.com>
1723
1724         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1725         section starting address for relocatable link.
1726         * testsuite/Makefile.am (script_test_11): New test.
1727         * testsuite/Makefile.in: Regenerate.
1728         * testsuite/script_test_11.c: New source file.
1729         * testsuite/script_test_11.t: New linker script.
1730
1731 2013-04-13  Alan Modra  <amodra@gmail.com>
1732
1733         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1734         owner when sections are not adjacent and exceed group size.
1735         (Target_powerpc::group_sections): Handle corner case.
1736         (Target_powerpc::Branch_info::make_stub): Handle case where
1737         stub table doesn't exist due to branches in non-exec sections.
1738         (Target_powerpc::Relocate::relocate): Likewise.
1739
1740 2013-04-11  Alan Modra  <amodra@gmail.com>
1741
1742         PR gold/15354
1743         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1744         .branch_lt to match bfd ld.  Adjust comments throughout file.
1745
1746 2013-04-04  Ian Lance Taylor  <iant@google.com>
1747
1748         GCC PR c++/56840
1749         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1750         sections before checking whether they are included in the link.
1751
1752 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1753
1754         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1755         object before calling the plugin claim_file handler.  Pass the elf
1756         object of the archive to the plugin. Delete the elf object if the
1757         plugin claims the file.
1758
1759 2013-03-21  Alan Modra  <amodra@gmail.com>
1760
1761         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1762         segment when omagic.
1763
1764 2013-03-21  Alan Modra  <amodra@gmail.com>
1765
1766         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1767         comparison warning.
1768         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1769         uninitialized" warning.
1770
1771 2013-03-20  Alan Modra  <amodra@gmail.com>
1772
1773         * symtab.h (Symbol::clear_version): New function.
1774         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1775         is_needed by weak references.  Clear version for symbols defined
1776         in as-needed objects that are not needed.
1777
1778 2013-03-15  Alan Modra  <amodra@gmail.com>
1779
1780         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1781         static and public.  Add report_err param.  Return false for data refs.
1782         (Target_powerpc::rela_dyn_section): New overloaded function.
1783         (Target_powerpc::plt_, iplt_): Elucidate.
1784         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1785         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1786         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1787         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1788         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1789         push_branch and make_plt_entry for ifunc syms when
1790         reloc_needs_plt_for_ifunc.
1791         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1792         for ifunc unless reloc_needs_plt_for_ifunc.
1793
1794 2013-03-15  Alan Modra  <amodra@gmail.com>
1795
1796         * gc.h (gc_process_relocs): Don't look through function descriptors.
1797         * icf.cc (get_section_contents): Do so here instead.
1798
1799 2013-03-13  Alan Modra  <amodra@gmail.com>
1800
1801         * powerpc.cc (is_branch_reloc): Forward declare.
1802         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1803         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1804         false for 64-bit, true for 32-bit non-branch relocs.
1805         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1806         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1807         nm output.
1808         (icf_safe_test): Generate linker map file as well as nm output.
1809         (icf_safe_so_test): Likewise.
1810         * testsuite/Makefile.in: Regenerate.
1811         * testsuite/icf_test.sh: Parse linker map file to determine
1812         section folding.
1813         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1814         * testsuite/icf_safe_so_test.sh: Likewise.
1815         (X86_32_or_ARM_specific_safe_fold): Merge into..
1816         (arch_specific_safe_fold): ..this.
1817         (X86_64_specific_safe_fold): Delete unused function.
1818
1819 2013-03-12  Alan Modra  <amodra@gmail.com>
1820
1821         * gc.h (gc_process_relocs): Look through function descriptors
1822         to determine shndx, symvalue and addend used by ICF.  Tidy
1823         variable duplication.
1824
1825 2013-03-11  Alan Modra  <amodra@gmail.com>
1826
1827         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1828         * layout.cc (Layout_task_runner::run): ..to here.
1829         * symtab.h (struct Symbol_location): Extract from..
1830         (class Symbol_table): ..here.
1831         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1832         * target.h (class Target): Add function_location and
1833         do_function_location functions.
1834         (class Sized_target): Add do_function_location.
1835         * object.h (class Sized_relobj_file): Move find_shdr..
1836         (class Object): ..to here.
1837         * object.cc: Likewise.  Update to suit.  Instantiate.
1838         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1839         * powerpc.cc (class Powerpc_dynobj): New.
1840         (Target_powerpc::do_function_location): New function.
1841         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1842         (Powerpc_dynobj::do_read_symbols): New function.
1843         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1844
1845 2013-03-08  Ian Lance Taylor  <iant@google.com>
1846
1847         * options.cc (General_options::string_to_object_format): Accept
1848         "default".
1849
1850 2013-03-08  Alan Modra  <amodra@gmail.com>
1851
1852         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1853         pointer to Post_fde.
1854         (struct Post_fde): Move definition to here..
1855         * ehframe.cc (struct Post_fde): ..from here.
1856         (Cie::write): Don't alloc Post_fde.
1857         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1858
1859 2013-03-07  Alan Modra  <amodra@gmail.com>
1860
1861         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1862         relocation referencing .LC0.
1863         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1864
1865 2013-03-07  Alan Modra  <amodra@gmail.com>
1866
1867         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1868         always_inline.  Add assembly for powerpc to avoid GOT.
1869
1870 2013-03-07  Alan Modra  <amodra@gmail.com>
1871
1872         * testsuite/script_test_10.sh: Don't test .bss section
1873         header number.
1874
1875 2013-03-06  Alan Modra  <amodra@gmail.com>
1876
1877         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1878         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1879         all callers.  Handle folded sections.
1880         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1881         to Powerpc_relobj.
1882         (Global_symbol_visitor_opd::operator()): Likewise.
1883
1884 2013-03-04  Alan Modra  <amodra@gmail.com>
1885
1886         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1887         * testsuite/Makefile.in: Regenerate.
1888
1889 2013-03-01  Cary Coutant  <ccoutant@google.com>
1890
1891         Add dwp support for v2 DWARF package file format.
1892         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1893         tu_length parameter.  Adjust all callers.
1894         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1895         * dwp.cc: Include dwarf.h.
1896         (Section_bounds): New struct type.
1897         (Unit_set): New struct type.
1898         (Dwo_file::Dwo_file): Initialize new data member.
1899         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1900         Combine and rename to...
1901         (Dwo_file::read_unit_index): ...this.
1902         (Dwo_file::sized_read_compunit_index)
1903         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1904         (Dwo_file::sized_read_unit_index): ...this.
1905         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1906         parameters; add section_id parameter.
1907         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1908         (Dwo_file::add_unit_set): ...this.
1909         (Dwo_file::shndx_map_): Remove.
1910         (Dwo_file::sect_offsets_): New data member.
1911         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1912         (Dwp_output_file::add_section): Rename to...
1913         (Dwp_output_file::add_contribution): ...this.
1914         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1915         (Dwp_output_file::add_tu_set): Likewise.
1916         (Dwp_output_file::Contribution): New type.
1917         (Dwp_output_file::Section::contributions): New data member.
1918         (Dwp_output_file::Cu_or_tu_set): Remove.
1919         (Dwp_output_file::Section::Section): New ctor.
1920         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1921         (Dwp_output_file::Dwp_index::Section_table): New type.
1922         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1923         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1924         parameter.
1925         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1926         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1927         (Dwp_output_file::Dwp_index::section_table): New member function.
1928         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1929         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1930         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1931         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1932         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1933         (Dwp_output_file::Dwp_index::section_table_): New data member.
1934         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1935         (Dwp_output_file::add_output_section): New member function.
1936         (Dwp_output_file::write_new_section): New member function.
1937         (Dwp_output_file::write_contributions): New member function.
1938         (Dwp_output_file::section_id_map_): New data member.
1939         (class Dwo_id_info_reader): Remove.
1940         (class Unit_reader): New class.
1941         (get_dwarf_section_name): New function.
1942         (Dwo_file::read_executable): Adjust initializations of class data.
1943         (Dwo_file::read): Add support for v2 package file format.
1944         (Dwo_file::read_unit_index): Likewise.
1945         (Dwo_file::sized_read_unit_index): Likewise.
1946         (Dwo_file::copy_section): Likewise.
1947         (Dwo_file::add_unit_set): Likewise.
1948         (Dwp_output_file::add_output_section): Likewise.
1949         (Dwp_output_file::add_contribution): Likewise.
1950         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1951         for empty slot.
1952         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1953         file format.
1954         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1955         slot.
1956         (Dwp_output_file::initialize): Remove unused function.
1957         (Dwp_output_file::finalize): Add support for v2 package file format.
1958         (Dwp_output_file::write_index): Likewise.
1959         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1960         function prototype.
1961
1962 2013-03-01  Cary Coutant  <ccoutant@google.com>
1963
1964         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1965         function into class definition in header file.
1966         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1967         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1968         New function.
1969         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1970
1971 2013-02-28  Alan Modra  <amodra@gmail.com>
1972
1973         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1974         * target.cc (Target::do_plt_fde_location): New function.
1975         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1976         accessor function, and constructor param.
1977         (struct Post_fde, Post_fdes): Declare.
1978         (Cie::write): Add post_fdes param.
1979         * ehframe.cc (Fde::write): Use plt_fde_location.
1980         (struct Post_fde): Define.
1981         (Cie::write): Stash FDEs added post merge mapping.
1982         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1983         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1984         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1985         other FDEs.
1986         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1987         (Target_powerpc::has_glink): New function.
1988         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1989         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1990         glink_eh_frame_fde_32, default_fde): New data.
1991         (Stub_table::eh_frame_added_): New var.
1992         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1993         Make const.
1994         (Stub_table::add_eh_frame): New function.
1995         (Output_data_glink::add_eh_frame): New function.
1996         (Target_powerpc::make_glink_section): Call add_eh_frame.
1997
1998 2013-02-15  Ian Lance Taylor  <iant@google.com>
1999
2000         * options.h (DEFINE_uint64_alias): Define.
2001         (class General_options): Add -Ttext-segment as an alias for
2002         -Ttext.
2003
2004 2013-02-15  Alan Modra  <amodra@gmail.com>
2005
2006         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2007         (Stub_table::do_write): ..here, two places.
2008         (Stub_table::plt_call_size): Use it here too.
2009
2010 2013-02-11  Ian Lance Taylor  <iant@google.com>
2011
2012         * descriptors.cc (Descriptors::close_all): New function.
2013         * descriptors.h (class Descriptors): Declare close_all.
2014         (close_all_descriptors): New inline function.
2015         * plugin.cc: Include "descriptors.h".
2016         (Plugin_manager::cleanup): Call close_all_descriptors.
2017
2018 2013-02-06  Alan Modra  <amodra@gmail.com>
2019
2020         * README: Update coding style link.
2021
2022 2013-01-28  Cary Coutant  <ccoutant@google.com>
2023
2024         * dwp.cc (File_list): New typedef.
2025         (Dwo_name_info_reader): New class.
2026         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2027         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2028         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2029         (Dwo_file::read_executable): New function.
2030         (Dwo_file::read): Move common setup code to ...
2031         (Dwo_file::make_object): ... here.
2032         (dwp_options): Add --exec/-e.
2033         (usage): Likewise.
2034         (main): Likewise.
2035
2036 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2037
2038         * layout.cc (Layout::layout): Check for option text_reorder.
2039         (Layout::make_output_section): Ditto.
2040         * options.h (text_reorder): New option.
2041         * output.cc (Input_section_sort_compare): Remove special ordering
2042         of section names.
2043         (Output_section::
2044          Input_section_sort_section_name_special_ordering_compare::
2045          operator()): New function.
2046         (Output_section::sort_attached_input_sections): Use new sort function
2047         for .text.
2048         * output.h (Input_section_sort_section_name_special_ordering_compare):
2049         New struct.
2050         * testsuite/Makefile.am (text_section_grouping): Test option
2051         --no-text-reorder
2052         * testsuite/Makefile.in: Regenerate.
2053         * testsuite/text_section_grouping.sh: Check order of functions without
2054         default text reordering.
2055
2056 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2057
2058         * options.h (General_options): Change default to true for new_dtags.
2059
2060 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2061
2062         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2063         when enable_new_dtags is false.  Only add DT_RUNPATH when
2064         enable_new_dtags is true.
2065
2066 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2067
2068         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2069         used in declaration and definition consistent.
2070         (Target_powerpc::symval_for_branch): Ditto.
2071
2072 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2073
2074         * testsuite/plugin_final_layout.cc: Fix comment.
2075
2076 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2077
2078         * layout.cc (Layout::layout): Do not do default sorting for
2079         text sections when section ordering is specified.
2080         (make_output_section): Ditto.
2081         * testsuite/plugin_final_layout.cc: Name the function sections
2082         to catch reordering issues.
2083
2084 2013-01-15  Alan Modra  <amodra@gmail.com>
2085
2086         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2087         plt-thread-safe.
2088
2089 2013-01-15  Alan Modra  <amodra@gmail.com>
2090
2091         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2092         * testsuite/Makefile.in: Regenerate.
2093
2094 2013-01-14  Alan Modra  <amodra@gmail.com>
2095
2096         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2097         * testsuite/Makefile.in: Regenerate.
2098
2099 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2100
2101         PR bfd/14430
2102         Fix mingw gold build with plugins enabled
2103         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2104         * configure.ac: Export DLOPEN_LIBS and add headers check.
2105         * plugin.cc: Handle non-dlfcn case.
2106         * Makefile.in: Regenerate.
2107         * config.in: Regenerate.
2108         * configure: Regenerate.
2109         * testsuite/Makefile.in: Regenerate.
2110
2111 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2112
2113         * output.h (sort_attached_input_sections): Change to be public.
2114         * script-sections.cc
2115         (Output_section_definition::set_section_addresses): Sort
2116         attached input sections according to section order before linker
2117         script assigns section addresses.
2118         (Orphan_output_section::set_section_addresses): Sort
2119         attached input sections according to section order before linker
2120         script assigns section addresses.
2121         * Makefile.am (final_layout.sh): Use a simple linker script to
2122         check if section ordering still works.
2123         * Makefile.in: Regenerate.
2124
2125 2013-01-09  Ben Cheng  <bccheng@google.com>
2126
2127         * arm.cc (Target_arm::attributes_accept_div): New function.
2128         (Target_arm::attributes_forbid_div): New function.
2129         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2130         attribute using the same new functions as what bfd/elf32_arm.c
2131         does.
2132
2133 2013-01-07  Cary Coutant  <ccoutant@google.com>
2134
2135         PR gold/14993
2136         * output.cc (Output_section::add_input_section): For incremental
2137         updates, don't track input sections that are allocated from patch
2138         space.
2139
2140 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2141             Ian Lance Taylor  <iant@google.com>
2142
2143         PR gold/14897
2144         * configure.ac (--enable-ld): Removed.
2145         (install_as_default): Set to yes only for --enable-gold=default
2146         or --disable-ld.
2147         * configure: Regenerated.
2148
2149 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2150
2151         * options.h (General_options): Add -fuse-ld= for GCC linker
2152         option compatibility.
2153
2154 2013-01-04  Cary Coutant  <ccoutant@google.com>
2155
2156         * configure.ac: Fix typo restoring CXXFLAGS.
2157         * configure: Regenerate.
2158
2159 2013-01-04  Cary Coutant  <ccoutant@google.com>
2160
2161         * testsuite/Makefile.am (CXXLINK_S): New macro.
2162         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2163         * testsuite/Makefile.in: Regenerate.
2164
2165 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2166
2167         * version.cc (print_version): Update copyright year to 2013.
2168
2169 2012-12-20  Ian Lance Taylor  <iant@google.com>
2170
2171         * layout.cc (Layout::special_ordering_of_input_section): New
2172         function.
2173         (Layout::layout): If input section requires special ordering, must
2174         sort input sections.
2175         (Layout::make_output_section): May sort .text input sections.
2176         (Layout::is_section_name_prefix_grouped): Remove.
2177         * layout.h (class Layout): Declare
2178         special_ordering_of_input_section.  Don't declare
2179         is_section_name_prefix_grouped.
2180         * output.cc (Output_section::add_input_section): Revert last
2181         change.
2182         (Output_section::Input_section_sort::match_file_name): Don't crash
2183         if called on output section data.
2184         (Output_section::Input_section_sort_compare): Sort based on
2185         special ordering.
2186         (Output_section::Input_section_sort_section_order_index_compare):
2187         Revert last patch.
2188         (Output_section::sort_attached_input_sections): Likewise.
2189
2190 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2191
2192         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2193         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2194         * output.cc (Output_section::add_input_section): Check if section
2195         name contains special prefix.  Keep input sections to sort such
2196         sections.
2197         (Output_section::Input_section_sort_section_order_index_compare
2198          ::operator()): Group sections according to prefixes.
2199         (Output_section::sort_attached_input_sections): Add condition to
2200         Input_section_entry constructor call.
2201         * testsuite/Makefile.am (text_section_grouping): New test.
2202         * testsuite/Makefile.in: Regenerate.
2203         * testsuite/text_section_grouping.cc: New file.
2204         * testsuite/text_section_grouping.sh: New file.
2205
2206 2012-12-17  Nick Clifton  <nickc@redhat.com>
2207
2208         * Makefile.am: Add copyright notice.
2209         * NEWS: Likewise.
2210         * README: Likewise.
2211         * configure.ac: Likewise.
2212         * ftruncate.c: Likewise.
2213         * Makefile.in: Regenerate.
2214
2215 2012-12-14  Cary Coutant  <ccoutant@google.com>
2216
2217         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2218         --no-as-needed flag.
2219         (exception_separate_shared_12_test): Likewise.
2220         (incremental_copy_test): Likewise.
2221         * testsuite/Makefile.in: Regenerate.
2222
2223 2012-12-14  Cary Coutant  <ccoutant@google.com>
2224
2225         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2226         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2227
2228 2012-12-12  Alan Modra  <amodra@gmail.com>
2229
2230         * powerpc.cc (class Track_tls): New.
2231         (class Relocate, class Scan): Inherit Track_tls.
2232         (Target_powerpc::Scan::local, global): Track tls optimization
2233         and avoid creating plt entry for __tls_get_addr if all uses
2234         are optimized away.
2235         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2236
2237 2012-12-12  Alan Modra  <amodra@gmail.com>
2238
2239         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2240         Replace no_toc_optimize with toc_optimize.
2241         * output.h (Output_section::input_sections): Provide non-const variant.
2242         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2243         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2244         accessors.
2245         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2246         (class Sort_toc_sections): New.
2247         (Target_powerpc::do_finalize_sections): Sort toc sections.
2248         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2249
2250 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2251
2252         * testsuite/binary_unittest.cc (read_all): New function.
2253         (Sized_binary_test): Use it instead of ::read.
2254         * fileread.cc (do_read): Don't assume pread always reads the whole
2255         amount in a single call.
2256
2257 2012-12-10  Alan Modra  <amodra@gmail.com>
2258
2259         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2260         Set EM_PPC64 or EM_PPC here.
2261         (Target_selector_powerpc::do_recognize): Delete.
2262
2263 2012-12-10  Alan Modra  <amodra@gmail.com>
2264
2265         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2266         stub_table_.
2267         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2268
2269 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2270
2271         * testsuite/binary_unittest.cc (Sized_binary_test):
2272         Use open_descriptor rather than ::open.
2273
2274 2012-12-07  Alan Modra  <amodra@gmail.com>
2275
2276         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2277         typedef and invalid_address constant.
2278         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2279         instantiate constants.
2280
2281 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2282
2283         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2284         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2285         * aclocal.m4: Regenerate.
2286         * configure: Regenerate.
2287         * Makefile.in: Regenerate.
2288         * testsuite/Makefile.in: Regenerate.
2289
2290 2012-12-07  Alan Modra  <amodra@gmail.com>
2291
2292         * options.h (General_options): Add no_toc_optimize.
2293         * powerpc.cc (ok_lo_toc_insn): New function.
2294         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2295
2296 2012-12-06  Alan Modra  <amodra@gmail.com>
2297
2298         * options.h (General_options): Add plt_align, plt_static_chain,
2299         plt_thread_safe.  Update stub_group_size help text.
2300         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2301         for new plt_thread_safe_ var.
2302         (use_plt_offset): Correct comments.
2303         (Target_powerpc::do_relax): Look for thread creation symbols to
2304         determine default plt_thread_safe value.  Clear plt call stubs
2305         as well as branch stubs each iteration.
2306         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2307         insn constants.
2308         (l, hi, ha, write_insn): Move earlier.
2309         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2310         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2311         plt stubs too.
2312         (Stub_table::update_size): Adjust.
2313         (Stub_table::prev_size, set_prev_size): Delete.
2314         (Stub_table::stub_align): Let --plt-align affect result.
2315         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2316         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2317         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2318         (Stub_table::do_write): Support more stub variants.
2319
2320 2012-12-04  Alan Modra  <amodra@gmail.com>
2321
2322         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2323         (Target_powerpc::do_define_standard_symbols): New function.
2324
2325 2012-12-03  Alan Modra  <amodra@gmail.com>
2326
2327         * output.h: Formatting, whitespace.
2328
2329 2012-12-03  Alan Modra  <amodra@gmail.com>
2330
2331         * layout.h (Layout::get_executable_sections): Declare.
2332         * layout.cc (Layout::get_executable_sections): New function.
2333         * arm.cc (Target_arm::group_sections): Use it.
2334         (Arm_output_section::group_sections): Delete now redundant test.
2335         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2336         param to handle relative relocs.
2337         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2338         (Output_data_reloc::add_absolute): Adjust.
2339         (Output_data_reloc::add_relative): New function.
2340         (Output_data::reset_data_size): New function.
2341         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2342         (Output_section::set_addralign): New function.
2343         (Output_section::checkpoint_set_addralign): New function.
2344         (Output_section::clear_section_offsets_need_adjustment): New function.
2345         (Output_section::input_sections): Make public.
2346         * powerpc.cc (class Output_data_brlt_powerpc): New.
2347         (class Stub_table, class Stub_control): New.
2348         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2349         stub_table_, set_stub_table, stub_table): New vectors and accessor
2350         functions.
2351         (Target_powerpc::do_may_relax, do_relax, push_branch,
2352         new_stub_table, stub_tables, brlt_section, group_sections,
2353         add_branch_lookup_table, find_branch_lookup_table,
2354         write_branch_lookup_table, make_brlt_section): New functions.
2355         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2356         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2357         branch_info_): New vars.
2358         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2359         make call stubs here.
2360         (Output_data_glink): Remove all call stub handling from this class.
2361         (Target_powerpc::Scan::local, global): Save interesting branch
2362         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2363         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2364         functions on final link.
2365         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2366         Handle long branch destinations too.
2367         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2368         do_plt_address_for_local): Adjust lookup of plt call stubs.
2369
2370 2012-11-30  Alan Modra  <amodra@gmail.com>
2371
2372         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2373         relocs against protected symbols when building 32-bit shared libs.
2374
2375 2012-11-30  Alan Modra  <amodra@gmail.com>
2376
2377         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2378         param.  Call got_section() to make .got.  Update all callers
2379         and their callers and so on.
2380
2381 2012-11-30  Alan Modra  <amodra@gmail.com>
2382
2383         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2384         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2385         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2386         value if it already exists.
2387
2388 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2389
2390         PR gold/14858
2391         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2392
2393 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2394
2395         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2396         than bfc instruction for data sandboxing.
2397
2398 2012-11-08  Alan Modra  <amodra@gmail.com>
2399
2400         * po/POTFILES.in: Regenerate.
2401
2402 2012-11-05  Alan Modra  <amodra@gmail.com>
2403
2404         * configure.ac: Apply 2012-09-10 change to config.in here.
2405         * configure: Regenerate.
2406
2407 2012-11-05  Alan Modra  <amodra@gmail.com>
2408
2409         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2410         (struct Opd_ent): Use "Address" rather than "Offset".
2411         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2412         (Target_powerpc::got_section): Make public.
2413         (Target_powerpc::scan_relocs): Move code setting symbols..
2414         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2415         Create _SDA_BASE_ only when referenced.
2416
2417 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2418
2419         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2420         from last change.
2421
2422 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2423
2424         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2425         for offset_in_output_section parameter.
2426         (Sized_target::relocate_special_relocatable): Likewise.
2427         * arm.cc (Target_arm::relocate_relocs): Likewise.
2428         (Target_arm::relocate_special_relocatable): Likewise.
2429         * i386.cc (Target_i386::relocate_relocs): Likewise.
2430         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2431         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2432         * target-reloc.h (relocate_relocs): Likewise.
2433         * testsuite/testfile.cc (Target_test): Likewise.
2434         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2435         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2436
2437         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2438         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2439
2440         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2441         parameter, which is unused in the [!F_SETFD] case.
2442
2443         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2444         SYMNDX to off_t before comparing it to this->data_size().
2445         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2446         * incremental.cc (Output_section_incremental_inputs::do_write):
2447         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2448
2449         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2450
2451 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2452
2453         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2454         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2455         in EABI_VER5.
2456
2457 2012-10-29  Cary Coutant  <ccoutant@google.com>
2458
2459         * dwp.cc (usage): Add file and exit status parameters;
2460         add --help and --version options.
2461         (print_version): New function.
2462         (main): Add --help and --version options.
2463
2464 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2465
2466         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2467         final_layout_sequence.txt.
2468         * testsuite/Makefile.in: Regenerated.
2469
2470 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2471
2472         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2473         COMPILE generated by automake.
2474         (LINK1): Likewise.
2475         (CXXCOMPILE1): Likewise.
2476         (CXXLINK1): Likewise.
2477         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2478         (LINK): Likewise.
2479         (CXXCOMPILE): Likewise.
2480         (CXXLINK): Likewise.
2481         * testsuite/Makefile.in: Regenerated.
2482
2483 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2484
2485         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2486         on bad fwrite return.
2487
2488 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2489
2490         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2491         on val.
2492
2493 2012-10-23  Cary Coutant  <ccoutant@google.com>
2494
2495         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2496         * testsuite/Makefile.in: Regenerate.
2497         * testsuite/dwp_test.h: New source file.
2498         * testsuite/dwp_test_1.cc: New source file.
2499         * testsuite/dwp_test_1.s: New source file.
2500         * testsuite/dwp_test_1.sh: New source file.
2501         * testsuite/dwp_test_1b.cc: New source file.
2502         * testsuite/dwp_test_1b.s: New source file.
2503         * testsuite/dwp_test_2.cc: New source file.
2504         * testsuite/dwp_test_2.s: New source file.
2505         * testsuite/dwp_test_2.sh: New source file.
2506         * testsuite/dwp_test_main.cc: New source file.
2507         * testsuite/dwp_test_main.s: New source file.
2508
2509 2012-10-23  Cary Coutant  <ccoutant@google.com>
2510
2511         * dwp.h: New header file.
2512         * dwp.cc: New source file.
2513         * gold.h: Move shared declarations to system.h.
2514         * system.h: New header file.
2515         * Makefile.am: Add dwp.
2516         * Makefile.in: Regenerate.
2517
2518 2012-10-23  Cary Coutant  <ccoutant@google.com>
2519
2520         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2521         Dwarf_info_reader::read_from_pointer.
2522         (Dwarf_pubnames_table::read_header): Likewise.
2523         (Dwarf_pubnames_table::next_name): Likewise.
2524         (Dwarf_die::read_attributes): Likewise.
2525         (Dwarf_die::skip_attributes): Likewise.
2526         (Dwarf_info_reader::read_from_pointer): New function template.
2527         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2528         (Dwarf_pubnames_table): Likewise.
2529         (Dwarf_info_reader::read_from_pointer): New function template.
2530         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2531         Dwarf_pubnames_table ctor.
2532
2533 2012-10-23  Cary Coutant  <ccoutant@google.com>
2534
2535         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2536         abbrev_shndx.
2537         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2538         abbrev_shndx_.
2539         (Dwarf_info_reader::set_abbrev_shndx): New method.
2540         (Dwarf_info_reader::abbrev_shndx_): New data member.
2541
2542 2012-10-23  Cary Coutant  <ccoutant@google.com>
2543
2544         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2545         from object, not parameters.
2546         (Dwarf_info_reader::parse): Likewise.
2547         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2548         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2549         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2550         methods.
2551
2552 2012-10-23  Cary Coutant  <ccoutant@google.com>
2553
2554         * fileread.cc (Input_file::Input_file): New constructor.
2555         * fileread.h (class Input_file): Add new constructor.
2556
2557 2012-10-18  Alan Modra  <amodra@gmail.com>
2558
2559         PR gold/14727
2560         * object.cc (Relobj::is_section_name_included): Also match
2561         .sdata personality section.
2562
2563 2012-10-18  Alan Modra  <amodra@gmail.com>
2564
2565         * target-reloc.h (class Default_comdat_behavior): New, package up..
2566         (get_comdat_behaviour): ..this.
2567         (relocate_section): Add Relocate_comdat_behavior template arg,
2568         adjust code to suit.
2569         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2570         (Target_arm::scan_reloc_section): Likewise.
2571         * i386.cc (Target_i386::relocate_section): Likewise.
2572         * sparc.cc (Target_sparc::relocate_section): Likewise.
2573         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2574         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2575         * powerpc.cc (class Relocate_comdat_behavior): New.
2576         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2577         gold::relocate_section with new template arg.
2578
2579 2012-10-18  Alan Modra  <amodra@gmail.com>
2580
2581         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2582         dynamic relocs for GOT_TPREL got entries, without symbol if
2583         resolving locally.
2584         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2585         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2586         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2587
2588 2012-10-17  Alan Modra  <amodra@gmail.com>
2589
2590         PR gold/14726
2591         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2592
2593 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2594
2595         * layout.cc (Layout::include_section): Keep sections marked
2596         SHF_EXCLUDE when doing relocatable links.
2597
2598 2012-10-16  Alan Modra  <amodra@gmail.com>
2599
2600         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2601         (Target_powerpc::do_finalize_sections): Call it.
2602         (Output_data_save_res): New class and supporting functions.
2603         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2604         normal symbols defined in object files.
2605
2606 2012-10-12  Alan Modra  <amodra@gmail.com>
2607
2608         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2609         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2610         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2611         section if scan_opd_relocs not yet called.
2612         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2613
2614 2012-10-12  Alan Modra  <amodra@gmail.com>
2615
2616         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2617         add_local_ifunc_entry): Revert last change.
2618         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2619
2620 2012-10-05  Alan Modra  <amodra@gmail.com>
2621
2622         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2623         do_plt_address_for_global): New functions.
2624         (Output_data_got_powerpc::do_write): Don't segfault when linking
2625         statically.
2626         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2627         add_local_ifunc_entry): Return true on adding entry..
2628         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2629         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2630         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2631         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2632         set up symbols here.
2633         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2634         syms here.  Do so even when no .iplt.  Don't segfault when linking
2635         statically.
2636         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2637         new variants without reloc param.
2638         (Glink_sym_ent::Glink_sym_ent): Likewise.
2639         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2640         reloc when refs will resolve to plt call stub.
2641         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2642         R_PPC_PLTREL24 to resolve locally.
2643         (Target_powerpc::Scan::global): Correct ifunc handling.
2644         (Target_powerpc::Relocate::relocate): Correct local sym glink
2645         lookup.  Don't destroy "value" when we have a plt call stub,
2646         and when checking plt call validity.
2647         (Target_powerpc::do_dynsym_value): Simplify.
2648
2649 2012-10-05  Alan Modra  <amodra@gmail.com>
2650
2651         * i386.cc (Output_data_plt_i386::address_for_global,
2652         address_for_local): Add plt offset to returned value.  Adjust uses.
2653         * sparc.cc (Output_data_plt_sparc::address_for_global,
2654         address_for_local): Likewise.
2655         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2656         address_for_local): Likewise.
2657         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2658         address_for_local): Likewise.
2659         * target.h (Target::plt_address_for_global, plt_address_for_local):
2660         Update comment.
2661         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2662         (Output_data_got::Got_entry::write): Nor here.
2663         * output.h: Comment fix.
2664
2665 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2666
2667         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2668         global_offset_table_ value for larget got.
2669         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2670
2671 2012-09-29  Alan Modra  <amodra@gmail.com>
2672
2673         * powerpc.cc (Target_powerpc::iplt_): New output section.
2674         (Target_powerpc::iplt_section, make_iplt_section,
2675         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2676         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2677         Target_powerpc::plt_entry_count): Count iplt entries too.
2678         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2679         reloc section in constructor.  New params.
2680         (Target_powerpc::make_plt_section): Create reloc section here instead.
2681         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2682         functions.
2683         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2684         (Output_data_glink::add_entry, find_entry): New functions to
2685         deal with local syms.
2686         (Glink_sym_ent): Add support for local syms.
2687         (Output_data_glink::do_write): Handle ifunc plt entries.
2688         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2689         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2690         (Target_powerpc::Relocate::relocate): Likewise.
2691         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2692
2693 2012-09-25  Alan Modra  <amodra@gmail.com>
2694
2695         * object.h (Sized_relobj_file::adjust_local_symbol,
2696         do_adjust_local_symbol): New functions.
2697         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2698         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2699         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2700         and irregular opd entry spacing.
2701         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2702         (Global_symbol_visitor_opd): New functor.
2703         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2704         on deleted opd entries.
2705
2706 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2707
2708         * tilegx.cc: New file.
2709         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2710         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2711         * configure.tgt: Add entries for tilegx*.
2712         * configure.ac: Likewise.
2713         * Makefile.in: Rebuild.
2714         * configure: Likewise.
2715         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2716         tilegx.
2717
2718 2012-09-13  Alan Modra  <amodra@gmail.com>
2719
2720         * target-reloc.h (scan_relocs): Call scan.local for relocs
2721         against symbols in discarded sections.  Pass is_discarded
2722         param.
2723         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2724         Add is_discarded param.
2725         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2726         is_discarded to flag opd entry as discarded.  Don't emit dyn
2727         relocs on such entries.
2728         (Target_powerpc::Scan::global): Similarly detect and handle
2729         such opd entries.
2730         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2731         opd_ent_.  Update all uses.
2732         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2733         (Target_powerpc::relocate_section): Zero out discarded opd
2734         entry relocs.
2735
2736 2012-09-12  Ian Lance Taylor  <iant@google.com>
2737
2738         PR gold/14570
2739         * output.cc: Rename Output_data_got template parameter from size
2740         to got_size for all functions.  Compile all variants of
2741         Output_data_got.
2742         (Output_data_got::Got_entry::write): Correct use of size for
2743         symbol value.  Use local_is_tls rather than casting to
2744         Sized_relobj_file.
2745         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2746         (class Sized_relobj_file): Add do_local_is_tls.
2747         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2748
2749 2012-09-11  Alan Modra  <amodra@gmail.com>
2750
2751         PR gold/14566
2752         * layout.cc (Layout::set_segment_offsets): When using
2753         common-page-size alignment, ensure we are on a new max-page-size
2754         page.
2755         * output.cc (Output_segment::set_section_addresses): Use
2756         abi_pagesize, not common_pagesize for relro boundary.
2757         (Output_segment::set_offset): Likewise.
2758
2759 2012-09-11  Alan Modra  <amodra@gmail.com>
2760
2761         * output.h (Output_data_got::add_global_tls, add_local_tls,
2762         add_local_tls_pair): New functions.
2763         (Output_data_got::add_local_pair_with_rel): Remove second
2764         reloc param.  Expand comment.
2765         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2766         use_plt_or_tls_offset_, similarly for constructor param.
2767         (Output_data_got::Got_entry::write): Add got_index param.
2768         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2769         add_local_tls_pair): New functions.
2770         (Output_data_got::Got_entry::write): Handle tls symbols
2771         with use_plt_or_tls_offset_ set specially.
2772         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2773         (Output_data_got::do_write): Replace iterator with index, pass
2774         index to entry write function.
2775         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2776         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2777         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2778         call.
2779         * i386.cc (Target_i386::Scan::local): Likewise.
2780         * sparc.cc (Target_sparc::Scan::local): Likewise.
2781         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2782         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2783         do_tls_offset_for_global): New functions.
2784         (Target_powerpc::Scan::local): Correct TLS relocations and got
2785         entry values.
2786         (Target_powerpc::Scan::global): Don't emit unnecessary
2787         dynamic relocations on TLS GOT entries.
2788
2789 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2790
2791         * config.in: Disable sanity check for kfreebsd.
2792
2793 2012-09-10  Sterling Augustine  <saugustine@google.com>
2794
2795         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2796         (Gdb_index::pubtypes_read): New parameter.
2797         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2798         to calls.
2799         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2800         pubtypes_object_.
2801
2802 2012-09-09  Alan Modra  <amodra@gmail.com>
2803
2804         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2805         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2806         * gc.h (gc_process_relocs): Call target gc_add_reference.
2807         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2808         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2809         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2810         unnecessary cast.
2811         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2812         to cater for when we don't need code offset.  Update use.
2813         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2814         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2815         set_opd_valid): New functions.
2816         (Target_powerpc::do_gc_add_reference): New function.
2817         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2818         stashed refs.
2819         (Target_powerpc::do_gc_mark_symbol): New function.
2820
2821 2012-09-06  Cary Coutant  <ccoutant@google.com>
2822
2823         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2824         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2825         (Dwarf_die::skip_attributes): Likewise.
2826         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2827         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2828         (main): Call it.
2829         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2830
2831 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2832
2833         * testsuite/script_test_3.t: Add .got.plt output section
2834         statement.
2835         * testsuite/script_test_4.t: Likewise.
2836
2837 2012-09-05  Alan Modra  <amodra@gmail.com>
2838
2839         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2840         update all uses and lose "enum" when using type.
2841
2842 2012-09-05  Alan Modra  <amodra@gmail.com>
2843
2844         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2845         * configure: Regenerate.
2846         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2847         (plugin_final_layout.stdout): Likewise.
2848         (memory_test): Set page sizes to 0x1000.
2849         * testsuite/Makefile.in: Regenerate.
2850         * testsuite/discard_locals_test.sh: Add FIXME comment.
2851         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2852         * testsuite/pr14265.t: Add .got output section statement.
2853         * testsuite/script_test_2.t: Likewise.
2854         * testsuite/script_test_3.t: Likewise.
2855         * testsuite/script_test_4.t: Likewise.
2856         * testsuite/script_test_5.t: Likewise.
2857         * testsuite/script_test_6.t: Likewise.
2858         * testsuite/script_test_7.t: Likewise.
2859         * testsuite/script_test_9.t: Likewise.
2860
2861 2012-09-05  Alan Modra  <amodra@gmail.com>
2862
2863         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2864         (Powerpc_relocate_functions::Status): New typedef.
2865         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2866         (Target_powerpc::Scan::local): Handle REL64.
2867         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2868         for REL32 and REL64.
2869         (Target_powerpc::symval_for_branch): New function, extracted from..
2870         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2871         checks.  Report overflow errors.
2872
2873 2012-09-05  Alan Modra  <amodra@gmail.com>
2874
2875         * object.h (Sized_relobj_file::emit_relocs): Delete.
2876         (Sized_relobj_file::emit_relocs_reltype): Delete.
2877         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2878         relocate_relocs for --emit-relocs.
2879         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2880         * output.h: Update comment.
2881         (Output_segment::first_section): New function.
2882         (Output_segment::first_section_load_address): Use first_section.
2883         * output.cc (Output_segment::first_section): New function extracted..
2884         (Output_segment::first_section_load_address): ..from here.  Delete.
2885         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2886         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2887         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2888         adjust call to target.h function.
2889         * i386.cc (Target_i386): Likewise.
2890         * sparc.cc (Target_sparc): Likewise.
2891         * x86_64.cc (Target_x86_64): Likewise.
2892         * powerpc.cc (Target_powerpc): Likewise.
2893         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2894         first tls section has section symbol for optimised local dynamic
2895         output relocs.
2896         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2897         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2898         optimised tls code.
2899         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2900         Rename to relocate_relocs.  Update error message.
2901
2902 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2903
2904         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2905         --just-symbols.
2906
2907 2012-08-31  Alan Modra  <amodra@gmail.com>
2908
2909         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2910         (Powerpc_relobj::toc_base_offset): New stub function.
2911         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2912         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2913         (Target_powerpc::Relocate::enum skip_tls): New.
2914         (Target_powerpc::call_tls_get_addr_): New var.
2915         (Target_powerpc::is_branch_reloc): Move to file scope.
2916         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2917         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2918         New functions.
2919         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2920         (powerpc_info): Correct common_pagesize for ppc64.
2921         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2922         (Powerpc_relocate_functions): Add overflow check enums and functions.
2923         Add non-shift version of rela, rela_ua.  Delete all rel public
2924         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2925         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2926         addr16_ha3, addr14 functions.
2927         (Output_data_got_powerpc::add_constant_pair): New function.
2928         (Output_data_got_powerpc::got_base_offset): Likewise.
2929         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2930         (instruction constants): Sort, add some more.
2931         (Output_data_glink::do_write): Add and use Address typedef.  Use
2932         object->toc_base_offset() stub for 64-bit.
2933         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2934         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2935         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2936         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2937         Always treat .opd relocs as against locally defined symbol.
2938         Correct condition for RELATIVE relocs.
2939         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2940         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2941         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2942         calculations.  Handle TLS relocs, and more.  Add overflow
2943         checking and adjust for Powerpc_relocate_functions changes.
2944         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2945         Reinstate --emit-relocs code with FIXME.
2946
2947 2012-08-30  Alan Modra  <amodra@gmail.com>
2948
2949         * layout.cc (Layout::set_segment_offsets): Set p_align to
2950         abi_pagesize, not common_pagesize.
2951         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2952         to determine whether file header can go in segment.
2953
2954 2012-08-30  Alan Modra  <amodra@gmail.com>
2955
2956         * output.h (Output_reloc::Output_reloc <output section>): Add
2957         is_relative param.  Adjust calls.
2958         (Output_reloc::add_output_section_relative): New functions.
2959         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2960         is_relative.
2961         (Output_reloc::symbol_value): Handle SECTION_CODE.
2962
2963 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2964
2965         * gold.cc (queue_middle_tasks): Call layout again when unique
2966         segments for sections is desired.
2967         * layout.cc (Layout::Layout): Initialize new members.
2968         (Layout::get_output_section_flags): New function.
2969         (Layout::choose_output_section): Call get_output_section_flags.
2970         (Layout::layout): Make output section for mapping to a unique segment.
2971         (Layout::insert_section_segment_map): New function.
2972         (Layout::attach_allocated_section_to_segment): Make unique segment for
2973         output sections marked so.
2974         (Layout::segment_precedes): Check for unique segments when sorting.
2975         * layout.h (Layout::Unique_segment_info): New struct.
2976         (Layout::Section_segment_map): New typedef.
2977         (Layout::insert_section_segment_map): New function.
2978         (Layout::get_output_section_flags): New function.
2979         (Layout::is_unique_segment_for_sections_specified): New function.
2980         (Layout::set_unique_segment_for_sections_specified): New function.
2981         (Layout::unique_segment_for_sections_specified_): New member.
2982         (Layout::section_segment_map_): New member.
2983         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2984         Rename is_gc_pass_one to is_pass_one.
2985         Rename is_gc_pass_two to is_pass_two.
2986         Rename is_gc_or_icf to is_two_pass.
2987         Check for which pass based on whether symbols data is present.
2988         Make it two pass when unique segments for sections is desired.
2989         * output.cc (Output_section::Output_section): Initialize new
2990         members.
2991         * output.h (Output_section::is_unique_segment): New function.
2992         (Output_section::set_is_unique_segment): New function.
2993         (Output_section::is_unique_segment_): New member.
2994         (Output_section::extra_segment_flags): New function.
2995         (Output_section::set_extra_segment_flags): New function.
2996         (Output_section::extra_segment_flags_): New member.
2997         (Output_section::segment_alignment): New function.
2998         (Output_section::set_segment_alignment): New function.
2999         (Output_section::segment_alignment_): New member.
3000         (Output_segment::Output_segment): Initialize is_unique_segment_.
3001         (Output_segment::is_unique_segment): New function.
3002         (Output_segment::set_is_unique_segment): New function.
3003         (Output_segment::is_unique_segment_): New member.
3004         * plugin.cc (allow_unique_segment_for_sections): New function.
3005         (unique_segment_for_sections): New function.
3006         (Plugin::load): Add new functions to transfer vector.
3007         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3008         * Makefile.in: Regenerate.
3009         * testsuite/plugin_final_layout.sh: Check if unique segment
3010         functionality works.
3011         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3012         are available.
3013         (allow_unique_segment_for_sections): New global.
3014         (unique_segment_for_sections): New global.
3015         (claim_file_hook): Call allow_unique_segment_for_sections.
3016         (all_symbols_read_hook): Call unique_segment_for_sections.
3017
3018 2012-08-22  Cary Coutant  <ccoutant@google.com>
3019
3020         * layout.cc (Layout::include_section): Don't assert on GROUP
3021         sections with --emit-relocs.
3022
3023 2012-08-21  Cary Coutant  <ccoutant@google.com>
3024
3025         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3026         if --export-dynamic-symbol names an undef symbol.
3027
3028 2012-08-18  Alan Modra  <amodra@gmail.com>
3029
3030         * powerpc.cc: Formatting and white space.
3031         (Powerpc_relobj): Rename got2_section_ to special_.
3032         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3033         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3034         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3035         (Target_powerpc): Add Address typedef and invalid_address.  Use
3036         throughout.
3037         (Target_powerpc::is_branch_reloc): New function.
3038         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3039         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3040         for dst_mask, value and addend.
3041         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3042         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3043         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3044         uint16_t for 24-bit offset.  Use get_output_section_offset and
3045         check return.
3046         (Target_powerpc::Scan::local): Handle more relocs.
3047         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3048         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3049         Plug in toc restoring insn after plt calls.  Translate branches
3050         to function descriptor symbols to corresponding entry point.
3051         (Target_powerpc::relocate_for_relocatable): Check return from
3052         get_output_section_offset.
3053         * symtab.h: Comment typo.
3054
3055 2012-08-14  Ian Lance Taylor  <iant@google.com>
3056
3057         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3058         unsupported_relocal_local to call unsupported_reloc_global.
3059
3060 2012-08-14  Nick Clifton  <nickc@redhat.com>
3061
3062         PR ld/14265
3063         * script-sections.cc (Sections_element::output_section_name): Add
3064         keep return parameter.
3065         (Output_section_element::match_name): Add keep return parameter.
3066         Return the value of the keep_ member.
3067         * script-sections.h (class Output_section): Update
3068         output_section_name prototype.
3069         * layout.cc (Layout::keep_input_section): New public member
3070         function.
3071         (Layout::choose_output_section): Pass keep parameter to
3072         output_section_name.
3073         * layout.h (class Layout): Add keep_input_section.
3074         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3075         sections.
3076         * testsuite/Makefile.am: Add a test.
3077         * testsuite/Makefile.in: Regenerate.
3078         * testsuite/pr14265.c: Source file for the test.
3079         * testsuite/pr14265.t: Linker script for the test.
3080         * testsuite/pr14265.sh: Shell script for the test.
3081
3082 2012-08-14  Alan Modra  <amodra@gmail.com>
3083
3084         * target.h (Target::output_section_name): New function.
3085         (Target::do_output_section_name): New function.
3086         * layout.cc (Layout::choose_output_section): Call the above.
3087         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3088
3089 2012-08-14  Alan Modra  <amodra@gmail.com>
3090
3091         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3092         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3093         for replace_constant call.
3094         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3095         (Output_data_glink::do_print_to_mapfile): New function.
3096         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3097         (Target_powerpc::Relocate::relocate): Likewise.
3098
3099 2012-08-14  Alan Modra  <amodra@gmail.com>
3100
3101         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3102         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3103         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3104         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3105         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3106         here.
3107         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3108         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3109         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3110         here.
3111         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3112         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3113
3114 2012-08-12  Alan Modra  <amodra@gmail.com>
3115
3116         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3117         (glink insn constants): Use uint32_t.
3118         (Output_data_glink::add_entry): Use insert, not [] operator.
3119
3120 2012-08-11  Alan Modra  <amodra@gmail.com>
3121
3122         * object.h (Sized_relobj_file::find_shdr): New function.
3123         (Sized_relobj_file::find_special_sections): New function.
3124         * object.cc (Sized_relobj_file::find_shdr): New function.
3125         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3126         (Sized_relobj_file::find_special_sections): New function, split out..
3127         (Sized_relobj_file::do_read_symbols): ..from here.
3128         * output.h (Output_data_got::replace_constant): New function.
3129         (Output_data_got::num_entries): New function.
3130         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3131         (Output_data_got::got_offset): Protected rather than private.
3132         (Output_data_got::replace_got_entry): New function.
3133         * output.cc (Output_data_got::replace_got_entry): New function.
3134         * powerpc.cc (class Powerpc_relobj): New.
3135         (class Powerpc_relocate_functions): Delete all psymval variants or
3136         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3137         Implement _ha functions using corresponding _hi function.
3138         (Powerpc_relobj::find_special_sections): New function.
3139         (Target_powerpc::do_make_elf_object): New function.
3140         (class Output_data_got_powerpc): New.
3141         (class Output_data_glink): New.
3142         (class Powerpc_scan_relocatable_reloc): New.
3143         Many more changes througout file.
3144
3145 2012-08-09  Nick Clifton  <nickc@redhat.com>
3146
3147         * po/vi.po: Updated Vietnamese translation.
3148
3149 2012-08-07  Ian Lance Taylor  <iant@google.com>
3150
3151         * layout.cc (Layout::add_target_dynamic_tags): If
3152         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3153         plt_rel.
3154
3155 2012-07-30  Nick Clifton  <nickc@redhat.com>
3156
3157         * po/gold.pot: Updated template.
3158         * po/es.po: Updated Spanish translation.
3159
3160 2012-07-18  Cary Coutant  <ccoutant@google.com>
3161
3162         PR gold/14344
3163         * configure.ac: Add check for -gpubnames support.
3164         * configure: Regenerate.
3165         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3166         support; force -gno-pubnames.
3167         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3168         support.
3169         (gdb_index_test_4): New test.
3170         * testsuite/Makefile.in: Regenerate.
3171         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3172         * testsuite/gdb_index_test_2.sh: Likewise.
3173         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3174         * testsuite/gdb_index_test_4.sh: New script.
3175         * testsuite/gdb_index_test_comm.sh: New script with common code;
3176         don't look for space after colon.
3177
3178 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3179
3180         * gold.cc (queue_middle_tasks): Update function order only after
3181         deferred objects due to plugins are processed.
3182
3183 2012-07-11  Ian Lance Taylor  <iant@google.com>
3184
3185         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3186         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3187         (Target_arm::scan_reloc_for_stub): Likewise.
3188         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3189         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3190         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3191         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3192         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3193
3194 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3195             Ian Lance Taylor  <iant@google.com>
3196
3197         PR gold/14309
3198         * configure.ac: Test whether std::tr1::hash<off_t> works.
3199         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3200         needed.
3201         * output.h (class Output_fill): Add virtual destructor.
3202         * configure, config.in: Rebuild.
3203
3204 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3205
3206         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3207
3208 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3209
3210         * plugin.cc (Plugin::load): Handle position independent executables.
3211
3212 2012-06-06  Cary Coutant  <ccoutant@google.com>
3213
3214         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3215         add .debug_macro.
3216         (lines_only_debug_sections): Likewise.
3217         (gdb_fast_lookup_sections): New static array.
3218         (is_gdb_debug_section): Rename formal parameter.
3219         (is_lines_only_debug_section): Likewise.
3220         (is_gdb_fast_lookup_section): New function.
3221         (Layout::include_section): Check for ".zdebug_" prefix; pass
3222         section name suffix to is_gdb_debug_section, et al.; check for
3223         fast-lookup sections when building .gdb_index.
3224         * options.h (--strip-debug-gdb): Update GDB version number.
3225
3226 2012-06-06  Cary Coutant  <ccoutant@google.com>
3227
3228         * configure.ac: Add check for fallocate.
3229         * configure: Regenerate.
3230         * config.in: Regenerate.
3231
3232         * options.h (class General_options): Add --mmap-output-file and
3233         --posix-fallocate options.
3234         * output.cc: (posix_fallocate): Remove; replace with...
3235         (gold_fallocate): New function.
3236         (Output_file::map_no_anonymous): Call gold_fallocate.
3237         (Output_file::map): Check --mmap-output-file option.
3238
3239 2012-06-05  Jing Yu  <jingyu@google.com>
3240
3241         * gold.h (textdomain): Add do {} to empty while(0).
3242         (bindtextdomain): Likewise.
3243
3244 2012-06-04  Cary Coutant  <ccoutant@google.com>
3245
3246         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3247         has_dynsym_index.
3248
3249 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3250
3251         * symtab.cc (Symbol_table::define_special_symbol):
3252         Initialize *poldsym to prevent uninitialized variable errors.
3253
3254 2012-05-23  Cary Coutant  <ccoutant@google.com>
3255
3256         * layout.cc (Layout::section_name_mapping): Add rules to handle
3257         exact match on .data.rel.ro.local or .data.rel.ro.
3258         (Layout::output_section_name): Check for exact matches.
3259
3260 2012-05-23  Cary Coutant  <ccoutant@google.com>
3261
3262         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3263         more carefully.
3264
3265 2012-05-22  Cary Coutant  <ccoutant@google.com>
3266
3267         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3268         object before exporting symbol.
3269
3270 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3271
3272         * testsuite/tls_test.cc: Include "config.h" first.
3273         * testsuite/tls_test_c.c: Likewise.
3274
3275 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3276             Nick Clifton  <nickc@redhat.com>
3277
3278         PR 14072
3279         * configure.in: Add check that sysdep.h has been included before
3280         any system header files.
3281         * configure: Regenerate.
3282         * config.in: Regenerate.
3283
3284 2012-05-14  Cary Coutant  <ccoutant@google.com>
3285
3286         * layout.cc (Layout::make_output_section): Mark .tdata section
3287         as RELRO.
3288         * testsuite/relro_test.cc: Add a TLS variable.
3289
3290 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3291
3292         PR gold/14091
3293         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3294         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3295         R_X86_64_64.
3296
3297 2012-05-08  Cary Coutant  <ccoutant@google.com>
3298
3299         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3300         (lines_only_debug_sections): Likewise.
3301
3302 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3303
3304         * nacl.cc: New file.
3305         * nacl.h: New file.
3306         * Makefile.am (CCFILES, HFILES): Add them.
3307         * Makefile.in: Regenerate.
3308         * i386.cc (Output_data_plt_i386_nacl): New class.
3309         (Output_data_plt_i386_nacl_exec): New class.
3310         (Output_data_plt_i386_nacl_dyn): New class.
3311         (Target_i386_nacl): New class.
3312         (Target_selector_i386_nacl): New class.
3313         (target_selector_i386): Use it instead of Target_selector_i386.
3314         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3315         (Target_x86_64_nacl): New class.
3316         (Target_selector_x86_64_nacl): New class.
3317         (target_selector_x86_64, target_selector_x32): Use it instead of
3318         Target_selector_x86_64.
3319         * arm.cc (Output_data_plt_arm_nacl): New class.
3320         (Target_arm_nacl): New class.
3321         (Target_selector_arm_nacl): New class.
3322         (target_selector_arm, target_selector_armbe): Use it instead of
3323         Target_selector_arm.
3324
3325         * target-select.cc (select_target): Take new Input_file* and off_t
3326         arguments, pass them on to recognize method of selector.
3327         * object.cc (make_elf_sized_object): Update caller.
3328         * parameters.cc (parameters_force_valid_target): Likewise.
3329         * incremental.cc (make_sized_incremental_binary): Likewise.
3330         * target-select.h: Update decl.
3331         (Target_selector::recognize): Take new Input_file* argument,
3332         pass it on to do_recognize.
3333         (Target_selector::do_recognize): Take new Input_file* argument.
3334         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3335         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3336         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3337         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3338
3339         * target.h (Target::Target_info): New members isolate_execinstr
3340         and rosegment_gap.
3341         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3342         * arm.cc (Target_arm::arm_info): Update initializer.
3343         * i386.cc (Target_i386::i386_info): Likewise.
3344         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3345         * sparc.cc (Target_sparc::sparc_info): Likewise.
3346         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3347         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3348         * layout.cc (Layout::attach_allocated_section_to_segment):
3349         Take new const Target* argument.  If target->isolate_execinstr(), act
3350         like --rosegment.
3351         (Layout::find_first_load_seg): Take new const Target* argument;
3352         if target->isolate_execinstr(), reject PF_X segments.
3353         (Layout::relaxation_loop_body): Update caller.
3354         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3355         reset file offset to zero when we hit LOAD_SEG, and then do a second
3356         loop over the segments before LOAD_SEG to reassign offsets after
3357         addresses have been determined.  Handle target->rosegment_gap().
3358         (Layout::attach_section_to_segment): Take new const Target* argument;
3359         pass it to attach_allocated_section_to_segment.
3360         (Layout::make_output_section): Update caller.
3361         (Layout::attach_sections_to_segments): Take new const Target* argument;
3362         pass it to attach_section_to_segment.
3363         * gold.cc (queue_middle_tasks): Update caller.
3364         * layout.h (Layout): Update method decls with new arguments.
3365
3366         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3367         Target_info pointer to use.
3368         (Target_arm::do_make_data_plt): New virtual method.
3369         (Target_arm::make_data_plt): New method that calls it.
3370         (Target_arm::make_plt_entry): Use it.
3371         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3372         for the section alignment.
3373         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3374         method.
3375         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3376         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3377         method.
3378         (Output_data_plt_arm::get_plt_entry_size): Call it.
3379         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3380         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3381         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3382         method.
3383         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3384         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3385         method instead of sizeof(plt_entry).
3386         (Output_data_plt_arm::add_entry): Likewise.
3387         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3388         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3389         than static method.
3390         (Target_arm::plt_entry_size): Likewise.
3391         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3392         Move to ...
3393         (Output_data_plt_arm_standard): ... here, new class.
3394         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3395         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3396         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3397
3398         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3399         Take additional argument for the PLT entry size.
3400         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3401         Use get_plt_entry_size method rather than plt_entry_size variable.
3402         (Output_data_plt_x86_64::reserve_slot): Likewise.
3403         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3404         (Output_data_plt_x86_64::add_entry): Likewise.
3405         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3406         (Output_data_plt_x86_64::address_for_global): Likewise.
3407         (Output_data_plt_x86_64::address_for_local): Likewise.
3408         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3409         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3410         Make method non-static.
3411         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3412         method.
3413         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3414         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3415         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3416         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3417         virtual method.
3418         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3419         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3420         virtual method.
3421         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3422         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3423         virtual method.
3424         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3425         (Output_data_plt_x86_64::plt_entry_size)
3426         (Output_data_plt_x86_64::first_plt_entry)
3427         (Output_data_plt_x86_64::plt_entry)
3428         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3429         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3430         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3431         (Output_data_plt_x86_64_standard): ... here, new class.
3432         (Target_x86_64::Target_x86_64): Take optional argument for the
3433         Target_info pointer to use.
3434         (Target_x86_64::do_make_data_plt): New virtual method.
3435         (Target_x86_64::make_data_plt): New method to call it.
3436         (Target_x86_64::init_got_plt_for_update): Use that.
3437         Call this->plt_->add_eh_frame method here.
3438         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3439         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3440         rather than static method.
3441         (Target_x86_64::plt_entry_size): Likewise.
3442         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3443         rather than plt_entry_size variable.  Move guts of PLT filling to...
3444         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3445         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3446         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3447
3448         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3449         additional argument for the section alignment.
3450         Don't do add_eh_frame_for_plt here.
3451         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3452         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3453         variable.
3454         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3455         method.
3456         (Output_data_plt_i386::get_plt_entry_size): Call it.
3457         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3458         (Output_data_plt_i386::add_eh_frame): New method to call it.
3459         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3460         method.
3461         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3462         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3463         method.
3464         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3465         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3466         method instead of plt_entry_size.
3467         (Output_data_plt_i386::plt_entry_size)
3468         (Output_data_plt_i386::plt_eh_frame_fde_size)
3469         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3470         (Output_data_plt_i386_standard): ... here, new class.
3471         (Output_data_plt_i386_exec): New class.
3472         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3473         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3474         (Output_data_plt_i386::exec_plt_entry): Move to ...
3475         (Output_data_plt_i386_exec::plt_entry): ... here.
3476         (Output_data_plt_i386_dyn): New class.
3477         (Output_data_plt_i386::first_plt_entry): Move to ...
3478         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3479         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3480         (Output_data_plt_i386_dyn::plt_entry): ... here.
3481         (Target_i386::Target_i386): Take optional argument for the Target_info
3482         pointer to use.
3483         (Target_i386::do_make_data_plt): New virtual method.
3484         (Target_i386::make_data_plt): New method to call it.
3485         (Target_i386::make_plt_section): Use that.
3486         Call this->plt_->add_eh_frame method here.
3487         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3488         rather than plt_entry_size variable.
3489         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3490         (Output_data_plt_i386::address_for_local): Likewise.
3491         (Output_data_plt_i386::do_write): Likewise.
3492         Move guts of PLT filling to...
3493         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3494         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3495         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3496         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3497
3498 2012-05-01  Cary Coutant  <ccoutant@google.com>
3499
3500         * dwarf_reader.cc (Dwarf_die::read_attributes)
3501         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3502         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3503         * reduced_debug_output.cc
3504         (Output_reduced_debug_info_section::get_die_end): Remove
3505         DW_FORM_GNU_ref_index.  Add default case.
3506
3507 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3508
3509         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3510         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3511         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3512         DW_AT_high_pc as offset from DW_AT_low_pc.
3513
3514         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3515         * testsuite/Makefile.in: Regenerate.
3516         * testsuite/gdb_index_test_3.c: New test source file.
3517         * testsuite/gdb_index_test_3.sh: New test source file.
3518
3519 2012-04-25  Ian Lance Taylor  <iant@google.com>
3520
3521         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3522         pointer.
3523         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3524         as a class, not a struct.
3525         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3526         (Target_arm::apply_cortex_a8_workaround): Likewise.
3527         * gc.h: Declare Reloc_types as a struct, not a class.
3528         * object.h: Declare Symbols_data as a struct.
3529         * reloc.h: Declare Read_relocs_data as a struct.
3530         * target.h: Declare Relocate_info as a struct.
3531
3532 2012-04-24  David S. Miller  <davem@davemloft.net>
3533
3534         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3535         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3536         and R_SPARC_WPLT30.
3537
3538 2012-04-24  Cary Coutant  <ccoutant@google.com>
3539
3540         * incremental-dump.cc (find_input_containing_global): Replace
3541         magic number with symbolic constant.
3542         (dump_incremental_inputs): Update version number.
3543         * incremental.cc (Output_section_incremental_inputs): Update version
3544         number; import symbolic constants from Incremental_inputs_reader.
3545         (Incremental_inputs::create_data_sections): Align relocations
3546         section correctly for 64-bit targets.
3547         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3548         constants; add padding.
3549         (Output_section_incremental_inputs::write_header): Add assert for
3550         header_size.
3551         (Output_section_incremental_inputs::write_input_files): Add assert
3552         for input_entry_size.
3553         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3554         add assert for object_info_size, input_section_entry_size,
3555         global_sym_entry_size.
3556         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3557         for data structure sizes; use them.
3558         (Incremental_input_entry_reader): Import symbolic constants from
3559         Incremental_inputs_reader; use them.
3560
3561 2012-04-23  David S. Miller  <davem@davemloft.net>
3562
3563         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3564         and elf_flags_set_.
3565         (Target_sparc::Target_sparc): Initialize new fields.
3566         (Target_sparc::do_make_elf_object): New function.
3567         (Target_sparc::do_adjust_elf_header): New function.
3568
3569 2012-04-23  Cary Coutant  <ccoutant@google.com>
3570
3571         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3572         CU range table of gdb index.
3573
3574 2012-04-20  David S. Miller  <davem@davemloft.net>
3575
3576         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3577         instead of false.
3578
3579 2012-04-16  David S. Miller  <davem@davemloft.net>
3580
3581         * sparc.cc (Target_sparc::got_address): New function.
3582         (Sparc_relocate_functions::gdop_hix22): New function.
3583         (Sparc_relocate_functions::gdop_lox10): New function.
3584         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3585         relocs.
3586         (Target_sparc::Scan::local): Likewise if the global symbol is not
3587         preemptible and is not IFUNC.
3588         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3589         transformations for local and non-preemptible non-IFUNC global
3590         symbols.
3591
3592         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3593         writing out 64-bit part of ranges.
3594
3595         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3596         -fpic and -fpie respectively.
3597         * Makefile.in: Regenerate.
3598
3599         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3600         (Target_sparc::Target_sparc): Initialize new field.
3601         (Target_sparc::do_plt_section_for_global): New function.
3602         (Target_sparc::do_plt_section_for_local): New function.
3603         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3604         (Target_sparc::make_plt_section): New function, broken out of
3605         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3606         (Target_sparc::make_plt_entry): Call make_plt_section.
3607         (Target_sparc::make_local_ifunc_plt_entry): New function.
3608         (Target_sparc::rela_ifunc_section): New function.
3609         (Target_sparc::plt_section): Remove const.
3610         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3611         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3612         and ifunc_count_ fields.
3613         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3614         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3615         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3616         (Output_data_plt_sparc::rela_ifunc): New function.
3617         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3618         (Output_data_plt_sparc::has_ifunc_section): New function.
3619         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3620         (Output_data_plt_sparc::address_for_global): New function.
3621         (Output_data_plt_sparc::address_for_local): New function.
3622         (Output_data_plt_sparc::plt_index_to_offset): New function.
3623         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3624         and entry_count.
3625         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3626         entry_count.
3627         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3628         R_SPARC_JMP_IREL to switch.
3629         (Target_sparc::Scan::check_non_pic): Likewise.
3630         (Target_sparc::Scan::local): Handle IFUNC symbols.
3631         (Target_sparc::Scan::local): Likewise.
3632         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3633         and plt_address_for_local.
3634         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3635         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3636
3637         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3638         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3639         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3640         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3641         global relocs too.
3642         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3643         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3644         calls.
3645         * sparc.cc (Target_sparc::Scan::global): Likewise.
3646         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3647
3648 2012-04-16  Cary Coutant  <ccoutant@google.com>
3649
3650         * archive.cc (Library_base::should_include_member): Check for
3651         --export-dynamic-symbol.
3652         * options.h (class General_options): Add --export-dynamic-symbol.
3653         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3654         --export-dynamic-symbol.
3655         (Symbol_table::gc_mark_undef_symbols): Likewise.
3656         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3657
3658 2012-04-12  David S. Miller  <davem@davemloft.net>
3659
3660         * sparc.cc (Reloc::wdisp10): New relocation method.
3661         (Reloc::h34): Likewise.
3662         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3663         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3664         R_SPARC_WDISP10.
3665         (Target_sparc::Scan::local): Likewise.
3666         (Target_sparc::Scan::global): Likewise.
3667         (Target_sparc::Relocate::relocate): Likewise.
3668
3669 2012-04-09  Cary Coutant  <ccoutant@google.com>
3670
3671         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3672         low_pc == 0.
3673
3674 2012-04-06  Ian Lance Taylor  <iant@google.com>
3675
3676         * timer.cc: #include <unistd.h>.
3677
3678 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3679
3680         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3681         * config.in: Regenerate.
3682         * configure: Regenerate.
3683
3684 2012-04-05  Nick Clifton  <nickc@redhat.com>
3685
3686         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3687         (AM_LC_MESSAGES): Add.
3688         * aclocal.m4: Regenerate.
3689         * config.in: Regenerate.
3690         * configure: Regenerate.
3691
3692 2012-03-21  Cary Coutant  <ccoutant@google.com>
3693
3694         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3695         * Makefile.in: Regenerate.
3696         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3697         (Sized_elf_reloc_mapper::symbol_section): New function.
3698         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3699         (make_elf_reloc_mapper): New function.
3700         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3701         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3702         (Dwarf_abbrev_table::do_get_abbrev): New function.
3703         (Dwarf_ranges_table::read_ranges_table): New function.
3704         (Dwarf_ranges_table::read_range_list): New function.
3705         (Dwarf_pubnames_table::read_section): New function.
3706         (Dwarf_pubnames_table::read_header): New function.
3707         (Dwarf_pubnames_table::next_name): New function.
3708         (Dwarf_die::Dwarf_die): New function.
3709         (Dwarf_die::read_attributes): New function.
3710         (Dwarf_die::skip_attributes): New function.
3711         (Dwarf_die::set_name): New function.
3712         (Dwarf_die::set_linkage_name): New function.
3713         (Dwarf_die::attribute): New function.
3714         (Dwarf_die::string_attribute): New function.
3715         (Dwarf_die::int_attribute): New function.
3716         (Dwarf_die::uint_attribute): New function.
3717         (Dwarf_die::ref_attribute): New function.
3718         (Dwarf_die::child_offset): New function.
3719         (Dwarf_die::sibling_offset): New function.
3720         (Dwarf_info_reader::check_buffer): New function.
3721         (Dwarf_info_reader::parse): New function.
3722         (Dwarf_info_reader::do_parse): New function.
3723         (Dwarf_info_reader::do_read_string_table): New function.
3724         (Dwarf_info_reader::lookup_reloc): New function.
3725         (Dwarf_info_reader::get_string): New function.
3726         (Dwarf_info_reader::visit_compilation_unit): New function.
3727         (Dwarf_info_reader::visit_type_unit): New function.
3728         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3729         Sized_elf_reloc_mapper.
3730         (Sized_dwarf_line_info::symbol_section): Remove function.
3731         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3732         (Sized_dwarf_line_info::read_line_mappings): Remove object
3733         parameter, adjust callers.
3734         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3735         * dwarf_reader.h: Include <sys/types.h>.
3736         (class Track_relocs): Remove forward declaration.
3737         (class Elf_reloc_mapper): New class.
3738         (class Sized_elf_reloc_mapper): New class.
3739         (class Dwarf_abbrev_table): New class.
3740         (class Dwarf_range_list): New class.
3741         (class Dwarf_ranges_table): New class.
3742         (class Dwarf_pubnames_table): New class.
3743         (class Dwarf_die): New class.
3744         (class Dwarf_info_reader): New class.
3745         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3746         (Sized_dwarf_line_info::symbol_section): Remove member function.
3747         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3748         base class.
3749         * gdb-index.cc: New source file.
3750         * gdb-index.h: New source file.
3751         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3752         and .debug_types sections, call Layout::add_to_gdb_index.
3753         (Sized_relobj_incr::do_section_name): Implement.
3754         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3755         return type; Implement.
3756         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3757         return type.
3758         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3759         parameter list and return type.
3760         (Sized_incr_dynobj::do_section_contents): Likewise.
3761         * layout.cc: Include gdb-index.h.
3762         (Layout::Layout): Initialize gdb_index_data_.
3763         (Layout::init_fixed_output_section): Check for .gdb_index section.
3764         (Layout::add_to_gdb_index): New function. Instantiate.
3765         * layout.h: Add forward declaration for class Gdb_index.
3766         (Layout::add_to_gdb_index): New member function.
3767         (Layout::gdb_index_data_): New data member.
3768         * main.cc: Include gdb-index.h.
3769         (main): Print statistics for gdb index.
3770         * object.cc (Object::section_contents): Move code into
3771         do_section_contents.
3772         (need_decompressed_section): Check for sections needed when building
3773         gdb index.
3774         (build_compressed_section_map): Likewise.
3775         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3776         gdb index.
3777         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3778         sections; call Layout::add_to_gdb_index.
3779         (Sized_relobj_file::do_decompressed_section_contents): Call
3780         do_section_contents directly.
3781         * object.h (Object::do_section_contents): Adjust parameter list and
3782         return type.
3783         (Object::do_decompressed_section_contents): Call do_section_contents
3784         directly.
3785         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3786         return type.
3787         * options.h (class General_options): Add --gdb-index option.
3788         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3789         list and return type.
3790         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3791         * reloc.h (Track_relocs::checkpoint): New function.
3792         (Track_relocs::reset): New function.
3793
3794         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3795         New test cases.
3796         * testsuite/Makefile.in: Regenerate.
3797         * testsuite/gdb_index_test.cc: New test source file.
3798         * testsuite/gdb_index_test_1.sh: New test source file.
3799         * testsuite/gdb_index_test_2.sh: New test source file.
3800
3801 2012-03-19  Doug Kwan  <dougkwan@google.com>
3802
3803         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3804         (Target_arm::do_finalize_sections): Remove code which defines
3805         __exidx_start and __exidx_end.  Make symbol table parameter
3806         anonymous as it is not used.
3807         * gold.cc (queue_middle_tasks): Call target hook to define any
3808         target-specific symbols.
3809         * target.h (Target::define_standard_symbols): New method.
3810         (Target::do_define_standard_symbols): Same.
3811         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3812         * testsuite/Makefile.in: Regenerate.
3813         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3814         and __exidx_end.
3815         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3816         relocations are generated for __exidx_start and __exidx_end.
3817
3818 2012-03-16  Doug Kwan  <dougkwan@google.com>
3819
3820         * testsuite/Makefile.am: Disable test initpri3b.
3821         * testsuite/Makefile.in: Regenerate.
3822
3823 2012-03-15  Doug Kwan  <dougkwan@google.com>
3824
3825         * arm.cc (Target_arm::got_section): Make .got section read-only
3826         if -z now is given.
3827
3828 2012-03-15  Ian Lance Taylor  <iant@google.com>
3829
3830         PR gold/13850
3831         * layout.cc (Layout::make_output_section): Correctly mark
3832         SHT_INIT_ARRAY, et. al., as relro.
3833
3834 2012-03-14  Doug Kwan  <dougkwan@google.com>
3835
3836         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3837         dynamic relocations for protected symbols in shared objects.
3838
3839 2012-03-13  Ian Lance Taylor  <iant@google.com>
3840
3841         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3842         keep the larger alignment.
3843
3844 2012-03-12  Cary Coutant  <ccoutant@google.com>
3845
3846         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3847         handling of DW_LNE_define_file.
3848
3849 2012-03-12  Cary Coutant  <ccoutant@google.com>
3850
3851         * reduced_debug_output.cc
3852         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3853         codes to switch.
3854
3855 2012-02-29  Cary Coutant  <ccoutant@google.com>
3856
3857         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3858
3859 2012-02-29  Cary Coutant  <ccoutant@google.com>
3860
3861         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3862         Call Object::decompressed_section_contents.
3863         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3864         New dtor.
3865         (Sized_dwarf_line_info::buffer_start_): New data member.
3866         * merge.cc (Output_merge_data::do_add_input_section): Call
3867         Object::decompressed_section_contents.
3868         (Output_merge_string::do_add_input_section): Likewise.
3869         * object.cc (need_decompressed_section): New function.
3870         (build_compressed_section_map): Decompress sections needed later.
3871         (Sized_relobj_file::do_decompressed_section_contents): New function.
3872         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3873         * object.h (Object::decompressed_section_contents): New function.
3874         (Object::discard_decompressed_sections): New function.
3875         (Object::do_decompressed_section_contents): New function.
3876         (Object::do_discard_decompressed_sections): New function.
3877         (Compressed_section_info): New type.
3878         (Compressed_section_map): Include decompressed section contents.
3879         (Sized_relobj_file::do_decompressed_section_contents): New function.
3880         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3881
3882 2012-02-16  Cary Coutant  <ccoutant@google.com>
3883
3884         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3885         * testsuite/Makefile.in: Regenerate.
3886
3887 2012-02-14  Cary Coutant  <ccoutant@google.com>
3888
3889         * options.cc (General_options::finalize): Disallow -pie and -static.
3890
3891 2012-02-03  Doug Kwan  <dougkwan@google.com>
3892
3893         * arm.cc (Arm_relocate_functions::abs8,
3894         Arm_relocate_functions::abs16): Use
3895         Bits::has_signed_unsigned_overflow32.
3896         (Arm_relocate_functions::thm_abs8): Correct range of
3897         overflow check.
3898         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3899         in assertions.
3900
3901 2012-02-02  Doug Kwan  <dougkwan@google.com>
3902
3903         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3904         position independent outputs, not just shared objects.
3905
3906 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3907
3908         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3909         * configure: Regenerated.
3910
3911 2012-01-27  Ian Lance Taylor  <iant@google.com>
3912
3913         * reloc.h (Bits): New class with static functions, copied from
3914         namespace utils in arm.cc.
3915         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3916         instead.
3917
3918 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3919
3920         * incremental.cc (write_info_blocks): Correct relocation offset.
3921
3922 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3923
3924         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3925         (Relocate::tls_gd_to_le): Likewise.
3926
3927 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3928
3929         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3930
3931 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3932
3933         * configure.ac: Check if -mcmodel=medium works.
3934         * configure: Regenerated.
3935
3936 2012-01-24  Cary Coutant  <ccoutant@google.com>
3937
3938         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3939         definition and ...
3940         (read_unsigned_LEB_128_x): ... this new function.
3941         (read_signed_LEB_128): Replaced with inline definition and ...
3942         (read_signed_LEB_128_x): ... this new function.
3943         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3944         (read_unsigned_LEB_128): Add inline definition.
3945         (read_signed_LEB_128_x): New function.
3946         (read_signed_LEB_128): Add inline definition.
3947         * testsuite/Makefile.am (leb128_unittest): New unit test.
3948         * testsuite/Makefile.in: Regenerate.
3949         * testsuite/leb128_unittest.cc: New unit test.
3950
3951 2012-01-23  Ian Lance Taylor  <iant@google.com>
3952
3953         PR gold/13617
3954         * i386.cc (Target_i386::do_code_fill): When using a jmp
3955         instruction, pad with nop instructions.
3956         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3957
3958 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3959
3960         * x86_64.cc (gc_process_relocs): Add typename on types used in
3961         template.
3962         (scan_relocs): Likewise.
3963         (relocate_section): Likewise.
3964         (apply_relocation): Likewise.
3965
3966 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3967
3968         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3969         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3970         under x32.
3971
3972 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3973
3974         * x86_64.cc: Initial support for x32.
3975
3976 2012-01-03  Cary Coutant  <ccoutant@google.com>
3977
3978         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3979         Use abstract base class for GOT.
3980         * gold/output.h (class Output_data_got_base): New abstract base class.
3981         (class Output_data_got): Derive from new base class, adjust ctors.
3982         (Output_data_got::reserve_slot): Make virtual; rename to
3983         do_reserve_slot; Adjust callers.
3984         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3985         pointer to abstract base class.
3986         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3987
3988 2011-12-18  Ian Lance Taylor  <iant@google.com>
3989
3990         * object.h (Relobj::local_symbol_value): New function.
3991         (Relobj::local_plt_offset): New function.
3992         (Relobj::local_has_got_offset): New function.
3993         (Relobj::local_got_offset): New function.
3994         (Relobj::set_local_got_offset): New function.
3995         (Relobj::do_local_symbol_value): New pure virtual function.
3996         (Relobj::do_local_plt_offset): Likewise.
3997         (Relobj::do_local_has_got_offset): Likewise.
3998         (Relobj::do_local_got_offset): Likewise.
3999         (Relobj::do_set_local_got_offset): Likewise.
4000         (Sized_relobj::do_local_has_got_offset): Rename from
4001         local_has_got_offset.
4002         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4003         (Sized_relobj::do_set_local_got_offset): Rename from
4004         set_local_got_offset.
4005         (Sized_relobj_file::do_local_plt_offset): Rename from
4006         local_plt_offset.
4007         (Sized_relobj_file::do_local_symbol_value): New function.
4008         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4009         local_plt_offset.
4010         * output.cc (Output_data_got::Got_entry::write): Change object to
4011         Relobj.  Use local_symbol_value.
4012         (Output_data_got::add_global_with_rel): Change rel_dyn to
4013         Output_data_reloc_generic*.  Use add_global_generic.
4014         (Output_data_got::add_global_with_rela): Remove.  Change all
4015         callers to use add_global_with_rel.
4016         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4017         Output_data_reloc_generic*.  Use add_global_generic.
4018         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4019         callers to use add_global_pair_with_rel.
4020         (Output_data_got::add_local): Change object to Relobj*.
4021         (Output_data_got::add_local_plt): Likewise.
4022         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4023         change rel_dyn to Output_data_reloc_generic*.  Use
4024         add_local_generic.
4025         (Output_data_got::add_local_with_rela): Remove.  Change all
4026         callers to use all_local_with_rel.
4027         (Output_data_got::add_local_pair_with_rel): Change object to
4028         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4029         add_output_section_generic.
4030         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4031         callers to use add_local_pair_with_rel.
4032         (Output_data_got::reserve_local): Change object to Relobj*.
4033         * output.h: (class Output_data_reloc_generic): Add pure virtual
4034         declarations for add_global_generic, add_local_generic,
4035         add_output_section_generic.
4036         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4037         functions for Output_data_reloc_generic.  Update declarations for
4038         changes listed in output.cc.
4039         (class Output_data_got): Change template parameter to got_size.
4040         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4041         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4042         function.
4043         (Sized_relobj_incr::do_local_plt_offset): New function.
4044         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4045         add_global_generic.
4046
4047 2011-12-17  Cary Coutant  <ccoutant@google.com>
4048
4049         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4050         * resolve.cc (Symbol_table::resolve): Likewise.
4051         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4052         arrays.
4053         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4054
4055 2011-12-16  Ian Lance Taylor  <iant@google.com>
4056
4057         * output.h (Output_data_reloc_generic::add): Only call
4058         add_dynamic_reloc if this is a dynamic reloc section.
4059
4060 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4061
4062         PR gold/13505
4063         * target-reloc.h (apply_relocation): Replace <64, false> with
4064         <size, big_endian>.
4065
4066 2011-11-25  Nick Clifton  <nickc@redhat.com>
4067
4068         * po/it.po: New Italian translation.
4069
4070 2011-11-17  Sterling Augustine  <saugustine@google.com>
4071
4072         * script.cc (script_include_directive): Implement.
4073         (read_script_file): New local variables name and search_path. Update
4074         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4075         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4076         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4077
4078 2011-11-11  Sterling Augustine  <saugustine@google.com>
4079
4080         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4081         (file_or_sections_cmd): Likewise.
4082
4083 2011-11-11  Doug Kwan  <dougkwan@google.com>
4084
4085         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4086         if --just-symbols is given.
4087
4088 2011-11-10  Doug Kwan  <dougkwan@google.com>
4089
4090         PR gold/13362
4091         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4092         when processing data relocs.
4093         * reloc.h (Relocate_functions::rel_unaligned): New method.
4094         (Relocate_functions::pcrel_unaligned): Ditto.
4095         (Relocate_functions::rel32_unaligned): Ditto.
4096         (Relocate_functions::pcrel32_unaligned): Ditto.
4097
4098 2011-11-09  Doug Kwan  <dougkwan@google.com>
4099
4100         PR gold/13362
4101         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4102         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4103         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4104         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4105         (Relocate_functions::rel_unaligned): New.
4106         (Relocate_functions::rel32_unaligned): New.
4107         * target-reloc.h (relocate_for_relocatable): Add code to handle
4108         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4109         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4110         arm_unaligned_reloc_r): New targets.
4111         * testsuite/Makefile.in: Regenerate.
4112         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4113         linking.
4114
4115 2011-11-02  Ian Lance Taylor  <iant@google.com>
4116
4117         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4118         NATIVE_LINKER.
4119         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4120         * options.cc (General_options::finalize): Use library search path
4121         from configure script if specified.  If not native and no sysroot,
4122         only search TOOLLIBDIR.
4123         * options.h (Search_directory::Search_directory): Change name to
4124         const std::string&.
4125         (General_options::add_to_library_path_with_sysroot): Change arg to
4126         const std::string&.
4127         * configure, Makefile.in, config.in: Rebuild.
4128
4129 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4130
4131         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4132         we are working around the ARM1176 Erratum.
4133         * options.h (General_options::fix_arm1176): Add option.
4134         * testsuite/Makefile.am: Add testcases, and keep current ones
4135         working.
4136         * testsuite/Makefile.in: Regenerate.
4137         * testsuite/arm_fix_1176.s: New file.
4138         * testsuite/arm_fix_1176.sh: Likewise.
4139
4140 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4141
4142         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4143         may_use_blx_.
4144         (Target_arm::may_use_blx): Remove method.
4145         (Target_arm::set_may_use_blx): Likewise.
4146         (Target_arm::may_use_v4t_interworking): New method.
4147         (Target_arm::may_use_v5t_interworking): Likewise.
4148         (Target_arm::may_use_blx_): Remove member variable.
4149         (Arm_relocate_functions::arm_branch_common): Check for v5T
4150         interworking.
4151         (Arm_relocate_functions::thumb_branch_common): Likewise.
4152         (Reloc_stub::stub_type_for_reloc): Likewise.
4153         (Target_arm::do_finalize_sections): Correct interworking checks.
4154         * testsuite/Makefile.am: Add new tests.
4155         * testsuite/Makefile.in: Regenerate.
4156         * testsuite/arm_farcall_arm_arm.s: New test.
4157         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4158         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4159         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4160         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4161         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4162         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4163         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4164
4165 2011-10-31  Cary Coutant  <ccoutant@google.com>
4166
4167         PR gold/13023
4168         * expression.cc (Expression::eval_with_dot): Add
4169         is_section_dot_assignment parameter.
4170         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4171         absolute and assigning to dot within a section.
4172         * script-sections.cc
4173         (Output_section_element_assignment::set_section_addresses): Pass
4174         dot_section to set_if_absolute.
4175         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4176         as is_section_dot_assignment flag to eval_with_dot.
4177         (Output_section_element_dot_assignment::set_section_addresses):
4178         Likewise.
4179         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4180         parameter.  Also set value if relative to dot_section; set the
4181         symbol's output_section.
4182         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4183         parameter.  Adjust all callers.
4184         (Expression::eval_maybe_dot): Likewise.
4185         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4186         Adjust all callers.
4187         * testsuite/script_test_2.t: Test assignment of an absolute value
4188         to dot within an output section element.
4189
4190 2011-10-31  Cary Coutant  <ccoutant@google.com>
4191
4192         * options.h (class General_options): Add --[no-]gnu-unique options.
4193         * symtab.cc (Symbol_table::sized_write_globals): Convert
4194         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4195
4196 2011-10-31  Cary Coutant  <ccoutant@google.com>
4197
4198         PR gold/13359
4199         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4200         unnecessary assertion.
4201         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4202
4203 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4204
4205         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4206         gc_mark_symbol.
4207         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4208         gc_mark_symbol.
4209         Change to just keep the section associated with symbol.
4210         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4211         they are externally visible and --export-dynamic is turned on.
4212         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4213
4214 2011-10-19  Ian Lance Taylor  <iant@google.com>
4215
4216         PR gold/13163
4217         * script-sections.cc
4218         (Output_section_element_dot_assignment::needs_output_section): New
4219         function.
4220
4221 2011-10-19  Ian Lance Taylor  <iant@google.com>
4222
4223         PR gold/13204
4224         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4225         --section-start option was seen.
4226         * options.h (General_options::any_section_start): New function.
4227
4228 2011-10-18  David S. Miller  <davem@davemloft.net>
4229
4230         PR binutils/13301
4231         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4232         member to track relocation locations that have moved during TLS
4233         reloc optimizations.
4234         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4235         (Target_sparc::Relocate::relocate): Adjust view down by 4
4236         bytes if it matches reloc_adjust_addr_.
4237         (Target_sparc::Relocate::relocate_tls): Always move the
4238         __tls_get_addr call delay slot instruction forward 4 bytes when
4239         performing relaxation.
4240
4241 2011-10-18  Cary Coutant  <ccoutant@google.com>
4242
4243         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4244         (Output_file::map_no_anonymous): Check for non-zero
4245         return code from posix_fallocate.
4246
4247 2011-10-17  Cary Coutant  <ccoutant@google.com>
4248
4249         PR gold/13245
4250         * plugin.cc (is_visible_from_outside): Check for symbols
4251         referenced from dynamic objects.
4252         * resolve.cc (Symbol_table::resolve): Don't count references
4253         from dynamic objects as references from real ELF files.
4254         * testsuite/plugin_test_2.sh: Adjust expected result.
4255
4256 2011-10-17  Cary Coutant  <ccoutant@google.com>
4257
4258         * gold.cc: Include timer.h.
4259         (queue_middle_tasks): Stamp time.
4260         (queue_final_tasks): Likewise.
4261         * main.cc (main): Store timer in parameters.  Print timers
4262         for each pass.
4263         * parameters.cc (Parameters::Parameters): Initialize timer_.
4264         (Parameters::set_timer): New function.
4265         (set_parameters_timer): New function.
4266         * parameters.h (Parameters::set_timer): New function.
4267         (Parameters::timer): New function.
4268         (Parameters::timer_): New data member.
4269         (set_parameters_timer): New function.
4270         * timer.cc (Timer::stamp): New function.
4271         (Timer::get_pass_time): New function.
4272         * timer.h (Timer::stamp): New function.
4273         (Timer::get_pass_time): New function.
4274         (Timer::pass_times_): New data member.
4275
4276 2011-10-17  Cary Coutant  <ccoutant@google.com>
4277
4278         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4279         task for members of lib groups.
4280
4281 2011-10-17  Cary Coutant  <ccoutant@google.com>
4282
4283         PR gold/13288
4284         * fileread.cc (File_read::find_view): Add assert.
4285         (File_read::make_view): Move bounds check (replace with assert)...
4286         (File_read::find_or_make_view): ... to here.
4287
4288 2011-10-12  Cary Coutant  <ccoutant@google.com>
4289
4290         * output.cc (Output_file::open_base_file): Handle case where
4291         ::read returns less than requested size.
4292
4293 2011-10-10  Cary Coutant  <ccoutant@google.com>
4294
4295         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4296         Initialize defined_count_.
4297         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4298         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4299         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4300         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4301         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4302         * incremental.h (Sized_relobj_incr::defined_count_): New data
4303         member.
4304         (Sized_incr_dynobj::defined_count_): New data member.
4305         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4306         Return zeroes instead of internal error.
4307
4308 2011-10-10  Cary Coutant  <ccoutant@google.com>
4309
4310         PR gold/13249
4311         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4312         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4313         * output.h (class Output_reloc): Add use_plt_offset flag.
4314         (Output_reloc::type_): Adjust size of bit field.
4315         (Output_reloc::use_plt_offset_): New bit field.
4316         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4317         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4318         flag.  Adjust all callers.
4319         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4320         creating RELATIVE relocations.
4321
4322 2011-10-10  Nick Clifton  <nickc@redhat.com>
4323
4324         * po/es.po: Updated Spanish translation.
4325         * po/fi.po: Updated Finnish translation.
4326
4327 2011-10-03   Diego Novillo  <dnovillo@google.com>
4328
4329         * options.cc (parse_uint): Fix dereference of RETVAL.
4330
4331 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4332
4333         * layout.h (section_order_map_): New member.
4334         (get_section_order_map): New member function.
4335         * output.cc (Output_section::add_input_section): Check for patterns
4336         only when --section-ordering-file is specified.
4337         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4338         output_sections have been formed.
4339         * layout.cc (Layout_Layout): Initialize section_order_map_.
4340         * plugin.cc (update_section_order): Store order in order_map. Do not
4341         update the order.
4342         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4343         * testsuite/Makefile.in: Regenerate.
4344         * testsuite/plugin_section_order.c: New file.
4345         * testsuite/plugin_final_layout.cc: New file.
4346         * testsuite/plugin_final_layout.sh: New file.
4347
4348 2011-09-29  Cary Coutant  <ccoutant@google.com>
4349
4350         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4351         Check for NULL.
4352         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4353         symbols during incremental update.
4354         (Symbol_table::add_from_dynobj): Likewise.
4355
4356 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4357             Ian Lance Taylor  <iant@google.com>
4358
4359         * symtab.cc (Symbol_table::define_special_symbol): Always
4360         canonicalize version string.
4361
4362 2011-09-26  Cary Coutant  <ccoutant@google.com>
4363
4364         * gold.cc (queue_initial_tasks): Move option checks ...
4365         * options.cc (General_options::finalize): ... to here. Disable
4366         some options; make others fatal.
4367
4368 2011-09-26  Cary Coutant  <ccoutant@google.com>
4369
4370         gcc PR lto/47247
4371         * plugin.cc (get_symbols_v2): New function.
4372         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4373         (is_referenced_from_outside): New function.
4374         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4375         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4376         (get_symbols): Pass version parameter.
4377         (get_symbols_v2): New function.
4378         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4379         parameter.
4380         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4381         (onload): Add LDPT_GET_SYMBOLS_V2.
4382         (all_symbols_read_hook): Use get_symbols_v2; check for
4383         LDPR_PREVAILING_DEF_IRONLY_EXP.
4384         * testsuite/plugin_test_3.sh: Update expected results.
4385
4386 2011-09-23  Simon Baldwin  <simonb@google.com>
4387
4388         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4389         configuration options.
4390         * configure: Regenerate.
4391         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4392         * Makefile.in: Regenerate.
4393         * testsuite/Makefile.in: Regenerate.
4394
4395 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4396
4397         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4398
4399 2011-09-19  Cary Coutant  <ccoutant@google.com>
4400
4401         * incremental.cc (can_incremental_update): Fix typo in comment.
4402         * incremental.h (can_incremental_update): Likewise.
4403
4404 2011-09-18  Cary Coutant  <ccoutant@google.com>
4405
4406         * incremental.cc (can_incremental_update): New function.
4407         * incremental.h (can_incremental_update): New function.
4408         * layout.cc (Layout::init_fixed_output_section): Call it.
4409         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4410         * object.cc (Sized_relobj_file::do_layout): Call
4411         can_incremental_update.
4412
4413 2011-09-13  Cary Coutant  <ccoutant@google.com>
4414
4415         * configure.ac: Check for glibc support for gnu_indirect_function
4416         support with static linking, setting automake conditional
4417         IFUNC_STATIC.
4418         * Makefile.in: Regenerate.
4419         * configure: Regenerate.
4420
4421         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4422         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4423         for IFUNC_STATIC.
4424         * testsuite/Makefile.in: Regenerate.
4425
4426 2011-09-13  Cary Coutant  <ccoutant@google.com>
4427
4428         * incremental.cc (Sized_relobj_incr::do_layout): Call
4429         report_comdat_group for kept comdat sections.
4430         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4431         * testsuite/Makefile.in: Regenerate.
4432         * testsuite/incr_comdat_test_1.cc: New source file.
4433         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4434         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4435         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4436
4437 2011-09-13  Ian Lance Taylor  <iant@google.com>
4438
4439         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4440         variable external_symbols_offset.
4441
4442 2011-09-12  Ian Lance Taylor  <iant@google.com>
4443
4444         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4445         triggered if object has no symbols.
4446
4447 2011-09-09  David S. Miller  <davem@davemloft.net>
4448
4449         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4450         (Output_fill_debug_line::do_write): Likewise.
4451
4452 2011-08-29  Cary Coutant  <ccoutant@google.com>
4453
4454         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4455         casts to match formatting specs.
4456         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4457
4458 2011-08-26  Cary Coutant  <ccoutant@google.com>
4459
4460         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4461         remaining hole size when allocating.
4462         (Layout::make_output_section): Set fill methods for debug sections.
4463         * layout.h (Free_list::Free_list_node): Move from private to
4464         public.
4465         (Free_list::set_min_hole_size): New function.
4466         (Free_list::begin, Free_list::end): New functions.
4467         (Free_list::min_hole_): New data member.
4468         * output.cc: Include dwarf.h.
4469         (Output_fill_debug_info::do_minimum_hole_size): New function.
4470         (Output_fill_debug_info::do_write): New function.
4471         (Output_fill_debug_line::do_minimum_hole_size): New function.
4472         (Output_fill_debug_line::do_write): New function.
4473         (Output_section::Output_section): Initialize new data member.
4474         (Output_section::set_final_data_size): Ensure patch space is larger
4475         than minimum hole size.
4476         (Output_section::do_write): Fill holes in debug sections.
4477         * output.h (Output_fill): New class.
4478         (Output_fill_debug_info): New class.
4479         (Output_fill_debug_line): New class.
4480         (Output_section::set_free_space_fill): New function.
4481         (Output_section::free_space_fill_): New data member.
4482         * testsuite/Makefile.am (incremental_test_3): Add
4483         --incremental-patch option.
4484         (incremental_test_4): Likewise.
4485         (incremental_test_5): Likewise.
4486         (incremental_test_6): Likewise.
4487         (incremental_copy_test): Likewise.
4488         (incremental_common_test_1): Likewise.
4489         * testsuite/Makefile.in: Regenerate.
4490
4491 2011-08-26  Nick Clifton  <nickc@redhat.com>
4492
4493         * po/es.po: Updated Spanish translation.
4494
4495 2011-08-01  Cary Coutant  <ccoutant@google.com>
4496
4497         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4498         * gold/testsuite/Makefile.in: Regenerate.
4499         * gold/testsuite/justsyms_exec.c: New source file.
4500         * gold/testsuite/justsyms_lib.c: New source file.
4501
4502 2011-08-01  Cary Coutant  <ccoutant@google.com>
4503
4504         * layout.cc (Layout::set_segment_offsets): Don't realign text
4505         segment if -Ttext was specified.
4506         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4507         file type.
4508         * object.h (Sized_relobj_file::e_type): New function.
4509         (Sized_relobj_file::e_type_): New data member.
4510         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4511         base address for ET_EXEC files.
4512         * target.cc (Target::do_make_elf_object_implementation): Allow
4513         ET_EXEC files with --just-symbols option.
4514
4515 2011-07-28  Cary Coutant  <ccoutant@google.com>
4516
4517         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4518         Add thread_number parameter.
4519         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4520         * workqueue-threads.cc
4521         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4522         current thread if its thread number is greater than desired thread
4523         count.
4524         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4525         Add thread_number parameter.
4526         (Workqueue::should_cancel_thread): Likewise.
4527         (Workqueue::find_runnable_or_wait): Pass thread_number to
4528         should_cancel_thread.
4529         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4530         parameter.
4531
4532 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4533
4534         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4535         only after checking if it cannot be forced local.
4536         * symtab.h (is_externally_visible): Check if the symbol is not forced
4537         local.
4538
4539 2011-07-15  Ian Lance Taylor  <iant@google.com>
4540
4541         * options.h (class General_options): Add --print-output-format.
4542         Move -EL next to -EB, for  better --help output.
4543         * target-select.cc: Include <cstdio>, "options.h", and
4544         "parameters.h".
4545         (Target_selector::do_target_bfd_name): New function.
4546         (print_output_format): New function.
4547         * target-select.h (class Target_selector): Update declarations.
4548         (Target_selector::target_bfd_name): New function.
4549         (print_output_format): Declare.
4550         * main.cc: Include "target-select.h".
4551         (main): Handle --print-output-format.
4552         * gold.cc: Include "target-select.h".
4553         (queue_initial_tasks): Handle --print-output-format when there are
4554         no input files.
4555         * parameters.cc (parameters_force_valid_target): Give a better
4556         error message if -EB/-EL does not match target.
4557         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4558         function.
4559
4560 2011-07-15  Ian Lance Taylor  <iant@google.com>
4561
4562         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4563         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4564         (Output_data_plt_i386::do_write): Write address of .dynamic
4565         section to first entry in .got.plt section.
4566         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4567         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4568         Initialize layout_.
4569         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4570         section to first entry in .got.plt section.
4571         * layout.h (Layout::dynamic_section): New function.
4572
4573 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4574
4575         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4576         to claim_file call.
4577         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4578         input_section_position_, and input_section_glob_.
4579         (read_layout_from_file): Call function section_ordering_specified.
4580         * layout.h (is_section_ordering_specified): New function.
4581         (section_ordering_specified): New function.
4582         (section_ordering_specified_): New boolean member.
4583         * main.cc(main): Call load_plugins after layout object is defined.
4584         * output.cc (Output_section::add_input_section): Use
4585         function section_ordering_specified to check if section ordering is
4586         needed.
4587         * output.cc (Output_section::add_relaxed_input_section): Use
4588         function section_ordering_specified to check if section ordering is
4589         needed.
4590         (Output_section::update_section_layout): New function.
4591         (Output_section::sort_attached_input_sections): Check if input section
4592         must be reordered.
4593         * output.h (Output_section::update_section_layout): New function.
4594         * plugin.cc (get_section_count): New function.
4595         (get_section_type): New function.
4596         (get_section_name): New function.
4597         (get_section_contents): New function.
4598         (update_section_order): New function.
4599         (allow_section_ordering): New function.
4600         (Plugin::load): Add the new interfaces to the transfer vector.
4601         (Plugin_manager::load_plugins): New parameter.
4602         (Plugin_manager::all_symbols_read): New parameter.
4603         (Plugin_manager::claim_file): New parameter. Save the elf object for
4604         unclaimed objects.
4605         (Plugin_manager::get_elf_object): New function.
4606         (Plugin_manager::get_view): Change to directly use the bool to check
4607         if get_view is called from claim_file_hook.
4608         * plugin.h (input_objects): New function
4609         (Plugin__manager::load_plugins): New parameter.
4610         (Plugin_manager::claim_file): New parameter.
4611         (Plugin_manager::get_elf_object): New function.
4612         (Plugin_manager::in_claim_file_handler): New function.
4613         (Plugin_manager::in_claim_file_handler_): New member.
4614         (layout): New function.
4615         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4616         handler with an extra parameter. Make the elf object before calling
4617         claim_file handler.
4618         * testsuite/plugin_test.c (get_section_count): New function pointer.
4619         (get_section_type): New function pointer.
4620         (get_section_name): New function pointer.
4621         (get_section_contents): New function pointer.
4622         (update_section_order): New function pointer.
4623         (allow_section_ordering): New function pointer.
4624         (onload): Check if the new interfaces exist.
4625
4626 2011-07-13  Ian Lance Taylor  <iant@google.com>
4627
4628         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4629         relro section.
4630         * x86_64.cc (Target_x86_64::got_section): Likewise.
4631         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4632         (relro_now_test_SOURCES): New variable.
4633         (relro_now_test_DEPENDENCIES): New variable.
4634         (relro_now_test_LDFLAGS): New variable.
4635         (relro_now_test_LDADD): New variable.
4636         (relro_now_test.so): New target.
4637         * testsuite/Makefile.in: Rebuild.
4638
4639 2011-07-12  Ian Lance Taylor  <iant@google.com>
4640
4641         PR gold/12980
4642         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4643         GLOB_DAT relocation rather than a RELATIVE relocation for a
4644         protected symbol when creating a shared library.
4645         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4646         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4647         * testsuite/protected_main_1.cc (main): Test that protected
4648         function has same address.
4649
4650 2011-07-11  Ian Lance Taylor  <iant@google.com>
4651
4652         PR gold/12979
4653         * options.h (class General_options): Add -Bgroup.
4654         * options.cc (General_options::finalize): If -Bgroup is set,
4655         default to --unresolved-symbols=report-all.
4656         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4657         * target-reloc.h (issue_undefined_symbol_error): Handle
4658         --unresolved-symbols=report-all.
4659
4660 2011-07-08  Ian Lance Taylor  <iant@google.com>
4661
4662         PR gold/11985
4663         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4664         if linker script discards key sections.
4665         (Layout::create_dynamic_symtab): Likewise.
4666         (Layout::assign_local_dynsym_offsets): Likewise.
4667         (Layout::sized_create_version_sections): Likewise.
4668         (Layout::create_interp): Likewise.
4669         (Layout::finish_dynamic_section): Likewise.
4670         (Layout::set_dynamic_symbol_size): Likewise.
4671
4672 2011-07-08  Ian Lance Taylor  <iant@google.com>
4673
4674         PR gold/12386
4675         * options.h (class General_options): Add --unresolved-symbols.
4676         * target-reloc.h (issue_undefined_symbol_error): Check
4677         --unresolved-symbols.  Add comments.
4678
4679 2011-07-08  Ian Lance Taylor  <iant@google.com>
4680
4681         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4682         expression more complex.
4683
4684 2011-07-08  Ian Lance Taylor  <iant@google.com>
4685
4686         PR gold/11317
4687         * target-reloc.h (issue_undefined_symbol_error): New inline
4688         function, broken out of relocate_section.
4689         (relocate_section): Call issue_undefined_symbol_error.
4690         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4691         there is no TLS segment if we are about to issue an undefined
4692         symbol error.
4693         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4694
4695 2011-07-08  Ian Lance Taylor  <iant@google.com>
4696
4697         PR gold/12279
4698         * resolve.cc (Symbol_table::should_override): Add fromtype
4699         parameter.  Change all callers.  Give error when linking together
4700         TLS and non-TLS symbol.
4701         (Symbol_table::should_override_with_special): Add fromtype
4702         parameter.  Change all callers.
4703         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4704         there is no TLS segment if we have reported some errors.
4705         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4706
4707 2011-07-08  Ian Lance Taylor  <iant@google.com>
4708
4709         PR gold/12372
4710         * target.h (Target::plt_address_for_global): New function.
4711         (Target::plt_address_for_local): New function.
4712         (Target::plt_section_for_global): Remove.
4713         (Target::plt_section_for_local): Remove.
4714         (Target::do_plt_address_for_global): New virtual function.
4715         (Target::do_plt_address_for_local): New virtual function.
4716         (Target::do_plt_section_for_global): Remove.
4717         (Target::do_plt_section_for_local): Remove.
4718         (Target::register_global_plt_entry): Add Symbol_table and Layout
4719         parameters.
4720         * output.cc (Output_data_got::Got_entry::write): Use
4721         plt_address_for_global and plt_address_for_local.
4722         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4723         address of output section.
4724         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4725         got_irelative_, and irelative_count_ fields.  Update
4726         declarations.
4727         (Output_data_plt_i386::has_irelative_section): New function.
4728         (Output_data_plt_i386::entry_count): Add irelative_count_.
4729         (Output_data_plt_i386::set_final_data_size): Likewise.
4730         (class Target_i386): Add got_irelative_ and rel_irelative_
4731         fields.  Update declarations.
4732         (Target_i386::Target_i386): Initialize new fields.
4733         (Target_i386::do_plt_address_for_global): New function replacing
4734         do_plt_section_for_global.
4735         (Target_i386::do_plt_address_for_local): New function replacing
4736         do_plt_section_for_local.
4737         (Target_i386::got_section): Create got_irelative_.
4738         (Target_i386::rel_irelative_section): New function.
4739         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4740         fields.  Don't define __rel_iplt_{start,end}.
4741         (Output_data_plt_i386::add_entry): Add symtab and layout
4742         parameters.  Change all callers.  Use different PLT and GOT for
4743         IFUNC symbols.
4744         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4745         layout parameters.  Change all callers.  Use different PLT and
4746         GOT.
4747         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4748         (Output_data_plt_i386::rel_irelative): New function.
4749         (Output_data_plt_i386::address_for_global): New function.
4750         (Output_data_plt_i386::address_for_local): New function.
4751         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4752         IRELATIVE GOT when changing IFUNC GOT entries.
4753         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4754         reloc.
4755         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4756         if we didn't create an IRELATIVE GOT.
4757         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4758         plt_address_for_local.
4759         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4760         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4761         got_irelative_, and irelative_count_ fields.  Update
4762         declarations.
4763         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4764         Initialize new fields.  Remove symtab parameter.  Change all
4765         callers.
4766         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4767         irelative_count_.
4768         (Output_data_plt_x86_64::has_irelative_section): New function.
4769         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4770         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4771         fields.  Update declarations.
4772         (Target_x86_64::Target_x86_64): Initialize new fields.
4773         (Target_x86_64::do_plt_address_for_global): New function replacing
4774         do_plt_section_for_global.
4775         (Target_x86_64::do_plt_address_for_local): New function replacing
4776         do_plt_section_for_local.
4777         (Target_x86_64::got_section): Create got_irelative_.
4778         (Target_x86_64::rela_irelative_section): New function.
4779         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4780         all callers.  Don't create __rel_iplt_{start,end}.
4781         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4782         parameters.  Change all callers.  Use different PLT and GOT for
4783         IFUNC symbols.
4784         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4785         layout parameters.  Change all callers.  Use different PLT and
4786         GOT.
4787         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4788         parameters.  Change all callers.  Use different PLT and GOT for
4789         IFUNC symbols.
4790         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4791         (Output_data_plt_x86_64::rela_irelative): New function.
4792         (Output_data_plt_x86_64::address_for_global): New function.
4793         (Output_data_plt_x86_64::address_for_local): New function.
4794         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4795         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4796         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4797         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4798         parameters.
4799         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4800         reloc.
4801         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4802         symbols if we didn't create an IRELATIVE GOT.
4803         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4804         plt_address_for_local.
4805         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4806         * testsuite/ifuncvar1.c: New test file.
4807         * testsuite/ifuncvar2.c: New test file.
4808         * testsuite/ifuncvar3.c: New test file.
4809         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4810         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4811         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4812         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4813         * testsuite/Makefile.in: Rebuild.
4814
4815 2011-07-07  Cary Coutant  <ccoutant@google.com>
4816
4817         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4818         (two_file_test_1_ndebug.o): Likewise.
4819         (two_file_test_1b_ndebug.o): Likewise.
4820         (two_file_test_2_ndebug.o): Likewise.
4821         (two_file_test_main_ndebug.o): Likewise.
4822         (incremental_test_2): Link with no-debug versions.
4823
4824 2011-07-06  Cary Coutant  <ccoutant@google.com>
4825
4826         * gold/incremental.cc
4827         (Output_section_incremental_inputs::write_info_blocks): Check for
4828         hidden and internal symbols.
4829
4830 2011-07-06  Cary Coutant  <ccoutant@google.com>
4831
4832         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4833         Check disposition for startup file.
4834         (Incremental_inputs::report_command_line): Ignore
4835         --incremental-startup-unchanged option.
4836         * options.cc (General_options::parse_incremental_startup_unchanged):
4837         New function.
4838         (General_options::General_options): Initialize new data member.
4839         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4840         (General_options): Add --incremental-startup-unchanged option.
4841         (General_options::incremental_startup_disposition): New function.
4842         (General_options::incremental_startup_disposition_): New data member.
4843
4844 2011-07-06  Cary Coutant  <ccoutant@google.com>
4845
4846         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4847         input file index to Script_info ctor.
4848         (Sized_incremental_binary::do_file_has_changed): Find the
4849         command-line argument for files named in scripts.
4850         * incremental.h (Script_info::Script_info): New ctor
4851         with input file index.
4852         (Script_info::input_file_index): New function.
4853         (Script_info::input_file_index_): New data member.
4854         (Incremental_binary::get_library): Add const.
4855         (Incremental_binary::get_script_info): Add const.
4856         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4857         * testsuite/Makefile.am (incremental_test_5): New test case.
4858         (incremental_test_6): New test case.
4859         * testsuite/Makefile.in: Regenerate.
4860
4861 2011-07-06  Cary Coutant  <ccoutant@google.com>
4862
4863         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4864         debug output when command lines differ.
4865
4866 2011-07-06  Cary Coutant  <ccoutant@google.com>
4867
4868         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4869         --incremental-patch option.
4870         * layout.cc (Free_list::allocate): Extend allocation beyond original
4871         end if enabled.
4872         (Layout::make_output_section): Mark sections that should get
4873         patch space.
4874         * options.cc (parse_percent): New function.
4875         * options.h (parse_percent): New function.
4876         (DEFINE_percent): New macro.
4877         (General_options): Add --incremental-patch option.
4878         * output.cc (Output_section::Output_section): Initialize new data
4879         members.
4880         (Output_section::add_input_section): Print section name when out
4881         of patch space.
4882         (Output_section::add_output_section_data): Likewise.
4883         (Output_section::set_final_data_size): Add patch space when
4884         doing --incremental-full.
4885         (Output_section::do_reset_address_and_file_offset): Remove patch
4886         space.
4887         (Output_segment::set_section_list_addresses): Print debug output
4888         only if --incremental-update.
4889         * output.h (Output_section::set_is_patch_space_allowed): New function.
4890         (Output_section::is_patch_space_allowed_): New data member.
4891         (Output_section::patch_space_): New data member.
4892         * parameters.cc (Parameters::incremental_full): New function.
4893         * parameters.h (Parameters::incremental_full): New function
4894         * testsuite/Makefile.am (incremental_test_2): Add test for
4895         --incremental-patch option.
4896         * testsuite/Makefile.in: Regenerate.
4897         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4898         (t18): Remove function body.
4899
4900 2011-07-05  Doug Kwan  <dougkwan@google.com>
4901
4902         PR gold/12771
4903         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4904         Arm_Address type for relocation result.
4905         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4906         overflow check.
4907         (Arm_relocate_functions::abs32): Use unaligned access.
4908         (Arm_relocate_functions::rel32): Ditto.
4909         (Arm_relocate_functions::prel31): Ditto.
4910         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4911         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4912         static data relocations.
4913         * testsuite/Makefile.in: Regnerate.
4914         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4915
4916 2011-07-05  Ian Lance Taylor  <iant@google.com>
4917
4918         PR gold/12392
4919         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4920         symbols if necessary.
4921         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4922
4923 2011-07-05  Ian Lance Taylor  <iant@google.com>
4924
4925         PR gold/12952
4926         * resolve.cc (Symbol::override_base_with_special): Simply override
4927         version with special symbol version, ignoring previous version.
4928
4929 2011-07-05  Ian Lance Taylor  <iant@google.com>
4930
4931         * object.cc (Sized_relobj_file::include_section_group): Add
4932         information to comment about signature location.
4933
4934 2011-07-02  Ian Lance Taylor  <iant@google.com>
4935
4936         PR gold/12957
4937         * options.h (class General_options): Add -f and -F.
4938         * options.cc (General_options::finalize): Fatal error if -f/-F
4939         are used without -shared.
4940         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4941
4942 2011-07-02  Ian Lance Taylor  <iant@google.com>
4943
4944         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4945
4946 2011-07-01  Ian Lance Taylor  <iant@google.com>
4947
4948         PR gold/12525
4949         PR gold/12952
4950         * resolve.cc (Symbol::override_base_with_special): Don't override
4951         the version if the overriding symbol has a different name.
4952         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4953         all callers.  If we give an error about an undefined version,
4954         define the base version if necessary.
4955         * dynobj.h (class Versions): Update declaration.
4956         * testsuite/weak_alias_test_5.cc: New file.
4957         * testsuite/weak_alias_test.script: New file.
4958         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4959         and versioned_alias have the right value, and call t2.
4960         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4961         weak_alias_test_5.so.
4962         (weak_alias_test_LDADD): Likewise.
4963         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4964         * testsuite/Makefile.in: Rebuild.
4965
4966 2011-07-01  Ian Lance Taylor  <iant@google.com>
4967
4968         PR gold/12525
4969         * options.h (class General_options): Support -z notext.
4970         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4971         -Wl,-z,notext.
4972         (two_file_shared_nonpic.so): Likewise.
4973         (two_file_shared_mixed.so): Likewise.
4974         (two_file_shared_mixed_1.so): Likewise.
4975         (weak_undef_lib_nonpic.so): Likewise.
4976         (alt/weak_undef_lib_nonpic.so): Likewise.
4977         (tls_test_shared_nonpic.so): Likewise.
4978         * testsuite/Makefile.in: Rebuild.
4979
4980 2011-07-01  Ian Lance Taylor  <iant@google.com>
4981
4982         PR gold/12525
4983         * configure.ac: Test whether static linking works, setting
4984         the automake conditional HAVE_STATIC.
4985         * testsuite/Makefile.am: Disable tests using -static if
4986         HAVE_STATIC is not true.
4987         * configure, testsuite/Makefile.in: Rebuild.
4988
4989 2011-07-01  Ian Lance Taylor  <iant@google.com>
4990
4991         PR gold/12525
4992         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4993         Assert if we see DW_EH_PE_indirect.
4994         * target.h (Target::ehframe_datarel_base): New function.
4995         (Target::do_ehframe_datarel_base): New target function.
4996         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4997         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4998         function.
4999
5000 2011-07-01  Ian Lance Taylor  <iant@google.com>
5001
5002         PR gold/12571
5003         * options.h (class General_options): Add
5004         --ld-generated-unwind-info.
5005         * ehframe.cc (Fde::write): Add address parameter.  Change all
5006         callers.  If associated with PLT, fill in address and size.
5007         (Cie::set_output_offset): Only add merge mapping if there is an
5008         object.
5009         (Cie::write): Add address parameter.  Change all callers.
5010         (Eh_frame::add_ehframe_for_plt): New function.
5011         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5012         input_offset_ fields into union u_, with new plt field.
5013         (Fde::Fde): Adjust for new union field.
5014         (Fde::Fde) [Output_data version]: New constructor.
5015         (Fde::add_mapping): Only add merge mapping if there is an object.
5016         (class Cie): Update declarations.
5017         (class Eh_frame): Declare add_ehframe_for_plt.
5018         * layout.cc (Layout::layout_eh_frame): Break out code into
5019         make_eh_frame_section, and call it.
5020         (Layout::make_eh_frame_section): New function.
5021         (Layout::add_eh_frame_for_plt): New function.
5022         * layout.h (class Layout): Update declarations.
5023         * merge.cc (Merge_map::add_mapping): Add assertion.
5024         * i386.cc: Include "dwarf.h".
5025         (class Output_data_plt_i386): Make first_plt_entry,
5026         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5027         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5028         and plt_eh_frame_fde.
5029         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5030         boundary.  Call add_eh_frame_for_plt if appropriate.
5031         * x86_64.cc: Include "dwarf.h".
5032         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5033         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5034         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5035         and plt_eh_frame_fde.
5036         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5037         appropriate.
5038
5039 2011-06-29  Ian Lance Taylor  <iant@google.com>
5040
5041         PR gold/12629
5042         * object.cc (Sized_relobj_file::layout_section): Change shdr
5043         parameter to be const.
5044         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5045         out of do_layout.
5046         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5047         appropriate.  Call layout_eh_frame_section.
5048         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5049         sections.
5050         * object.h (class Sized_relobj_file): Update declarations.
5051
5052 2011-06-29  Ian Lance Taylor  <iant@google.com>
5053
5054         PR gold/12652
5055         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5056         modifier.
5057         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5058
5059 2011-06-29  Ian Lance Taylor  <iant@google.com>
5060
5061         PR gold/12675
5062         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5063         SHT_X86_64_UNWIND.
5064         * layout.cc (Layout::layout_eh_frame): Likewise.
5065
5066 2011-06-29  Ian Lance Taylor  <iant@google.com>
5067
5068         PR gold/12695
5069         * layout.cc (Layout::symtab_section_shndx): New function.
5070         * layout.h (class Layout): Declare symtab_section_shndx.
5071         * output.cc (Output_section::write_header): Call it.
5072
5073 2011-06-29  Ian Lance Taylor  <iant@google.com>
5074
5075         PR gold/12818
5076         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5077         symbols which are not used in a relocation.
5078
5079 2011-06-28  Ian Lance Taylor  <iant@google.com>
5080
5081         PR gold/12898
5082         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5083         script create indistinguishable segments.
5084         (Layout::set_segment_offsets): Use stable_sort when sorting
5085         segments.  Pass this to Compare_segments constructor.
5086         * layout.h (class Layout): Make segment_precedes non-static.
5087         (class Compare_segments): Change from struct to class.  Add
5088         layout_ field.  Add constructor.
5089         * script-sections.cc
5090         (Script_sections::attach_sections_using_phdrs_clause): Rename
5091         local orphan to is_orphan.  Don't report failure to put empty
5092         section in segment.  On attachment failure, report name of
5093         section, and attach to first PT_LOAD segment.
5094
5095 2011-06-28  Ian Lance Taylor  <iant@google.com>
5096
5097         PR gold/12934
5098         * target-select.cc (Target_selector::Target_selector): Add
5099         emulation parameter.  Change all callers.
5100         (select_target_by_bfd_name): Rename from select_target_by_name.
5101         Change all callers.
5102         (select_target_by_emulation): New function.
5103         (supported_emulation_names): New function.
5104         * target-select.h (class Target_selector): Add emulation_ field.
5105         Update declarations.
5106         (Target_selector::recognize_by_bfd_name): Rename from
5107         recognize_by_name.  Change all callers.
5108         (Target_selector::supported_bfd_names): Rename from
5109         supported_names.  Change all callers.
5110         (Target_selector::recognize_by_emulation): New function.
5111         (Target_selector::supported_emulations): New function.
5112         (Target_selector::emulation): New function.
5113         (Target_selector::do_recognize_by_bfd_name): Rename from
5114         do_recognize_by_name.  Change all callers.
5115         (Target_selector::do_supported_bfd_names): Rename from
5116         do_supported_names.  Change all callers.
5117         (Target_selector::do_recognize_by_emulation): New function.
5118         (Target_selector::do_supported_emulations): New function.
5119         (select_target_by_bfd_name): Change name in declaration.
5120         (select_target_by_emulation): Declare.
5121         (supported_emulation_names): Declare.
5122         * parameters.cc (parameters_force_valid_target): Try to find
5123         target based on emulation from -m option.
5124         * options.h (class General_options): Change doc string for -m.
5125         * options.cc (help): Print emulations.
5126         (General_options::parse_V): Likewise.
5127         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5128         Add emulation parameter.  Change all callers.
5129
5130 2011-06-28  Ian Lance Taylor  <iant@google.com>
5131
5132         * target.h (class Target): Add osabi_ field.
5133         (Target::osabi): New function.
5134         (Target::set_osabi): New function.
5135         (Target::Target): Initialize osabi_.
5136         (Target::do_adjust_elf_header): Make pure virtual.
5137         (Sized_target::do_adjust_elf_header): Declare.
5138         * target.cc (Sized_target::do_adjust_elf_header): New function.
5139         (class Sized_target): Instantiate all versions.
5140         * freebsd.h (class Target_freebsd): Remove.
5141         (Target_selector_freebsd::do_recognize): Call set_osabi on
5142         Target.
5143         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5144         (Target_selector_freebsd::set_osabi): Remove.
5145         * i386.cc (class Target_i386): Inherit from Sized_target rather
5146         than Target_freebsd.
5147         * x86_64.cc (class Target_x86_64): Likewise.
5148
5149 2011-06-28  Ian Lance Taylor  <iant@google.com>
5150
5151         * target.h (Target::can_check_for_function_pointers): Rewrite.
5152         Make non-virtual.
5153         (Target::can_icf_inline_merge_sections): Likewise.
5154         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5155         (Target::Target_info): Add can_icf_inline_merge_sections field.
5156         (Target::do_can_check_for_function_pointers): New virtual
5157         function.
5158         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5159         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5160         from can_check_for_function_pointers, move in file.
5161         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5162         section_may_have_icf_unsafe_poineters, move in file.
5163         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5164         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5165         Rename from can_check_for_function_pointers, move in file.
5166         (Target_i386::can_icf_inline_merge_sections): Remove.
5167         (Target_i386::i386_info): Initialize
5168         can_icf_inline_merge_sections.
5169         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5170         Initialize can_icf_inline_merge_sections.
5171         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5172         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5173         Rename from can_check_for_function_pointers, move in file.
5174         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5175         (Target_x86_64::x86_64_info): Initialize
5176         can_icf_inline_merge_sections.
5177         * testsuite/testfile.cc (Target_test::test_target_info):
5178         Likewise.
5179         * icf.cc (get_section_contents): Correct formatting.
5180
5181 2011-06-27  Ian Lance Taylor  <iant@google.com>
5182
5183         * symtab.cc (Symbol::versioned_name): New function.
5184         (Symbol_table::add_to_final_symtab): Use versioned_name when
5185         appropriate.
5186         (Symbol_table::sized_write_symbol): Likewise.
5187         * symtab.h (class Symbol): Declare versioned_name.
5188         * stringpool.h (class Stringpool_template): Add variant of add
5189         which takes a std::basic_string.
5190         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5191         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5192         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5193         (ver_test_12.o): New target.
5194         * testsuite/Makefile.in: Rebuild.
5195
5196 2011-06-27  Doug Kwan  <dougkwan@google.com>
5197
5198         * arm.cc (Arm_relocate_functions::thm_jump8,
5199         Arm_relocate_functions::thm_jump11): Use a wider signed
5200         type to compute offset.
5201         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5202         arm_thm_jump8.
5203         * testsuite/Makefile.in: Regenerate.
5204         * testsuite/arm_branch_in_range.sh: Check test results of
5205         arm_thm_jump11 and arm_thm_jump8.
5206         * testsuite/arm_thm_jump11.s: New test source file.
5207         * testsuite/arm_thm_jump11.t: New linker script.
5208         * testsuite/arm_thm_jump8.s: New test source file.
5209         * testsuite/arm_thm_jump8.t: New linker script.
5210
5211 2011-06-24  Ian Lance Taylor  <iant@google.com>
5212
5213         * layout.cc: Include "object.h".
5214         (ctors_sections_in_init_array): New static variable.
5215         (Layout::is_ctors_in_init_array): New function.
5216         (Layout::layout): Add entry to ctors_sections_in_init_array if
5217         appropriate.
5218         * layout.h (class Layout): Declare is_ctors_in_init_array.
5219         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5220         is_ctors_reverse_view is set.
5221         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5222         all callers.  Set is_ctors_reverse_view field of View_size.
5223         (Sized_relobj_file::reverse_words): New function.
5224         * object.h (Sized_relobj_file::View_size): Add
5225         is_ctors_reverse_view field.
5226         (class Sized_relobj_file): Update declarations.
5227         * testsuite/initpri3.c: New test.
5228         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5229         initpri3b.
5230         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5231         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5232         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5233         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5234         * testsuite/Makefile.in: Rebuild.
5235
5236 2011-06-24  Cary Coutant  <ccoutant@google.com>
5237
5238         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5239         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5240         (debug_msg_cdebug.err): New targets.
5241         * testsuite/Makefile.in: Regenerate.
5242         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5243         Fix checks for link with shared library.
5244
5245 2011-06-24  Doug Kwan  <dougkwan@google.com>
5246
5247         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5248         skip empty text sections.
5249         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5250
5251 2011-06-22  Ian Lance Taylor  <iant@google.com>
5252
5253         PR gold/12910
5254         * options.h (class General_options): Add --ctors-in-init-array.
5255         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5256         friends as SHT_PROGBITS for merging sections.
5257         (Layout::layout): Remove special handling of .init_array and
5258         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5259         and .dtors if ctors_in_init_array.
5260         (Layout::make_output_section): Force correct section types for
5261         .init_array and friends.  Don't sort if doing relocatable link,
5262         Don't sort .ctors and .dtors if ctors_in_init_array.
5263         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5264         (Layout::output_section_name): Add relobj parameter.  Change all
5265         callers.  Handle .ctors. and .dtors. in code rather than table.
5266         Handle .ctors and .dtors if ctors_in_init_array.
5267         (Layout::match_file_name): New function, moved from output.cc.
5268         * layout.h (class Layout): Update declarations.
5269         * output.cc: Include "layout.h".
5270         (Input_section_sort_entry::get_priority): New function.
5271         (Input_section_sort_entry::match_file_name): Just call
5272         Layout::match_file_name.
5273         (Output_section::Input_section_sort_init_fini_compare::operator()):
5274         Handle .ctors and .dtors.  Sort by explicit priority rather than
5275         by name.
5276         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5277         * testsuite/initpri2.c: New test.
5278         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5279         (check_PROGRAMS): Add initpri2.
5280         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5281         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5282         * configure, testsuite/Makefile.in: Rebuild.
5283
5284 2011-06-19  Ian Lance Taylor  <iant@google.com>
5285
5286         PR gold/12880
5287         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5288         .interp section to a PT_INTERP segment even if we have seen a
5289         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5290         clause in a linker script.
5291         (Layout::finalize): Don't create a .interp section if we've
5292         already create a PT_INTERP segment.
5293         (Layout::create_interp): Always call choose_output_section (revert
5294         patch of 2011-06-17).  Don't create PT_INTERP segment.
5295         * script-sections.cc
5296         (Script_sections::create_note_and_tls_segments): Add a .interp
5297         section to a PT_INTERP segment even if we have seen a
5298         --dynamic-linker option.
5299
5300 2011-06-18  Ian Lance Taylor  <iant@google.com>
5301
5302         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5303         merely because a non-PT_LOAD segment has a dynamic reloc.
5304
5305 2011-06-18  Ian Lance Taylor  <iant@google.com>
5306
5307         * layout.cc (Layout::finish_dynamic_section): Don't create
5308         DT_FLAGS entry if not needed.
5309
5310 2011-06-18  Ian Lance Taylor  <iant@google.com>
5311
5312         PR gold/12745
5313         * layout.cc (Layout::layout_eh_frame): Correct handling of
5314         writable .eh_frame section.
5315
5316 2011-06-17  Ian Lance Taylor  <iant@google.com>
5317
5318         PR gold/12893
5319         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5320         symbol is redefined with the exact same object and value.
5321
5322 2011-06-17  Ian Lance Taylor  <iant@google.com>
5323
5324         PR gold/12880
5325         * layout.h (class Layout): Add interp_segment_ field.
5326         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5327         (Layout::attach_allocated_section_to_segment): If making shared
5328         library, put .interp section in PT_INTERP segment.
5329         (Layout::finalize): Also call create_interp if -dynamic-linker
5330         option was used.
5331         (Layout::create_interp): Assert that there is no PT_INTERP
5332         segment.  If not using a SECTIONS clause, use make_output_section.
5333         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5334         * script-sections.cc
5335         (Script_sections::create_note_and_tls_segments): If making shared
5336         library, put .interp section in PT_INTERP segment.
5337
5338 2011-06-17  Ian Lance Taylor  <iant@google.com>
5339
5340         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5341         when making a shared library.
5342
5343 2011-06-17  Ian Lance Taylor  <iant@google.com>
5344
5345         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5346         parameter.  Change all callers.  Don't issue warning about PC32
5347         against locally defined symbol.
5348
5349 2011-06-16  Ian Lance Taylor  <iant@google.com>
5350
5351         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5352         occurs in same object.
5353
5354 2011-06-14  Alan Modra  <amodra@gmail.com>
5355
5356         * po/POTFILES.in: Regenerate.
5357
5358 2011-06-09  Ian Lance Taylor  <iant@google.com>
5359
5360         * script-sections.cc
5361         (Orphan_output_section::set_section_addresses): For a relocatable
5362         link set address to 0.
5363
5364 2011-06-09  Cary Coutant  <ccoutant@google.com>
5365
5366         PR gold/12804
5367         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5368         used with --compress-debug-sections.
5369         * gold/object.cc (Sized_relobj_file::do_layout): Report
5370         uncompressed size of compressed input sections.
5371
5372 2011-06-08  Cary Coutant  <ccoutant@google.com>
5373
5374         PR gold/12804
5375         * testsuite/two_file_test_2_v1.cc: Change initialization of
5376         v2 to keep it in .data.
5377
5378 2011-06-07  Cary Coutant  <ccoutant@google.com>
5379
5380         * common.cc (Symbol_table::do_allocate_commons_list): Call
5381         gold_fallback.
5382         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5383         (Errors::fallback): New function.
5384         (gold_fallback): New function.
5385         * errors.h (Errors::fallback): New function.
5386         * gold.cc (gold_exit): Change status parameter to enum; adjust
5387         all callers.
5388         (queue_initial_tasks): Call gold_fallback.
5389         * gold.h: Include cstdlib.
5390         (Exit_status): New enum type.
5391         (gold_exit): Change status parameter to enum.
5392         (gold_fallback): New function.
5393         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5394         (Layout::create_symtab_sections): Likewise.
5395         (Layout::create_shdrs): Likewise.
5396         * main.cc (main): Adjust call to gold_exit.
5397         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5398         (Output_data_got::add_got_entry_pair): Likewise.
5399         (Output_section::add_input_section): Likewise.
5400         (Output_section::add_output_section_data): Likewise.
5401         (Output_segment::set_section_list_addresses): Likewise.
5402         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5403
5404 2011-06-07  Cary Coutant  <ccoutant@google.com>
5405
5406         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5407         for incremental links.
5408         * output.cc (Output_segment::set_section_list_addresses): Remove
5409         FIXME and test for TLS or BSS.
5410
5411 2011-06-07  Cary Coutant  <ccoutant@google.com>
5412
5413         * testsuite/Makefile.am: Add incremental_copy_test,
5414         incremental_common_test_1.
5415         * testsuite/Makefile.in: Regenerate.
5416         * testsuite/common_test_1_v1.c: New source file.
5417         * testsuite/common_test_1_v2.c: New source file.
5418         * testsuite/copy_test_v1.cc: New source file.
5419
5420 2011-06-07  Cary Coutant  <ccoutant@google.com>
5421
5422         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5423         update, allocate common from bss section's free list.
5424         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5425         linker-defined symbols.
5426         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5427         Skip GOT and PLT entries that are no longer referenced.
5428         (Output_section_incremental_inputs::write_info_blocks): Mark
5429         linker-defined symbols.
5430         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5431         * output.cc (Output_section::allocate): New function.
5432         * output.h (Output_section::allocate): New function.
5433         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5434         linker-defined symbols.
5435         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5436         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5437         (Symbol::init_base_output_data): Likewise.
5438         (Symbol::init_base_output_segment): Likewise.
5439         (Symbol::init_base_constant): Likewise.
5440         (Sized_symbol::init_output_data): Likewise.
5441         (Sized_symbol::init_output_segment): Likewise.
5442         (Sized_symbol::init_constant): Likewise.
5443         (Symbol_table::do_define_in_output_data): Likewise.
5444         (Symbol_table::do_define_in_output_segment): Likewise.
5445         (Symbol_table::do_define_as_constant): Likewise.
5446         * symtab.h (Symbol::is_predefined): New function.
5447         (Symbol::init_base_output_data): Add is_predefined parameter.
5448         (Symbol::init_base_output_segment): Likewise.
5449         (Symbol::init_base_constant): Likewise.
5450         (Symbol::is_predefined_): New data member.
5451         (Sized_symbol::init_output_data): Add is_predefined parameter.
5452         (Sized_symbol::init_output_segment): Likewise.
5453         (Sized_symbol::init_constant): Likewise.
5454         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5455
5456 2011-06-07  Cary Coutant  <ccoutant@google.com>
5457
5458         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5459         instead of emit_copy_reloc.
5460         (Copy_relocs::emit_copy_reloc): Refactor.
5461         (Copy_relocs::make_copy_reloc): New function.
5462         (Copy_relocs::add_copy_reloc): Remove.
5463         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5464         section.
5465         (Copy_relocs::make_copy_reloc): New function.
5466         (Copy_relocs::add_copy_reloc): Remove.
5467         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5468         unchanged input files.
5469         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5470         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5471         Reserve BSS space for COPY relocations.
5472         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5473         (Output_section_incremental_inputs::write_info_blocks): Record
5474         whether a symbol is copied from a shared object.
5475         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5476         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5477         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5478         (Incremental_input_entry_reader::get_output_symbol_index): Add
5479         is_copy parameter.
5480         (Incremental_binary::emit_copy_relocs): New function.
5481         (Incremental_binary::do_emit_copy_relocs): New function.
5482         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5483         new data member.
5484         (Sized_incremental_binary::add_copy_reloc): New function.
5485         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5486         (Sized_incremental_binary::Copy_reloc): New struct.
5487         (Sized_incremental_binary::Copy_relocs): New typedef.
5488         (Sized_incremental_binary::copy_relocs_): New data member.
5489         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5490         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5491         * target.h (Sized_target::emit_copy_reloc): New function.
5492         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5493
5494 2011-06-02  Cary Coutant  <ccoutant@google.com>
5495
5496         PR gold/12163
5497         * gold/archive.cc (Archive::Archive): Initialize new data member.
5498         (Archive::include_all_members): Return if archive has already been
5499         included.
5500         * gold/archive.h (Archive::include_all_members_): New data member.
5501
5502 2011-06-02  Nick Clifton  <nickc@redhat.com>
5503
5504         * dynobj.h: Fix spelling mistake in comment.
5505         * output.cc: Likewise.
5506
5507 2011-05-31  Doug Kwan  <dougkwan@google.com>
5508             Asier Llano
5509
5510         PR gold/12826
5511         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5512         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5513         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5514         redundant arm_exidx_test.so.
5515         * testsuite/Makefile.in: Regenerate.
5516         (check_SCRIPTS): Add pr12826.sh
5517         (check_DATA): Add pr12826.stdout
5518         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5519         * testsuite/pr12826.sh: New file.
5520         * testsuite/pr12826_1.s: Ditto.
5521         * testsuite/pr12826_1.s: Ditto.
5522
5523 2011-05-30  Ian Lance Taylor  <iant@google.com>
5524
5525         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5526         sections.
5527
5528 2011-05-29  Ian Lance Taylor  <iant@google.com>
5529
5530         PR gold/12804
5531         * testsuite/Makefile.am: Use different file name for two_file_test
5532         temporary file for each incremental test.
5533         * testsuite/Makefile.in: Rebuild.
5534
5535 2011-05-29  Ian Lance Taylor  <iant@google.com>
5536
5537         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5538         binary input file is empty.
5539
5540 2011-05-27  Ian Lance Taylor  <iant@google.com>
5541
5542         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5543         (ver_test_9.so): Likewise.
5544         * testsuite/Makefile.in: Rebuild.
5545
5546 2011-05-26 Cary Coutant  <ccoutant@google.com>
5547
5548         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5549         * incremental.cc (Incremental_inputs::report_input_section): Fix
5550         comment, indentation.
5551         (Incremental_inputs::report_comdat_group): New function.
5552         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5553         of data for incremental input file entry.
5554         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5555         group count, COMDAT group signatures.
5556         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5557         an unchanged input file.
5558         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5559         Initialize new data member.
5560         (Incremental_object_entry::add_comdat_group): New function.
5561         (Incremental_object_entry::get_comdat_group_count): New function.
5562         (Incremental_object_entry::get_comdat_signature_key): New function.
5563         (Incremental_object_entry::groups_): New data member.
5564         (Incremental_inputs::report_comdat_group): New function.
5565         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5566         data for incremental input file entry.
5567         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5568         (Incremental_input_entry_reader::get_input_section): Adjust size of
5569         data for incremental input file entry.
5570         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5571         (Incremental_input_entry_reader::get_comdat_group_signature): New
5572         function.
5573         * object.cc (Sized_relobj::include_section_group): Report kept
5574         COMDAT groups for incremental links.
5575
5576 2011-05-24  David Meyer  <pdox@google.com>
5577
5578         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5579         with name parameter.  Add found_name parameter.
5580         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5581         * dirsearch.h (class Dirsearch): Update declaration.
5582
5583 2011-05-24  Ian Lance Taylor  <iant@google.com>
5584
5585         * archive.cc (Library_base::should_include_member): Pull in object
5586         from archive if it defines the entry symbol.
5587         * parameters.cc (Parameters::entry): New function.
5588         * parameters.h (class Parameters): Declare entry.
5589         * output.h (class Output_file_header): Remove entry_ field.
5590         * output.cc (Output_file_header::Output_file_header): Remove entry
5591         parameter.  Change all callers.
5592         (Output_file_header::entry): Use parameters->entry.
5593         * gold.cc (queue_middle_tasks): Likewise.
5594         * plugin.cc (Plugin_hook::run): Likewise.
5595
5596 2011-05-24 Cary Coutant  <ccoutant@google.com>
5597
5598         * gold.cc (queue_initial_tasks): Pass incremental base filename
5599         to Output_file::open_base_file; don't print error message.
5600         * incremental-dump.cc (main): Adjust call to
5601         Output_file::open_for_modification.
5602         * incremental-dump.cc (main): Likewise.
5603         * incremental.cc (Incremental_inputs::report_command_line):
5604         Ignore --incremental-base option when comparing command lines.
5605         Ignore parameter when given as separate argument.
5606         * options.h (class General_options): Add --incremental-base.
5607         * output.cc (Output_file::Output_file):
5608         (Output_file::open_base_file): Add base_name and writable parameters;
5609         read base file into new file; print error message here.
5610         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5611         callers.
5612         * output.h (Output_file::open_for_modification): Rename to...
5613         (Output_file::open_base_file): ...this; add base_name and
5614         writable parameters; adjust all callers.
5615         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5616         callers.
5617         * testsuite/Makefile.am (incremental_test_4): Test
5618         --incremental-base.
5619         * testsuite/Makefile.in: Regenerate.
5620
5621 2011-05-24 Cary Coutant  <ccoutant@google.com>
5622
5623         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5624         incremental_test_4.
5625         * testsuite/Makefile.in: Regenerate.
5626         * testsuite/two_file_test_1_v1.cc: New test source file.
5627         * testsuite/two_file_test_1b_v1.cc: New test source file.
5628         * testsuite/two_file_test_2_v1.cc: New test source file.
5629
5630 2011-05-24 Cary Coutant  <ccoutant@google.com>
5631
5632         * dynobj.h (Dynobj::do_dynobj): New function.
5633         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5634         flag and soname for shared objects.
5635         * incremental.cc (Incremental_inputs::report_object): Make
5636         either Incremental_object_entry or Incremental_dynobj_entry; add
5637         soname to string table.
5638         (Incremental_inputs::report_input_section): Add assertion.
5639         (Output_section_incremental_inputs::set_final_data_size): Adjust
5640         type of input file entry for shared libraries; adjust size of
5641         shared library info entry.
5642         (Output_section_incremental_inputs::write_input_files): Write
5643         as_needed flag for shared libraries.
5644         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5645         of input file entry for shared libraries; write soname.
5646         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5647         soname from incremental info.
5648         * incremental.h (enum Incremental_input_flags): Add
5649         INCREMENTAL_INPUT_AS_NEEDED.
5650         (Incremental_input_entry::Incremental_input_entry): Initialize new
5651         data member.
5652         (Incremental_input_entry::set_as_needed): New function.
5653         (Incremental_input_entry::as_needed): New function.
5654         (Incremental_input_entry::do_dynobj_entry): New function.
5655         (Incremental_input_entry::as_needed_): New data member.
5656         (Incremental_object_entry::Incremental_object_entry): Don't check
5657         for shared library.
5658         (Incremental_object_entry::do_type): Likewise.
5659         (class Incremental_dynobj_entry): New class.
5660         (Incremental_input_entry_reader::as_needed): New function.
5661         (Incremental_input_entry_reader::get_soname): New function.
5662         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5663         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5664         size of shared library info entry.
5665         * layout.cc (Layout::finish_dynamic_section): Don't test for
5666         incremental link when adding DT_NEEDED entries.
5667         * object.h (Object::Object): Initialize new data member.
5668         (Object::dynobj): New function.
5669         (Object::set_as_needed): New function.
5670         (Object::as_needed): New function.
5671         (Object::do_dynobj): New function.
5672         (Object::as_needed_): New data member.
5673
5674 2011-05-24 Cary Coutant  <ccoutant@google.com>
5675
5676         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5677         info; adjust display of GOT entries.
5678         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5679         vector of input objects; remove file_status_.
5680         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5681         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5682         got_plt reader; call target hooks to reserve GOT entries.
5683         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5684         of input file info header and GOT info entry.
5685         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5686         relocation info.
5687         (Got_plt_view_info::got_descriptor): Remove.
5688         (Got_plt_view_info::sym_index): New data member.
5689         (Got_plt_view_info::input_index): New data member.
5690         (Local_got_offset_visitor::visit): Write input file index.
5691         (Global_got_offset_visitor::visit): Write 0 for input file index.
5692         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5693         with sym_index and input_index.
5694         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5695         incremental info GOT entry; replace got_descriptor with input_index.
5696         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5697         map from input file index to object.
5698         (Sized_relobj_incr::do_layout): Replace direct data member reference
5699         with accessor function.
5700         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5701         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5702         Adjust size of input file info header.
5703         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5704         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5705         (Incremental_input_entry_reader::get_input_section): Adjust size of
5706         input file info header.
5707         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5708         of incremental info GOT entry.
5709         (Incremental_got_plt_reader::get_got_desc): Remove.
5710         (Incremental_got_plt_reader::get_got_symndx): New function.
5711         (Incremental_got_plt_reader::get_got_input_index): New function.
5712         (Sized_incremental_binary::Sized_incremental_binary): Remove
5713         file_status_; add input_objects_.
5714         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5715         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5716         (Sized_incremental_binary::file_is_unchanged): Remove.
5717         (Sized_incremental_binary::set_input_object): New function.
5718         (Sized_incremental_binary::input_object): New function.
5719         (Sized_incremental_binary::file_status_): Remove.
5720         (Sized_incremental_binary::input_objects_): New data member.
5721         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5722         references.
5723         (Sized_relobj_incr::invalid_address): Move to base class.
5724         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5725         class.
5726         (Sized_relobj_incr::do_output_section_offset): Likewise.
5727         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5728         (Sized_relobj_incr::section_offsets_): Likewise.
5729         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5730         function.
5731         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5732         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5733         with accessor function.
5734         (Sized_relobj_file::do_layout): Likewise.
5735         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5736         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5737         (Sized_relobj_file::compute_final_local_value): Replace refs to
5738         section_offsets_ with accessor function.
5739         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5740         * object.h (Relobj::Relobj): Initialize new data members.
5741         (Relobj::add_dyn_reloc): New function.
5742         (Relobj::first_dyn_reloc): New function.
5743         (Relobj::dyn_reloc_count): New function.
5744         (Relobj::first_dyn_reloc_): New data member.
5745         (Relobj::dyn_reloc_count_): New data member.
5746         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5747         references.
5748         (Sized_relobj::Address): New typedef.
5749         (Sized_relobj::invalid_address): Move here from child class.
5750         (Sized_relobj::Sized_relobj): Initialize new data members.
5751         (Sized_relobj::sized_relobj): New function.
5752         (Sized_relobj::is_output_section_offset_invalid): Move here from
5753         child class.
5754         (Sized_relobj::get_output_section_offset): Likewise.
5755         (Sized_relobj::local_has_got_offset): Likewise.
5756         (Sized_relobj::local_got_offset): Likewise.
5757         (Sized_relobj::set_local_got_offset): Likewise.
5758         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5759         (Sized_relobj::clear_got_offsets): New function.
5760         (Sized_relobj::section_offsets): Move here from child class.
5761         (Sized_relobj::do_output_section_offset): Likewise.
5762         (Sized_relobj::do_set_section_offset): Likewise.
5763         (Sized_relobj::Local_got_offsets): Likewise.
5764         (Sized_relobj::local_got_offsets_): Likewise.
5765         (Sized_relobj::section_offsets_): Likewise.
5766         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5767         references.
5768         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5769         class.
5770         (Sized_relobj_file::sized_relobj): New function
5771         (Sized_relobj_file::local_has_got_offset): Move to base class.
5772         (Sized_relobj_file::local_got_offset): Likewise.
5773         (Sized_relobj_file::set_local_got_offset): Likewise.
5774         (Sized_relobj_file::get_output_section_offset): Likewise.
5775         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5776         (Sized_relobj_file::do_output_section_offset): Likewise.
5777         (Sized_relobj_file::do_set_section_offset): Likewise.
5778         (Sized_relobj_file::Local_got_offsets): Likewise.
5779         (Sized_relobj_file::local_got_offsets_): Likewise.
5780         (Sized_relobj_file::section_offsets_): Likewise.
5781         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5782         (all constructors).
5783         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5784         (Output_reloc::get_symbol_index): Likewise.
5785         (Output_reloc::local_section_offset): Likewise.
5786         (Output_reloc::get_address): Likewise.
5787         (Output_reloc::symbol_value): Likewise.
5788         (Output_data_got::reserve_slot): Move to class definition.
5789         (Output_data_got::reserve_local): New function.
5790         (Output_data_got::reserve_slot_for_global): Remove.
5791         (Output_data_got::reserve_global): New function.
5792         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5793         (all constructors, two instantiations).
5794         (Output_reloc::get_relobj): New function (two instantiations).
5795         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5796         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5797         (Output_data_reloc::add_global): Adjust type of relobj.
5798         (Output_data_reloc::add_global_relative): Likewise.
5799         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5800         (Output_data_reloc::add_local): Likewise.
5801         (Output_data_reloc::add_local_relative): Likewise.
5802         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5803         (Output_data_reloc::add_local_section): Likewise.
5804         (Output_data_reloc::add_output_section): Likewise.
5805         (Output_data_reloc::add_absolute): Likewise.
5806         (Output_data_reloc::add_target_specific): Likewise.
5807         (Output_data_got::reserve_slot): Move definition here.
5808         (Output_data_got::reserve_local): New function.
5809         (Output_data_got::reserve_global): New function.
5810         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5811         section_offsets_ with accessor function.
5812         (Sized_relobj_file::write_sections): Likewise.
5813         (Sized_relobj_file::do_relocate_sections): Likewise.
5814         * target.h (Sized_target::reserve_local_got_entry): New function.
5815         (Sized_target::reserve_global_got_entry): New function.
5816         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5817         (Target_x86_64::reserve_global_got_entry): New function.
5818         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5819
5820 2011-05-23 Cary Coutant  <ccoutant@google.com>
5821
5822         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5823         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5824         bit when checking got_type.
5825         * incremental.cc (Sized_incremental_binary::setup_readers):
5826         Store symbol table and string table locations; initialize bit vector
5827         of file status flags.
5828         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5829         unchanged files.
5830         (Sized_incremental_binary::do_process_got_plt): New function.
5831         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5832         (Output_section_incremental_inputs::set_final_data_size): Record
5833         file index for each input file.
5834         (Output_section_incremental_inputs::write_got_plt): Store file index
5835         instead of input entry offset for each GOT entry.
5836         * incremental.h
5837         (Incremental_input_entry::Incremental_input_entry): Initialize new
5838         data member.
5839         (Incremental_input_entry::set_offset): Store file index.
5840         (Incremental_input_entry::get_file_index): New function.
5841         (Incremental_input_entry::file_index_): New data member.
5842         (Incremental_binary::process_got_plt): New function.
5843         (Incremental_binary::do_process_got_plt): New function.
5844         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5845         data members.
5846         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5847         (Sized_incremental_binary::set_file_is_unchanged): New function.
5848         (Sized_incremental_binary::file_is_unchanged): New function.
5849         (Sized_incremental_binary::do_process_got_plt): New function.
5850         (Sized_incremental_binary::file_status_): New data member.
5851         (Sized_incremental_binary::main_symtab_loc_): New data member.
5852         (Sized_incremental_binary::main_strtab_loc_): New data member.
5853         * output.cc (Output_data_got::Got_entry::write): Add case
5854         RESERVED_CODE.
5855         (Output_data_got::add_global): Call add_got_entry.
5856         (Output_data_got::add_global_plt): Likewise.
5857         (Output_data_got::add_global_with_rel): Likewise.
5858         (Output_data_got::add_global_with_rela): Likewise.
5859         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5860         (Output_data_got::add_global_pair_with_rela): Likewise.
5861         (Output_data_got::add_local): Call add_got_entry.
5862         (Output_data_got::add_local_plt): Likewise.
5863         (Output_data_got::add_local_with_rel): Likewise.
5864         (Output_data_got::add_local_with_rela): Likewise.
5865         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5866         (Output_data_got::add_local_pair_with_rela): Likewise.
5867         (Output_data_got::reserve_slot): New function.
5868         (Output_data_got::reserve_slot_for_global): New function.
5869         (Output_data_got::add_got_entry): New function.
5870         (Output_data_got::add_got_entry_pair): New function.
5871         (Output_section::add_output_section_data): Edit FIXME.
5872         * output.h
5873         (Output_section_data_build::Output_section_data_build): New
5874         constructor with size parameter.
5875         (Output_data_space::Output_data_space): Likewise.
5876         (Output_data_got::Output_data_got): Initialize new data member; new
5877         constructor with size parameter.
5878         (Output_data_got::add_constant): Call add_got_entry.
5879         (Output_data_got::reserve_slot): New function.
5880         (Output_data_got::reserve_slot_for_global): New function.
5881         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5882         (Output_data_got::add_got_entry): New function.
5883         (Output_data_got::add_got_entry_pair): New function.
5884         (Output_data_got::free_list_): New data member.
5885         * target.h (Sized_target::init_got_plt_for_update): New function.
5886         (Sized_target::register_global_plt_entry): New function.
5887         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5888         Initialize new data member; call init; add constructor with PLT count.
5889         (Output_data_plt_x86_64::init): New function.
5890         (Output_data_plt_x86_64::add_relocation): New function.
5891         (Output_data_plt_x86_64::reserve_slot): New function.
5892         (Output_data_plt_x86_64::free_list_): New data member.
5893         (Target_x86_64::init_got_plt_for_update): New function.
5894         (Target_x86_64::register_global_plt_entry): New function.
5895         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5896         incremental updates.
5897         (Output_data_plt_x86_64::add_relocation): New function.
5898         * testsuite/object_unittest.cc (Object_test): Set default options.
5899
5900 2011-05-16  Ian Lance Taylor  <iant@google.com>
5901
5902         * options.h (class General_options): Make -i a synonym for -r.
5903
5904 2011-05-16  Ian Lance Taylor  <iant@google.com>
5905
5906         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5907
5908 2011-05-10 Cary Coutant  <ccoutant@google.com>
5909
5910         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5911         strip_all (-s).
5912
5913 2011-05-06  Ian Lance Taylor  <iant@google.com>
5914
5915         * layout.cc (Layout::layout): If the output section flags change,
5916         update the ordering.
5917
5918 2011-04-25 Cary Coutant  <ccoutant@google.com>
5919
5920         * incremental-dump.cc (dump_incremental_inputs): Print local
5921         symbol info for each input file.
5922         * incremental.cc
5923         (Output_section_incremental_inputs::set_final_data_size): Add local
5924         symbol info to input file entries in incremental info.
5925         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5926         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5927         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5928         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5929         implementation.
5930         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5931         (Sized_incr_relobj::do_relocate): Write the local symbols.
5932         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5933         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5934         Adjust size of input file header.
5935         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5936         (Incremental_inputs_reader::get_local_symbol_count): New function.
5937         (Incremental_inputs_reader::get_input_section): Adjust size of input
5938         file header.
5939         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5940         (Sized_incr_relobj::This): New typedef.
5941         (Sized_incr_relobj::sym_size): New const data member.
5942         (Sized_incr_relobj::Local_symbol): New struct.
5943         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5944         (Sized_incr_relobj::do_local_symbol_offset): New function.
5945         (Sized_incr_relobj::local_symbol_count_): New data member.
5946         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5947         (Sized_incr_relobj::local_symbol_index_): New data member.
5948         (Sized_incr_relobj::local_symbol_offset_): New data member.
5949         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5950         (Sized_incr_relobj::local_symbols_): New data member.
5951         * object.h (Relobj::output_local_symbol_count): New function.
5952         (Relobj::local_symbol_offset): New function.
5953         (Relobj::do_output_local_symbol_count): New function.
5954         (Relobj::do_local_symbol_offset): New function.
5955         (Sized_relobj::do_output_local_symbol_count): New function.
5956         (Sized_relobj::do_local_symbol_offset): New function.
5957
5958 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5959
5960         * descriptors.cc (set_close_on_exec): New function.
5961         (Descriptors::open): Use set_close_on_exec.
5962         * output.cc (S_ISLNK): Define if not defined.
5963
5964 2011-04-22 Cary Coutant  <ccoutant@google.com>
5965
5966         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5967         global symbol map.
5968         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5969         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5970         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5971         relocations.
5972         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5973         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5974         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5975         * incremental.h
5976         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5977         function.
5978         (Incremental_binary::apply_incremental_relocs): New function.
5979         (Incremental_binary::do_apply_incremental_relocs): New function.
5980         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5981         data member.
5982         (Sized_incremental_binary::add_global_symbol): New function.
5983         (Sized_incremental_binary::global_symbol): New function.
5984         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5985         (Sized_incremental_binary::symbol_map_): New data member.
5986         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5987         * target.h (Sized_target::apply_relocation): New function.
5988         * target-reloc.h (apply_relocation): New function.
5989         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5990
5991 2011-04-22  Doug Kwan  <dougkwan@google.com>
5992
5993         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5994         flag of a SHT_ARM_EXIDX section.
5995         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5996         * testsuite/Makefile.in: Regenerate.
5997         * testsuite/arm_exidx_test.s: New file.
5998         * testsuite/arm_exidx_test.sh: Same.
5999
6000 2011-04-20 Cary Coutant  <ccoutant@google.com>
6001
6002         PR gold/12689
6003         * archive.h (Incremental_archive_entry::Archive_member):
6004         Initialize arg_serial_ (second constructor).
6005
6006 2011-04-17  Ian Lance Taylor  <iant@google.com>
6007
6008         * object.cc (Relocate_info::location): Simplify location string.
6009         * errors.cc (Errors::error_at_location): Don't print program
6010         name.
6011         (Errors::warning_at_location): Likewise.
6012         (Errors::undefined_symbol): Likewise.
6013         * testsuite/debug_msg.sh: Update accordingly.
6014
6015 2011-04-14 Cary Coutant  <ccoutant@google.com>
6016
6017         * gold/layout.cc (Layout::symtab_section_offset): New function.
6018         * gold/layout.h (Layout::symtab_section_offset): New function.
6019         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6020
6021 2011-04-12  Ian Lance Taylor  <iant@google.com>
6022
6023         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6024         with MREMAP_MAYMOVE.
6025         * output.h (class Output_file): Add map_is_allocated_ field.
6026         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6027         not available, provide stubs.  If mremap is not available, #define
6028         it to gold_mremap.
6029         (MREMAP_MAYMOVE): Define if not defined.
6030         (Output_file::Output_file): Initialize map_is_allocated_.
6031         (Output_file::resize): Check map_is_allocated_.
6032         (Output_file::map_anonymous): If mmap fails, use malloc.
6033         (Output_file::unmap): Don't do anything for an anonymous map.
6034         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6035         is not available, provide stubs.
6036         (File_read::View::~View): Use free rather than delete[].
6037         (File_read::make_view): Use malloc rather than new[].  If mmap
6038         fails, use malloc.
6039         (File_read::find_or_make_view): Use malloc rather than new[].
6040         * gold.h: Remove HAVE_REMAP code.
6041         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6042         exists.  Rename mremap to gold_mremap.  If mmap is not available
6043         don't do anything.
6044         * configure, config.in: Rebuild.
6045
6046 2011-04-11  Ian Lance Taylor  <iant@google.com>
6047
6048         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6049         initialize local variable v.
6050
6051 2011-04-11  Cary Coutant  <ccoutant@google.com>
6052
6053         * archive.cc (Archive::include_member): Adjust call to
6054         report_object.
6055         (Add_archive_symbols::run): Track argument serial numbers.
6056         (Lib_group::include_member): Likewise.
6057         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6058         * archive.h (Incremental_archive_entry::Archive_member):
6059         Initialize arg_serial_.
6060         (Archive_member::arg_serial_): New data member.
6061         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6062         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6063         incremental link.
6064         (Sized_dynobj::do_for_all_local_got_entries): New function.
6065         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6066         function.
6067         * fileread.cc (get_mtime): New function.
6068         * fileread.h (get_mtime): New function.
6069         * gold.cc (queue_initial_tasks): Check for incremental update.
6070         (process_incremental_input): New function.
6071         (queue_middle_tasks): Don't force valid target for incremental
6072         update.
6073         * incremental-dump.cc (find_input_containing_global): Adjust
6074         size of symbol info entry.
6075         (dump_incremental_inputs): Dump argument serial number and
6076         in_system_directory flag; bias shndx by 1; print symbol names
6077         when dumping per-file symbol lists; use new symbol info readers.
6078         * incremental.cc
6079         (Output_section_incremental_inputs:update_data_size): New function.
6080         (Sized_incremental_binary::setup_readers): Setup input readers
6081         for each input file; build maps for files added from libraries
6082         and scripts.
6083         (Sized_incremental_binary::check_input_args): New function.
6084         (Sized_incremental_binary::do_check_inputs): Build map of argument
6085         serial numbers to input arguments.
6086         (Sized_incremental_binary::do_file_has_changed): Rename
6087         do_file_is_unchanged to this; compare file modification times.
6088         (Sized_incremental_binary::do_init_layout): New function.
6089         (Sized_incremental_binary::do_reserve_layout): New function.
6090         (Sized_incremental_binary::do_get_input_reader): Remove.
6091         (Sized_incremental_binary::get_symtab_view): New function.
6092         (Incremental_checker::can_incrementally_link_output_file): Remove.
6093         (Incremental_inputs::report_command_line): Exclude --debug options.
6094         (Incremental_inputs::report_archive_begin): Add parameter; track
6095         argument serial numbers; don't put input file entry for archive
6096         before archive members.
6097         (Incremental_inputs::report_archive_end): Put input file entry
6098         for archive after archive members.
6099         (Incremental_inputs::report_object): Add parameter; track argument
6100         serial numbers and in_system_directory flag.
6101         (Incremental_inputs::report_script): Add parameter; track argument
6102         serial numbers.
6103         (Output_section_incremental_inputs::set_final_data_size): Adjust
6104         size of symbol info entry; check for forwarding symbols.
6105         (Output_section_incremental_inputs::write_input_files): Write
6106         in_system_directory flag and argument serial number.
6107         (Output_section_incremental_inputs::write_info_blocks): Map section
6108         indices between incremental info and original input file; store
6109         input section index for each symbol.
6110         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6111         change operator() to visit().
6112         (class Global_got_offset_visitor): Likewise.
6113         (class Global_symbol_visitor_got_plt):
6114         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6115         classes.
6116         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6117         (Sized_incr_relobj::do_read_symbols): New function.
6118         (Sized_incr_relobj::do_layout): New function.
6119         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6120         (Sized_incr_relobj::do_add_symbols): New function.
6121         (Sized_incr_relobj::do_should_include_member): New function.
6122         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6123         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6124         (Sized_incr_relobj::do_section_size): New function.
6125         (Sized_incr_relobj::do_section_name): New function.
6126         (Sized_incr_relobj::do_section_contents): New function.
6127         (Sized_incr_relobj::do_section_flags): New function.
6128         (Sized_incr_relobj::do_section_entsize): New function.
6129         (Sized_incr_relobj::do_section_address): New function.
6130         (Sized_incr_relobj::do_section_type): New function.
6131         (Sized_incr_relobj::do_section_link): New function.
6132         (Sized_incr_relobj::do_section_info): New function.
6133         (Sized_incr_relobj::do_section_addralign): New function.
6134         (Sized_incr_relobj::do_initialize_xindex): New function.
6135         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6136         (Sized_incr_relobj::do_read_relocs): New function.
6137         (Sized_incr_relobj::do_gc_process_relocs): New function.
6138         (Sized_incr_relobj::do_scan_relocs): New function.
6139         (Sized_incr_relobj::do_count_local_symbols): New function.
6140         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6141         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6142         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6143         (Sized_incr_relobj::do_relocate): New function.
6144         (Sized_incr_relobj::do_set_section_offset): New function.
6145         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6146         (Sized_incr_dynobj::do_read_symbols): New function.
6147         (Sized_incr_dynobj::do_layout): New function.
6148         (Sized_incr_dynobj::do_add_symbols): New function.
6149         (Sized_incr_dynobj::do_should_include_member): New function.
6150         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6151         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6152         (Sized_incr_dynobj::do_section_size): New function.
6153         (Sized_incr_dynobj::do_section_name): New function.
6154         (Sized_incr_dynobj::do_section_contents): New function.
6155         (Sized_incr_dynobj::do_section_flags): New function.
6156         (Sized_incr_dynobj::do_section_entsize): New function.
6157         (Sized_incr_dynobj::do_section_address): New function.
6158         (Sized_incr_dynobj::do_section_type): New function.
6159         (Sized_incr_dynobj::do_section_link): New function.
6160         (Sized_incr_dynobj::do_section_info): New function.
6161         (Sized_incr_dynobj::do_section_addralign): New function.
6162         (Sized_incr_dynobj::do_initialize_xindex): New function.
6163         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6164         (make_sized_incremental_object): New function.
6165         (Incremental_library::copy_unused_symbols): New function.
6166         (Incremental_library::do_for_all_unused_symbols): New function.
6167         * incremental.h (enum Incremental_input_flags): New type.
6168         (class Incremental_checker): Remove.
6169         (Incremental_input_entry::Incremental_input_entry): Add argument
6170         serial number.
6171         (Incremental_input_entry::arg_serial): New function.
6172         (Incremental_input_entry::set_is_in_system_directory): New function.
6173         (Incremental_input_entry::is_in_system_directory): New function.
6174         (Incremental_input_entry::arg_serial_): New data member.
6175         (Incremental_input_entry::is_in_system_directory_): New data member.
6176         (class Script_info): Move here from script.h.
6177         (Script_info::Script_info): Add filename parameter.
6178         (Script_info::filename): New function.
6179         (Script_info::filename_): New data member.
6180         (Incremental_script_entry::Incremental_script_entry): Add argument
6181         serial number.
6182         (Incremental_object_entry::Incremental_object_entry): Likewise.
6183         (Incremental_object_entry::add_input_section): Build list of input
6184         sections with map to original shndx.
6185         (Incremental_object_entry::get_input_section_index): New function.
6186         (Incremental_object_entry::shndx_): New data member.
6187         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6188         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6189         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6190         serial number.
6191         (Incremental_inputs::report_archive_begin): Likewise.
6192         (Incremental_inputs::report_object): Likewise.
6193         (Incremental_inputs::report_script): Likewise.
6194         (class Incremental_global_symbol_reader): New class.
6195         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6196         and store flags and input file type.
6197         (Incremental_input_entry_reader::arg_serial): New function.
6198         (Incremental_input_entry_reader::type): Extract type from flags.
6199         (Incremental_input_entry_reader::is_in_system_directory): New function.
6200         (Incremental_input_entry_reader::get_input_section_count): Call
6201         accessor function for type.
6202         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6203         function for type; adjust size of global symbol entry.
6204         (Incremental_input_entry_reader::get_global_symbol_count): Call
6205         accessor function for type.
6206         (Incremental_input_entry_reader::get_object_count): Likewise.
6207         (Incremental_input_entry_reader::get_object_offset): Likewise.
6208         (Incremental_input_entry_reader::get_member_count): Likewise.
6209         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6210         (Incremental_input_entry_reader::get_member_offset): Likewise.
6211         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6212         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6213         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6214         (Incremental_input_entry_reader::get_global_symbol_reader): New
6215         function.
6216         (Incremental_input_entry_reader::get_output_symbol_index): New
6217         function.
6218         (Incremental_input_entry_reader::type_): Remove.
6219         (Incremental_input_entry_reader::flags_): New data member.
6220         (Incremental_inputs_reader::input_file_offset): New function.
6221         (Incremental_inputs_reader::input_file_index): New function.
6222         (Incremental_inputs_reader::input_file): Call input_file_offset.
6223         (Incremental_inputs_reader::input_file_at_offset): New function.
6224         (Incremental_relocs_reader::get_r_type): Reformat.
6225         (Incremental_relocs_reader::get_r_shndx): Reformat.
6226         (Incremental_relocs_reader::get_r_offset): Reformat.
6227         (Incremental_relocs_reader::data): New function.
6228         (Incremental_binary::Incremental_binary): Initialize new data members.
6229         (Incremental_binary::check_inputs): Add cmdline parameter.
6230         (Incremental_binary::file_is_unchanged): Remove.
6231         (Input_reader::arg_serial): New function.
6232         (Input_reader::get_unused_symbol_count): New function.
6233         (Input_reader::get_unused_symbol): New function.
6234         (Input_reader::do_arg_serial): New function.
6235         (Input_reader::do_get_unused_symbol_count): New function.
6236         (Input_reader::do_get_unused_symbol): New function.
6237         (Incremental_binary::input_file_count): New function.
6238         (Incremental_binary::get_input_reader): Change signature to use
6239         index instead of filename.
6240         (Incremental_binary::file_has_changed): New function.
6241         (Incremental_binary::get_input_argument): New function.
6242         (Incremental_binary::get_library): New function.
6243         (Incremental_binary::get_script_info): New function.
6244         (Incremental_binary::init_layout): New function.
6245         (Incremental_binary::reserve_layout): New function.
6246         (Incremental_binary::output_file): New function.
6247         (Incremental_binary::do_check_inputs): New function.
6248         (Incremental_binary::do_file_is_unchanged): Remove.
6249         (Incremental_binary::do_file_has_changed): New function.
6250         (Incremental_binary::do_init_layout): New function.
6251         (Incremental_binary::do_reserve_layout): New function.
6252         (Incremental_binary::do_input_file_count): New function.
6253         (Incremental_binary::do_get_input_reader): Change signature.
6254         (Incremental_binary::input_args_map_): New data member.
6255         (Incremental_binary::library_map_): New data member.
6256         (Incremental_binary::script_map_): New data member.
6257         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6258         new data members.
6259         (Sized_incremental_binary::output_section): New function.
6260         (Sized_incremental_binary::inputs_reader): Add const.
6261         (Sized_incremental_binary::symtab_reader): Add const.
6262         (Sized_incremental_binary::relocs_reader): Add const.
6263         (Sized_incremental_binary::got_plt_reader): Add const.
6264         (Sized_incremental_binary::get_symtab_view): New function.
6265         (Sized_incremental_binary::Inputs_reader): New typedef.
6266         (Sized_incremental_binary::Input_entry_reader): New typedef.
6267         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6268         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6269         (Sized_incremental_binary::do_file_has_changed): New function.
6270         (Sized_incremental_binary::do_init_layout): New function.
6271         (Sized_incremental_binary::do_reserve_layout): New function.
6272         (Sized_input_reader::Inputs_reader): Remove.
6273         (Sized_input_reader::Input_entry_reader): Remove.
6274         (Sized_input_reader::do_arg_serial): New function.
6275         (Sized_input_reader::do_get_unused_symbol_count): New function.
6276         (Sized_input_reader::do_get_unused_symbol): New function.
6277         (Sized_incremental_binary::do_input_file_count): New function.
6278         (Sized_incremental_binary::do_get_input_reader): Change signature;
6279         use index instead of filename.
6280         (Sized_incremental_binary::section_map_): New data member.
6281         (Sized_incremental_binary::input_entry_readers_): New data member.
6282         (class Sized_incr_relobj): New class.
6283         (class Sized_incr_dynobj): New class.
6284         (make_sized_incremental_object): New function.
6285         (class Incremental_library): New class.
6286         * layout.cc (Free_list::num_lists): New static data member.
6287         (Free_list::num_nodes): New static data member.
6288         (Free_list::num_removes): New static data member.
6289         (Free_list::num_remove_visits): New static data member.
6290         (Free_list::num_allocates): New static data member.
6291         (Free_list::num_allocate_visits): New static data member.
6292         (Free_list::init): New function.
6293         (Free_list::remove): New function.
6294         (Free_list::allocate): New function.
6295         (Free_list::dump): New function.
6296         (Free_list::print_stats): New function.
6297         (Layout_task_runner::run): Resize output file for incremental updates.
6298         (Layout::Layout): Initialize new data members.
6299         (Layout::set_incremental_base): New function.
6300         (Layout::init_fixed_output_section): New function.
6301         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6302         incremental updates.
6303         (Layout::create_gold_note): Do not create gold note section for
6304         incremental updates.
6305         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6306         for incremental updates.
6307         (Layout::set_section_offsets): For incremental updates, allocate space
6308         from free list.
6309         (Layout::create_symtab_sections): Layout with offsets relative to
6310         start of section; for incremental updates, allocate space from free
6311         list.
6312         (Layout::create_shdrs): For incremental updates, allocate space from
6313         free list.
6314         (Layout::finish_dynamic_section): For incremental updates, do not
6315         check --as-needed (fixed in subsequent patch).
6316         * layout.h (class Free_list): New class.
6317         (Layout::set_incremental_base): New function.
6318         (Layout::incremental_base): New function.
6319         (Layout::init_fixed_output_section): New function.
6320         (Layout::allocate): New function.
6321         (Layout::incremental_base_): New data member.
6322         (Layout::free_list_): New data member.
6323         * main.cc (main): Print Free_list statistics.
6324         * object.cc (Relobj::finalize_incremental_relocs): Add
6325         clear_counts parameter; clear counts only when clear_counts is set.
6326         (Sized_relobj::Sized_relobj): Initialize new base class.
6327         (Sized_relobj::do_layout): Don't report special sections.
6328         (Sized_relobj::do_for_all_local_got_entries): New function.
6329         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6330         symtab_off to all symbol table offsets.
6331         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6332         * object.h (class Got_offset_list): Move to top of file.
6333         (Object::Object): Allow case where input_file == NULL.
6334         (Object::~Object): Likewise.
6335         (Object::input_file): Assert that input_file != NULL.
6336         (Object::lock): Allow case where input_file == NULL.
6337         (Object::unlock): Likewise.
6338         (Object::is_locked): Likewise.
6339         (Object::token): Likewise.
6340         (Object::release): Likewise.
6341         (Object::is_incremental): New function.
6342         (Object::get_mtime): New function.
6343         (Object::for_all_local_got_entries): New function.
6344         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6345         (Object::set_is_in_system_directory): New function.
6346         (Object::is_in_system_directory): New function.
6347         (Object::do_is_incremental): New function.
6348         (Object::do_get_mtime): New function.
6349         (Object::do_for_all_local_got_entries): New function.
6350         (Object::is_in_system_directory_): New data member.
6351         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6352         (class Sized_relobj_base): New class.
6353         (class Sized_relobj): Derive from Sized_relobj_base.
6354         (class Sized_relobj::Symbols): Redeclare from base class.
6355         (class Sized_relobj::local_got_offset_list): Remove.
6356         (class Sized_relobj::Output_sections): Redeclare from base class.
6357         (class Sized_relobj::do_for_all_local_got_entries): New function.
6358         (class Sized_relobj::write_local_symbols): Add offset parameter.
6359         (class Sized_relobj::local_symbol_offset_): Update comment.
6360         (class Sized_relobj::local_dynsym_offset_): Update comment.
6361         * options.cc (Input_arguments::add_file): Remove const.
6362         * options.h (Input_file_argument::Input_file_argument):
6363         Initialize arg_serial_ (all constructors).
6364         (Input_file_argument::set_arg_serial): New function.
6365         (Input_file_argument::arg_serial): New function.
6366         (Input_file_argument::arg_serial_): New data member.
6367         (Input_arguments::Input_arguments): Initialize file_count_.
6368         (Input_arguments::add_file): Remove const.
6369         (Input_arguments::number_of_input_files): New function.
6370         (Input_arguments::file_count_): New data member.
6371         (Command_line::number_of_input_files): Call
6372         Input_arguments::number_of_input_files.
6373         * output.cc (Output_segment_headers::Output_segment_headers):
6374         Set current size.
6375         (Output_section::Input_section::current_data_size): New function.
6376         (Output_section::Output_section): Initialize new data members.
6377         (Output_section::add_input_section): Don't do merge sections for
6378         an incremental link; allocate space from free list for an
6379         incremental update.
6380         (Output_section::add_output_section_data): Allocate space from
6381         free list for an incremental update.
6382         (Output_section::update_data_size): New function.
6383         (Output_section::set_fixed_layout): New function.
6384         (Output_section::reserve): New function.
6385         (Output_segment::set_section_addresses): Remove const.
6386         (Output_segment::set_section_list_addresses): Remove const; allocate
6387         space from free list for an incremental update.
6388         (Output_segment::set_offset): Adjust size of RELRO segment for an
6389         incremental update.
6390         * output.h (Output_data::current_data_size): Move here from
6391         child classes.
6392         (Output_data::pre_finalize_data_size): New function.
6393         (Output_data::update_data_size): New function.
6394         (Output_section_headers::update_data_size): new function.
6395         (Output_section_data_build::current_data_size): Move to Output_data.
6396         (Output_data_strtab::update_data_size): New function.
6397         (Output_section::current_data_size): Move to Output_data.
6398         (Output_section::set_fixed_layout): New function.
6399         (Output_section::has_fixed_layout): New function.
6400         (Output_section::reserve): New function.
6401         (Output_section::update_data_size): New function.
6402         (Output_section::has_fixed_layout_): New data member.
6403         (Output_section::free_list_): New data member.
6404         (Output_segment::set_section_addresses): Remove const.
6405         (Output_segment::set_section_list_addresses): Remove const.
6406         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6407         New function.
6408         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6409         New function.
6410         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6411         parameter when calling Add_symbols constructor; store argument
6412         serial number for members of a lib group.
6413         (Add_symbols::locks): Allow case where token == NULL.
6414         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6415         (Read_member::~Read_member): New function.
6416         (Read_member::is_runnable): New function.
6417         (Read_member::locks): New function.
6418         (Read_member::run): New function.
6419         (Check_script::~Check_script): New function.
6420         (Check_script::is_runnable): New function.
6421         (Check_script::locks): New function.
6422         (Check_script::run): New function.
6423         (Check_library::~Check_library): New function.
6424         (Check_library::is_runnable): New function.
6425         (Check_library::locks): New function.
6426         (Check_library::run): New function.
6427         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6428         (Add_symbols::library_): New data member.
6429         (class Read_member): New class.
6430         (class Check_script): New class.
6431         (class Check_library): New class.
6432         * reloc.cc (Read_relocs::is_runnable): Allow case where
6433         token == NULL.
6434         (Read_relocs::locks): Likewise.
6435         (Scan_relocs::locks): Likewise.
6436         (Relocate_task::locks): Likewise.
6437         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6438         to clear counters.
6439         (Sized_relobj::incremental_relocs_scan): Fix comment.
6440         (Sized_relobj::do_relocate): Pass output file offset to
6441         write_local_symbols.
6442         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6443         from class declaration.
6444         * script.cc (read_input_script): Allocate Script_info; pass
6445         argument serial number to report_script.
6446         * script.h (class Script_info): Move to incremental.h.
6447         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6448         * symtab.h (Symbol_table::add_from_incrobj): New function.
6449         (Symbol_table::set_file_offset): New function.
6450
6451 2011-04-05  Cary Coutant  <ccoutant@google.com>
6452
6453         * incremental-dump.cc (dump_incremental_inputs): Change signature
6454         to take a Sized_incremental_binary; change caller.  Use readers
6455         in Sized_incremental_binary.
6456         * incremental.cc
6457         (Sized_incremental_binary::find_incremental_inputs_sections):
6458         Rename do_find_incremental_inputs_sections to this.
6459         (Sized_incremental_binary::setup_readers): New function.
6460         (Sized_incremental_binary::do_check_inputs): Check
6461         has_incremental_info_ flag; move setup code to setup_readers;
6462         use input readers.
6463         (Sized_incremental_binary::do_file_is_unchanged): New function.
6464         (Sized_incremental_binary::do_get_input_reader): New function.
6465         * incremental.h (class Incremental_binary): Move to end of file.
6466         (Incremental_binary::file_is_unchanged): New function.
6467         (Incremental_binary::do_file_is_unchanged): New function.
6468         (Incremental_binary::Input_reader): New class.
6469         (Incremental_binary::get_input_reader): New function.
6470         (class Sized_incremental_binary): Move to end of file.
6471         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6472         input section reader classes.
6473         (Sized_incremental_binary::has_incremental_info): New function.
6474         (Sized_incremental_binary::inputs_reader): New function.
6475         (Sized_incremental_binary::symtab_reader): New function.
6476         (Sized_incremental_binary::relocs_reader): New function.
6477         (Sized_incremental_binary::got_plt_reader): New function.
6478         (Sized_incremental_binary::do_file_is_unchanged): New function.
6479         (Sized_incremental_binary::Sized_input_reader): New class.
6480         (Sized_incremental_binary::get_input_reader): New function.
6481         (Sized_incremental_binary::find_incremental_inputs_sections):
6482         Rename do_find_incremental_inputs_sections to this.
6483         (Sized_incremental_binary::setup_readers): New function.
6484         (Sized_incremental_binary::has_incremental_info_): New data member.
6485         (Sized_incremental_binary::inputs_reader_): New data member.
6486         (Sized_incremental_binary::symtab_reader_): New data member.
6487         (Sized_incremental_binary::relocs_reader_): New data member.
6488         (Sized_incremental_binary::got_plt_reader_): New data member.
6489         (Sized_incremental_binary::current_input_file_): New data member.
6490
6491 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6492
6493         PR gold/12640
6494         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6495         violation.
6496
6497 2011-03-30  Cary Coutant  <ccoutant@google.com>
6498
6499         * archive.cc (Archive::include_member): Adjust call to report_object.
6500         (Add_archive_symbols::run): Add script_info to call to
6501         report_archive_begin.
6502         (Lib_group::include_member): Adjust call to report_object.
6503         (Add_lib_group_symbols::run): Adjust call to report_object.
6504         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6505         blocks.  Add object count for script input files.
6506         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6507         script_info parameter; change all callers.
6508         (Incremental_inputs::report_object): Add script_info parameter;
6509         change all callers.
6510         (Incremental_inputs::report_script): Store backpointer to
6511         incremental info entry.
6512         (Output_section_incremental_inputs::set_final_data_size): Record
6513         additional information for scripts.
6514         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6515         * incremental.h (Incremental_script_entry::add_object): New function.
6516         (Incremental_script_entry::get_object_count): New function.
6517         (Incremental_script_entry::get_object): New function.
6518         (Incremental_script_entry::objects_): New data member; adjust
6519         constructor.
6520         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6521         (Incremental_inputs::report_object): Add script_info parameter.
6522         (Incremental_inputs_reader::get_object_count): New function.
6523         (Incremental_inputs_reader::get_object_offset): New function.
6524         * options.cc (Input_arguments::add_file): Return reference to
6525         new input argument.
6526         * options.h (Input_argument::set_script_info): New function.
6527         (Input_argument::script_info): New function.
6528         (Input_argument::script_info_): New data member; adjust all
6529         constructors.
6530         (Input_file_group::add_file): Return reference to new input argument.
6531         (Input_file_lib::add_file): Likewise.
6532         (Input_arguments::add_file): Likewise.
6533         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6534         * script.cc (Parser_closure::Parser_closure): Add script_info
6535         parameter; adjust all callers.
6536         (Parser_closure::script_info): New function.
6537         (Parser_closure::script_info_): New data member.
6538         (read_input_script): Report scripts earlier to incremental info.
6539         (script_add_file): Set script_info in Input_argument.
6540         (script_add_library): Likewise.
6541         * script.h (Script_options::Script_info): Rewrite class.
6542
6543 2011-03-29  Cary Coutant  <ccoutant@google.com>
6544
6545         * archive.cc (Library_base::should_include_member): Move
6546         method here from class Archive.
6547         (Archive::Archive): Initialize base class.
6548         (Archive::should_include_member): Move to base class.
6549         (Archive::do_for_all_unused_symbols): New function.
6550         (Add_archive_symbols::run): Remove redundant access to
6551         incremental_inputs.
6552         (Lib_group::Lib_group): Initialize base class.
6553         (Lib_group::do_filename): New function.
6554         (Lib_group::include_member): Pass pointer to Lib_group to
6555         report_object.
6556         (Lib_group::do_for_all_unused_symbols): New function.
6557         (Add_lib_group_symbols::run): Report archive information for
6558         incremental links.
6559         * archive.h (class Library_base): New base class.
6560         (class Archive): Derive from Library_base.
6561         (Archive::filename): Move to base class.
6562         (Archive::set_incremental_info): Likewise.
6563         (Archive::incremental_info): Likewise.
6564         (Archive::Should_include): Likewise.
6565         (Archive::should_include_member): Likewise.
6566         (Archive::Armap_entry): Remove.
6567         (Archive::Unused_symbol_iterator): Remove.
6568         (Archive::unused_symbols_begin): Remove.
6569         (Archive::unused_symbols_end): Remove.
6570         (Archive::do_filename): New function.
6571         (Archive::do_get_mtime): New function.
6572         (Archive::do_for_all_unused_symbols): New function.
6573         (Archive::task_): Move to base class.
6574         (Archive::incremental_info_): Likewise.
6575         (class Lib_group): Derive from Library_base.
6576         (Lib_group::do_filename): New function.
6577         (Lib_group::do_get_mtime): New function.
6578         (Lib_group::do_for_all_unused_symbols): New function.
6579         (Lib_group::task_): Move to base class.
6580         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6581         function.
6582         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6583         function.
6584         * incremental.cc (Incremental_inputs::report_archive_begin):
6585         Use Library_base; call library's get_mtime; add incremental inputs
6586         entry before members.
6587         (class Unused_symbol_visitor): New class.
6588         (Incremental_inputs::report_archive_end): Use Library_base; use
6589         visitor class to record unused symbols; don't add incremental inputs
6590         entry after members.
6591         (Incremental_inputs::report_object): Use Library_base.
6592         * incremental.h
6593         (Incremental_archive_entry::Incremental_archive_entry): Remove
6594         unused Archive parameter.
6595         (Incremental_inputs::report_archive_begin): Use Library_base.
6596         (Incremental_inputs::report_archive_end): Likewise.
6597         (Incremental_inputs::report_object): Likewise.
6598         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6599         function.
6600         * object.h (Object::for_all_global_symbols): New function.
6601         (Object::do_for_all_global_symbols): New function.
6602         (Sized_relobj::do_for_all_global_symbols): New function.
6603         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6604         function.
6605         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6606         function.
6607
6608 2011-03-27  Ian Lance Taylor  <iant@google.com>
6609
6610         * archive.cc (Archive::interpret_header): Return -1 if something
6611         goes wrong.  Change callers accordingly.
6612
6613 2011-03-25  Cary Coutant  <ccoutant@google.com>
6614
6615         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6616         * testsuite/Makefile.in: Regenerate.
6617
6618 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6619
6620         * plugin.cc (get_view): New.
6621         (Plugin::load): Pass get_view to the plugin.
6622         (Plugin_manager::get_view): New.
6623
6624 2011-03-21  Ian Lance Taylor  <iant@google.com>
6625
6626         * testsuite/final_layout.sh: Rewrite to not use dc.
6627         * testsuite/relro_test.sh: Fail if dc is not present.
6628
6629 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6630
6631         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6632         Change == to -eq.
6633         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6634         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6635         Change == to -eq.
6636         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6637         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6638
6639 2011-03-14  Ian Lance Taylor  <iant@google.com>
6640
6641         * script-sections.cc (Sort_output_sections::script_compare):
6642         Rename from is_before, change return type.
6643         (Sort_output_sections::operator()): Adjust accordingly.
6644
6645 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6646
6647         PR gold/12572
6648         * testsuite/odr_violation2.cc: Add comment to make all error line
6649         numbers double digits.
6650         * testsuite/debug_msg.sh: Adjust expected errors.
6651
6652 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6653
6654         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6655         but mark earlier ones as non-canonical
6656         (offset_to_iterator): Update search target and example
6657         (do_addr2line): Return extra lines in a vector*
6658         (format_file_lineno): Extract from do_addr2line
6659         (one_addr2line): Add vector* out-param
6660         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6661         when a lineno entry appeared last for its instruction
6662         (Dwarf_line_info): Add vector* out-param
6663         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6664         * symtab.cc (Odr_violation_compare): Include the lineno in the
6665         comparison again.
6666         (linenos_from_loc): New. Combine the canonical line for an
6667         address with its other lines.
6668         (True_if_intersect): New. Helper functor to make
6669         std::set_intersection a query.
6670         (detect_odr_violations): Compare sets of lines instead of just
6671         one line for each function. This became less deterministic, but
6672         has fewer false positives.
6673         * symtab.h: Declarations.
6674         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6675         mix an optimized and non-optimized object in the same binary
6676         (odr_violation2.so): Same.
6677         * testsuite/Makefile.in: Regenerate from Makefile.am.
6678         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6679         * testsuite/debug_msg.sh: Update line numbers and add
6680         assertions.
6681         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6682         non-optimized context.
6683         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6684         isn't inlined, and use OdrDerived in an optimized context.
6685         * testsuite/odr_header1.h: Defines OdrDerived, where
6686         optimization will change the
6687         first-instruction-in-the-destructor's file and line number.
6688         * testsuite/odr_header2.h: Defines OdrBase.
6689
6690 2011-03-09  Ian Lance Taylor  <iant@google.com>
6691
6692         * fileread.cc (File_read::clear_views): Don't delete the whole
6693         file view.
6694
6695 2011-03-08  Ian Lance Taylor  <iant@google.com>
6696
6697         PR gold/12525
6698         * fileread.cc: #include <climits>.
6699         (GOLD_IOV_MAX): Define.
6700         (File_read::read_multiple): Limit number of entries by iov_max.
6701         * fileread.h (class File_read): Always set max_readv_entries to
6702         128.
6703
6704 2011-03-07  Ian Lance Taylor  <iant@google.com>
6705
6706         PR gold/12525
6707         * options.h (class General_options): Add -dy and -dn.
6708
6709 2011-03-02  Cary Coutant  <ccoutant@google.com>
6710
6711         * testsuite/script_test_9.t: Add TLS segment.
6712
6713 2011-03-02  Simon Baldwin  <simonb@google.com>
6714
6715         * configure.ac: Add check for gnu_indirect_function support in
6716         the toolchain building binutils.
6717         * configure: Rebuild.
6718
6719 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6720
6721         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6722         plugin only symbols.
6723         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6724         in plugin files as not needed in the symbol table.
6725
6726 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6727
6728         * output.cc (Output_section::add_input_section): Delay fill
6729         generation for section ordering.
6730
6731 2011-02-09  Ian Lance Taylor  <iant@google.com>
6732
6733         PR gold/12316
6734         * object.h (class Sized_relobj): Remove clear_local_symbols.
6735         * reloc.cc (Sized_relobj::do_relocate): Don't call
6736         clear_local_symbols.
6737
6738 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6739
6740         * plugin.cc (is_visible_from_outside): Return true for symbols
6741         in the -u option.
6742
6743 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6744
6745         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6746         filename.
6747
6748 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6749
6750         * icf.h (is_section_foldable_candidate): Change type of parameter
6751         to std::string.
6752         * icf.cc (Icf::find_identical_sections): Change type of local variable
6753         section_name to be std::string.
6754         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6755
6756 2011-01-25  Ian Lance Taylor  <iant@google.com>
6757
6758         * script.cc (script_add_extern): Rewrite to use
6759         add_symbol_reference.
6760
6761 2011-01-25  Doug Kwan  <dougkwan@google.com>
6762
6763         * icf.cc (get_section_contents): Always lock section's object.
6764
6765 2011-01-24  Ian Lance Taylor  <iant@google.com>
6766
6767         * options.h (class General_options): Accept
6768         --no-detect-odr-violations.
6769
6770 2011-01-24  Ian Lance Taylor  <iant@google.com>
6771
6772         * version.cc (version_string): Bump to 1.11.
6773
6774 2011-01-24  Ian Lance Taylor  <iant@google.com>
6775
6776         * plugin.cc (class Plugin_rescan): Define new class.
6777         (Plugin_manager::claim_file): Set any_claimed_.
6778         (Plugin_manager::save_archive): New function.
6779         (Plugin_manager::save_input_group): New function.
6780         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6781         necessary.
6782         (Plugin_manager::new_undefined_symbol): New function.
6783         (Plugin_manager::rescan): New function.
6784         (Plugin_manager::rescannable_defines): New function.
6785         (Plugin_manager::add_input_file): Set any_added_.
6786         * plugin.h (class Plugin_manager): define new fields rescannable_,
6787         undefined_symbols_, any_claimed_, and any_added_.  Declare
6788         Plugin_rescan as friend.  Declare new functions.
6789         (Plugin_manager::Rescannable): Define type.
6790         (Plugin_manager::Rescannable_list): Define type.
6791         (Plugin_manager::Undefined_symbol_list): Define type.
6792         (Plugin_manager::Plugin_manager): Initialize new fields.
6793         * archive.cc (Archive::defines_symbol): New function.
6794         (Add_archive_symbols::run): Pass archive to plugins if any.
6795         * archive.h (class Archive): Declare defines_symbol.
6796         * readsyms.cc (Input_group::~Input_group): New function.
6797         (Finish_group::run): Pass input_group to plugins if any.
6798         * readsyms.h (class Input_group): Declare destructor.
6799         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6800         any.
6801
6802 2011-01-10  Ian Lance Taylor  <iant@google.com>
6803
6804         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6805         section as relro.
6806         (Layout::set_segment_offsets): Reset increase_relro before calling
6807         set_section_addresses a second time.
6808
6809 2011-01-04  Cary Coutant  <ccoutant@google.com>
6810
6811         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6812         sections before NOBITS sections.
6813
6814 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6815
6816         * version.cc (print_version): Update copyright to 2011.
6817
6818 2010-12-23  Cary Coutant  <ccoutant@google.com>
6819
6820         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6821         of OS to this->add.  Add OD parameter to second form of the function.
6822
6823 2010-12-20  Ian Lance Taylor  <iant@google.com>
6824
6825         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6826         second of two consecutive entries with same offset.
6827
6828 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6829
6830         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6831         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6832         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6833         to avoid unneeded links against $(LDADD).
6834         * testsuite/Makefile.in: Regenerate.
6835
6836 2010-12-15  Ian Lance Taylor  <iant@google.com>
6837
6838         PR gold/12324
6839         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6840         for R_X86_64_32 and R_X86_64_PC32.
6841         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6842         ver_matching_def_pic.o.
6843         (ver_matching_def_pic.o): New target.
6844
6845 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6846
6847         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6848         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6849         Move definition before File_read::View member definitions.
6850         (File_read::View::~View): Initialize and hold lock before
6851         updating current_mapped_bytes.
6852
6853 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6854
6855         * dwarf_reader.cc: Remove outdated comment.
6856         * gold-threads.cc: Fix typo in error message.
6857         * archive.cc: Fix typos in comments.
6858         * archive.h: Likewise.
6859         * arm-reloc-property.cc: Likewise.
6860         * arm-reloc-property.h: Likewise.
6861         * arm-reloc.def: Likewise.
6862         * arm.cc: Likewise.
6863         * attributes.h: Likewise.
6864         * cref.cc: Likewise.
6865         * ehframe.cc: Likewise.
6866         * fileread.h: Likewise.
6867         * gold.h: Likewise.
6868         * i386.cc: Likewise.
6869         * icf.cc: Likewise.
6870         * incremental.h: Likewise.
6871         * int_encoding.cc: Likewise.
6872         * layout.h: Likewise.
6873         * main.cc: Likewise.
6874         * merge.h: Likewise.
6875         * object.cc: Likewise.
6876         * object.h: Likewise.
6877         * options.cc: Likewise.
6878         * readsyms.cc: Likewise.
6879         * reduced_debug_output.cc: Likewise.
6880         * reloc.cc: Likewise.
6881         * script-sections.cc: Likewise.
6882         * sparc.cc: Likewise.
6883         * symtab.h: Likewise.
6884         * target-reloc.h: Likewise.
6885         * target.cc: Likewise.
6886         * target.h: Likewise.
6887         * timer.cc: Likewise.
6888         * timer.h: Likewise.
6889         * x86_64.cc: Likewise.
6890
6891 2010-12-09  Cary Coutant  <ccoutant@google.com>
6892
6893         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6894         stack.
6895         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6896         parameter; change all callers.
6897         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6898         * options.h (warn_execstack): New option.
6899
6900 2010-12-07  Doug Kwan  <dougkwan@google.com>
6901
6902         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6903         like function call relocations.
6904
6905 2010-12-07  Ian Lance Taylor  <iant@google.com>
6906
6907         * archive.cc (Archive::get_elf_object_for_member): Permit
6908         punconfigured to be NULL.
6909         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6910         (Archive::include_member): Pass NULL to get_elf_object_for_member
6911         if we searched for the archive and this is the first included
6912         object.
6913
6914 2010-12-01  Ian Lance Taylor  <iant@google.com>
6915
6916         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6917         track_relocs_type_ field.
6918         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6919         Set track_relocs_type_.
6920         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6921         contents when using RELA relocs.
6922         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6923         reloc_map_.
6924         * reloc.cc (Track_relocs::next_addend): New function.
6925         * reloc.h (class Track_relocs): Declare next_addend.
6926
6927 2010-12-01  Ian Lance Taylor  <iant@google.com>
6928
6929         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6930         virtual destructor.
6931
6932 2010-12-01  Ian Lance Taylor  <iant@google.com>
6933
6934         * README: Update compilers known to work and fail.
6935
6936 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6937
6938         * configure.in: For --enable-gold, handle value `default' instead of
6939         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6940         not the default.
6941         * configure: Regenerate.
6942
6943 2010-11-18  Doug Kwan  <dougkwan@google.com>
6944
6945         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6946         and right_alignment to be zero.  Store result alignment only if it is
6947         greater than existing alignment.
6948
6949 2010-11-16  Cary Coutant  <ccoutant@google.com>
6950
6951         PR gold/12220
6952         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6953         Check for ".zdebug_line".
6954
6955 2010-11-16  Doug Kwan  <dougkwan@google.com>
6956             Cary Coutant  <ccoutant@google.com>
6957
6958         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6959         by reference; adjust all callers.
6960         * output.cc (Output_segment::set_section_addresses): Adjust references
6961         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6962         list is empty.
6963         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6964         end at page boundary.
6965
6966 2010-11-16  Cary Coutant  <ccoutant@google.com>
6967
6968         PR gold/12220
6969         * layout.cc (Layout::choose_output_section): Transform names of
6970         compressed sections even when using a script with a SECTIONS clause.
6971         (Layout::output_section_name): Remove code to transform
6972         compressed debug section names.
6973         * output.cc (Output_section::add_input_section): Use uncompressed
6974         section size when tracking input sections.
6975
6976 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6977
6978         * symtab.h (Symbol::NON_PIC_REF): Remove.
6979         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6980         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6981         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6982         (Symbol::use_plt_offset): Take a flags argument and pass it
6983         directly to needs_dynamic_reloc.  Restrict check for undefined
6984         weak symbols to function calls.
6985         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6986         (Target_arm::Scan::global): Use it.
6987         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6988         (Target_arm::Relocate::relocate): Likewise.
6989         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6990         parameter with an r_type parameter.  Use get_reference_flags
6991         to get the flags.
6992         (Target_arm::Relocate::relocate): Update accordingly.
6993         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6994         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6995         (Target_i386::Scan::global): Likewise.
6996         (Target_i386::Relocate::relocate): Likewise.
6997         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6998         parameter with an r_type parameter.  Use get_reference_flags
6999         to get the flags.
7000         (Target_i386::Relocate::relocate): Update accordingly.
7001         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7002         (Target_powerpc::Scan::global): Use it.
7003         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7004         (Target_powerpc::Relocate::relocate): Likewise.
7005         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7006         (Target_sparc::Scan::global): Use it.
7007         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7008         (Target_sparc::Relocate::relocate): Likewise.
7009         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7010         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7011         (Target_x86_64::Scan::global): Likewise.
7012         (Target_x86_64::Relocate::relocate): Likewise.
7013
7014 2010-11-08  Doug Kwan  <dougkwan@google.com>
7015             Cary Coutant  <ccoutant@google.com>
7016
7017         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7018         (Arm_exidx_merge_section::section_contents_): New data member.
7019         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7020         (Arm_input_section::~Arm_input_section): De-allocate memory.
7021         (Arm_input_section::original_contents_): New data member.
7022         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7023         in parameters instead of calling Object::section_contents without
7024         locking.
7025         (Arm_output_section::group_section): New parameter TASK.  Pass it
7026         to callees that need locking objects.
7027         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7028         to lock EXIDX input sections.  Fix a formatting issue.  Call
7029         Arm_exidx_merged_section::build_contents to create merged section
7030         contents.
7031         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7032         to lock object of stub table owner.
7033         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7034         TEXT_SIZE to initialize data member TEXT_SIZE_.
7035         (Arm_exidx_input_section::addralign): Fix typo in comment.
7036         (Arm_exidx_input_section::text_size): New method.
7037         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7038         that require locking objects.  Lock objects before scanning for stubs
7039         and updating local symbols.
7040         (Arm_input_section<big_endian>::init): Copy contents of original
7041         input section.
7042         (Arm_input_section<big_endian>::do_write): Use saved contents of
7043         original input section instead of calling Object::section_contents
7044         without locking.
7045         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7046         size without calling Object::section_size().
7047         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7048         for size.  Allocate a buffer for merged EXIDX entries.
7049         (Arm_exidx_merged_section::build_contents): New method.
7050         (Arm_exidx_merged_section::do_write): Move merge section contents
7051         building code to Arm_exidx_merged_section::build_contetns.  Write
7052         out contetns in buffer instead of building it on the fly.
7053         (Arm_relobj::make_exidx_input_section): Also pass text section size
7054         to Arm_exidx_input_section constructor.
7055         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7056         (Arm_dynobj::do_read_symbols): Fix memory leak.
7057         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7058         * target.h: (class Task): Add forward declaration.
7059         (Target::relax): Add new parameter TASK and pass it to
7060         Target::do_relax().
7061         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7062
7063 2010-11-05  Cary Coutant  <ccoutant@google.com>
7064
7065         PR gold/10708
7066         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7067         object when reading from the file.
7068         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7069         second layout pass.
7070         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7071         when reading section contents.
7072         (get_section_contents): Likewise.
7073         (icf::find_identical_sections): Likewise.
7074         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7075         object when reading from the file.
7076         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7077         the object when doing deferred section layout.
7078
7079 2010-11-03  Nick Clifton  <nickc@redhat.com>
7080
7081         PR gold/12001
7082         * script.h (class Symbol_assignment: name): New member.  Returns
7083         the name of the symbol.
7084         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7085         Returns true if the given symbol name is on the list of
7086         assignments wating to be processed.
7087         * archive.cc (should_incldue_member): If the symbol is undefined,
7088         check to see if it is on the list of symbols pending assignment.
7089
7090 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7091
7092         * script-sections.cc (Script_sections::find_memory_region): Check
7093         for a NULL output section pointer.
7094
7095 2010-10-29  Doug Kwan  <dougkwan@google.com>
7096
7097         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7098         Output_section::add_relaxed_input_section.
7099         * output.cc (Output_section::add_relaxed_input_section): Add new
7100         arguments LAYOUT and NAME.  Set section order index.
7101         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7102         Copy section order index.
7103         * output.h (Output_section::add_relaxed_input_section): Add new
7104         arguments LAYOUT and NAME.
7105
7106 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7107
7108         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7109         NATIVE_OR_CROSS_LINKER.
7110         * testsuite/Makefile.in: Regenerate.
7111
7112 2010-10-20  Doug Kwan  <dougkwan@google.com>
7113
7114         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7115         without SHF_LINK_ORDER flags.
7116         * layout.cc (Layout::choose_output_section): Do not filter
7117         SHF_LINK_ORDER flag in a relocatable link.
7118
7119 2010-10-17  Cary Coutant  <ccoutant@google.com>
7120
7121         * output.h (Output_segment::set_section_addresses): Change function
7122         signature.  Update all callers.
7123         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7124         sections.
7125         (Output_segment::set_section_addresses): Align after last TLS
7126         section.  Add padding before last relro section instead of after.
7127
7128 2010-10-17  Doug Kwan  <dougkwan@google.com>
7129
7130         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7131         GOT output section to be writable.
7132
7133 2010-10-14  Cary Coutant  <ccoutant@google.com>
7134
7135         * debug.h (DEBUG_INCREMENTAL): New flag.
7136         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7137         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7138         mode.
7139         * incremental.cc (report_command_line): Ignore all forms of
7140         --incremental.
7141         * layout.cc (Layout::Layout): Check parameters for incremental link
7142         mode.
7143         * options.cc (General_options::parse_incremental): New function.
7144         (General_options::parse_no_incremental): New function.
7145         (General_options::parse_incremental_full): New function.
7146         (General_options::parse_incremental_update): New function.
7147         (General_options::incremental_mode_): New data member.
7148         (General_options::finalize): Check incremental_mode_.
7149         * options.h (General_options): Update help text for --incremental.
7150         Add --no-incremental, --incremental-full, --incremental-update.
7151         (General_options::Incremental_mode): New enum type.
7152         (General_options::incremental_mode): New function.
7153         (General_options::incremental_mode_): New data member.
7154         * parameters.cc (Parameters::incremental_mode_): New data member.
7155         (Parameters::set_options): Set incremental_mode_.
7156         (Parameters::set_incremental_full): New function.
7157         (Parameters::incremental): New function.
7158         (Parameters::incremental_update): New function.
7159         (set_parameters_incremental_full): New function.
7160         * parameters.h (Parameters::set_incremental_full): New function.
7161         (Parameters::incremental): New function.
7162         (Parameters::incremental_update): New function.
7163         (Parameters::incremental_mode_): New data member.
7164         (set_parameters_incremental_full): New function.
7165         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7166         incremental link mode.
7167         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7168         (Sized_relobj::do_relocate_sections): Likewise.
7169         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7170         option.
7171         * testsuite/Makefile.in: Regenerate.
7172         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7173
7174 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7175
7176         * script-sections.h (class Script_sections): Make
7177         Sections_elements typedef public.
7178         * script-sections.cc (class Sort_output_sections): Add elements_
7179         field.  Add constructor which sets it; change all callers.
7180         (Sort_output_sections::is_before): New function.
7181         (Sort_output_sections::operator()): Call is_before.
7182         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7183         conditional.
7184         * testsuite/script_test_10.sh: New test. Test script section
7185         order.
7186         * testsuite/script_test_10.t: Likewise.
7187         * testsuite/script_test_10.s: Likewise.
7188         * testsuite/Makefile.am: Wrap the cross linker tests and the
7189         common tests into NATIVE_OR_CROSS_LINKER.
7190         (check_SCRIPTS): Add script_test_10.sh.
7191         (check_DATA): Add script_test_10.stdout.
7192         (script_test_10.o, script_test_10): New targets.
7193         (script_test_10.stdout): New target.
7194         * configure, testsuite/Makefile.in: Regenerate.
7195
7196 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7197
7198         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7199         error for the deprecated relocations.
7200         (Target_arm::Scan::global): Likewise.
7201         (Target_arm::Relocate::relocate): Likewise.
7202
7203 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7204
7205         * fileread.cc (Input_file::find_file): Initialize *found_name
7206         and *namep when using the fallback search for case 4.
7207
7208 2010-10-11  Cary Coutant  <ccoutant@google.com>
7209
7210         * options.h (class General_options): Redefine -z lazy as an alias for
7211         the negation of -z now.
7212
7213 2010-10-11  Ian Lance Taylor  <iant@google.com>
7214
7215         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7216         binding.
7217
7218 2010-10-06  Nick Clifton  <nickc@redhat.com>
7219
7220         * script-sections.cc(class Memory_region): Remove
7221         current_lma_offset_ field.  Rename current_vma_offset_ to
7222         current_offset_.  Add last_section_ field.
7223         (Memory_region::get_current_vma_address): Rename to
7224         get_current_address.
7225         (Memory_region::get_current_lma_address): Delete.
7226         (Memory_region::increment_vma_offset): Rename to
7227         increment_offset.
7228         (Memory_region::increment_lma_offset): Delete.
7229         (Memory_region::attributes_compatible): New method.  Returns
7230         true if the provided section is compatible with the region.
7231         (Memory_region::get_last_section): New method.  Returns the last
7232         section to use the region.
7233         (Memory_region::set_last_section): New method.  Stores the last
7234         section to use the region.
7235         (Script_sections::block_in_region): New method.  Returns true if
7236         a block of memory is contained within a region.
7237         (Script_sections::find_memory_region): New method.  Locates a
7238         memory region to be used to set a VMA or LMA address.
7239         (Output_section_definition::set_section_addresses): Add code to
7240         check for addresses set by memory regions.
7241         (Output_segment::set_section_addresses): Remove memory region
7242         walking code.
7243         (Script_sections::create_segment): Add a warning if a header
7244         segment is created outside of any region.
7245         * script-sections.h (class Script_sections): Add prototypes for
7246         find_memory_region and block_in_region methods.
7247         * testsuite/memory_test.s: Use .long instead of .word.
7248         * testsuite/memory_test.t: Add some more output sections.
7249         * testsuite/memory_test.sh: Update expected output.
7250
7251 2010-10-02  Doug Kwan  <dougkwan@google.com>
7252
7253         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7254         defintion to symtab.h
7255         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7256         declaration to defintion.
7257
7258 2010-10-01  Nick Clifton  <nickc@redhat.com>
7259
7260         * expression.cc (eval): Replace dummy argument with NULL.
7261         (eval_maybe_dot): Check for a NULL result section pointer.
7262         (Symbol_expression::value): Likewise.
7263         (Dot_expression::value): Likewise.
7264         (BINARY_EXPRESSION): Likewise.
7265         (Max_expression::value): Likewise.
7266         (Min_expression::value): Likewise.
7267         (Absolute_expression::value): Likewise.
7268         (Addr_expression::value_from_output_section): Likewise.
7269         (Loaddddr_expression::value_from_output_section): Likewise.
7270         (Segment_start_expression::value): Likewise.
7271         * script-sections.cc
7272         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7273         argument with NULL.
7274         (Sections_elememt_dot_assignment::set_section_addresses):
7275         Likewise.
7276         (Output_data_expression::do_write_to_buffer): Likewise.
7277         (Output_section_definition::finalize_symbols): Likewise.
7278         (Output_section_definition::set_section_addresses): Likewise.
7279
7280 2010-09-30  Doug Kwan  <dougkwan@google.com>
7281
7282         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7283
7284 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7285
7286         * target.h (Target::can_icf_inline_merge_sections): New virtual
7287         function.
7288         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7289         virtual function.
7290         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7291         virtual function.
7292         * icf.cc (get_section_contents): Inline merge sections only when
7293         target allows it.
7294
7295 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7296
7297         * configure: Regenerate.
7298
7299 2010-09-17  Ian Lance Taylor  <iant@google.com>
7300
7301         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7302         * testsuite/Makefile.am (memory_test.o): New target.
7303         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7304         memory_test.t.
7305         * testsuite/Makefile.in: Rebuild.
7306
7307 2010-09-17  Doug Kwan  <dougkwan@google.com>
7308
7309         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7310         defintion if relocation uses GOT entries of the symbol.
7311         * testsuite/icf_safe_test.sh: Fix test.
7312         * testsuite/icf_safe_so_test.sh: Fix test.
7313
7314 2010-09-16  Cary Coutant  <ccoutant@google.com>
7315
7316         * script_sections.cc (class Memory_region): Remove "NULL" from
7317         vector initializations.
7318
7319 2010-09-15  Cary Coutant  <ccoutant@google.com>
7320
7321         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7322         Resolve forwarding symbols.
7323
7324 2010-09-15  Doug Kwan  <dougkwan@google.com>
7325
7326         * gold/testsuite/script_test_3.t: Add ARM special sections.
7327         * gold/testsuite/script_test_4.t: Same.
7328         * gold/testsuite/script_test_5.t: Same.
7329         * gold/testsuite/script_test_6.t: Same.
7330         * gold/testsuite/script_test_7.t: Same.
7331         * gold/testsuite/script_test_7.t: Same.
7332         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7333
7334 2010-09-14  Cary Coutant  <ccoutant@google.com>
7335
7336         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7337         (Target_x86_64::Relocate::relocate_tls): Replace check for
7338         saw_tls_block_reloc_ with test for executable section.
7339
7340 2010-09-12  Cary Coutant  <ccoutant@google.com>
7341
7342         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7343         position-independent executables to shared libraries need dynamic
7344         relocations.
7345         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7346         position-independent executables.
7347         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7348         * testsuite/Makefile.in: Regenerate.
7349
7350 2010-09-10  Nick Clifton  <nickc@redhat.com>
7351
7352         PR gold/11997
7353         * testsuite/memory_test.t: Discard any sections that are not
7354         needed.
7355
7356 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7357
7358         PR gold/11996
7359         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7360         "This::" to work around a bug in gcc 4.2.
7361
7362         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7363
7364 2010-09-09  Rafael Espindola  <espindola@google.com>
7365
7366         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7367         sections with different PF_X flags in the same segment.
7368         (Layout::find_first_load_seg): Search all segments to find the first
7369         one.
7370         * options.h (rosegment): New.
7371
7372 2010-09-08  Rafael Espindola  <espindola@google.com>
7373
7374         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7375
7376 2010-09-08  Doug Kwan  <dougkwan@google.com>
7377
7378         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7379         (Arm_relobj::do_relocate_sections): Add new parameter for output
7380         file to match the parent.
7381         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7382         of local symbols instead of input values.  Update code to track
7383         changes in gold::relocate_section.
7384         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7385         (Sized_relobj::compute_final_local_value_internal): New methods.
7386         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7387         body into private version of Sized_relobj::compute_final_local_value.
7388         Call the inline method.
7389         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7390         merged symbol value if there is one.
7391         (Symbol_value::has_output_value): New method defintiion.
7392         (Sized_relobj::Compute_final_local_value_status): New enum type.
7393         (Sized_relobj::compute_final_local_value): New methods.
7394         (Sized_relobj::compute_final_local_value_internal): New methods.
7395         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7396         and arm_cortex_a8.sh.
7397         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7398         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7399         New tests.
7400         * Makefile.in: Regenerate.
7401         * testsuite/arm_bl_out_of_range.s: Update test.
7402         * testsuite/thumb_bl_out_of_range.s: Ditto.
7403         * testsuite/thumb_blx_out_of_range.s: Ditto.
7404         * testsuite/arm_branch_out_of_range.sh: New file.
7405         * testsuite/arm_cortex_a8.sh: Ditto.
7406         * testsuite/arm_cortex_a8_b.s: Ditto.
7407         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7408         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7409         * testsuite/arm_cortex_a8_bl.s: Ditto.
7410         * testsuite/arm_cortex_a8_blx.s: Ditto.
7411         * testsuite/arm_cortex_a8_local.s: Ditto.
7412         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7413         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7414
7415 2010-09-08  Rafael Espindola  <espindola@google.com>
7416
7417         * Makefile.am (memory_test.stdout): Run readelf with -W.
7418         * Makefile.in: Regenerate.
7419         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7420         64 bit output.
7421
7422 2010-09-08  Rafael Espindola  <espindola@google.com>
7423
7424         * script-sections.cc (Script_sections::add_memory_region): Convert
7425         field precision to int.
7426         * script.cc (script_set_section_region, script_set_section_region):
7427         Convert field precision to int.
7428
7429 2010-09-08  Rafael Espindola  <espindola@google.com>
7430
7431         * arm.cc (do_finalize_sections): Create the __exidx_start and
7432         __exdix_end symbols even when the section is missing.
7433
7434 2010-09-08  Nick Clifton  <nickc@redhat.com>
7435
7436         * README: Remove claim that MEMORY is not supported.
7437         * expression.cc (script_exp_function_origin)
7438         (script_exp_function_length): Move from here to ...
7439         * script.cc: ... here.
7440         (script_set_section_region, script_add_memory)
7441         (script_parse_memory_attr, script_include_directive): New
7442         functions.
7443         * script-sections.cc
7444         (class Memory_region): New class.
7445         (class Output_section_definition): Add set_memory_region,
7446         set_section_vma, set_section_lma and get_section_name methods.
7447         (class Script_Sections): Add add_memory_region,
7448         find_memory_region, find_memory_region_origin,
7449         find_memory_region_length and set_memory_region methods.
7450         Have set_section_addresses method walk the list of set memory
7451         regions.
7452         Extend the print methos to display memory regions.
7453         * script-sections.h: Add prototypes for new methods.
7454         Add enum for MEMORY region attributes.
7455         * yyscript.y: Add support for parsing MEMORY regions.
7456         * script-c.h: Add prototypes for new functions.
7457         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7458         * testsuite/Makefile.in: Regenerate.
7459         * testsuite/memory_test.sh: New script.
7460         * testsuite/memory_test.s: New assembler source file.
7461         * testsuite/memory_test.t: New linker script.
7462
7463 2010-08-27  Doug Kwan  <dougkwan@google.com>
7464
7465         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7466         reference override an existing dynamic weak reference.
7467         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7468         * testsuite/Makefile.in: Regenerate.
7469         * testsuite/dyn_weak_ref.sh: New file.
7470         * testsuite/dyn_weak_ref_1.c: Ditto.
7471         * testsuite/dyn_weak_ref_2.c: Ditto.
7472
7473 2010-08-27  Ian Lance Taylor  <iant@google.com>
7474
7475         * incremental.h (class Incremental_input_entry): Add virtual
7476         destructor.
7477
7478 2010-08-27  Ian Lance Taylor  <iant@google.com>
7479
7480         * testsuite/start_lib_test_3.c: Mark t3 as used.
7481
7482 2010-08-27  Nick Clifton  <nickc@redhat.com>
7483
7484         * options.cc (version_script): Fix small typo in previous
7485         whitespace tidyup.
7486
7487 2010-08-25  Nick Clifton  <nickc@redhat.com>
7488
7489         * archive.cc: Formatting fixes: Remove whitespace between
7490         typename and following asterisk.  Remove whitespace between
7491         function name and opening parenthesis.
7492         * archive.h: Likewise.
7493         * arm.cc: Likewise.
7494         * attributes.cc: Likewise.
7495         * attributes.h: Likewise.
7496         * common.cc: Likewise.
7497         * copy-relocs.cc: Likewise.
7498         * dirsearch.h: Likewise.
7499         * dynobj.cc: Likewise.
7500         * ehframe.cc: Likewise.
7501         * ehframe.h: Likewise.
7502         * expression.cc: Likewise.
7503         * fileread.cc: Likewise.
7504         * fileread.h: Likewise.
7505         * gc.h: Likewise.
7506         * gold-threads.cc: Likewise.
7507         * gold.cc: Likewise.
7508         * i386.cc: Likewise.
7509         * icf.h: Likewise.
7510         * incremental-dump.cc: Likewise.
7511         * incremental.cc: Likewise.
7512         * layout.cc: Likewise.
7513         * layout.h: Likewise.
7514         * main.cc: Likewise.
7515         * merge.cc: Likewise.
7516         * merge.h: Likewise.
7517         * object.cc: Likewise.
7518         * object.h: Likewise.
7519         * options.cc: Likewise.
7520         * options.h: Likewise.
7521         * output.cc: Likewise.
7522         * output.h: Likewise.
7523         * plugin.cc: Likewise.
7524         * plugin.h: Likewise.
7525         * powerpc.cc: Likewise.
7526         * reloc.cc: Likewise.
7527         * script-c.h: Likewise.
7528         * script-sections.cc: Likewise.
7529         * script.cc: Likewise.
7530         * stringpool.cc: Likewise.
7531         * symtab.cc: Likewise.
7532         * symtab.h: Likewise.
7533         * target.cc: Likewise.
7534         * timer.cc: Likewise.
7535         * timer.h: Likewise.
7536         * version.cc: Likewise.
7537         * x86_64.cc: Likewise.
7538
7539 2010-08-24  Nick Clifton  <nickc@redhat.com>
7540
7541         PR 11899
7542         * layout.cc (segment_precedes): Sort segments by their physical
7543         addresses, if they have been set.
7544
7545 2010-08-23  Cary Coutant  <ccoutant@google.com>
7546
7547         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7548         symbols data.
7549         (Lib_group::include_member): Unlock object after deleting its
7550         symbols data.
7551         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7552         the bug fixed here.
7553
7554 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7555             Cary Coutant  <ccoutant@google.com>
7556
7557         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7558         constructor, and set_blocker.
7559         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7560         readsyms_blocker_.
7561         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7562         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7563         * testsuite/Makefile.am (start_lib_test): New test case.
7564         * testsuite/Makefile.in: Regenerate.
7565         * testsuite/start_lib_test_main.c: New file.
7566         * testsuite/start_lib_test_1.c: New file.
7567         * testsuite/start_lib_test_2.c: New file.
7568         * testsuite/start_lib_test_3.c: New file.
7569
7570 2010-08-19  Ian Lance Taylor  <iant@google.com>
7571
7572         * Makefile.in: Rebuild with automake 1.11.1.
7573         * aclocal.m4: Likewise.
7574         * testsuite/Makefile.in: Likewise.
7575
7576 2010-08-19  Ian Lance Taylor  <iant@google.com>
7577
7578         PR 10893
7579         * i386.cc (class Output_data_plt_i386): Update declarations.
7580         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7581         local_ifuncs_ fields.
7582         (Target_i386::do_plt_section_for_global): New function.
7583         (Target_i386::do_plt_section_for_local): New function.
7584         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7585         parameter; change all callers.  Initialize global_ifuncs_ and
7586         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7587         __rel_iplt_end.
7588         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7589         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7590         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7591         symbols.
7592         (Target_i386::make_plt_section): New function, broken out of
7593         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7594         (Target_i386::make_plt_entry): Call make_plt_section.
7595         (Target_i386::make_local_ifunc_plt_entry): New function.
7596         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7597         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7598         R_386_IRELATIVE to switch.
7599         (Target_i386::Scan::global): Likewise.
7600         (Target_i386::Relocate::relocate): Likewise.
7601         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7602         switch.
7603         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7604         (Target_x86_64::do_plt_section_for_global): New function.
7605         (Target_x86_64::do_plt_section_for_local): New function.
7606         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7607         parameter; change all callers.  If doing a static link define
7608         __rela_iplt_start and __rela_iplt_end.
7609         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7610         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7611         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7612         to point to .plt.
7613         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7614         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7615         switch.
7616         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7617         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7618         R_X86_64_IRELATIVE to switch.
7619         (Target_x86_64::Scan::global): Likewise.
7620         (Target_x86_64::Relocate::relocate): Likewise.
7621         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7622         switch.
7623         * target.h (class Target): Add plt_section_for_global and
7624         plt_section_for_local functions.  Add do_plt_section_for_global
7625         and do_plt_section_for_local virtual functions.
7626         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7627         clarifying comments.
7628         (Symbol::use_plt_offset): Handle IFUNC symbol.
7629         * object.cc (Sized_relobj::Sized_relobj): Initialize
7630         local_plt_offsets_.
7631         (Sized_relobj::local_has_plt_offset): New function.
7632         (Sized_relobj::local_plt_offset): New function.
7633         (Sized_relobj::set_local_plt_offset): New function.
7634         (Sized_relobj::do_count): Handle IFUNC symbol.
7635         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7636         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7637         is_ifunc_symbol functions.
7638         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7639         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7640         local_plt_offsets_ field.
7641         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7642         * output.h (class Output_section_data): Add non-const
7643         output_section function.
7644         (class Output_data_got): Update declarations.
7645         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7646         Add use_plt_offset parameter to global and local constructors.
7647         Change all callers.  Change local_sym_index_ field to 31 bits.
7648         Change GSYM_CODE and CONSTANT_CODE accordingly.
7649         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7650         doing a static link don't set sh_link field.
7651         (Output_data_got::Got_entry::write): Use PLT offset if
7652         appropriate.
7653         (Output_data_got::add_global_plt): New function.
7654         (Output_data_got::add_local_plt): New function.
7655         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7656         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7657         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7658         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7659         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7660         IFUNC conditional.
7661         * testsuite/ifunc-sel.h: New file.
7662         * testsuite/ifuncmain1.c: New file.
7663         * testsuite/ifuncmain1vis.c: New file.
7664         * testsuite/ifuncmod1.c: New file.
7665         * testsuite/ifuncdep2.c: New file.
7666         * testsuite/ifuncmain2.c: New file.
7667         * testsuite/ifuncmain3.c: New file.
7668         * testsuite/ifuncmod3.c: New file.
7669         * testsuite/ifuncmain4.c: New file.
7670         * testsuite/ifuncmain5.c: New file.
7671         * testsuite/ifuncmod5.c: New file.
7672         * testsuite/ifuncmain6pie.c: New file.
7673         * testsuite/ifuncmod6.c: New file.
7674         * testsuite/ifuncmain7.c: New file.
7675         * configure, testsuite/Makefile.in: Rebuild.
7676
7677 2010-08-18  Ian Lance Taylor  <iant@google.com>
7678
7679         * incremental.cc
7680         (Output_section_incremental_inputs::write_input_files): Add cast
7681         to avoid signed/unsigned comparison warning.
7682         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7683
7684 2010-08-12  Cary Coutant  <ccoutant@google.com>
7685
7686         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7687
7688 2010-08-13  Ian Lance Taylor  <iant@google.com>
7689
7690         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7691
7692 2010-08-12  Cary Coutant  <ccoutant@google.com>
7693             Doug Kwan  <dougkwan@google.com>
7694
7695         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7696         defintion overrides non-weak undef, remember that the original undef
7697         is not weak.
7698         * symtab.cc (Symbol_table::sized_write_global): For undef without
7699         an original weak binding, set binding to global in output.
7700         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7701         * testsuite/Makefile.in: Regenerate.
7702         * testsuite/strong_ref_weak_def.sh: New file.
7703         * testsuite/strong_ref_weak_def_1.c: Ditto.
7704         * testsuite/strong_ref_weak_def_2.c: Ditto.
7705
7706 2010-08-12  Cary Coutant  <ccoutant@google.com>
7707
7708         * testsuite/incremental_test.sh: Rewrite.
7709         * testsuite/incremental_test_1.c: Rewrite.
7710         * testsuite/incremental_test_2.c: Rewrite.
7711
7712 2010-08-12  Cary Coutant  <ccoutant@google.com>
7713
7714         * arm.cc (Target_arm::got_size): Add const.
7715         (Target_arm::got_entry_count): New function.
7716         (Target_arm::plt_entry_count): New function.
7717         (Target_arm::first_plt_entry_offset): New function.
7718         (Target_arm::plt_entry_size): New function.
7719         (Output_data_plt_arm::entry_count): New function.
7720         (Output_data_plt_arm::first_plt_entry_offset): New function.
7721         (Output_data_plt_arm::get_plt_entry_size): New function.
7722         * i386.cc (Target_i386::got_size): Add const.
7723         (Target_i386::got_entry_count): New function.
7724         (Target_i386::plt_entry_count): New function.
7725         (Target_i386::first_plt_entry_offset): New function.
7726         (Target_i386::plt_entry_size): New function.
7727         (Output_data_plt_i386::entry_count): New function.
7728         (Output_data_plt_i386::first_plt_entry_offset): New function.
7729         (Output_data_plt_i386::get_plt_entry_size): New function.
7730         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7731         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7732         * incremental.cc: Include target.h.
7733         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7734         parameter.  Adjust all callers.  Find incremental_got_plt section.
7735         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7736         section.
7737         (Output_section_incremental_inputs::set_final_data_size): Calculate
7738         size of incremental_got_plt section.
7739         (Output_section_incremental_inputs::do_write): Write the
7740         incremental_got_plt section.
7741         (Got_plt_view_info): New struct.
7742         (Local_got_offset_visitor): New class.
7743         (Global_got_offset_visitor): New class.
7744         (Global_symbol_visitor_got_plt): New class.
7745         (Output_section_incremental_inputs::write_got_plt): New function.
7746         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7747         Add parameter.  Adjust all callers.
7748         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7749         (Incremental_inputs::got_plt_section): New function.
7750         (Incremental_inputs::got_plt_section_): New data member.
7751         (Incremental_got_plt_reader): New class.
7752         * layout.cc (Layout::create_incremental_info_sections): Add the
7753         incremental_got_plt section.
7754         * object.h (Got_offset_list::get_list): New function.
7755         (Got offset_list::for_all_got_offsets): New function.
7756         (Sized_relobj::local_got_offset_list): New function.
7757         * powerpc.cc (Target_powerpc::got_size): Add const.
7758         (Target_powerpc::got_entry_count): New function.
7759         (Target_powerpc::plt_entry_count): New function.
7760         (Target_powerpc::first_plt_entry_offset): New function.
7761         (Target_powerpc::plt_entry_size): New function.
7762         (Output_data_plt_powerpc::entry_count): New function.
7763         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7764         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7765         * sparc.cc (Target_sparc::got_size): Add const.
7766         (Target_sparc::got_entry_count): New function.
7767         (Target_sparc::plt_entry_count): New function.
7768         (Target_sparc::first_plt_entry_offset): New function.
7769         (Target_sparc::plt_entry_size): New function.
7770         (Output_data_plt_sparc::entry_count): New function.
7771         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7772         (Output_data_plt_sparc::get_plt_entry_size): New function.
7773         * symtab.h (Symbol::got_offset_list): New function.
7774         (Symbol_table::for_all_symbols): New function.
7775         * target.h (Sized_target::got_entry_count): New function.
7776         (Sized_target::plt_entry_count): New function.
7777         (Sized_target::plt_entry_size): New function.
7778         * x86_64.cc (Target_x86_64::got_size): Add const.
7779         (Target_x86_64::got_entry_count): New function.
7780         (Target_x86_64::plt_entry_count): New function.
7781         (Target_x86_64::first_plt_entry_offset): New function.
7782         (Target_x86_64::plt_entry_size): New function.
7783         (Output_data_plt_x86_64::entry_count): New function.
7784         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7785         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7786
7787 2010-08-12  Cary Coutant  <ccoutant@google.com>
7788
7789         * archive.cc: Include incremental.h.
7790         (Archive::Archive): Initialize incremental_info_.
7791         (Archive::include_member): Record archive members in incremental info.
7792         (Add_archive_symbols::run): Record begin and end of an archive in
7793         incremental info.
7794         (Lib_group::include_member): Record objects in incremental info.
7795         * archive.h (Incremental_archive_entry): Forward declaration.
7796         (Archive::set_incremental_info): New member function.
7797         (Archive::incremental_info): New member function.
7798         (Archive::Unused_symbol_iterator): New class.
7799         (Archive::unused_symbols_begin): New member function.
7800         (Archive::unused_symbols_end): New member function.
7801         (Archive::incremental_info_): New data member.
7802         * incremental-dump.cc (find_input_containing_global): New function.
7803         (dump_incremental_inputs): Dump new incremental info sections.
7804         * incremental.cc: Include symtab.h.
7805         (Output_section_incremental_inputs): New class.
7806         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7807         new incremental info sections.
7808         (Sized_incremental_binary::do_check_inputs): Likewise.
7809         (Incremental_inputs::report_archive): Remove.
7810         (Incremental_inputs::report_archive_begin): New function.
7811         (Incremental_inputs::report_archive_end): New function.
7812         (Incremental_inputs::report_object): New function.
7813         (Incremental_inputs::finalize_inputs): Remove.
7814         (Incremental_inputs::report_input_section): New function.
7815         (Incremental_inputs::report_script): Rewrite.
7816         (Incremental_inputs::finalize): Do nothing but finalize string table.
7817         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7818         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7819         (Incremental_inputs::create_data_sections): New function.
7820         (Incremental_inputs::relocs_entsize): New function.
7821         (Output_section_incremental_inputs::set_final_data_size): New function.
7822         (Output_section_incremental_inputs::do_write): New function.
7823         (Output_section_incremental_inputs::write_header): New function.
7824         (Output_section_incremental_inputs::write_input_files): New function.
7825         (Output_section_incremental_inputs::write_info_blocks): New function.
7826         (Output_section_incremental_inputs::write_symtab): New function.
7827         * incremental.h (Incremental_script_entry): Forward declaration.
7828         (Incremental_object_entry): Forward declaration.
7829         (Incremental_archive_entry): Forward declaration.
7830         (Incremental_inputs): Forward declaration.
7831         (Incremental_inputs_header_data): Remove.
7832         (Incremental_inputs_header): Remove.
7833         (Incremental_inputs_header_write): Remove.
7834         (Incremental_inputs_entry_data): Remove.
7835         (Incremental_inputs_entry): Remove.
7836         (Incremental_inputs_entry_write): Remove.
7837         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7838         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7839         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7840         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7841         Likewise.
7842         (Incremental_input_entry): New class.
7843         (Incremental_script_entry): New class.
7844         (Incremental_object_entry): New class.
7845         (Incremental_archive_entry): New class.
7846         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7847         (Incremental_inputs::report_inputs): Remove.
7848         (Incremental_inputs::report_archive): Remove.
7849         (Incremental_inputs::report_archive_begin): New function.
7850         (Incremental_inputs::report_archive_end): New function.
7851         (Incremental_inputs::report_object): Change prototype.
7852         (Incremental_inputs::report_input_section): New function.
7853         (Incremental_inputs::report_script): Change prototype.
7854         (Incremental_inputs::get_reloc_count): New function.
7855         (Incremental_inputs::set_reloc_count): New function.
7856         (Incremental_inputs::create_data_sections): New function.
7857         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7858         (Incremental_inputs::inputs_section): New function.
7859         (Incremental_inputs::symtab_section): New function.
7860         (Incremental_inputs::relocs_section): New function.
7861         (Incremental_inputs::get_stringpool): Add const.
7862         (Incremental_inputs::command_line): Add const.
7863         (Incremental_inputs::inputs): Remove.
7864         (Incremental_inputs::command_line_key): New function.
7865         (Incremental_inputs::input_file_count): New function.
7866         (Incremental_inputs::input_files): New function.
7867         (Incremental_inputs::relocs_entsize): New function.
7868         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7869         (Incremental_inputs::finalize_inputs): Remove.
7870         (Incremental_inputs::Input_info): Remove.
7871         (Incremental_inputs::lock_): Remove.
7872         (Incremental_inputs::inputs_): Change type.
7873         (Incremental_inputs::inputs_map_): Remove.
7874         (Incremental_inputs::current_object_entry_): New data member.
7875         (Incremental_inputs::inputs_section_): New data member.
7876         (Incremental_inputs::symtab_section_): New data member.
7877         (Incremental_inputs::relocs_section_): New data member.
7878         (Incremental_inputs::reloc_count_): New data member.
7879         (Incremental_inputs_reader): New class.
7880         (Incremental_symtab_reader): New class.
7881         (Incremental_relocs_reader): New class.
7882         * layout.cc (Layout::finalize): Move finalization of incremental info
7883         and creation of incremental info sections to follow finalization of
7884         symbol table.  Set offsets for postprocessing sections.
7885         (Layout::create_incremental_info_sections): Call
7886         Incremental_inputs::create_data_sections.  Add incremental symtab
7887         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7888         sections to layout after input sections.
7889         * layout.h (struct Timespec): Forward declaration.
7890         (Layout::incremental_inputs): Add const.
7891         (Layout::create_incremental_info_sections): Add parameter.
7892         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7893         * object.cc: Include incremental.h.
7894         (Relobj::finalize_incremental_relocs): New function.
7895         (Sized_relobj::do_layout): Record input sections in incremental info.
7896         * object.h (Object::output_section): New function.
7897         (Object::output_section_offset): Moved from Relobj.
7898         (Object::get_incremental_reloc_base): New function.
7899         (Object::get_incremental_reloc_count): New function.
7900         (Object::do_output_section): New function.
7901         (Object::do_output_section_offset): Moved from Relobj.
7902         (Object::do_get_incremental_reloc_base): New function.
7903         (Object::do_get_incremental_reloc_count): New function.
7904         (Object::Object): Initialize new data members.
7905         (Relobj::output_section): Renamed do_output_section and moved to
7906         protected.
7907         (Relobj::output_section_offset): Moved to Object.
7908         (Relobj::do_get_incremental_reloc_base): New function.
7909         (Relobj::do_get_incremental_reloc_count): New function.
7910         (Relobj::allocate_incremental_reloc_counts): New function.
7911         (Relobj::count_incremental_reloc): New function.
7912         (Relobj::finalize_incremental_relocs): New function.
7913         (Relobj::next_incremental_reloc_index): New function.
7914         (Relobj::reloc_counts_): New data member.
7915         (Relobj::reloc_bases_): New data member.
7916         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7917         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7918         (Sized_relobj::incremental_relocs_scan): New function.
7919         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7920         (Sized_relobj::incremental_relocs_write): New function.
7921         (Sized_relobj::incremental_relocs_write_reltype): New function.
7922         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7923         incremental link.
7924         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7925         archives and object files elsewhere.
7926         (Add_symbols::run): Report object files here.
7927         (Finish_group::run): Report end of archive at end of group.
7928         * reloc.cc: Include layout.h, incremental.h.
7929         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7930         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7931         (Sized_relobj::incremental_relocs_scan): New function.
7932         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7933         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7934         (Sized_relobj::incremental_relocs_write): New function.
7935         (Sized_relobj::incremental_relocs_write_reltype): New function.
7936         * script.cc (read_input_script): Rewrite test for incremental link.
7937         Change call to Incremental_inputs::report_script.
7938         * symtab.h (Symbol_table::first_global_index): New function.
7939         (Symbol_table::output_count): New function.
7940
7941 2010-08-12  Doug Kwan  <dougkwan@google.com>
7942
7943         * arm.cc (Target_arm::merge_object_attributes): Check command line
7944         options --no-wchar-size-warning and --no-enum-size-warning.
7945         * options.h (General_options): Add ld-compatible options
7946         --no-enum-size-warning and --no-wchar-size-warning.
7947
7948 2010-08-04  Ian Lance Taylor  <iant@google.com>
7949
7950         * x86_64.cc (Target_x86_64::Scan::local): Use
7951         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7952         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7953         (Target_x86_64::Scan::global): Likewise.
7954         (Target_x86_64::Relocate::relocate): Likewise.
7955         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7956         Likewise.
7957
7958 2010-08-03  Cary Coutant  <ccoutant@google.com>
7959
7960         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7961         to reserve space in merged_strings vector. Keep total input size
7962         for stats.
7963         (Output_merge_string::do_print_merge_stats): Print total input size.
7964         * merge.h (Output_merge_string): Add input_size_ field.
7965         * stringpool.cc (Stringpool_template::string_length): Move
7966         implementations out of Stringpool_template class and place in
7967         stringpool.h.
7968         * stringpool.h (string_length): Move out of Stringpool_template.
7969
7970 2010-08-03  Ian Lance Taylor  <iant@google.com>
7971
7972         PR 11712
7973         * layout.cc (relaxation_loop_body): If address of load segment is
7974         set, adjust address to include headers if possible.
7975
7976 2010-08-03  Ian Lance Taylor  <iant@google.com>
7977
7978         * version.cc (version_string): Bump to 1.10.
7979
7980 2010-08-03  Ian Lance Taylor  <iant@google.com>
7981
7982         PR 11805
7983         * layout.h (enum Output_section_order): Define.
7984         (class Layout): Update declarations.
7985         * layout.cc (Layout::get_output_section): Add order parameter.
7986         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7987         is_first_non_relro parameters.  Change all callers.
7988         (Layout::choose_output_section): Likewise.
7989         (Layout::add_output_section_data): Likewise.
7990         (Layout::make_output_section): Likewise.  Set order.
7991         (Layout::default_section_order): New function.
7992         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7993         * output.cc (Output_section::Output_section): Initialize order_.
7994         Don't initialize deleted fields.
7995         (Output_segment::Output_segment): Don't initialize deleted
7996         fields.
7997         (Output_segment::add_output_section_to_load): New function
7998         replacing add_output_section.  Change all callers to call this or
7999         add_output_section_to_nonload.
8000         (Output_segment::add_output_section_to_nonload): New function.
8001         (Output_segment::remove_output_section): Rewrite.
8002         (Output_segment::add_initial_output_data): Likewise.
8003         (Output_segment::has_any_data_sections): Likewise.
8004         (Output_segment::is_first_section_relro): Likewise.
8005         (Output_segment::maximum_alignment): Likewise.
8006         (Output_segment::has_dynamic_reloc): New function replacing
8007         dynamic_reloc_count.  Change all callers.
8008         (Output_segment::has_dynamic_reloc_list): New function replacing
8009         dynamic_reloc_count_list.  Change all callers.
8010         (Output_segment::set_section_addresses): Rewrite.
8011         (Output_segment::set_offset): Rewrite.
8012         (Output_segment::find_first_and_last_list): Remove.
8013         (Output_segment::set_tls_offsets): Rewrite.
8014         (Output_segment::first_section_load_address): Likewise.
8015         (Output_segment::output_section_count): Likewise.
8016         (Output_segment::section_with_lowest_load_address): Likewise.
8017         (Output_segment::write_section_headers): Likewise.
8018         (Output_segment::print_sections_to_map): Likewise.
8019         * output.h (class Output_data): Remove dynamic_reloc_count_
8020         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8021         (Output_data::add_dynamic_reloc): Rewrite.
8022         (Output_data::has_dynamic_reloc): New function.
8023         (Output_data::dynamic_reloc_count): Remove.
8024         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8025         is_last_relro_, is_first_non_relro_, is_interp_,
8026         is_dynamic_linker_section_ fields.  Add order and set_order
8027         functions.  Remove is_relro_local, set_is_relro_local,
8028         is_last_relro, set_is_last_relro, is_first_non_relro,
8029         set_is_first_non_relro functions, is_interp, set_is_interp,
8030         is_dynamic_linker_section, and set_is_dynamic_linker_section
8031         functions.
8032         (class Output_segment): Change Output_data_list from std::list to
8033         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8034         output_bss_ fields.  Update declarations.
8035
8036 2010-08-02  Ian Lance Taylor  <iant@google.com>
8037
8038         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8039         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8040         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8041
8042 2010-08-02  Ian Lance Taylor  <iant@google.com>
8043
8044         PR 11855
8045         * script.cc (Script_options::Script_options): Initialize
8046         symbol_definitions_ and symbol_references_.
8047         (Script_options::add_symbol_assignment): Update
8048         symbol_definitions_ and symbol_references_.
8049         (Script_options::add_symbol_reference): New function.
8050         (script_symbol): New function.
8051         * script.h (class Script_options): Add symbol_definitions_ and
8052         symbol_references_ fields.
8053         (Script_options::referenced_const_iterator): New type.
8054         (Script_options::referenced_begin): New function.
8055         (Script_options::referenced_end): New function.
8056         (Script_options::is_referenced): New function.
8057         (Script_options::any_unreferenced): New function.
8058         * script-c.h (script_symbol): Declare.
8059         * yyscript.y (exp): Call script_symbol.
8060         * symtab.cc: Include "script.h".
8061         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8062         Change all callers.  Check symbols referenced by scripts.
8063         (Symbol_table::add_undefined_symbols_from_command_line): Add
8064         layout parameter.  Change all callers.
8065         (Symbol_table::do_add_undefined_symbols_from_command_line):
8066         Likewise.  Break out loop body.  Check symbols referenced by
8067         scripts.
8068         (Symbol_table::add_undefined_symbol_from_command_line): New
8069         function broken out of
8070         do_add_undefined_symbols_from_command_line.
8071         * symtab.h (class Symbol_table): Update declarations.
8072         * archive.cc: Include "layout.h".
8073         (Archive::should_include_member): Add layout parameter.  Change
8074         all callers.  Check for symbol mentioned in expression.
8075         * archive.h (class Archive): Update declaration.
8076         * object.cc (Sized_relobj::do_should_include_member): Add layout
8077         parameter.
8078         * object.h (Object::should_include_member): Add layout parameter.
8079         Change all callers.
8080         (Object::do_should_include_member): Add layout parameter.
8081         (class Sized_relobj): Update declaration.
8082         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8083         parameter.
8084         * dynobj.h (class Sized_dynobj): Update declaration.
8085         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8086         layout parameter.
8087         * plugin.h (class Sized_pluginobj): Update declaration.
8088
8089 2010-08-02  Ian Lance Taylor  <iant@google.com>
8090
8091         PR 11866
8092         * output.cc (Output_segment::set_offset): Search for the first and
8093         last sections rather than assuming that the list is in order.
8094         (Output_segment::find_first_and_last_list): New function.
8095         * output.h (class Output_segment): Update declarations.
8096         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8097         (relro_strip_test_SOURCES): New variable.
8098         (relro_strip_test_DEPENDENCIES): New variable.
8099         (relro_strip_test_LDFLAGS): New variable.
8100         (relro_strip_test_LDADD): New variable.
8101         (relro_strip_test.so): New target.
8102
8103 2010-08-02  Ian Lance Taylor  <iant@google.com>
8104
8105         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8106         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8107         (Target_i386::got_tlsdesc_section): New function.
8108         (Target_i386::got_section): Create space for GOT entries for
8109         TLSDESC relocations.
8110         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8111         R_386_TLS_GOTDESC.
8112         (Target_i386::Scan::global): Likewise.
8113         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8114         using TLSDESC GOT.
8115         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8116         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8117         (Target_x86_64::got_tlsdesc_section): New function.
8118         (Target_x86_64::got_section): Create space for GOT entries for
8119         TLSDESC relocations.
8120         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8121         R_386_TLS_GOTDESC.
8122         (Target_x86_64::Scan::global): Likewise.
8123         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8124         using TLSDESC GOT.
8125
8126 2010-08-02  Ian Lance Taylor  <iant@google.com>
8127
8128         * testsuite/final_layout.sh: Use dc to convert from hex to
8129         decimal.
8130
8131 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8132
8133         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8134         paramter to the call to gold::gc_process_relocs.
8135         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8136         paramter to the call to gold::gc_process_relocs.
8137         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8138         parameter to the call to gold::gc_process_relocs.
8139         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8140         template parameter to the call to gold::gc_process_relocs.
8141         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8142         paramter to the call to gold::gc_process_relocs.
8143         * gc.h (get_embedded_addend_size): New function.
8144         (gc_process_relocs): Save the size of the reloc for use by ICF.
8145         * icf.cc (get_section_contents): Get the addend from the text section
8146         for SHT_REL relocation sections.
8147         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8148         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8149         * int_encoding.h (read_from_pointer): New overloaded function.
8150         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8151         * testsuite/icf_sht_rel_addend_test.sh: New file.
8152         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8153         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8154
8155 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8156
8157         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8158         * Makefile.in: Regenerate.
8159         * testsuite/Makefile.in: Regenerate.
8160
8161 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8162
8163         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8164         * gold/testsuite/debug_msg.cc: Likewise.
8165         * gold/testsuite/odr_violation1.cc
8166         * gold/testsuite/odr_violation2.cc
8167
8168 2010-07-21  Cary Coutant  <ccoutant@google.com>
8169
8170         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8171         string, and length fields.
8172         (Output_merge_string::Merged_strings_list): New type.
8173         (Output_merge_string::Merged_strings_lists): New typedef.
8174         (Output_merge_string): Replace merged_strings_ with
8175         merged_strings_lists_.
8176         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8177         Merged_strings_list per input object and section.  Don't store pointer
8178         to the string.  Don't store length with each merged string entry.
8179         (Output_merge_string::finalize_merged_data): Loop over list of merged
8180         strings lists.  Recompute length of each merged string.
8181
8182 2010-07-15  Cary Coutant  <ccoutant@google.com>
8183
8184         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8185         here.
8186
8187 2010-07-14  Ian Lance Taylor  <iant@google.com>
8188
8189         * descriptors.cc (Descriptors::open): Report correct name in error
8190         message.
8191
8192 2010-07-13  Doug Kwan  <dougkwan@google.com>
8193
8194         * arm.cc (Arm_input_section::Arm_input_section): For a
8195         SHT_ARM_EXIDX section, always keeps the input sections.
8196         (Arm_input_section::set_exidx_section_link): New method.
8197         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8198         has_errors_ to false.
8199         (Arm_exidx_input_section::has_errors,
8200         Arm_exidx_input_section::set_has_errors): New methods.
8201         (Arm_exidx_input_section::has_errors_): New data member.
8202         (Arm_relobj::get_exidx_shndx_list): New method.
8203         (Arm_output_section::append_text_sections_to_list): Do not skip
8204         section without SHF_EXECINSTR.
8205         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8206         errors.
8207         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8208         section header.  Make error messages more verbose.  Check for
8209         a non-executable section linked to an EXIDX section.
8210         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8211         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8212         check that there is no deferred EXIDX section if we exit early.
8213         Instead of not making an EXIDX section in case of an error, make one
8214         and set the has_errors flag of it.
8215         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8216         in a relocatable link.
8217         (Target_arm::do_relax): Look for the EXIDX output section instead of
8218         assuming that it is called .ARM.exidx.
8219         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8220         section list.  Do not check for SHF_EXECINSTR section flags but
8221         skip any input section with errors.
8222         * output.cc (Output_section::Output_section): Initialize
8223         always_keeps_input_sections_ to false.
8224         (Output_section::add_input_section): Check for
8225         always_keeps_input_sections_.
8226         *  output.h (Output_section::always_keeps_input_sections,
8227         Output_section::set_always_keeps_input_sections): New methods.
8228         (Output_section::always_keeps_input_sections): New data member.
8229
8230 2010-07-13  Rafael Espindola  <espindola@google.com>
8231
8232         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8233         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8234
8235 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8236             Ian Lance Taylor  <iant@google.com>
8237
8238         * output.h (Output_section_lookup_maps::add_merge_section):
8239         Correct check of whether value was inserted.
8240         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8241         (Output_section_lookup_maps::add_relaxed_input_section):
8242         Likewise.
8243         * arm.cc (Target_arm::got_section): Remove used local os.
8244         * i386.cc (Target_i386::got_section): Likewise.
8245         * x86_64.cc (Target_x86_64::got_section): Likewise.
8246         * sparc.cc (Target_sparc::got_section): Likewise.
8247         (Target_sparc::relocate): Remove unused local have_got_offset.
8248         * powerpc.cc (Target_powerpc::relocate): Likewise.
8249
8250 2010-07-13  Ian Lance Taylor  <iant@google.com>
8251
8252         * compressed_output.cc (zlib_decompress): Fix signature in
8253         !HAVE_ZLIB_H case.
8254
8255         * archive.cc (Archive::include_member): Unlock an external member
8256         of a thin archive.  Don't bother to delete an object we know is
8257         NULL.
8258
8259 2010-07-12  Cary Coutant  <ccoutant@google.com>
8260
8261         * compressed_output.cc (zlib_decompress): New function.
8262         (get_uncompressed_size): New function.
8263         (decompress_input_section): New function.
8264         * compressed_output.h (get_uncompressed_size): New function.
8265         (decompress_input_section): New function.
8266         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8267         Handle compressed debug sections.
8268         * layout.cc (is_compressed_debug_section): New function.
8269         (Layout::output_section_name): Map compressed section names to
8270         canonical names.
8271         * layout.h (is_compressed_debug_section): New function.
8272         (is_debug_info_section): Recognize compressed debug sections.
8273         * merge.cc: Include compressed_output.h.
8274         (Output_merge_data::do_add_input_section): Handle compressed
8275         debug sections.
8276         (Output_merge_string::do_add_input_section): Handle compressed
8277         debug sections.
8278         * object.cc: Include compressed_output.h.
8279         (Sized_relobj::Sized_relobj): Initialize new data members.
8280         (build_compressed_section_map): New function.
8281         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8282         * object.h (Object::section_is_compressed): New method.
8283         (Object::do_section_is_compressed): New method.
8284         (Sized_relobj::Compressed_section_map): New type.
8285         (Sized_relobj::do_section_is_compressed): New method.
8286         (Sized_relobj::compressed_sections_): New data member.
8287         * output.cc (Output_section::add_input_section): Handle compressed
8288         debug sections.
8289         * reloc.cc: Include compressed_output.h.
8290         (Sized_relobj::write_sections): Handle compressed debug sections.
8291
8292 2010-07-08  Cary Coutant  <ccoutant@google.com>
8293
8294         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8295         weak when resolving to a dynamic def.
8296         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8297         for weak undef/dynamic def cases. Adjust callers.
8298         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8299         undef_binding_weak_.
8300         (Symbol_table::sized_write_globals): Adjust symbol binding.
8301         (Symbol_table::sized_write_symbol): Add binding parameter.
8302         * symtab.h (Symbol::set_undef_binding): New method.
8303         (Symbol::is_undef_binding_weak): New method.
8304         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8305         (Symbol_table::should_override): Add new parameter.
8306         (Symbol_table::sized_write_symbol): Add new parameter.
8307
8308         * testsuite/weak_undef_file1.cc: Add new test case.
8309         * testsuite/weak_undef_file2.cc: Fix header comment.
8310         * testsuite/weak_undef_test.cc: Add new test case.
8311
8312 2010-06-29  Doug Kwan  <dougkwan@google.com>
8313
8314         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8315         Initialize USE_SYMBOL_.
8316         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8317         definition.
8318         (Arm_reloc_property::uses_symbol_): New data member declaration.
8319         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8320         uses symbol value and symbol is undefined but not weakly undefined.
8321
8322 2010-06-28  Rafael Espindola  <espindola@google.com>
8323
8324         * plugin.cc (Plugin::load): Use dlerror.
8325
8326 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8327
8328         * symtab.cc (detect_odr_violations): When reporting an ODR
8329         violation, report an object where the symbol is defined.
8330
8331 2010-06-25  Doug Kwan  <dougkwan@google.com>
8332
8333         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8334         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8335         definition.
8336         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8337         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8338         target hook to detect function points.
8339         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8340         * icf.h (Icf::check_section_for_function_pointers): Change type of
8341         parameter SECTION_NAME to const reference to std::string.  Use
8342         target hook to determine if section may have unsafe pointers.
8343         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8344         method definition.
8345
8346 2010-06-21  Rafael Espindola  <espindola@google.com>
8347
8348         * fileread.cc (Input_file::find_fie): New
8349         (Input_file::open): Use Input_file::find_fie.
8350         * fileread.h (Input_file::find_fie): New
8351         * plugin.cc (set_extra_library_path): New.
8352         (Plugin::load): Add set_extra_library_path to the transfer vector.
8353         (Plugin_manager::set_extra_library_path): New.
8354         (Plugin_manager::add_input_file): Use the extra search path if set.
8355         (set_extra_library_path(): New.
8356         * plugin.h (Plugin_manager): Add set_extra_library_path and
8357         extra_search_path_.
8358
8359 2010-06-19  Cary Coutant  <ccoutant@google.com>
8360
8361         * layout.cc (gdb_sections): Add .debug_types.
8362         (lines_only_debug_sections): Likewise.
8363
8364 2010-06-18  Rafael Espindola  <espindola@google.com>
8365
8366         * plugin.cc (add_input_file,add_input_library)
8367         (Plugin_manager::add_input_file): Make filename arguments const.
8368         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8369         const.
8370
8371 2010-06-16  Doug Kwan  <dougkwan@google.com>
8372
8373         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8374         .ARM.attributes section if we have not merged any input
8375         attributes sections.
8376
8377 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8378
8379         * arm.cc: Allow combining objects with no EABI version
8380         information.
8381
8382 2010-06-15  Rafael Espindola  <espindola@google.com>
8383
8384         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8385
8386 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8387
8388         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8389         (struct iovec): Correct !HAVE_READV definition.
8390
8391 2010-06-10  Cary Coutant  <ccoutant@google.com>
8392
8393         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8394         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8395         reloc sections.
8396         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8397
8398         PR 11683
8399         * symtab.h (Symbol::is_placeholder): New member function.
8400         * target-reloc.h (relocate_section): Check for placeholder symbols.
8401
8402         * testsuite/Makefile.am (plugin_test_8): New test.
8403         (plugin_test_9): New test.
8404         * testsuite/Makefile.in: Regenerate.
8405
8406 2010-06-09  Nick Clifton  <nickc@redhat.com>
8407
8408         * yyscript.y (input_list_element): Allow strings prefixed with
8409         the '-' character.  Treat these as libraries.
8410         * script.cc (script_add_library): New function.  Adds a library
8411         specified by "-l<name>" found in an input script.
8412         * script-c.h: Add prototype for script_add_library.
8413
8414 2010-06-07  Doug Kwan  <dougkwan@google.com>
8415
8416         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8417         Restrict stub-group size to be within long conditional branch
8418         range when working around cortex-A8 erratum.
8419
8420 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8421
8422         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8423         #ifdef typo.
8424
8425 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8426
8427         PR gold/11658
8428         * output.cc
8429         (Output_section::Input_section_sort_entry::compare_section_ordering):
8430         Change to return non-zero correctly.
8431         (Output_section::Input_section_sort_section_order_index_compare
8432         ::operator()): Change to fix ambiguity in comparisons.
8433
8434 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8435
8436         * gold.h (is_wildcard_string): New function.
8437         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8438         (Layout::layout_eh_frame): Ditto.
8439         (Layout::find_section_order_index): New method.
8440         (Layout::read_layout_from_file): New method.
8441         * layout.h (Layout::find_section_order_index): New method.
8442         (Layout::read_layout_from_file): New method.
8443         (Layout::input_section_position_): New private member.
8444         (Layout::input_section_glob_): New private member.
8445         * main.cc (main): Call read_layout_from_file here.
8446         * options.h (--section-ordering-file): New option.
8447         * output.cc (Output_section::input_section_order_specified_): New
8448         member.
8449         (Output_section::Output_section): Initialize new member.
8450         (Output_section::add_input_section): Add new parameter.
8451         Keep input sections when --section-ordering-file is used.
8452         (Output_section::set_final_data_size): Sort input sections when
8453         section ordering file is specified.
8454         (Output_section::Input_section_sort_entry): Add new parameter.
8455         Check sorting type.
8456         (Output_section::Input_section_sort_entry::compare_section_ordering):
8457         New method.
8458         (Output_section::Input_section_sort_compare::operator()): Change to
8459         consider section_order_index.
8460         (Output_section::Input_section_sort_init_fini_compare::operator()):
8461         Change to consider section_order_index.
8462         (Output_section::Input_section_sort_section_order_index_compare
8463         ::operator()): New method.
8464         (Output_section::sort_attached_input_sections): Change to sort
8465         according to section order when specified.
8466         (Output_section::add_input_section<32, true>): Add new parameter.
8467         (Output_section::add_input_section<64, true>): Add new parameter.
8468         (Output_section::add_input_section<32, false>): Add new parameter.
8469         (Output_section::add_input_section<64, false>): Add new parameter.
8470         * output.h (Output_section::add_input_section): Add new parameter.
8471         (Output_section::input_section_order_specified): New
8472         method.
8473         (Output_section::set_input_section_order_specified): New method.
8474         (Input_section::Input_section): Initialize section_order_index_.
8475         (Input_section::section_order_index): New method.
8476         (Input_section::set_section_order_index): New method.
8477         (Input_section::section_order_index_): New member.
8478         (Input_section::Input_section_sort_section_order_index_compare): New
8479         struct.
8480         (Output_section::input_section_order_specified_): New member.
8481         * script-sections.cc (is_wildcard_string): Delete and move modified
8482         method to gold.h.
8483         (Output_section_element_input::Output_section_element_input): Modify
8484         call to is_wildcard_string.
8485         (Output_section_element_input::Input_section_pattern
8486         ::Input_section_pattern): Ditto.
8487         (Output_section_element_input::Output_section_element_input): Ditto.
8488         * testsuite/Makefile.am (final_layout): New test case.
8489         * testsuite/Makefile.in: Regenerate.
8490         * testsuite/final_layout.cc: New file.
8491         * testsuite/final_layout.sh: New file.
8492
8493 2010-06-01  Rafael Espindola  <espindola@google.com>
8494
8495         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8496
8497 2010-06-01  Rafael Espindola  <espindola@google.com>
8498
8499         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8500         visibility of symbols.
8501
8502 2010-05-27  Doug Kwan  <dougkwan@google.com>
8503
8504         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8505         from start of output section instead of address for a local symbol
8506         in a merged or relaxed section when doing a relocatable link.
8507
8508 2010-05-26  Rafael Espindola  <espindola@google.com>
8509
8510         PR 11604
8511         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8512         adding sections the garbage collector removed.
8513         * gold/testsuite/Makefile.am: Add test.
8514         * gold/testsuite/Makefile.in: Regenerate.
8515         * gold/testsuite/plugin_test_7.sh: New.
8516         * gold/testsuite/plugin_test_7_1.c: New.
8517         * gold/testsuite/plugin_test_7_2.c: New.
8518
8519 2010-05-26  Rafael Espindola  <espindola@google.com>
8520
8521         * script-sections.cc (Output_section_definition::set_section_addresses):
8522         Check for --section-start.
8523
8524 2010-05-26  Doug Kwan  <dougkwan@google.com>
8525
8526         * arm.cc (Arm_scan_relocatable_relocs): New class.
8527         (Target_arm::relocate_special_relocatable): New method.
8528         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8529         (Arm_relocate_functions::thumb_branch_common): Same.
8530         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8531         instead of Default_scan_relocatable_relocs.
8532         * target-reloc.h (relocate_for_relocatable): Let target handle
8533         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8534         * target.h (Sized_target::relocate_special_relocatable): New method.
8535
8536 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8537
8538         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8539
8540 2010-05-23  Doug Kwan  <dougkwan@google.com>
8541
8542         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8543         instead of a cast.
8544         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8545         with a direct branch, not a conditional branch, to a stub.
8546         * merge.cc (Output_merge_base::record_input_section): New method
8547         defintion.
8548         (Output_merge_data::do_add_input_section): Record input section if
8549         keeps-input-sections flag is set.
8550         (Output_merge_string::do_add_input_section): Ditto.
8551         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8552         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8553         INPUT_SECTIONS_.
8554         (Output_merge_base::keeps_input_sections,
8555         Output_merge_base::set_keeps_input_sections,
8556         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8557         method definitions.
8558         (Output_merge_base::Input_sections): New type declaration.
8559         (Output_merge_base::input_sections_begin,
8560         Output_merge_base::input_sections_end,
8561         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8562         (Output_merge_base::bool keeps_input_sections_,
8563         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8564         Output_merge_base::input_sections_): New data members.
8565         (Output_merge_data::do_set_keeps_input_sections): New method
8566         defintion.
8567         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8568         * output.cc (Output_section::Input_section::relobj): Move method
8569         defintion from class declaration to here and handle merge sections.
8570         (Output_section::Input_section::shndx): Ditto.
8571         (Output_section::Output_section): Remove initializations of removed
8572         data members and initialize new data member LOOKUP_MAPS_.
8573         (Output_section::add_input_section): Set keeps-input-sections flag
8574         for a newly created merge output section as appropriate.  Adjust code
8575         to use Output_section_lookup_maps class.
8576         (Output_section::add_relaxed_input_section): Adjst code for lookup
8577         maps code refactoring.
8578         (Output_section::add_merge_input_section): Add a new parameter
8579         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8580         class.  If adding input section to a newly created merge output
8581         section fails, remove the new merge section.
8582         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8583         Adjust code for use of the Output_section_lookup_maps class.
8584         (Output_section::find_merge_section): Ditto.
8585         (Output_section::build_lookup_maps): New method defintion.
8586         (Output_section::find_relaxed_input_section): Adjust code to use
8587         Output_section_lookup_maps class.
8588         (Output_section::get_input_sections): Export merge sections.  Adjust
8589         code to use Output_section_lookup_maps class.
8590         (Output_section:::add_script_input_section): Adjust code to use
8591         Output_section_lookup_maps class.  Update lookup maps for merge
8592         sections also.
8593         (Output_section::discard_states): Use Output_section_lookup_maps.
8594         (Output_section::restore_states): Same.
8595         * output.h (Merge_section_properties): Move class defintion out of
8596         Output_section.
8597         (Output_section_lookup_maps): New class.
8598         (Output_section::Input_section::is_merge_section): New method
8599         defintion.
8600         (Output_section::Input_section::relobj): Move defintion out of class
8601         defintion.  Declare method only.
8602         (Output_section::Input_section::shndx): Ditto.
8603         (Output_section::Input_section::output_merge_base): New method defintion.
8604         (Output_section::Input_section::u2_.pomb): New union field.
8605         (Output_section::Merge_section_by_properties_map,
8606         Output_section::Output_section_data_by_input_section_map,
8607         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8608         Remove types.
8609         (Output_section::add_merge_input_section): Add new parameter
8610         KEEPS_INPUT_SECTIONS.
8611         (Output_section::build_lookup_maps): New method declaration.
8612         (Output_section::merge_section_map_,
8613         Output_section::merge_section_by_properties_map_,
8614         Output_section::relaxed_input_section_map_,
8615         Output_section::is_relaxed_input_section_map_valid_): Remove data
8616         members.
8617         (Output_section::lookup_maps_): New data member.
8618
8619 2010-05-21  Doug Kwan  <dougkwan@google.com>
8620
8621         PR gold/11619
8622         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8623         avoid a compilation error.
8624
8625 2010-05-19  Rafael Espindola  <espindola@google.com>
8626
8627         * script-sections.cc (Output_section_definition::allocate_to_segment):
8628         Update the phdrs_list even when the output section is NULL.
8629         * testsuite/Makefile.am: Add test.
8630         * testsuite/Makefile.in: Regenerate.
8631         * testsuite/script_test_9.cc: New.
8632         * testsuite/script_test_9.sh: New.
8633         * testsuite/script_test_9.t: New.
8634
8635 2010-05-19  Doug Kwan  <dougkwan@google.com>
8636
8637         * arm.cc (Arm_input_section::original_size): New method.
8638         (Arm_input_section::do_addralign): Add a cast.
8639         (Arm_input_section::do_output_offset): Remove static cast.
8640         (Arm_input_section::original_addralign,
8641          Arm_input_section::original_size_): Change type to uint32_t.
8642         (Arm_input_section::init): Add safe casts for section alignment
8643         and size.
8644         (Arm_input_section::set_final_data_size): Do not set address and
8645         offset of stub table.
8646         (Arm_output_section::fix_exidx_coverage): Change use of of
8647         Output_section::Simple_input_section to that of
8648         Output_section::Input_section.
8649         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8650         except for the first pass.
8651         * output.cc (Output_section::get_input_sections): Change type of
8652         input_sections to std::list<Input_section>.
8653         (Output_section::add_script_input_section): Rename from
8654         Output_section::add_simple_input_section.  Change type of SIS
8655         parameter from Simple_input_section to Input_section.
8656         * output.h (Output_section::Simple_input_section): Remove class.
8657         (Output_section::Input_section): Change class visibility to public.
8658         (Output_section::Input_section::addralign): Use stored alignments
8659         for special input sections if set.
8660         (Output_section::Input_section::set_addralign): New method.
8661         (Output_section::get_input_sections): Change parameter type from
8662         list of Simple_input_section to list of Input_section.
8663         (Output_section::add_script_input_section): Rename from
8664         Output_section::add_simple_input_section. Change first parameter's
8665         type from Simple_input_section to Input_section and remove the
8666         second and third parameters.
8667         * script-sections.cc (Input_section::Input_section_list): Change
8668         type to list of Output_section::Input_section/
8669         (Input_section_info::Input_section_info): Change parameter type of
8670         INPUT_SECTION to Output_section::Input_section.
8671         (Input_section_info::input_section): Change return type.
8672         (Input_section_info::input_section_): Change type to
8673         Output_section::Input_section.
8674         (Output_section_element_input::set_section_addresses): Adjust code
8675         to use Output_section::Input_section instead of
8676         Output_section::Simple_input_section.  Adjust code for renaming
8677         of Output_section::add_simple_input_section.
8678         (Orphan_output_section::set_section_addresses): Ditto.
8679
8680 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8681
8682         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8683         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8684
8685 2010-05-18  Rafael Espindola  <espindola@google.com>
8686
8687         * options.cc (General_options::finalize): Handle -nostdlib.
8688         * options.h (nostdlib): New option.
8689         * script.cc (script_add_search_dir): Handle -nostdlib.
8690
8691 2010-05-12  Doug Kwan  <dougkwan@google.com>
8692
8693         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8694         attributes section only if there no attributes section after merging.
8695         (Target_arm::merge_object_attributes): Move value of
8696         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8697         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8698         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8699         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8700         and arm_attr_merge_7.stdout.
8701         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8702         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8703         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8704         arm_attr_merge_7b.o): New rules.
8705         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8706         arm_attr_merge_7
8707         * testsuite/Makefile.in: Regenerate.
8708         * testsuite/arm_attr_merge.sh: New file.
8709         * testsuite/arm_attr_merge_[67][ab].s: Same.
8710
8711 2010-05-05  Nick Clifton  <nickc@redhat.com>
8712
8713         * po/es.po: Updated Spanish translation.
8714
8715 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8716
8717         * Makefile.am (install-exec-local): Properly install gold as
8718         default cross linker.
8719         * Makefile.in: Regenerated.
8720
8721 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8722             Nick Clifton  <nickc@redhat.com>
8723
8724         * configure.ac (install_as_default): Define and set to false
8725         unless --enable-gold or --enable-gold=both/gold has been
8726         specified.
8727         * configure: Regenerate.
8728
8729         * Makefile.am (install-exec-local): Install the executable as
8730         'ld.gold'.  If install_as_default is true then also install it as
8731         'ld'.
8732         * Makefile.in: Regenerated.
8733
8734 2010-04-24  Ian Lance Taylor  <iant@google.com>
8735
8736         * layout.cc (Layout::layout_reloc): In relocatable link don't
8737         combine reloc sections for grouped sections.
8738
8739 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8740
8741         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8742         sections that are not ordinary to icf.
8743         * icf.cc (get_section_contents): Handle relocation pointing to section
8744         with no object or shndx information.
8745         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8746         * testsuite/Makefile.in: Regenerate.
8747         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8748         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8749
8750 2010-04-22  Ian Lance Taylor  <iant@google.com>
8751
8752         * expression.cc (Expression::Expression_eval_info): Add
8753         result_alignment_pointer field.
8754         (Expression::eval_with_dot): Add result_alignment_pointer
8755         parameter.  Change all callers.
8756         (Expression::eval_maybe_dot): Likewise.
8757         (class Binary_expression): Add alignment_pointer parameter to
8758         left_value and right_value.  Change all callers.
8759         (BINARY_EXPRESSION): Set result alignment.
8760         (class Trinary_expression): Add alignment_pointer parameter to
8761         arg2_value and arg3_value.  Change all callers.
8762         (Trinary_cond::value): Set result alignment.
8763         (Max_expression::value, Min_expression::value): Likewise.
8764         (Align_expression::value): Likewise.
8765         * script-sections.cc (class Sections_element): Add dot_alignment
8766         parameter to set_section_addresses virtual function.  Update
8767         instantiations.
8768         (class Output_section_element): Likewise.
8769         (Script_sections::create_segments): Add dot_alignment parameter.
8770         Change all callers.
8771         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8772         (Script_sections::set_phdrs_clause_addresses): Likewise.
8773         * script-sections.h: Update declarations.
8774         * script.h: Update declarations.
8775         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8776         min_p_align.
8777         * testsuite/script_test_3.t: Set large alignment.
8778         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8779         segment has expected alignment.
8780
8781 2010-04-22  Nick Clifton  <nickc@redhat.com>
8782
8783         * po/gold.pot: Updated by the Translation project.
8784         * po/vi.po: Updated Vietnamese translation.
8785
8786 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8787
8788         * testsuite/Makefile.am (check_PROGRAMS): Add
8789         icf_virtual_function_folding_test.
8790         * testsuite/Makefile.in: Regenerated.
8791
8792 2010-04-15  Andrew Haley  <aph@redhat.com>
8793
8794         * options.h (merge_exidx_entries): New option.
8795         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8796         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8797         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8798         (Target_arm::merge_exidx_entries): New function.
8799         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8800         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8801         to Arm_exidx_fixup constructor.
8802         Add new arg, merge_exidx_entries.
8803         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8804         Arm_output_section::fix_exidx_coverage.
8805
8806 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8807
8808         * icf.cc (get_section_contents): Check for preemptible functions.
8809         Ignore addend when appropriate.
8810         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8811         section folded.
8812         (add_from_relobj): Check for section folded.
8813         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8814         * symtab.h (should_add_dynsym_entry): Add new parameter.
8815         * target-reloc.h (scan_relocs): Check for section folded.
8816         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8817         Check reloc types for function pointers in shared objects.
8818         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8819         case.
8820         (icf_preemptible_functions_test): New test case.
8821         (icf_string_merge_test): New test case.
8822         * testsuite.Makefile.in: Regenerate.
8823         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8824         bar_glob.  Refactor code.
8825         * testsuite/icf_preemptible_functions_test.cc: New file.
8826         * testsuite/icf_preemptible_functions_test.sh: New file.
8827         * testsuite/icf_string_merge_test.cc: New file.
8828         * testsuite/icf_string_merge_test.sh: New file.
8829         * testsuite/icf_virtual_function_folding_test.cc: New file.
8830         * testsuite/icf_virtual_function_folding_test.sh: New file.
8831
8832 2010-04-14  Doug Kwan  <dougkwan@google.com>
8833
8834         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8835         for local symbol recounting if we remove a section due to ICF.
8836         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8837         there are no regular objects in input.
8838
8839 2010-04-13  Doug Kwan  <dougkwan@google.com>
8840
8841         * arm.cc (Arm_input_section::set_final_data_size): Compute
8842         accurate final data size instead of using current data size.
8843
8844 2010-04-09  Doug Kwan  <dougkwan@google.com>
8845
8846         * layout.cc (Layout::choose_output_section): Handle script section
8847         types.
8848         (Layout::make_output_section_for_script): Add section type parameter.
8849         Handle script section types.
8850         * layout.h (Layout::make_output_section_for_script): Add section
8851         type parameter.
8852         * output.cc (Output_section::Output_section): Initialize data member
8853         is_noload_.
8854         (Output_section::do_reset_address_and_file_offset): Do not set address
8855         to 0 if section is a NOLOAD section.
8856         * output.h (Output_section::is_noload): New method.
8857         (Output_section::set_is_noload): Ditto.
8858         (Output_section::is_noload_): New data member.
8859         * script-c.h (Script_section_type): New enum type.
8860         (struct Parser_output_section_header): Add new file section_type.
8861         * script-sections.cc (Sections_element::output_section_name): Add
8862         parameter for returning script section type.
8863         (Output_section_definition::output_section_name): Ditto.
8864         (Output_section_definition::section_type)P; New method.
8865         (Output_section_definiton::script_section_type_name): Ditto.
8866         (Output_section_definition::script_section_type_): New data member.
8867         (Output_section_definition::Output_section_definition): Initialize
8868         data member Output_section_definition::script_section_type_.
8869         (Output_section_definition::create_sections): Pass script section type
8870         to Layout::make_output_section_for_script.
8871         (Output_section_definition::output_section_name): Return script
8872         section type to caller.
8873         (Output_section_definition::set_section_address): Do not advance
8874         dot value and load address if section type is NOLOAD.  Set address
8875         of NOLOAD sections regardless of section flags.
8876         (Output_section_definition::print): Print section type if it is
8877         not SCRIPT_SECTION_TYPE_NONE.
8878         (Output_section_definition::section_type): New method.
8879         (Output_section_definition::script_section_type_name): Ditto.
8880         (Script_sections::output_section_name): Add new parameter
8881         PSECTION_TYPE for returning script section type.  Pass it to
8882         section elements.  Handle discard sections.
8883         (Sort_output_sections::operator()): Handle NOLOAD sections.
8884         * script-sections.h (Script_sections::Section_type): New enum type.
8885         (Script_sections::output_section_name): Add a new parameter for
8886         returning script section type.
8887         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8888         INFO and NOLOAD.
8889         * yyscript.y (union): Add new field SECTION_TYPE.
8890         (COPY, DSECT, INFO, NOLOAD): New tokens.
8891         (opt_address_and_section_type): Change type to output_section_header.
8892         (section_type): New non-terminal
8893         (section_header): Handle section type.
8894         (opt_address_and_section_type): Return section type value.
8895
8896 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8897
8898         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8899         * testsuite/plugin_common_test_2.c (foo): Likewise.
8900
8901 2010-04-08  Doug Kwan  <dougkwan@google.com>
8902
8903         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8904         Output_merge_data.
8905         * output.cc (Output_section::add_merge_input_section): Simplify
8906         code and return status of Output_merge_base::add_input_section.
8907         Update merge section map only if Output_merge_base::add_input_section
8908         returns true.
8909
8910 2010-04-07  Doug Kwan  <dougkwan@google.com>
8911
8912         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8913         if section is marked as containing instructions but has no mapping
8914         symbols.
8915         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8916         correct section index.
8917         (Arm_relobj::find_linked_text_section): Ditto.
8918
8919 2010-04-07  Cary Coutant  <ccoutant@google.com>
8920
8921         * archive.cc (include_member): Destroy Read_symbols_data object before
8922         releasing file.
8923         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8924         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8925         (Read_symbols_data::~Read_symbols_data) New destructor.
8926         (Section_relocs::Section_relocs) New constructor.
8927         (Section_relocs::~Section_relocs) New destructor.
8928         (Read_relocs_data::Read_relocs_data) New constructor.
8929         (Read_relocs_data::~Read_relocs_data) New destructor.
8930         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8931         pointers to NULL after deleting.
8932
8933 2010-04-07  Doug Kwan  <dougkwan@google.com>
8934
8935         * arm.cc: Replace "endianity" with "endianness" in comments.
8936         (Arm_exidx_cantunwind): Ditto.
8937         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8938         (Arm_relobj::merge_flags_and_attributes): New method.
8939         (Arm_relobj::merge_flags_and_attributes_): New data member.
8940         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8941         (Arm_relobj::scan_sections_for_stubs): Ditto.
8942         (Arm_relobj::do_read_symbols): Check to see if we really want to
8943         merge processor-specific flags and attributes.  Exit early if
8944         an object is empty except for section names and the undefined symbol.
8945         (Target_arm::do_finalize_sections): Move check for ELF format to
8946         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8947         attributes from a regular object only when we have determined that
8948         it is aapropriate.  Do not create an .ARM.attributes section in
8949         output if there is no regular input object.
8950         (Target_arm::merge_processor_specific_flags): Check
8951         --warn-mismatch before printing any error.
8952         (Target_arm::merge_object_attributes): Ditto.
8953         * gold.cc (queue_middle_tasks): Handle the case in which there is
8954         no regular object in input.
8955         * options.cc (General_options::parse_EB): New method.
8956         (General_options::parse_EL): Same.
8957         (General_options::General_options): Initialize endianness_.
8958         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8959         New options.
8960         (General_options::Endianness): New enum.
8961         (General_options::endianness): New method.
8962         (General_options::endianness_): New data member.
8963         * parameters.cc (Parameters::set_options): Check target endianness.
8964         (Parameters::set_target_once): Ditto.
8965         (Parameters::check_target_endianness): New method.
8966         (parameters_force_valid_target): If either -EL or -EB is specified,
8967         use it to define endianness of default target.
8968         * parameters.h (Parameters::check_target_endianness): New method
8969         declaration.
8970         * target.h (class Target): Change "endianity" to "endianness"
8971         in comments.
8972
8973 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8974
8975         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8976         * configure: Regenerate.
8977         * Makefile.in: Regenerate.
8978         * testsuite/Makefile.in: Regenerate.
8979
8980 2010-04-06  Cary Coutant  <ccoutant@google.com>
8981
8982         gcc PR lto/42757
8983         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8984         prevailing definitions of common symbols.
8985         * testsuite/plugin_test_6.sh: New test case.
8986         * testsuite/plugin_common_test_1.c: New test case.
8987         * testsuite/plugin_common_test_2.c: New test case.
8988         * testsuite/Makefile.am (plugin_test_6): New test case.
8989         * testsuite/Makefile.in: Regenerate.
8990
8991 2010-04-06  Nick Clifton  <nickc@redhat.com>
8992
8993         * po/vi.po: New Vietnamese translation.
8994
8995 2010-03-30  Doug Kwan  <dougkwan@google.com>
8996
8997         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8998
8999 2010-03-25  Doug Kwan  <dougkwan@google.com>
9000
9001         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9002         to avoid a conversion warning on a 32-bit host.
9003
9004 2010-03-24  Ian Lance Taylor  <iant@google.com>
9005
9006         * testsuite/script_test_3.t: Add a TLS segment.
9007         * testsuite/Makefile.am (check_PROGRAMS): Add
9008         tls_phdrs_script_test.
9009         (tls_phdrs_script_test_SOURCES): Define.
9010         (tls_phdrs_script_test_DEPENDENCIES): Define.
9011         (tls_phdrs_script_test_LDFLAGS): Define.
9012         (tls_phdrs_script_test_LDADD): Define.
9013         * testsuite/Makefile.in: Rebuild.
9014
9015 2010-03-23  Cary Coutant  <ccoutant@google.com>
9016
9017         * fileread.cc (find_or_make_view): Fix comment.
9018
9019 2010-03-23  Ian Lance Taylor  <iant@google.com>
9020
9021         * script-sections.cc (class Orphan_section_placement): Define
9022         PLACE_TLS and PLACE_TLS_BSS.
9023         (Orphan_section_placement::Orphan_section_placement): Initialize
9024         new places.
9025         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9026         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9027         (tls_script_test_SOURCES): Define.
9028         (tls_script_test_DEPENDENCIES): Define.
9029         (tls_script_test_LDFLAGS): Define.
9030         (tls_script_test_LDADD): Define.
9031         * testsuite/Makefile.in: Rebuild.
9032
9033 2010-03-22  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Arm_relocate_functions::abs8,
9036         Arm_relocate_functions::abs16): Use correct check for overflow
9037         specified in the ARM ELF specs.
9038         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9039         target of a BLX instruction specially.
9040         (Reloc_stub::stub_type_for_reloc): Ditto.
9041         (Relocate::relocate): Use symbolic names instead of numeric relocation
9042         codes to report error.
9043         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9044         workaround.
9045         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9046         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9047         thumb2_blx_out_of_range.stdout
9048         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9049         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9050         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9051         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9052         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9053         thumb2_blx_in_range, thumb2_blx_in_range.o,
9054         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9055         thumb2_blx_out_of_range.o): New rules.
9056         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9057         thumb2_blx_in_range and thumb2_blx_out_of_range.
9058         * testsuite/Makefile.in: Regenerate.
9059         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9060         * testsuite/thumb_blx_in_range.s: New file.
9061         * testsuite/thumb_blx_out_of_range.s: New file.
9062
9063 2010-03-22  Rafael Espindola  <espindola@google.com>
9064
9065         * archive.cc (Should_include): Move to archive.h.
9066         (should_include_member): Make it a member of Archive.
9067         (Lib_group): New.
9068         (Add_lib_group_symbols): New.
9069         * archive.h: Include options.h.
9070         (Archive_member): Moved from Archive.
9071         (Should_include): Moved from archive.cc.
9072         (Lib_group): New.
9073         (Add_lib_group_symbols): New.
9074         * dynobj.cc (do_should_include_member): New.
9075         * dynobj.h (do_should_include_member): New.
9076         * gold.cc (queue_initial_tasks): Update call to queue.
9077         * main.cc (main): Print lib group stats.
9078         * object.cc (do_should_include_member): New.
9079         * object.h: Include archive.h.
9080         (Object::should_include_member): New.
9081         (Object::do_should_include_member): New.
9082         (Sized_relobj::do_should_include_member): New.
9083         * options.cc (General_options::parse_start_lib): New.
9084         (General_options::parse_end_lib): New.
9085         (Input_arguments::add_file): Handle lib groups.
9086         (Input_arguments::start_group): Check we are not in a lib.
9087         (Input_arguments::start_lib): New.
9088         (Input_arguments::end_lib): New.
9089         * options.h (General_options): Add start_lib and end_lib.
9090         (Input_argument::lib_): New.
9091         (Input_argument::lib): New.
9092         (Input_argument::is_lib): New.
9093         (Input_file_lib): New.
9094         (Input_arguments::in_lib_): New.
9095         (Input_arguments::in_lib): New.
9096         (Input_arguments::start_lib): New.
9097         (Input_arguments::end_lib_): New.
9098         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9099         in unused members as preempted.
9100         (Sized_pluginobj::do_should_include_member): New.
9101         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9102         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9103         return the blocker.
9104         (Read_symbols::do_whole_lib_group): New.
9105         (Read_symbols::do_lib_group): New.
9106         (Read_symbols::do_read_symbols): Handle lib groups.
9107         (Read_symbols::get_name): Handle lib groups.
9108         * readsyms.h (Read_symbols): Add an archive member pointer.
9109         (Read_symbols::do_whole_lib_group): New.
9110         (Read_symbols::do_lib_group): New.
9111         (Read_symbols::member_): New.
9112         * script.cc (read_input_script): Update call to queue_soon.
9113
9114 2010-03-19  Doug Kwan  <dougkwan@google.com>
9115
9116         * arm.cc (Stub_table::Stub_table): Initialize new data members
9117         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9118         (Stub_table::add_reloc_stub): Assign stub offset and update
9119         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9120         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9121         New data members.
9122         (Stub_table::update_data_size_and_addralign): Use
9123         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9124         instead of going over all reloc stubs.
9125         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9126         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9127         Stringpool_template::offset_ to size of Stringpool_char.
9128         (Stringpool_template::new_key_offset): Remove code to initialize
9129         Stringpool_template::offset_.
9130         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9131         Stringpool_template::offset_ to zero.
9132
9133 2010-03-15  Doug Kwan  <dougkwan@google.com>
9134
9135         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9136         offset_.
9137         (Stringpool_template::new_key_offset): New method.
9138         (Stringpool_template::add_string): Assign offsets when adding new
9139         strings.
9140         (Stringpool_template::set_string_offsets): Do not set string offsets
9141         when not optimizing.
9142         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9143         member size_.
9144         (Chunked_vector::clear): Clear size_.
9145         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9146         (Chunked_vector::size): Return size_.
9147         (Chunked_vector::push_back): Use size_ to find insert position.
9148         (Chunked_vector::size_): New data member.
9149         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9150         (Stringpool_template::new_key_offset): New method declaration.
9151         (Stringpool_template::offset_): New data member.
9152
9153 2010-03-15   Rafael Espindola  <espindola@google.com>
9154
9155         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9156         Add_symbols' constructor.
9157         * readsyms.h (Add_symbols): Remove the input_group member.
9158
9159 2010-03-10  Ian Lance Taylor  <iant@google.com>
9160
9161         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9162         target to ask whether a reference to a symbol requires a stack
9163         split.
9164         * target.h (Target::is_call_to_non_split): New function.
9165         (Target::do_is_call_to_non_split): Declare virtual function.
9166         * target.cc: Include "symtab.h".
9167         (Target::do_is_call_to_non_split): New function.
9168         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9169
9170 2010-03-10  Cary Coutant  <ccoutant@google.com>
9171
9172         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9173         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9174         (File_read::open[2]): Add whole_file_view_ to list of views.
9175         (File_read::make_view): Remove test of whole_file_view_.
9176         (File_read::find_or_make_view): Create whole_file_view_ if
9177         necessary.
9178         (File_read::clear_views): Replace bool parameter with enum;
9179         adjust all callers.  Don't delete views with permanent data;
9180         do delete cached views and views from archives if
9181         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9182         if clearing the corresponding view.
9183         * fileread.h (File_read::Clear_views_mode): New enum.
9184         (File_read::View::is_permanent_view): New method.
9185         (File_read::clear_views): Replace bool parameter
9186         with enum; adjust all callers.
9187         * options.h (General_options): Change keep_files_mapped option;
9188         add map_whole_files.
9189         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9190         releasing the file.
9191         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9192         the file.
9193
9194 2010-03-10  David S. Miller  <davem@davemloft.net>
9195
9196         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9197
9198 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9199
9200         * icf.cc (get_section_contents): Add '@' marker after processing the
9201         merge reloc.
9202
9203 2010-03-08  Doug Kwan  <dougkwan@google.com>
9204
9205         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9206         due to a conversion warning.
9207         (Arm_relobj::update_output_local_symbol_count): Check for local
9208         symbol with unset output index.
9209
9210 2010-03-05  Ian Lance Taylor  <iant@google.com>
9211
9212         * options.h (class General_options): Add --spare-dynamic-tags.
9213         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9214         --spare-dynamic-tags.
9215
9216 2010-03-05  Ian Lance Taylor  <iant@google.com>
9217
9218         * incremental.cc: Include "libiberty.h".
9219
9220 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9221
9222         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9223         function, is_info_ member.
9224         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9225         (Versions::Versions): Update caller.
9226         (Versions::define_base_version): Likewise.
9227         (Versions::add_def): Likewise.
9228
9229 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9230
9231         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9232         (Scan::possible_function_pointer_reloc): New function.
9233         (Scan::local_reloc_may_be_function_pointer): Change to call
9234         possible_function_pointer_reloc.
9235         (Scan::global_reloc_may_be_function_pointer): Ditto.
9236         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9237         relocations in ".data.rel.ro._ZTV" section.
9238         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9239         * testsuite/icf_safe_so_test.cc: Ditto.
9240         * testsuite/icf_safe_test.cc: Ditto.
9241         * testsuite/icf_safe_test.sh: Ditto.
9242
9243 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9244             Ian Lance Taylor  <iant@google.com>
9245
9246         * target-reloc.h (relocate_section): Check the symbol table index
9247         for -1U before setting the local symbol index.
9248         (scan_relocatable_relocs): If copying the relocation, record that
9249         the local symbol is required.
9250         * object.h (Symbol_value::is_output_symtab_index_set): New
9251         function.
9252         (Symbol_value::may_be_discarded_from_output_symtab): New
9253         function.
9254         (Symbol_value::has_output_symtab_entry): New function.
9255         (Symbol_value::needs_output_symtab_entry): Remove.
9256         (Symbol_value::output_symtab_index): Make sure the symbol index is
9257         set.
9258         (Symbol_value::set_output_symtab_index): Make sure the symbol
9259         index is not set.  Make sure the new index is valid.
9260         (Symbol_value::set_must_have_output_symtab_entry): New function.
9261         (Symbol_value::has_output_dynsym_entry): New function.
9262         (Symbol_value::set_output_dynsym_index): Make sure the new index
9263         is valid.
9264         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9265         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9266         local symbol if permitted.
9267         (Sized_relobj::do_finalize_local_symbols): Call
9268         is_output_symtab_index_set rather than needs_output_symtab_entry.
9269         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9270         rather than needs_output_symtab_entry.  Call
9271         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9272         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9273         is_output_symtab_index_set rather than needs_output_symtab_entry.
9274         * testsuite/discard_locals_relocatable_test.c: New file.
9275         * testsuite/discard_locals_test.sh: Test -r.
9276         * testsuite/Makefile.am (check_DATA): Add
9277         discard_locals_relocatable_test1.syms,
9278         discard_local_relocatable_test2.syms.
9279         (MOSTLYCLEANFILES): Likewise.  Also add
9280         discard_locals_relocatable_test1.lout and
9281         discard_locals_relocatable_test2.out.
9282         (discard_locals_relocatable_test1.syms): New target.
9283         (discard_locals_relocatable_test.o): New target.
9284         (discard_locals_relocatable_test1.out): New target.
9285         (discard_locals_relocatable_test2.syms): New target.
9286         (discard_locals_relocatable_test2.out): New target.
9287         (various): Add missing ../ld-new dependencies.
9288         * testsuite/Makefile.in: Rebuild.
9289
9290 2010-03-03  Nick Clifton  <nickc@redhat.com>
9291
9292         * po/fi.po: New Finnish translation.
9293
9294 2010-03-01  Doug Kwan  <dougkwan@google.com>
9295
9296         * layout.cc (Layout::Layout): Force section types of .init_array*,
9297         .preinit_array* and .fini_array* sections.
9298         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9299         Fix check of return value of std::string::find.().
9300         (Output_section::Input_section_sort_compare::operator()): Remove
9301         comment about .init_array.
9302         (Output_section::Input_section_sort_init_fini_compare::operator()):
9303         New method.
9304         (Output_section::sort_attached_input_sections): Handle .init_array
9305         and .fini_array specially.
9306         * output.h (Output_section::Inut_section_sort_compare): Update
9307         comment.
9308         (Output_section::Input_section_sort_init_fini_compare): New struct.
9309
9310 2010-02-26  Doug Kwan  <dougkwan@google.com>
9311
9312         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9313         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9314         * testsuite/debug_msg.sh: Avoid matching source line number for
9315         use of global variable undef_int.
9316
9317 2010-02-26  Doug Kwan  <dougkwan@google.com>
9318
9319         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9320         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9321         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9322         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9323         * options.cc (General_options::General_options): Initialize member
9324         fix_v4bx_.
9325         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9326         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9327         and rm_no_fix_v4bx.stdout
9328         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9329         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9330         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9331         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9332         and arm_no_fix_v4bx.
9333         * Makefile.in: Regenerate.
9334         * testsuite/arm_fix_v4bx.s: New file.
9335         * testsuite/arm_fix_v4bx.sh: Ditto.
9336
9337 2010-02-24  Doug Kwan  <dougkwan@google.com>
9338
9339         * arm.cc (Target_arm::got_section): Make the .got section the first
9340         non RELRO section in the data segment.
9341         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9342         suffixes of section names.
9343
9344 2010-02-24  Doug Kwan  <dougkwan@google.com>
9345
9346         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9347         flags and attributes merging if an input file is a binary file.
9348         * fileread.cc (Input_file::open): Record format of original file.
9349         * fileread.h (Input_file::Format): New enum type.
9350         (Input_file::Input_file): Initialize data member format_.
9351         (Input_file::format): New method definition.
9352         (Input_file::format_):: New data member.
9353
9354 2010-02-24  Doug Kwan  <dougkwan@google.com>
9355
9356         * arm.cc (Arm_output_data_got): New class.
9357         (ARM_TCB_SIZE): New constant
9358         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9359         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9360         If user uses a script with a SECTIONS clause, issue only a warning
9361         for a misplaced EXIDX input section.  Otherwise, issue an error.
9362         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9363         garbage collection.
9364         (Target_arm::got_mode_index_entry): Handle static linking.
9365         (Target_arm::Scan::local): Ditto.
9366         (Target_arm::Scan::global): Ditto.
9367         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9368         all incorrectly implemented relocations.
9369         (Target_arm::fix_exidx_coverage): Pass layout to
9370         Arm_output_section::fix_exidx_coverage.
9371         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9372         from ".ARM.exidx." and ".ARM.extab.".
9373
9374 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9375
9376         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9377         section if it does not already exist.
9378         * attributes.cc (Attributes_section_data::Attributes_section_data):
9379         Don't crash if size is zero.
9380
9381 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9382             Ian Lance Taylor  <iant@google.com>
9383
9384         * gold.cc (queue_middle_tasks): If no input files were opened,
9385         exit.
9386         * workqueue.h (Task_function::Task_function): Assert that there is
9387         a blocker.
9388
9389 2010-02-22  Doug Kwan  <dougkwan@google.com>
9390
9391         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9392         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9393         types to avoid warnings due to different uint64_t implementations
9394         on different hosts.
9395
9396 2010-02-21  Doug Kwan  <dougkwan@google.com>
9397
9398         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9399         handling of the maximum backward branch offset.
9400         (Arm_relocate_functions::thumb_branch_common): Ditto.
9401         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9402         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9403         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9404         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9405         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9406         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9407         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9408         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9409         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9410         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9411         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9412         thumb2_bl_out_of_range.o): New rules.
9413         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9414         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9415         thumb2_bl_out_of_range
9416         * testsuite/Makefile.in: Regenerate.
9417         * testsuite/arm_bl_in_range.s: New file.
9418         * testsuite/arm_bl_out_of_range.s: Ditto.
9419         * testsuite/arm_branch_in_range.sh: Ditto.
9420         * testsuite/arm_branch_range.t: Ditto.
9421         * testsuite/thumb2_branch_range.t: Ditto.
9422         * testsuite/thumb_bl_in_range.s: Ditto.
9423         * testsuite/thumb_bl_out_of_range.s: Ditto.
9424         * testsuite/thumb_branch_range.t: Ditto.
9425
9426 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9427
9428         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9429         Add reloc offset information.
9430         * icf.cc (get_section_contents): Change iterators to point to the new
9431         vectors. Add reloc offset information to the contents.
9432         * icf.h (Icf::Sections_reachable_info): New typedef.
9433         (Icf::Sections_reachable_list): New typedef.
9434         (Icf::Offset_info): New typedef.
9435         (Icf::Reloc_info): New struct typedef.
9436         (Icf::Reloc_info_list): New typedef.
9437         (Icf::symbol_reloc_list): Delete method.
9438         (Icf::addend_reloc_list): Delete method.
9439         (Icf::section_reloc_list): Delete method.
9440         (Icf::reloc_info_list): New method.
9441         (Icf::reloc_info_list_): New member.
9442
9443 2010-02-19  Doug Kwan  <dougkwan@google.com>
9444
9445         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9446         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9447         * arm.cc (Arm_relocation_functions): New forward declaration.
9448         (Target_arm::Target_arm): Initialize new data members
9449         got_mod_index_offset_ and tls_base_symbol_defined_.
9450         (Target_arm::Relocate::relocate_tls): New method.
9451         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9452          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9453         New methods.
9454         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9455         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9456         (Target_arm::got_mod_index_offset_,
9457         Target_arm::tls_base_symbol_defined_): New data members.
9458         (Target_arm::Scan::local, Target::Scan::global,
9459         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9460         relocations.
9461
9462 2010-02-18  Doug Kwan  <dougkwan@google.com>
9463
9464         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9465         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9466         text section as a parameter becuase some broken tools may not set
9467         the link in section header.
9468         (Target_arm::has_got_section): New method.
9469         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9470         without any mapping symbol as data only.  Remove warning.
9471         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9472         link in its section header, try to discover the link by inspecting the
9473         REL31 relocation at the beginning of the section.
9474         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9475         in error message.
9476         (Target_arm::Scan::global): Treat any reference to the symbol
9477         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9478
9479 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9480
9481         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9482         (Scan::global_reloc_may_be_function_pointer): New function.
9483         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9484         (Scan::global_reloc_may_be_function_pointer): New function.
9485         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9486         (Scan::global_reloc_may_be_function_pointer): New function.
9487         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9488         (Scan::global_reloc_may_be_function_pointer): New function.
9489         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9490         (Scan::global_reloc_may_be_function_pointer): New function.
9491         (Scan::possible_function_pointer_reloc): New function.
9492         (Target_x86_64::can_check_for_function_pointers): New function.
9493         * gc.h (gc_process_relocs): Scan relocation types to determine if
9494         function pointers were taken for targets that support it.
9495         * icf.cc (Icf::find_identical_sections): Include functions for
9496         folding in safe ICF whose pointer is not taken.
9497         * icf.h (Secn_fptr_taken_set): New typedef.
9498         (fptr_section_id_): New member.
9499         (section_has_function_pointers): New function.
9500         (set_section_has_function_pointers): New function.
9501         (check_section_for_function_pointers): New function.
9502         * options.h: Fix comment for safe ICF option.
9503         * target.h (can_check_for_function_pointers): New function.
9504         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9505         Modify icf_safe_test for X86-64.
9506         * testsuite/Makefile.in: Regenerate.
9507         * testsuite/icf_safe_so_test.cc: New file.
9508         * testsuite/icf_safe_so_test.sh: New file.
9509         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9510         (main): Change to take pointer to function kept_func_3.
9511         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9512         folding is done correctly for X86-64.
9513
9514 2010-02-12  David S. Miller  <davem@davemloft.net>
9515
9516         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9517         is_symbolless parameter.
9518         (Output_reloc<SHT_REL>::is_symbolless): New.
9519         (Output_reloc<SHT_REL>::is_symbolless_): New.
9520         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9521         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9522         (Output_reloc<SHT_RELA>::is_symbolless): New.
9523         (Output_data_reloc::add_global): Handle is_symbolless.
9524         (Output_data_reloc::add_global_relative): Likewise.
9525         (Output_data_reloc::add_local): Likewise.
9526         (Output_data_reloc::add_local_relative): Likewise.
9527         (Output_data_reloc::add_symbolless_global_addend): New.
9528         (Output_data_reloc::add_symbolless_local_addend): New.
9529         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9530         is_symbolless.
9531         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9532         instead of ->is_relative_
9533         (Output_reloc::write): Likewise.
9534         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9535         (Output_reloc::write_rel): Simplify.
9536
9537         * sparc.cc (Target_sparc::Scan::local): Use
9538         ->add_symbolless_local_addend as needed.
9539         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9540         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9541         based upon relocation offset.
9542
9543 2010-02-11  Doug Kwan  <dougkwan@google.com>
9544
9545         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9546         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9547         beginning of function.
9548         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9549         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9550         parameter is_32bit in calls to should_apply_static_reloc.
9551         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9552         (check_DATA): Add arm_abs_global.stdout.
9553         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9554         arm_abs_global.stdout): New rules.
9555         (MOSTLLYCLEANFILES): Add arm_abs_global
9556         * Makefile.in: Regenerate.
9557         * testsuite/arm_abs_global.s: New file.
9558         * testsuite/arm_abs_global.sh: Ditto.
9559         * testsuite/arm_abs_lib.s: Ditto.
9560
9561 2010-02-11  Ian Lance Taylor  <iant@google.com>
9562
9563         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9564         Read_relocs task.
9565         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9566         Allocate_commons_task first.
9567         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9568         task, rather than symtab_lock_.
9569         (Gc_process_relocs::~Gc_process_relocs): New function.
9570         (Gc_process_relocs::is_runnable): Check this_blocker_.
9571         (Gc_process_relocs::locks): Use next_blocker_ rather than
9572         blocker_.
9573         (Scan_relocs::~Scan_relocs): New function.
9574         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9575         symtab_lock_.
9576         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9577         next_blocker_.
9578         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9579         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9580         constructor accordingly.
9581         (class Gc_process_relocs): Likewise.
9582         (class Scan_relocs): Likewise.
9583         * common.h (class Allocate_commons_task): Remove symtab_lock_
9584         field, and corresponding constructor parameter.
9585         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9586         symtab_lock_.
9587         (Allocate_commons_task::locks): Likewise.
9588
9589 2010-02-11  Ian Lance Taylor  <iant@google.com>
9590
9591         * gold-threads.h (class Once): Define.
9592         (class Initialize_lock): Rewrite as child of Once.
9593         * gold-threads.cc (class Once_initialize): Define.
9594         (once_pointer_control): New static variable.
9595         (once_pointer, once_arg): New static variables.
9596         (c_run_once): New static function.
9597         (Once::Once, Once::run_once, Once::internal_run): New functions.
9598         (class Initialize_lock_once): Remove.
9599         (initialize_lock_control): Remove.
9600         (initialize_lock_pointer): Remove.
9601         (initialize_lock_once): Remove.
9602         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9603         (Initialize_lock::initialize): Rewrite.
9604         (Initialize_lock::do_run_once): New function.
9605         * archive.cc (Archive::interpret_header): Only clear name if it is
9606         not already empty.
9607         * fileread.cc: Include "gold-threads.h"
9608         (file_counts_lock): New static variable.
9609         (file_counts_initialize_lock): Likewise.
9610         (File_read::release): Only increment counts when using --stats.
9611         Use a lock around the increment.
9612         * parameters.cc (class Set_parameters_target_once): Define.
9613         (set_parameters_target_once): New static variable.
9614         (Parameters::Parameters): Move here from parameters.h.
9615         (Parameters::set_target): Rewrite.
9616         (Parameters::set_target_once): New function.
9617         (Parameters::clear_target): Move here and rewrite.
9618         * parameters.h (class Parameters): Update declarations.  Add
9619         set_parameters_target_once_ field.
9620         (Parameters::Parameters): Move to parameters.cc.
9621         (Parameters::clear_target): Likewise.
9622         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9623         task.
9624         (Start_group::~Start_group): New function.
9625         (Start_group::is_runnable): New function.
9626         (Start_group::locks, Start_group::run): New functions.
9627         (Finish_group::run): Change saw_undefined to size_t.
9628         * readsyms.h (class Start_group): Define.
9629         (class Finish_group): Change saw_undefined_ field to size_t.
9630         (Finish_group::Finish_group): Remove saw_undefined and
9631         this_blocker parameters.  Change all callers.
9632         (Finish_group::set_saw_undefined): New function.
9633         (Finish_group::set_blocker): New function.
9634         * symtab.h (class Symbol_table): Change saw_undefined to return
9635         size_t.  Change saw_undefined_ field to size_t.
9636         * target-select.cc (Set_target_once::do_run_once): New function.
9637         (Target_selector::Target_selector): Initialize set_target_once_
9638         field.  Don't initialize lock_ and initialize_lock_ fields.
9639         (Target_selector::instantiate_target): Rewrite.
9640         (Target_selector::set_target): New function.
9641         * target-select.h (class Set_target_once): Define.
9642         (class Target_selector): Update declarations.  Make
9643         Set_target_once a friend.  Remove lock_ and initialize_lock_
9644         fields.  Add set_target_once_ field.
9645
9646 2010-02-10  Ian Lance Taylor  <iant@google.com>
9647
9648         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9649         queueing any tasks.
9650         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9651         (queue_middle_tasks): Add all blockers before queueing any tasks.
9652         (queue_final_tasks): Likewise.
9653         * token.h (Task_token::add_blockers): New function.
9654         * object.h (Input_objects::number_of_relobjs): New function.
9655
9656 2010-02-10  Ian Lance Taylor  <iant@google.com>
9657
9658         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9659         shared, not if not position independent.
9660         * x86_64.cc (Relocate::relocate_tls): Likewise.
9661         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9662         (tls_pie_pic_test): New target.
9663         * testsuite/Makefile.in: Rebuild.
9664
9665         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9666         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9667         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9668         * testsuite/Makefile.in: Rebuild.
9669
9670 2010-02-09  David S. Miller  <davem@davemloft.net>
9671
9672         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9673         R_SPARC_RELATIVE using ->add_local_relative().
9674         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9675
9676         * output.h (Output_data_dynamic::add_section_size): New method
9677         that takes two Output_data objects.
9678         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9679         entry param.  Handle it in initializers.
9680         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9681         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9682         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9683         arg.
9684         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9685         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9686         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9687         for dynrel_includes_plt.
9688         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9689         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9690         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9691         before .rela.plt
9692         (Target_sparc::do_finalize_sections): Update to pass true for
9693         dynrel_includes_plt.
9694         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9695         output before .rela.plt
9696         (Target_powerpc::do_finalize_sections): Update to pass true for
9697         dynrel_includes_plt when 32-bit.
9698
9699 2010-02-08  Doug Kwan  <dougkwan@google.com>
9700
9701         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9702         method.
9703         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9704         Arm_relobj::scan_section_for_cortex_a8_stubs,
9705         Arm_relobj::do_relocation_section): Instead of calling
9706         Output_section::output_address, use faster
9707         Arm_relobj::simple_input_section_output_address.
9708
9709 2010-02-08  David S. Miller  <davem@davemloft.net>
9710
9711         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9712         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9713         relocation helper function.
9714
9715         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9716         just like R_SPARC_GOT{10,13,22}.
9717         (Target_sparc::Scan::local): Likewise.
9718         (Target_sparc::Relocate:relocate): Likewise.
9719
9720 2010-02-06  Ian Lance Taylor  <iant@google.com>
9721
9722         * configure.ac: Rewrite targetobjs duplicate removal code to use
9723         only shell constructs.
9724         * configure: Rebuild.
9725
9726 2010-02-05  Doug Kwan  <dougkwan@google.com>
9727
9728         PR 11247
9729         * arm.cc (Arm_relobj::section_is_scannable): New method.
9730         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9731         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9732
9733 2010-02-04  Doug Kwan  <dougkwan@google.com>
9734
9735         PR 11247
9736         * arm-reloc-property.cc (cstdio): Include.
9737         * configure.ac (targetobjs): Remove duplicates.
9738         * configure: Regenerate.
9739         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9740         big and little endian version for a given address size.
9741
9742 2010-02-03  Doug Kwan  <dougkwan@google.com>
9743
9744         * arm-reloc-property.cc
9745         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9746         definition.
9747         * arm-reloc-property.h
9748         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9749         New method definition.
9750         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9751         declaration.
9752         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9753         overflow to N.
9754         (GOT_PREL): Change implemented to Y.
9755         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9756         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9757         (Arm_relocate_functions::movw_abs_nc): Remove method.
9758         (Arm_relocate_functions::movt_abs): Ditto.
9759         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9760         (Arm_relocate_functions::thm_movt_abs): Ditto.
9761         (Arm_relocate_functions::movw_rel_nc): Ditto.
9762         (Arm_relocate_functions::movw_rel): Ditto.
9763         (Arm_relocate_functions::movt_rel): Ditto.
9764         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9765         (Arm_relocate_functions:thm_movw_rel): Ditto.
9766         (Arm_relocate_functions:thm_movt_rel): Ditto.
9767         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9768         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9769         New method definitions.
9770         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9771         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9772         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9773         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9774         (Target_arm::Relocate::relocate): Check for non-static or
9775         unimplemented relocation code and exit early.  Change calls to
9776         Target_arm::reloc_uses_thumb_bit and
9777         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9778         instead.  Refactor code to handle similar relocations to increase
9779         code sharing.  Remove check for unsupported relocation code in switch
9780         statement.
9781         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9782         relocation property table to find out size.  Change error message to
9783         print out the name of a relocation code instead of the numeric value.
9784         (Target_arm::scan_reloc_for_stub): Use relocation property table
9785         instead of calling Target_arm::reloc_uses_thumb_bit().
9786
9787 2010-02-02  Doug Kwan  <dougkwan@google.com>
9788
9789         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9790         types of relaxed input section.
9791
9792 2010-02-02  Doug Kwan  <dougkwan@google.com>
9793
9794         * Makefile.am (HFILES): Add arm-reloc-property.h.
9795         (DEFFILES): New.
9796         (TARGETSOURCES): Add arm-reloc-property.cc
9797         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9798         (libgold_a_SOURCES): $(DEFFILES)
9799         * Makefile.in: Regenerate.
9800         * arm-reloc-property.cc: New file.
9801         * arm-reloc-property.h: New file.
9802         * arm-reloc.def: New file.
9803         * arm.cc: Update comments.
9804         (arm-reloc-property.h): New included header.
9805         (arm_reloc_property_table): New global variable.
9806         (Target_arm::do_select_as_default_target): New method definition.
9807         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9808         arm-reloc-property to targ_extra_obj.
9809         * parameters.cc (set_parameters_target): Call
9810         Target::select_as_default_target().
9811         * target.h (Target::select_as_default_target): New method definition.
9812         (Target::do_select_as_default_target): Same.
9813
9814 2010-02-01  Doug Kwan  <dougkwan@google.com>
9815
9816         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9817         first_output_text_section_.
9818         (Arm_exidx_fixup::first_output_text_section): New method definition.
9819         (Arm_exidx_fixup::first_output_text_section_): New data member.
9820         (Arm_exidx_fixup::process_exidx_section): Record the first text
9821         output section seen.
9822         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9823         and entsize in output section header.
9824
9825 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9826
9827         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9828         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9829         (Arm_relocate_functions::thm_alu11): New Method.
9830         (Arm_relocate_functions::thm_pc8): New Method.
9831         (Arm_relocate_functions::thm_pc12): New Method.
9832         (Target_arm::Scan::local): Handle the relocations.
9833         (Target_arm::Scan::global): Likewise.
9834         (Target_arm::Relocate::relocate): Likewise.
9835         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9836
9837 2010-01-29  Doug Kwan  <dougkwan@google.com>
9838
9839         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9840         of relocation types as ld.
9841
9842 2010-01-29  Doug Kwan  <dougkwan@google.com>
9843
9844         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9845         to public.
9846         (Arm_relocate_functions::thumb_branch_common): Ditto.
9847         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9848         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9849         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9850         Arm_relocate_functions::jump24): Remove.
9851         (Target_arm::Relocate::relocate): Adjust code to call
9852         Arm_relocation_functions::arm_branch_common and
9853         Arm_relocation_functions::thumb_branch_common instead of their removed
9854         wrappers.  Merge switch-cases together to reduce source code size.
9855
9856 2010-01-29  Doug Kwan  <dougkwan@google.com>
9857
9858         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9859         output_local_symbol_count_needs_update_.
9860         (Arm_relobj::output_local_symbol_count_needs_update,
9861          Arm_relobj::set_output_local_symbol_count_needs_update,
9862          Arm_relobj::update_output_local_symbol_count): New methods.
9863         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9864         member.
9865         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9866         of pointed function as in a R_ARM_PREL31 relocation.
9867         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9868         for output local symbol count updating.
9869         (Target_arm::do_relax): Update output local symbol counts in objects
9870         if necessary.
9871         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9872
9873 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9874
9875         * arm.cc: Added support for the ARM relocations:
9876         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9877         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9878         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9879         movw_prel_nc).
9880         (Arm_relocate_functions::movw_rel): New method.
9881         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9882         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9883         thm_movw_prel_nc).
9884         (Arm_relocate_functions::thm_movw_rel): New method.
9885         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9886         thm_movt_prel).
9887         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9888         relocations.
9889         (Target_arm::Scan::global): Likewise.
9890         (Target_arm::Relocate::relocate): Likewise.
9891         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9892         Likewise.
9893
9894 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9895
9896         * arm.cc: Added support for ARM group relocations.
9897         (Target_arm::reloc_needs_sym_origin): New method.
9898         (Arm_relocate_functions::calc_grp_kn): New method.
9899         (Arm_relocate_functions::calc_grp_residual): New method.
9900         (Arm_relocate_functions::calc_grp_gn): New method.
9901         (Arm_relocate_functions::arm_grp_alu): New Method.
9902         (Arm_relocate_functions::arm_grp_ldr): New Method.
9903         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9904         (Arm_relocate_functions::arm_grp_ldc): New Method.
9905         (Target_arm::Scan::local): Handle the ARM group relocations.
9906         (Target_arm::Scan::global): Likewise.
9907         (Target_arm::Relocate::relocate): Likewise.
9908         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9909         Likewise.
9910
9911 2010-01-26  Doug Kwan  <dougkwan@google.com>
9912
9913         * arm.cc (set): Include.
9914         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9915         pointer type.
9916         (Arm_output_section::Text_section_list): New type.
9917         (Arm_output_section::append_text_sections_to_list): New method.
9918         (Arm_output_section::fix_exidx_coverage): Ditto.
9919         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9920         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9921         Relobj::set_section_offset() instead of
9922         Sized_relobj::invalidate_section_offset().
9923         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9924         parameter for section headers. Ignore relocation sections for
9925         unallocated sections and EXIDX sections.
9926         (Target_arm::fix_exidx_coverage): New method.
9927         (Target_arm::output_section_address_less_than): New type.
9928         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9929         linked text section instead of the EXIDX section.
9930         (Arm_output_section::create_stub_group): Add an assertion to check
9931         that this is not an EXIDX output section.
9932         (Arm_output_section::append_text_sections_to_list): New method.
9933         (Arm_output_section::fix_exidx_coverage): Ditto.
9934         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9935         Arm_relobj::section_needs_reloc_stub_scanning.
9936         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9937         first pass.
9938         (Target_arm::fix_exidx_coverage): New method.
9939         * object.h (Relobj::set_output_section): New method.
9940         (Sized_relobj::invalidate_section_offset): Remove method.
9941         (Sized_relobj::do_invalidate_section_offset): Remove method.
9942         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9943
9944 2010-01-25  Doug Kwan  <dougkwan@google.com>
9945
9946         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9947         Fix warning due to signed and unsigned comparison on a 32-bit host.
9948
9949 2010-01-22  Doug Kwan  <dougkwan@google.com>
9950
9951         * arm.cc (Target_arm::do_relax): Record an output section for section
9952         offset adjustment it contains any stub table that has changed.
9953         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9954         offsets in an output section if necessary.
9955         * output.cc (Output_section::Output_section): Initialize
9956         section_offsets_need_adjustments_.
9957         (Output_section::add_input_section_for_script): Renamed to
9958         Output_section::add_simple_input_section.
9959         (Output_section::save_states): Add a comment.
9960         (Output_section::discard_states): New method defintion.
9961         (Output_section::adjust_section_offsets): Same.
9962         * output.h (Output_section::add_input_section_for_script): Renamed to
9963         Output_section::add_simple_input_section.
9964         (Output_section::discard_states): New method declaration.
9965         (Output_section::adjust_section_offsets): Same.
9966         (Output_section::section_offsets_need_adjustment,
9967         Output_section::set_section_offsets_need_adjustment): New method
9968         definitions.
9969         (Output_section::section_offsets_need_adjustment_): New data member.
9970         * script-sections.cc
9971         (Output_section_element_input::set_section_address): Adjust code for
9972         renaming of Output_section::add_input_section_for_script.
9973         (Orphan_output_section::set_section_address): Same.
9974
9975 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9976
9977         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9978         Fix_v4bx enum values .
9979         * gold/options.h (General_options): New option definitions.
9980         (General_options::fix_v4bx): New method.
9981         (General_options::Fix_v4bx): New enum.
9982         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9983         (General_options::parse_fix_v4bx_interworking): New method.
9984
9985 2010-01-22  Doug Kwan  <dougkwan@google.com>
9986
9987         * arm.cc (Arm_exidx_fixup): New class.
9988
9989 2010-01-21  Doug Kwan  <dougkwan@google.com>
9990
9991         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9992         classes.
9993         (Arm_exidx_section_offset_map): New type.
9994
9995 2010-01-21  Doug Kwan  <dougkwan@google.com>
9996
9997         * arm.cc (Arm_exidx_input_section): New class.
9998         (Arm_relobj::exidx_input_section_by_link,
9999         Arm_relobj::exidx_input_section_by_shndx,
10000         Arm_relobj::make_exidx_input_section): New methods.
10001         (read_arm_attributes_section): Remove.
10002         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10003         information about them.
10004         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10005         to here.
10006
10007 2010-01-20  Doug Kwan  <dougkwan@google.com>
10008
10009         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10010         Input_section_specifier to Section_id.
10011         (Target_arm::new_arm_input_section: Adjust code for change of key
10012         type.
10013         (Target_arm::find_arm_input_section): Ditto.
10014         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10015         (Section_id): Remove.
10016         (Garbage_collection::Section_id_hash): Remove.
10017         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10018         (Section_id): Remove.
10019         (Icf::Section_id_hash): Remove.
10020         * object.h (Section_id, Const_section_id, Section_id_hash,
10021         Const_section_id_hash): New type definitions.
10022         * output.cc (Output_section::add_relaxed_input_section): Change to
10023         use Const_section_id instead of Input_section_specifier as key type.
10024         (Output_section::add_merge_input_section): Ditto.
10025         (Output_section::build_relaxation_map): Change to use Section_id
10026         instead of Input_section_specifier as key type.
10027         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10028         Ditto.
10029         (Output_section::convert_input_sections_to_relaxed_sections): Change
10030         to use Const_section_id instead of Input_section_specifier as key type.
10031         (Output_section::find_merge_section): Ditto.
10032         (Output_section::find_relaxed_input_section): Ditto.
10033         * output.h (Input_section_specifier): Remove class.
10034         (Output_section::Output_section_data_by_input_section_map): Change
10035         key type to Const_section_id.
10036         (Output_section::Output_relaxed_input_section_by_input_section_map):
10037         Ditto.
10038         (Output_section::Relaxation_map): Change key type to Section_id.
10039
10040 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10041
10042         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10043         (class Arm_v4bx_stub): New class.
10044         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10045         (Stub_factory::make_arm_v4bx_stub): New method.
10046         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10047         (Stub_table::empty): Handle v4bx stubs.
10048         (Stub_table::add_arm_v4bx_stub): New method.
10049         (Stub_table::find_arm_v4bx_stub): New method.
10050         (Arm_relocate_functions::v4bx): New method.
10051         (Target_arm::fix_v4bx): New method.
10052         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10053         (Stub_table::relocate_stubs): Likewise.
10054         (Stub_table::do_write): Likewise.
10055         (Stub_table::update_data_size_and_addralign): Likewise.
10056         (Stub_table::finalize_stubs):  Likewise.
10057         (Target_arm::Scan::local): Likewise.
10058         (Target_arm::Scan::global): Likewise.
10059         (Target_arm::do_finalize_sections): Likewise.
10060         (Target_arm::Relocate::relocate): Likewise.
10061         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10062         Likewise.
10063         (Target_arm::scan_reloc_for_stub): Likewise.
10064         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10065
10066 2010-01-19  Ian Lance Taylor  <iant@google.com>
10067
10068         * output.cc (Output_section_headers::do_sized_write): Write large
10069         segment count to sh_info field.
10070         (Output_file_header::do_sized_write): For large segment count,
10071         write PN_XNUM to e_phnum field.
10072
10073 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10074
10075         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10076         (Arm_relocate_functions::thm_jump8): New function.
10077         (Arm_relocate_functions::thm_jump11): New function.
10078         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10079         R_ARM_THM_JUMP11.
10080         (Target_arm::Scan::global): Likewise.
10081         (Target_arm::Relocate::relocate): Likewise.
10082         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10083         Likewise.
10084
10085 2010-01-14  Doug Kwan  <dougkwan@google.com>
10086
10087         * arm.cc (map, utility): Include headers.
10088         (Target_arm::apply_cortex_a8_workaround): New method.
10089         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10090         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10091         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10092         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10093         the --[no-]fix-cortex-a8 command line options.
10094         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10095         (Target_arm::relocate_stub): Use addend in instruction template.
10096         * options.h (DEFINE_bool): Set the user-set flag.
10097         (General_options): Add --[no-]-fix-cortex options.
10098         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10099         : Update fast look-up map after conversion.
10100
10101 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10102
10103         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10104         in the first pass of do_layout.
10105
10106 2010-01-13  Doug Kwan  <dougkwan@google.com>
10107
10108         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10109         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10110         apparent compiler problem of not folding static constant integral
10111         data members of elfcpp::Elf_sizes<32>.
10112
10113 2010-01-13  Doug Kwan  <dougkwan@google.com>
10114
10115         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10116         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10117         Arm_relobj::scan_section_for_cortex_a8_erratum,
10118         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10119         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10120         sections to scan for relocation stubs into a new method
10121         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10122         relocation and Cortex-A8 stub scanning.
10123         (Target_arm::do_relax): Force stubs to be after stubbed sections
10124         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10125         the beginning of a new relaxation pass.  Update a comment.
10126         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10127
10128 2010-01-12  Ian Lance Taylor  <iant@google.com>
10129
10130         * target-reloc.h (visibility_error): New inline function.
10131         (relocate_section): Call visibility_error.
10132         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10133         (MOSTLYCLEANFILES): Likewise.
10134         (protected_4_pic.o, protected_3.err): New targets.
10135         * testsuite/protected_4.cc: New file.
10136
10137 2010-01-12  Doug Kwan  <dougkwan@google.com>
10138
10139         * arm.cc (Cortex_a8_reloc): New class.
10140         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10141         and cortex_a8_relocs_info_.
10142         (Target_arm::fix_cortex_a8): New method definition.
10143         (Target_arm::Cortex_a8_relocs_info): New type.
10144         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10145         New data member declarations.
10146         (Target_arm::scan_reloc_for_stub): Record information about
10147         relocations for THUMB branches that might be exempted from the
10148         Cortex-A8 workaround.
10149         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10150         at the beginning of a relaxation pass.
10151
10152 2010-01-12  Doug Kwan  <dougkwan@google.com>
10153
10154         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10155         (Arm_relobj::Mapping_symbol_position,
10156          Arm_reloj::Mapping_symbol_position_less,
10157          Arm_relobj::Mapping_symbols_info): New types.
10158         (Target_arm::is_mapping_symbol_name): New method definition.
10159         (Arm_relobj::do_count_local_symbols): Save information about mapping
10160         symbols.
10161
10162 2010-01-11  Doug Kwan  <dougkwan@google.com>
10163
10164         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10165         Arm_relocate_functions::thumb32_branch_upper,
10166         Arm_relocate_functions::thumb32_branch_lower,
10167         Arm_relocate_functions::thumb32_cond_branch_offset,
10168         Arm_relocate_functions::thumb32_cond_branch_upper,
10169         Arm_relocate_functions::thumb32_cond_branch_lower,
10170         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10171         branch offset encoding.
10172         (Arm_relocate_functions::thumb_branch_common): Use new branch
10173         offset encoding methods to avoid code duplication.
10174         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10175         (Stub_addend_reader::operator()): Use new branch encoding method
10176         to avoid code duplication.
10177
10178 2010-01-11  Doug Kwan  <dougkwan@google.com>
10179
10180         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10181         (Target_arm::do_finalize_sections): Define special EXIDX section
10182         symbols only if referenced.
10183         * gc.h (Garbage_collection::add_reference): New method.
10184         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10185         code duplication.
10186
10187 2010-01-11  Ian Lance Taylor  <iant@google.com>
10188
10189         * script.cc (Version_script_info::build_expression_list_lookup):
10190         Change complaing about duplicate wildcard match from error to
10191         warning.
10192
10193         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10194         of 2009-12-30.
10195         (Version_script_info::Version_script_info): Initialize globs_,
10196         default_version_, default_is_global_, and exact_.  Don't
10197         initialize globals_ or locals_.
10198         (Version_script_info::build_lookup_tables): Build local symbols
10199         first.
10200         (Version_script_info::unquote): New function.
10201         (Version_script_info::add_exact_match): New function.
10202         (Version_script_info::build_expression_list_lookup): Remove lookup
10203         parameter.  Add is_global parameter.  Change all callers.  Handle
10204         wildcard pattern specially.  Unquote pattern.  Call
10205         add_exact_match.
10206         (Version_script_info::get_name_to_match): New function.
10207         (Version_script_info::get_symbol_version): New function.
10208         (Version_script_info::get_symbol_version_helper): Remove.
10209         (Version_script_info::check_unmatched_names): Call unquote.
10210         * script.h (class Version_script_info): Change get_symbol_version
10211         to be non-inline and add is_global parameter; change all callers.
10212         Rewrite symbol_is_local.  Update declarations.  Define struct
10213         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10214         Remove globals_ and locals_ members.  Add exact_, globs_,
10215         default_version_, is_global_.
10216         (Version_script_info::Glob): Remove pattern, add expression and
10217         is_global.  Update constructor.  Change all callers.
10218         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10219         default version.
10220         (Versions::symbol_section_contents): If a symbol is undefined, or
10221         defined in a dynamic object, set the version index to
10222         VER_NDX_LOCAL.
10223         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10224         symbol_is_local.
10225         (Symbol_table::add_from_pluginobj): Likewise.
10226         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10227
10228 2010-01-11  Doug Kwan  <dougkwan@google.com>
10229
10230         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10231         (incremental_dump_LDADD): Add linking option for libintl.
10232         * Makefile.in: Regenerate.
10233
10234 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10235
10236         PR gold/11144
10237         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10238         instead of -Ds.
10239         * testsuite/Makefile.in: Regenerated.
10240
10241 2010-01-10  Doug Kwan  <dougkwan@google.com>
10242
10243         * options.h (DEFINE_var): Use parentheses around argument varname__
10244         in macro body to avoid any unintended subsequent substitutions.
10245
10246 2010-01-10  Ian Lance Taylor  <iant@google.com>
10247
10248         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10249         candidates before doing symbol resolution.
10250
10251         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10252         ODR candidates if only one is weak.
10253
10254 2010-01-08  Ian Lance Taylor  <iant@google.com>
10255
10256         * script.cc (Version_script_info::build_expression_list_lookup):
10257         Don't warn about ambiguous version, just record the ambiguity.
10258         (Version_script_info::get_symbol_version_helper): Give error if
10259         version is ambiguous.
10260
10261 2010-01-08  Doug Kwan  <dougkwan@google.com>
10262
10263         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10264         prev_data_size_ and prev_addralign_.  Remove initializer for
10265         deleted data member has_been_changed_.
10266         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10267         to determine if the table is empty.
10268         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10269         Remove.
10270         (Stub_table::add_reloc_stub): Define method in class definition
10271         instead of just declaring it there.
10272         (Stub_table::add_cortex_a8_stub): New method definition.
10273         (Stub_table::update_data_size_and_addralign): Ditto.
10274         (Stub_table::finalize_stubs): Ditto.
10275         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10276         (Stub_table::do_addralign_): Return address alignment in the
10277         (Stub_table::do_reset_address_and_file_offset): Define method in
10278         class definition instead of declaring it there.  Set current data
10279         size to be the data size of the previous pass.
10280         (Stub_table::set_final_data_size): Use current data size as the
10281         final data size.
10282         (Stub_table::relocate_stub): Change parameter type of stub from
10283         Reloc_stub pointer to Stub pointer.
10284         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10285         (Stub_table::Cortex_a8_stub_list): New typedef.
10286         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10287          Stub_table::prev_addralign_): New data member.
10288         (Arm_relobj::Arm_relobj): Initialize data member
10289         section_has_cortex_a8_workaround_.
10290         (Arm_relobj::section_has_cortex_a8_workaround,
10291          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10292          definitions.
10293         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10294         declarations.
10295         (Target_arm::relocate_stub): Change parameter type of stub from
10296         Reloc_stub pointer to Stub pointer.
10297         (Insn_template::size, Insn_template::alignment): Handle
10298         THUMB16_SPECIAL_TYPE.
10299         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10300          Stub_table::update_data_size_and_addralign,
10301          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10302         definitions.
10303         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10304         (Stub_table::do_write): Ditto.
10305         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10306
10307 2010-01-08  Ian Lance Taylor  <iant@google.com>
10308
10309         PR 11108
10310         * symtab.h (class Symbol): Remove fields is_target_special_ and
10311         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10312         (Symbol::is_defined_in_discarded_section): New function.
10313         (Symbol::set_is_defined_in_discarded_section): New function.
10314         (Symbol::has_plt_offset): Rewrite.
10315         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10316         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10317         Don't initialize is_target_special_ or has_plt_offset_.
10318         Initialize is_defined_in_discarded_section_.
10319         (Symbol_table::add_from_relobj): If appropriate, set
10320         is_defined_in_discarded_section.
10321         * resolve.cc (Symbol::override_base_with_special): Don't test
10322         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10323         * target-reloc.h (relocate_section): Do special handling for
10324         symbols defined in discarded sections for global symbols as well
10325         as local symbols.
10326
10327 2010-01-08  Ian Lance Taylor  <iant@google.com>
10328
10329         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10330         the SHT_SYMTAB case.
10331
10332 2010-01-08  Ian Lance Taylor  <iant@google.com>
10333
10334         * object.cc (Sized_relobj::do_layout): Don't get confused if
10335         layout_eh_frame returns NULL.
10336
10337 2010-01-08  Ian Lance Taylor  <iant@google.com>
10338
10339         PR 11084
10340         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10341         dynamic symbol table, use the normal symbol table.
10342         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10343         symbol table.
10344
10345 2010-01-08  Ian Lance Taylor  <iant@google.com>
10346
10347         PR 11072
10348         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10349         sections.
10350
10351 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10352
10353         * version.cc (print_version): Change to "Copyright 2010".
10354
10355 2010-01-08  Ian Lance Taylor  <iant@google.com>
10356
10357         PR 10287
10358         PR 11063
10359         * i386.cc (class Target_i386): Change return type of plt_section
10360         to be non-const.
10361         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10362         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10363         tls_desc_rel_ field.
10364         (Output_data_plt_i386::rel_tls_desc): New function.
10365         (Target_i386::rel_tls_desc_section): New function.
10366         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10367         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10368         R_386_TLS_DESC reloc in rel_tls_desc_section.
10369         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10370         Define struct Tlsdesc_info.
10371         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10372         (Target_x86_64::do_reloc_symbol_index): New function.
10373         (Target_x86_64::add_tlsdesc_info): New function.
10374         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10375         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10376         tlsdesc_rel_ field.
10377         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10378         all callers.
10379         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10380         (Target_x86_64::rela_tlsdesc_section): New function.
10381         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10382         handling.
10383         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10384         (Target_x86_64::do_reloc_addend): New function.
10385         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10386         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10387         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10388         (Output_reloc::type): New function.
10389         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10390         (Output_reloc::is_target_specific): New function.
10391         (Output_reloc::target_arg): New function.
10392         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10393         absolute relocs and target specific relocs.
10394         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10395         add_target_specific.
10396         (class Output_data_reloc) [SHT_RELA]: Likewise.
10397         * output.cc (Output_reloc::Output_reloc): Add four new versions
10398         for absolute relocs and target specific relocs.
10399         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10400         (Output_reloc::get_symbol_index): Likewise.
10401         (Output_reloc::local_section_offset): Check that local_sym_index_
10402         is not TARGET_CODE or 0.
10403         (Output_reloc::symbol_value): Likewise.
10404         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10405         reloc.
10406         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10407         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10408         functions.
10409         * layout.cc (add_target_dynamic_tags): Use output section for
10410         DT_PLTRELSZ and DT_JMPREL.
10411
10412 2010-01-07  Ian Lance Taylor  <iant@google.com>
10413
10414         PR 11061
10415         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10416         function.
10417         (class Output_data_reloc_generic): Define.
10418         (class Output_data_reloc_base): Change base class to
10419         Output_data_reloc_generic.  Change add() method to call
10420         bump_relative_reloc_count for a relative reloc.  Remove
10421         sort_relocs_ field.
10422         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10423         to sort_relocs().
10424         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10425         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10426         appropriate.
10427         * layout.h (class Layout): Update declaration.
10428
10429 2010-01-07  Ian Lance Taylor  <iant@google.com>
10430
10431         * output.h (class Output_data): Add const version of
10432         output_section and do_output_section.
10433         (class Output_section_data): Add const version of
10434         do_output_section.
10435         (class Output_section): Likewise.
10436         * layout.cc (Layout::add_target_dynamic_tags): New function.
10437         * layout.h (class Layout): Update declarations.
10438         * arm.cc (Target_arm::do_finalize_sections): Use
10439         add_target_dynamic_tags.
10440         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10441         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10442         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10443         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10444
10445 2010-01-07  Ian Lance Taylor  <iant@google.com>
10446
10447         PR 11042
10448         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10449         object as needed.
10450
10451 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10452             Ian Lance Taylor  <iant@google.com>
10453
10454         PR 11019
10455         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10456         Xindex::read_symtab_xindex.
10457
10458 2010-01-07  Doug Kwan  <dougkwan@google.com>
10459
10460         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10461         (Insn_template::thumb16_bcond_insn): New method declaration.
10462         (Insn_template): Fix spelling.
10463         (Stub::thumb16_special): New method declaration.
10464         (Stub::do_write): Define virtual method which was previously pure
10465         virtual.
10466         (Stub::do_thumb16_special): New method declaration.
10467         (Stub::do_fixed_endian_write): New template member.
10468         (Reloc_stub::do_write): Remove.
10469         (Reloc_stub::do_fixed_endian_write): Remove.
10470         (Cortex_a8_stub): New class definition.
10471         (Stub_factory::make_cortex_a8_stub): New method definition.
10472         (Stub_factory::Stub_factory): Add missing static storage class
10473         qualifier for elf32_arm_stub_a8_veneer_blx.
10474
10475 2010-01-07  Ian Lance Taylor  <iant@google.com>
10476
10477         PR 10980
10478         * options.h (class General_options): Add --warn-unresolved-symbols
10479         and --error-unresolved-symbols.
10480         * errors.cc (Errors::undefined_symbol): Implement
10481         --warn-unresolved-symbols.
10482
10483         * options.h (class General_options): Add -z text and -z textoff.
10484         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10485
10486 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10487
10488         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10489         (Garbage_collection::cident_sections): New function.
10490         (Garbage_collection::add_cident_section): New function.
10491         (Garbage_collection::cident_sections_): New member.
10492         (gc_process_relocs): Add references to sections whose names are C
10493         identifiers.
10494         * gold.h (cident_section_start_prefix): New constant.
10495         (cident_section_stop_prefix): New constant.
10496         (is_cident): New function.
10497         * layout.cc (Layout::define_section_symbols): Replace string constants
10498         with the newly defined constants.
10499         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10500         C identifiers.
10501         * testsuite/Makefile.am: Add gc_orphan_section_test.
10502         * testsuite/Makefile.in: Regenerate.
10503         * testsuite/gc_orphan_section_test.cc: New file.
10504         * testsuite/gc_orphan_section_test.sh: New file.
10505
10506 2010-01-06  Ian Lance Taylor  <iant@google.com>
10507
10508         PR 10980
10509         * options.h (class General_options): Add --warn-shared-textrel.
10510         * layout.cc (Layout::finish_dynamic_section): Implement
10511         --warn-shared-textrel.
10512
10513         PR 10980
10514         * options.h (class General_options): Add --warn-multiple-gp.
10515
10516 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10517
10518         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10519         $(THREADSLIB) and $(LIBDL).
10520         * Makefile.in: Rebuild.
10521
10522 2010-01-06  Ian Lance Taylor  <iant@google.com>
10523
10524         PR 10980
10525         * options.cc (General_options::parse_section_start): New function.
10526         (General_options::section_start): New function.
10527         (General_options::General_options): Initialize all members.
10528         * options.h: Include <map>
10529         (class General_options): Add --section-start.  Add section_starts_
10530         member.
10531         * layout.cc (Layout::attach_allocated_section_to_segment): If
10532         --section-start was used, set the address of the segment.  Remove
10533         local sort_sections.
10534         (Layout::relaxation_loop_body): If the address of the load segment
10535         has been set by --section-start, don't use it.
10536         * output.h (Output_segment::update_flags_for_output_section): New
10537         function.
10538         * output.cc (Output_segment::add_output_section): Call
10539         update_flags_for_output_section.
10540
10541 2010-01-05  Ian Lance Taylor  <iant@google.com>
10542
10543         PR 10980
10544         * options.h (class General_options): Add --undefined-version.
10545         * script.cc (struct Version_expression): Add was_matched_by_symbol
10546         field.
10547         (Version_script_info::matched_symbol): New function.
10548         (Version_script_info::get_symbol_version_helper): Call
10549         matched_symbol.
10550         (Version_script_info::check_unmatched_names): New function.
10551         * script.h (class Version_script_info): Update declarations.
10552         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10553
10554         * options.h (class General_options): Use DEFINE_bool_alias for
10555         allow_multiple_definition.
10556         * resolve.cc (Symbol_table::should_override): Don't test
10557         allow_multiple_definition.
10558
10559         PR 10980
10560         * options.h (class General_options): Add --cref.
10561         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10562         until after printing cref table.
10563         * cref.cc: Include "symtab.h".
10564         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10565         (Cref_table_compare::operator()): New function.
10566         (Cref_inputs::gather_cref): New function.
10567         (filecol): New static const.
10568         (Cref_inputs::print_cref): New function.
10569         (Cref::print_cref): New function.
10570         * cref.h: Include <cstdio>.
10571         (class Cref): Update declarations.
10572         * mapfile.h (Mapfile::file): New function.
10573         * object.h (class Object): Define Symbols.  Declare virtual
10574         do_get_global_symbols.
10575         (Object::get_global_symbols): New function.
10576         * object.cc (Input_objects::add_object): Pass object to cref_ if
10577         --cref.
10578         (Input_objects::archive_start): Likewise.
10579         (Input_objects::archive_stop): Likewise.
10580         (Input_objects::print_cref): New function.
10581         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10582         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10583         --cref.
10584         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10585         function.
10586         * plugin.h (class Sized_pluginobj): Update declarations.
10587
10588 2010-01-05  Ian Lance Taylor  <iant@google.com>
10589
10590         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10591         to is_default_version.  Rename insdef to insdefault.
10592         (Symbol_table::add_from_relobj): Rename def to is_default_version
10593         and local to is_forced_local.
10594         (Symbol_table::add_from_pluginobj): Likewise.
10595         (Symbol_table::add_from_dynobj): Likewise.
10596         (Symbol_table::define_special_symbol): Rename insdef to
10597         insdefault.
10598
10599 2010-01-04  Ian Lance Taylor  <iant@google.com>
10600
10601         PR 10980
10602         * options.h (class General_options): Add
10603         --allow-multiple-definition and -z muldefs.
10604         * resolve.cc (Symbol_table::should_override): Don't warn about a
10605         multiple symbol definition if --allow-multiple-definition or -z
10606         muldefs.
10607
10608         PR 10980
10609         * options.h (class General_options): Add --add-needed and
10610         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10611         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10612         error if --copy-dt-needed-entries aka --add-needed is used and
10613         would cause a change in behaviour.
10614
10615         PR 10980
10616         * options.h (class General_options): Add -G as a short version of
10617         --shared.  Add no-op options -assert, -g, and -i.
10618
10619 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10620
10621         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10622         check for .text or .gnu.linkonce.t sections.
10623         * icf.cc (Icf::find_identical_sections): Ditto.
10624         Change the detection for mangled function name within the section
10625         name.
10626         * icf.h (is_section_foldable_candidate): New function.
10627
10628 2009-12-30  Ian Lance Taylor  <iant@google.com>
10629
10630         PR 10980
10631         * options.h (class General_options): Permit two dashes with
10632         --retain-symbols-file.
10633
10634 2009-12-30  Ian Lance Taylor  <iant@google.com>
10635
10636         PR 10979
10637         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10638         don't put the file header and segment headers in the text
10639         segment.
10640
10641         PR 10979
10642         * common.cc (Sort_commons::operator()): Stabilize sort when both
10643         entries are NULL.
10644         (Symbol_table::do_allocate_commons_list): When allocating common
10645         symbols, skip a symbol which is no longer common.
10646         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10647         an object before checking its type.
10648         * testsuite/common_test_2.c: New file.
10649         * testsuite/common_test_3.c: New file.
10650         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10651         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10652         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10653         (common_test_2_pic.o, common_test_2.so): New targets.
10654         (common_test_3_pic.o, common_test_3.so): New targets.
10655         * testsuite/Makefile.in: Rebuild.
10656
10657         PR 10979
10658         * script.cc (read_input_script): If we see a new SECTIONS clause,
10659         and we have added an input section, give an error.
10660         * layout.h (class Layout): Add have_added_input_section function.
10661         Add have_added_input_section_ field.
10662         * layout.cc (Layout::Layout): Initialize
10663         have_added_input_section_.
10664         (Layout::layout): Set have_added_input_section_.
10665         (Layout::layout_eh_frame): Likewise.
10666
10667 2009-12-30  Ian Lance Taylor  <iant@google.com>
10668
10669         PR 10931
10670         * options.h (class General_options): Add --sort-common option.
10671         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10672         * common.cc (Sort_common): Add sort_order parameter to
10673         constructor.  Add sort_order_ field.
10674         (Sort_commons::operator): Check sort_order_.
10675         (Symbol_table::allocate_commons): Determine the sort order.
10676         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10677         Change all callers.
10678         (Symbol_table::do_allocate_commons_list): Likewise.
10679
10680 2009-12-30  Ian Lance Taylor  <iant@google.com>
10681
10682         PR 10916
10683         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10684         symbols from this object, don't change the visibility of an
10685         undefined symbol.
10686         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10687
10688 2009-12-30  Ian Lance Taylor  <iant@google.com>
10689
10690         PR 10861
10691         * script.h (class Version_script_info): Define Language enum.
10692         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10693         new fields globals_, locals_, and is_finalized_.
10694         * script.cc: Various formatting fixes.
10695         (class Parser_closure): Change language_stack_ from a vector of
10696         std::string to one of Version_script_info::Language.  Adjust all
10697         uses accordingly.
10698         (class Lazy_demangler): Remove.
10699         (struct Version_expression): Change language from std::string to
10700         Version_script_info::Language.
10701         (Version_script_info::Version_script_info): New function.
10702         (Version_script_info::~Version_script_info): Don't call clear.
10703         (Version_script_info::finalize): New function.
10704         (Version_script_info::build_lookup_tables): New function.
10705         (Version_script_info::build_expression_list_lookup): New
10706         function.
10707         (Version_script_info::get_symbol_version_helper): Rewrite to use
10708         lookup tables.
10709         (Version_script_info::print_expression_list): Adjust to use
10710         Version_script_info::Language.
10711         (script_push_lex_into_version_mode): Check that the version script
10712         has not been finalized.
10713         (version_script_push_lang): Change language string to
10714         Version_script_info::Language.
10715         * options.cc (Command_line::version_script): New function.
10716         * options.h (class General_options): Add finalize_dynamic_list
10717         function.  Change version_script from declaration to definition.
10718         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10719         * testsuite/version_script.map: Remove duplicate def of foo.
10720         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10721         version_script.map.
10722         * testsuite/Makefile.in: Rebuild.
10723
10724 2009-12-30  Ian Lance Taylor  <iant@google.com>
10725
10726         PR 10843
10727         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10728         if the input symbol index is 0, make the output symbol index 0.
10729
10730 2009-12-30  Ian Lance Taylor  <iant@google.com>
10731
10732         PR 10670
10733         * options.h (class General_options): Add -x/--discard-all.
10734         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10735         --discard-all.  If the local symbol needs a dynamic entry, check
10736         that before handling --discard-locals.
10737
10738 2009-12-30  Ian Lance Taylor  <iant@google.com>
10739
10740         PR 10450
10741         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10742         flags to PF_R.
10743         (Output_segment::add_output_section): Don't change the flags if
10744         the type is PT_TLS.
10745
10746         PR 10450
10747         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10748         GNU hash table if they need a dynamic value.  Otherwise, don't add
10749         them if they are defined in a dynamic object or are forced local.
10750
10751 2009-12-29  Ian Lance Taylor  <iant@google.com>
10752
10753         PR 10450
10754         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10755         .gnu.hash table for a 32-bit target.
10756
10757         PR 10450
10758         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10759         regular and a dynamic object only needs a dynamic symbol table
10760         entry if it is externally visible.
10761
10762         PR 10450
10763         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10764         constructor.  Add global_offset_table_ field.
10765         (Target_i386::got_section): Set global_offset_table_.
10766         (Target_i386::do_finalize_sections): Set global_offset_table_
10767         size.
10768         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10769         in constructor.  Add global_offset_table_ field.
10770         (Target_x86_64::got_section): Set global_offset_table_.
10771         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10772         size.
10773
10774         * layout.cc (Layout::Layout): Initialize increase_relro_.
10775         (Layout::get_output_section): Add is_relro, is_last_relro, and
10776         is_first_non_relro parameters.  Change all callers.
10777         (Layout::choose_output_section): Likewise.
10778         (Layout::add_output_section_data): Likewise.
10779         (Layout::make_output_section): Likewise.
10780         (Layout::set_segment_offsets): Clear increase_relro when using a
10781         linker script.
10782         * layout.h (class Layout): Add increase_relro method.  Add
10783         increase_relro_ field.  Update declarations.
10784         * output.cc (Output_section::Output_section): Initialize
10785         is_last_relro_ and is_first_non_relro_.
10786         (Output_segment::add_output_section): Group relro sections is
10787         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10788         (Output_segment::maximum_alignment): Remove relro handling.
10789         (Output_segment::set_section_addresses): Add increase_relro
10790         parameter.  Change all callers.  Add initial alignment to align
10791         relro sections on separate page.  Remove old relro handling.
10792         (Output_segment::set_section_list_addresses): Remove in_relro
10793         parameter.  Change all callers.
10794         (Output_segment::set_offset): Add increase parameter.  Change all
10795         callers.  Remove old relro handling.
10796         * output.h (class Output_section): Add new methods: is_last_relro,
10797         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10798         Add is_last_relro_ and is_first_non_relro_ fields.
10799         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10800         Create separate .got.plt section.  Call increase_relro.
10801         * x86_64.cc (Target_x86_64::got_section): Likewise.
10802         * testsuite/relro_script_test.t: Add .got.plt.
10803
10804         PR 10450
10805         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10806         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10807         (Layout::finalize): Call set_dynamic_symbol_size.
10808         (Layout::set_dynamic_symbol_size): New function.
10809         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10810         set_dynamic_symbol_size.
10811
10812         PR 10450
10813         * output.h (class Output_section): Add is_entsize_zero_ field.
10814         * output.cc (Output_section::Output_section): Initialize
10815         is_entsize_zero_.
10816         (Output_section::set_entsize): If two different entsizes are
10817         requested, force it to zero.
10818         (Output_section::add_input_section): Set flags for .debug_str
10819         before updating section flags.  Set entsize.
10820         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10821         and SHF_STRING if all input sections have those flags.
10822
10823 2009-12-29   Rafael Espindola  <espindola@google.com>
10824
10825         * main.cc (main): Fix the sys time reporting.
10826         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10827         reporting.
10828
10829 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10830
10831         * options.cc (General_options::parse_version): Allow -v to exit
10832         without an error if there is nothing to link.
10833
10834 2009-12-29  Ian Lance Taylor  <iant@google.com>
10835
10836         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10837         using a version of gcc before 4.1.
10838         * configure: Rebuild.
10839
10840 2009-12-28  Chris Demetriou  <cgd@google.com>
10841
10842         * attributes.cc (Output_attributes_section_data::do_write): Use
10843         std::vector::front rather than std::vector::data.
10844
10845 2009-12-28  Ian Lance Taylor  <iant@google.com>
10846
10847         * symtab.h (class Symbol_table): Add enum Defined.
10848         * resolve.cc (Symbol_table::should_override): Add defined
10849         parameter.  Change all callers.  Test whether object is NULL
10850         before calling a method on it.
10851         (Symbol_table::report_resolve_problem): Add defined parameter.
10852         Change all callers.
10853         (Symbol_table::should_override_with_special): Likewise.
10854         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10855         parameter.  Change all callers.
10856         (Symbol_table::do_define_in_output_data): Likewise.
10857         (Symbol_table::define_in_output_segment): Likewise.
10858         (Symbol_table::do_define_in_output_segment): Likewise.
10859         (Symbol_table::define_as_constant): Likewise.
10860         (Symbol_table::do_define_as_constant): Likewise.
10861         * script.h (class Symbol_assignment): Add is_defsym parameter to
10862         constructor; change all callers.
10863         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10864         parameter.  Change all callers.  Add is_defsym_ field.
10865         (class Parser_closure): Add parsing_defsym parameter to
10866         constructor; change all callers.  Add parsing_defsym accessor
10867         function.  Add parsing_defsym_ field.
10868
10869 2009-12-28  Ian Lance Taylor  <iant@google.com>
10870
10871         * gold.cc (queue_middle_tasks): Fix formatting.
10872         * object.cc (Relobj::is_section_name_included): Likewise.
10873
10874 2009-12-23  Ian Lance Taylor  <iant@google.com>
10875
10876         * i386.cc (Target_i386::do_calls_non_split): Recognize
10877         -fsplit-stack prologue for a function with a static chain.
10878         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10879         -fsplit-stack prologue when using %r11.
10880
10881 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10882
10883         * options.cc (General_options::parse_version): Make -v continue and do
10884         the link like GNU ld does.
10885
10886 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10887
10888         * Makefile.am (CCFILES): Add timer.cc.
10889         (HFILES): Add timer.h.
10890         * configure.ac: Check for sysconf and times.
10891         * main.cc: include timer.h.
10892         (main): Use Timer instead of get_run_time.
10893         * timer.cc: New.
10894         * timer.h: New.
10895         * workqueue.cc: include timer.h.
10896         (Workqueue::find_and_run_task):
10897         Report user, sys and wall time.
10898         * Makefile.in: Regenerate.
10899         * config.in: Regenerate.
10900         * configure: Regenerate.
10901
10902 2009-12-16  Doug Kwan  <dougkwan@google.com>
10903
10904         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10905         sections.
10906         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10907         relaxed input sections.
10908         * output.cc (Output_section::find_relaxed_input_section): Change
10909         return type to Output_relaxed_input_section pointer.  Adjust code
10910         for new type of relaxed_input_section_map_.
10911         * output.h (Output_section::find_relaxed_input_section): Change
10912         return type to Output_relaxed_input_section pointer.
10913         (Output_section::Output_relaxed_input_section_by_input_section_map):
10914         New type.
10915         (Output_section::relaxed_input_section_map_): Change type to
10916         Output_section::Output_relaxed_input_section_by_input_section_map.
10917         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10918         input section.
10919
10920 2009-12-15  Ian Lance Taylor  <iant@google.com>
10921
10922         * layout.cc (Layout::create_shstrtab): Only write out after input
10923         sections if we are compressing debug sections.
10924
10925 2009-12-15  Ian Lance Taylor  <iant@google.com>
10926
10927         * archive.cc (Archive::add_symbols): Only look up a symbol without
10928         a version if there is, in fact, a version.
10929
10930 2009-12-14  Ian Lance Taylor  <iant@google.com>
10931
10932         Revert -Wshadow changes, all changes from:
10933         2009-12-11  Doug Kwan  <dougkwan@google.com>
10934         2009-12-11  Nick Clifton  <nickc@redhat.com>
10935         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10936
10937 2009-12-11  Doug Kwan  <dougkwan@google.com>
10938
10939         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10940         due to -Wshadow.
10941         * attributes.cc (Object_attribute::size): Ditto.
10942         (Attributes_section_data::size): Ditto.
10943         (Attributes_section_data::Attributes_section_data): Ditto.
10944         (Output_attributes_section_data::do_write): Ditto.
10945         * attributes.h (Object_attribute::set_type): Ditto.
10946         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10947
10948 2009-12-11  Nick Clifton  <nickc@redhat.com>
10949
10950         * archive.cc: Fix shadowed variable warnings.
10951         * arm.cc: Likewise.
10952         * compressed_output.cc: Likewise.
10953         * compressed_output.h: Likewise.
10954         * configure: Likewise.
10955         * dwarf_reader.cc: Likewise.
10956         * dynobj.cc: Likewise.
10957         * dynobj.h: Likewise.
10958         * ehframe.cc: Likewise.
10959         * ehframe.h: Likewise.
10960         * errors.cc: Likewise.
10961         * expression.cc: Likewise.
10962         * fileread.cc: Likewise.
10963         * fileread.h: Likewise.
10964         * freebsd.h: Likewise.
10965         * i386.cc: Likewise.
10966         * icf.cc: Likewise.
10967         * incremental.h: Likewise.
10968         * layout.cc: Likewise.
10969         * layout.h: Likewise.
10970         * mapfile.cc: Likewise.
10971         * merge.cc: Likewise.
10972         * merge.h: Likewise.
10973         * object.cc: Likewise.
10974         * object.h: Likewise.
10975         * options.h: Likewise.
10976         * output.cc: Likewise.
10977         * output.h: Likewise.
10978         * parameters.cc: Likewise.
10979         * plugin.cc: Likewise.
10980         * powerpc.cc: Likewise.
10981         * reduced_debug_output.cc: Likewise.
10982         * reduced_debug_output.h: Likewise.
10983         * reloc.cc: Likewise.
10984         * reloc.h: Likewise.
10985         * resolve.cc: Likewise.
10986         * script-sections.cc: Likewise.
10987         * script.cc: Likewise.
10988         * script.h: Likewise.
10989         * sparc.cc: Likewise.
10990         * symtab.cc: Likewise.
10991         * symtab.h: Likewise.
10992         * target-select.cc: Likewise.
10993         * target-select.h: Likewise.
10994         * token.h: Likewise.
10995         * workqueue.cc: Likewise.
10996         * workqueue.h: Likewise.
10997         * x86_64.cc: Likewise.
10998
10999 2009-12-10  Doug Kwan  <dougkwan@google.com>
11000
11001         * arm.cc (attributes.h): New include.
11002         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11003         (Arm_relobj::~Arm_relobj): Delete object pointed by
11004         attributes_section_data_.
11005         (Arm_relobj::attributes_section_data): New method definition.
11006         (Arm_relobj::attributes_section_data_): New data member declaration.
11007         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11008         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11009         attributes_section_data_.
11010         (Arm_dynobj::attributes_section_data): New method definition.
11011         (Arm_dynobj::attributes_section_data_): New data member declaration.
11012         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11013         initialization value of may_use_blx_ to false.
11014         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11015         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11016         object attributes to compute results instead of hard-coding.
11017         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11018         Target_arm::get_secondary_compatible_arch,
11019         Target_arm::set_secondary_compatible_arch
11020         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11021         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11022         New method declarations.
11023         (Target_arm::get_aeabi_object_attribute): New method definition.
11024         (Target_arm::attributes_section_data_): New data member declaration.
11025         (read_arm_attributes_section): New template definition.
11026         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11027         (Arm_dynobj::do_read_symbols): Ditto.
11028         (Target_arm::do_finalize_sections): Merge attributes sections from
11029         input.  Check for BLX use after attributes section merging.
11030         Fix __exidx_start and __exidx_end visibility.  Create an
11031         .ARM.attributes section if necessary.
11032         (Target_arm::get_secondary_compatible_arch,
11033         Target_arm::set_secondary_compatible_arch,
11034         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11035         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11036         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11037         New method definitions.
11038
11039 2009-12-09  Ian Lance Taylor  <iant@google.com>
11040
11041         * plugin.cc (Plugin::load): Don't cast from void* to a function
11042         pointer.
11043
11044 2009-12-09  Ian Lance Taylor  <iant@google.com>
11045
11046         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11047         information fields.
11048
11049 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11050
11051         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11052         Replace two_file_shared_1.so with two_file_shared_2.so.
11053         * testsuite/Makefile.in: Regenerated.
11054
11055 2009-12-08  Doug Kwan  <dougkwan@google.com>
11056
11057         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11058         (HFILES): Add attributes.h and int_encoding.h.
11059         * Makefile.in: Regenerate.
11060         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11061         function definitions to int_encoding.cc
11062         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11063         prototypes to int_encoding.h
11064         * reduced_debug_output.cc (int_encoding.h): New include.
11065         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11066         function definitions to int_encoding.cc
11067         (insert_into_vector, read_from_pointer): Move template definitions to
11068         int_encoding.h
11069         * attributes.cc: New file.
11070         * attributes.h: New file.
11071         * int_encoding.cc: New file.
11072         * int_encoding.h: New file.
11073
11074 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11075
11076         PR gold/11055
11077         * incremental-dump.cc (dump_incremental_inputs): New.
11078         (main): Use dump_incremental_inputs.
11079
11080 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11081
11082         PR gold/10893
11083         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11084         checking elfcpp::STT_FUNC.
11085         (Target_i386::Relocate::relocate): Likewise.
11086         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11087
11088         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11089         symbols from shared libraries into normal FUNC symbols.
11090
11091         * symtab.h (Symbol): Add is_func and use it.
11092
11093 2009-12-05  Doug Kwan  <dougkwan@google.com>
11094
11095         * arm.cc (Target_arm::arm_info): Initialize new fields
11096         attributes_section and attributes_vendor.
11097         * i386.cc (Target_i386::i386_info): Same.
11098         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11099         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11100         fields attributes_section and attributes_vendor.
11101         * sparc.cc (Target_sparc::sparc_info): Same.
11102         * target.h (Target::attributes_section, Target::attributes_vendor,
11103         Target::is_attributes_section, Target::attribute_arg_type,
11104         Target::attributes_order): New method definitions.
11105         (Target::Target_info::attributes_section,
11106         Target::Target_info::attributes_vendor): New fields.
11107         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11108         virtual method definitions.
11109         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11110         attributes_section and attributes_vendor.
11111         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11112
11113 2009-12-05  Doug Kwan  <dougkwan@google.com>
11114
11115         * arm.cc: Update comments about interworking and stub generation.
11116         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11117         considered as non-PIC.
11118         (Arm_relocate_functions::base_abs): Fix formatting.
11119         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11120         of function to use GOT entry address instead of offset.
11121         (Target_arm::Scan::global): Issue an error if a symbol would need a
11122         PLT does not get one because it is untyped.  Remove code to create
11123         dynamic symbols for relative branches.
11124         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11125         takes unsigned integer instead of boolean.
11126
11127 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11128
11129         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11130         (two_file_test_LDADD): Likewise.
11131         (common_test_1_LDADD): Likewise.
11132         (exception_test_LDADD) Likewise.
11133         (weak_test_LDADD): Likewise.
11134         (many_sections_test_LDADD): Likewise.
11135         (initpri1_LDADD): Likewise.
11136         (script_test_1_LDADD): Likewise.
11137         (script_test_2_LDADD): Likewise.
11138         (justsyms_LDADD): Likewise.
11139         (binary_test_LDADD): Likewise.
11140         (large_LDADD): Likewise.
11141         * testsuite/Makefile.in: Regenerated.
11142
11143 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11144
11145         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11146         (Symbol_table::override_with_special): Likewise.
11147         (Symbol_table::add_from_object): Likewise.
11148
11149 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11150
11151         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11152         Don't set the data_offset twice.
11153
11154 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11155
11156         * testsuite/Makefile.in: Regenerate.
11157
11158 2009-12-03  Doug Kwan  <dougkwan@google.com>
11159
11160         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11161         (Target_arm::do_finalize_sections): Add parameter for symbol table
11162         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11163         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11164         parameter for symbol table pointer.
11165         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11166         an additional parameter for a pointer to symbol table.
11167         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11168         parameter for a symbol table pointer.
11169         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11170         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11171         Ditto.
11172         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11173         parameter for a symbol table pointer.
11174
11175 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11176
11177         * incremental.cc (Incremental_inputs_header)
11178         (Incremental_inputs_header_write, Incremental_inputs_entry)
11179         (Incremental_inputs_entry_write): Move ...
11180         * incremental.h (Incremental_inputs_header)
11181         (Incremental_inputs_header_write, Incremental_inputs_entry)
11182         (Incremental_inputs_entry_write): here.
11183
11184 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11185
11186         * incremental.cc (make_sized_incremental_binary): Set the target.
11187         Error if it is incompatible.
11188         * output.h (Output_file): Add filename method.
11189
11190 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11191
11192         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11193         from the get_* methods.
11194
11195 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11196
11197         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11198         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11199         Write 0 for the data_offset of scripts.
11200
11201 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11202
11203         * testsuite/Makefile.am: Add the incremental_test.sh test.
11204         * testsuite/incremental_test.sh: New.
11205         * testsuite/incremental_test_1.c: New.
11206         * testsuite/incremental_test_2.c: New.
11207
11208 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11209
11210         * incremental-dump.cc (main): Fix typos.
11211
11212 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11213
11214         PR gold/11025
11215         * incremental-dump.cc (main): Use llu to print 64 bit values.
11216
11217 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11218             H.J. Lu  <hongjiu.lu@intel.com>
11219
11220         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11221         $(LIBDL).
11222         (incremental_dump_LDADD): Likewise.
11223         * Makefile.in: Regenerated.
11224
11225 2009-11-25  Doug Kwan  <dougkwan@google.com>
11226
11227         Revert:
11228
11229         2009-11-25  Doug Kwan  <dougkwan@google.com>
11230
11231                 * arm.cc (Target_arm::Target_arm): Move method definition
11232                 outside of class definition.  Add code to handle
11233                 --target1-rel, --target1-abs and --target2= options.
11234                 (Target_arm::get_reloc_reloc_type): Change method to be
11235                 non-static and const.
11236                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11237                 New data member declaration.
11238                 (Target_arm::Scan::local, Target_arm::Scan::global,
11239                 Target_arm::Relocate::relocate,
11240                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11241                 Adjust call to Target_arm::get_real_reloc_type.
11242                 (Target_arm::get_real_reloc_type): Use command line options
11243                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11244                 * options.h (--target1-rel, --target1-abs, --target2): New
11245                 ARM-only options.
11246
11247 2009-11-25  Doug Kwan  <dougkwan@google.com>
11248
11249         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11250         class definition.  Add code to handle --target1-rel, --target1-abs
11251         and --target2= options.
11252         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11253         and const.
11254         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11255         member declaration.
11256         (Target_arm::Scan::local, Target_arm::Scan::global,
11257         Target_arm::Relocate::relocate,
11258         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11259         call to Target_arm::get_real_reloc_type.
11260         (Target_arm::get_real_reloc_type): Use command line options to
11261         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11262         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11263         options.
11264
11265 2009-11-25  Doug Kwan  <dougkwan@google.com>
11266
11267         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11268         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11269         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11270         formatting.
11271         (Arm_relocate_functions::thm_call): Replace body with a call to
11272         Arm_relocate_functions::thumb_branch_common.
11273         (Arm_relocate_functions::thm_jump24,
11274         Arm_relocate_functions::thm_xpc22): New method definitions.
11275         (Arm_relocate_functions::thumb_branch_common): New method definition.
11276         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11277         operator.
11278         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11279         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11280
11281 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11282
11283         * Makefile.am: Build incremental-dump
11284         * Makefile.in: Regenerate.
11285         * incremental-dump.cc: New.
11286         * incremental.cc (Incremental_inputs_header_data,
11287         Incremental_inputs_entry_data): Move to incremental.h
11288         * incremental.h: (Incremental_inputs_header_data,
11289         Incremental_inputs_entry_data): Move from incremental.cc
11290
11291 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11292
11293         * incremental.cc (Incremental_inputs_header,
11294         Incremental_inputs_header_write, Incremental_inputs_entry,
11295         Incremental_inputs_entry_write): Add a typedef with the data type.
11296
11297 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11298
11299         * incremental.cc (Incremental_inputs_header,
11300         Incremental_inputs_header_write, Incremental_inputs_entry,
11301         Incremental_inputs_entry_write): Update comment about which
11302         type has the filed descriptions.
11303
11304 2009-11-15  Doug Kwan  <dougkwan@google.com>
11305
11306         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11307         (Arm_relocate_functions::arm_branch_common): Change method defintion
11308         in class definition to a method declaration and update list of formal
11309         parameters.
11310         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11311         Arm_relocation_functions::jump24): Adjust call to
11312         Arm_relocate_functions::arm_branch_common.  Update list of formal
11313         parameters.
11314         (Arm_relocate_functions::xpc25): New method definition.
11315         (Arm_relocate_functions::arm_branch_common): Move method defintion
11316         out from class definition.  Use stubs for mode-switching and extending
11317         branch ranges.
11318         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11319         specially.  Change code to enable use of stubs in ARM branches.
11320
11321 2009-11-10  Doug Kwan  <dougkwan@google.com>
11322
11323         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11324         in method declaration.
11325         (Target_arm::relocate_stub): New method declaration.
11326         (Target_arm::default_target): Change to return a pointer instead of
11327         a const reference.
11328         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11329         Target_arm::default_target.
11330         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11331         method definition.
11332         (Target_arm::relocate_section): Adjust view.
11333         (Target_arm::relocate_stub): New method definition.
11334
11335 2009-11-10  Doug Kwan  <dougkwan@google.com>
11336
11337         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11338         a format warning.
11339         * incremental.cc (open_incremental_binary): Initialized local
11340         variables to avoid warnings.
11341         * object.cc (make_elf_object): Ditto.
11342         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11343         a format warning.
11344
11345 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11346
11347         PR gold/10930
11348         * testsuite/plugin_test.c: Include "config.h".
11349
11350 2009-11-09  Doug Kwan  <dougkwan@google.com>
11351
11352         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11353         (arm_symbol_value): Remove.
11354         (Arm_relocate_functions::arm_branch_common,
11355         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11356         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11357         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11358         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11359         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11360         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11361         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11362         Arm_relocate_functions::thm_mobw_abs_nc,
11363         Arm_relocate_functions::thm_mov_abs,
11364         Arm_relocate_functions::movw_prel_nc,
11365         Arm_relocate_functions::thm_movt_abs,
11366         Arm_relocate_functions::movt_prel,
11367         Arm_relocate_functions::thm_movw_prel_nc,
11368         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11369         (Target_arm::Relocate::relocate): Only decompose address into two
11370         parts if relocation type uses the thumb-bit and pass the actual
11371         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11372         calls to methods in Arm_relocate_functions for this change.
11373
11374 2009-11-08  Ian Lance Taylor  <iant@google.com>
11375
11376         PR 10925
11377         * reloc.cc: Instantiate
11378         Sized_relobj::initialize_input_to_output_maps and
11379         Sized_relobj:free_input_to_output_maps.
11380
11381 2009-11-06  Ian Lance Taylor  <iant@google.com>
11382
11383         PR 10876
11384         * defstd.cc (in_segment): Set only_if_ref true for "end".
11385
11386 2009-11-06  Doug Kwan  <dougkwan@google.com>
11387
11388         * arm.cc (class Reloc_stub): Correct a comment.
11389         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11390         (Target_arm::scan_section_for_stubs): New method declaration.
11391         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11392         Change methods from private to protected.
11393         (Target_arm::do_may_relax): New method definition.
11394         (Target_arm::do_relax, Target_arm::group_sections,
11395         Target_arm::scan_reloc_for_stub,
11396         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11397         (Target_arm::arm_input_section_map_): New data member declaration.
11398         (Target_arm::scan_reloc_for_stub,
11399         Target_arm::scan_reloc_section_for_stubs,
11400         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11401         Target_arm::do_relax): New method definitions.
11402
11403 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11404
11405         * configure.ac: Check for (struct stat)::st_mtim
11406         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11407         * config.in: Regenerate.
11408         * configure: Regenerate.
11409
11410 2009-11-05  Ian Lance Taylor  <iant@google.com>
11411
11412         PR 10910
11413         * output.cc (Output_segment::add_output_section): Add missing
11414         return statement.
11415
11416 2009-11-04  Ian Lance Taylor  <iant@google.com>
11417
11418         PR 10880
11419         * object.h (class Object): Add is_needed and set_is_needed
11420         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11421         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11422         defined in a dynamic object and referenced by a regular object,
11423         set is_needed for the dynamic object.
11424         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11425         if the file is marked with as_needed and it is not needed.
11426
11427 2009-11-04  Ian Lance Taylor  <iant@google.com>
11428
11429         PR 10887
11430         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11431         tags if data is discarded by linker script.
11432         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11433         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11434         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11435         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11436
11437 2009-11-04  Ian Lance Taylor  <iant@google.com>
11438
11439         * layout.cc (Layout::get_output_section): Add is_interp and
11440         is_dynamic_linker_section parameters.  Change all callers.
11441         (Layout::choose_output_section): Likewise.
11442         (Layout::make_output_section): Likewise.
11443         (Layout::add_output_section_data): Add is_dynamic_linker_section
11444         parameter.  Change all callers.
11445         * layout.h (class Layout): Update declarations.
11446         * output.h (class Output_section): Add is_interp, set_is_interp,
11447         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11448         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11449         generate_code_fills_at_write_ to a bitfield.
11450         * output.cc (Output_section::Output_sections): Initialize new
11451         fields.
11452         (Output_segment::add_output_section): Add do_sort parameter.
11453         Change all callers.
11454
11455 2009-11-03  Ian Lance Taylor  <iant@google.com>
11456
11457         PR 10860
11458         * options.h (class General_options): Add --warn-common.
11459         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11460         merging two common symbols.
11461         (Symbol_table::should_override): Handle --warn-common when merging
11462         a common symbol with a defined symbol.  Use report_resolve_problem
11463         for multiple definitions.
11464         (Symbol_table::report_resolve_problem): New function.
11465         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11466
11467 2009-11-03  Doug Kwan  <dougkwan@google.com>
11468
11469         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11470         stub_factory_.
11471         (Target_arm::stub_factory): New method definition.
11472         (Target_arm::new_arm_input_section,
11473         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11474         Target_arm::reloc_uses_thumb_bit): New method declarations.
11475         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11476         New type definitions.
11477         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11478         member declarations.
11479         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11480         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11481         New method definitions.
11482
11483 2009-11-03  Ian Lance Taylor  <iant@google.com>
11484
11485         * options.h (class General_options): Add --warn_constructors.
11486
11487 2009-11-03  Ian Lance Taylor  <iant@google.com>
11488
11489         PR 10893
11490         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11491         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11492
11493 2009-11-03  Ian Lance Taylor  <iant@google.com>
11494
11495         PR 10895
11496         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11497         --msgid-bugs-address.
11498         (install-pdf): New target.
11499         (install-data_yes): Look up one directory to find mkinstalldirs.
11500
11501 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11502
11503         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11504         tree.
11505
11506 2009-10-30  Doug Kwan  <dougkwan@google.com>
11507
11508         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11509
11510 2009-10-30  Doug Kwan  <dougkwan@google.com>
11511
11512         * arm.cc (Stub_addend_reader): New struct template definition
11513         and partial specializations.
11514         (Stub_addend_reader::operator()): New method definition for a
11515         partially specialized template.
11516
11517 2009-10-30  Doug Kwan  <dougkwan@google.com>
11518
11519         * arm.cc (Arm_relobj::processor_specific_flags): New method
11520         definition.
11521         (Arm_relobj::do_read_symbols): New method declaration.
11522         (Arm_relobj::processor_specific_flags_): New data member declaration.
11523         (Arm_dynobj): New class definition.
11524         (Target_arm::do_finalize_sections): Add input_objects parameter.
11525         (Target_arm::do_adjust_elf_header): New method declaration.
11526         (Target_arm::are_eabi_versions_compatible,
11527         (Target_arm::merge_processor_specific_flags): New method declaration.
11528         (Target_arm::do_make_elf_object): New overloaded method definitions
11529         and declaration.
11530         (Arm_relobj::do_read_symbols): New method definition.
11531         (Arm_dynobj::do_read_symbols): Ditto.
11532         (Target_arm::do_finalize_sections): Add input_objects parameters.
11533         Merge processor-specific flags from all input objects.
11534         (Target_arm::are_eabi_versions_compatible,
11535         Target_arm::merge_processor_specific_flags,
11536         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11537         New method definitions.
11538         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11539         Input_objects pointer type parameter.
11540         * layout.cc (Layout::finalize): Pass input objects to target's.
11541         finalize_sections function.
11542         * output.cc (Output_file_header::do_sized_write): Set ELF file
11543         header's processor-specific flags.
11544         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11545         Input_objects pointer type parameter.
11546         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11547         * target.h (Input_objects): New forward class declaration.
11548         (Target::processor_specific_flags,
11549         Target::are_processor_specific_flags_sect): New method definitions.
11550         (Target::finalize_sections): Add input_objects parameter.
11551         (Target::Target): Initialize processor_specific_flags_ and
11552         are_processor_specific_flags_set_.
11553         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11554         parameter.
11555         (Target::set_processor_specific_flags): New method definition.
11556         (Target::processor_specific_flags_,
11557         Target::are_processor_specific_flags_set_): New data member
11558         declarations.
11559         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11560         Input_objects pointer type parameter.
11561
11562 2009-10-30  Doug Kwan  <dougkwan@google.com>
11563
11564         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11565
11566 2009-10-28  Ian Lance Taylor  <iant@google.com>
11567
11568         * object.h (class Relobj): Drop options parameter from
11569         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11570         do_scan_relocs, do_relocate.  Change all callers.
11571         (class Sized_relobj): Drop options parameters from
11572         do_gc_process_relocs, do_scan_relocs, do_relocate,
11573         do_relocate_sections, relocate_sections, emit_relocs_scan,
11574         emit_relocs_scan_reltype.  Change all callers.
11575         (struct Relocate_info): Remove options field and all references to
11576         it.
11577         * reloc.h (class Read_relocs): Remove options constructor
11578         parameter and options_ field.  Change all callers.
11579         (class Gc_process_relocs, class Scan_relocs): Likewise.
11580         (class Relocate_task): Likewise.
11581         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11582         all callers.
11583         (scan_relocatable_relocs): Likewise.
11584         * target.h (class Sized_target): Remove options parameter from
11585         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11586         all callers.
11587         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11588         callers.
11589         * arm.cc: Update functions to remove options parameters.
11590         * i386.cc: Likewise.
11591         * powerpc.cc: Likewise.
11592         * sparc.cc: Likewise.
11593         * x86_64.cc: Likewise.
11594         * testsuite/testfile.cc: Likewise.
11595
11596 2009-10-28  Doug Kwan  <dougkwan@google.com>
11597
11598         * arm.cc (Arm_relobj): New class definition.
11599         (Arm_relobj::scan_sections_for_stubs,
11600         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11601         New method definitions.
11602
11603 2009-10-28  Cary Coutant  <ccoutant@google.com>
11604
11605         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11606         (Plugin::cleanup_done_): New member.
11607         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11608         (Plugin_manager::cleanup_done_): Remove.
11609         (Plugin_manager::add_input_file): Edit error message.
11610         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11611         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11612
11613 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11614
11615         * fileread.cc: (File_read::View::~View): Use the new
11616         data_ownership_ filed.
11617         (File_read::~File_read): Dispose the new whole_file_view_.
11618         (File_read::open): Mmap the whole file if needed.
11619         (File_read::open): Use whole_file_view_ instead of contents_.
11620         (File_read::find_view): Use whole_file_view_ if applicable.
11621         (File_read::do_read): Use whole_file_view_ instead of contents_.
11622         (File_read::make_view): Use whole_file_view_ instead of contents_,
11623         update File_read::View::View call.
11624         (File_read::find_or_make_view): Update File_read::View::View
11625         call.
11626         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11627         remove contents_
11628         (File_read::View::Data_ownership): New enum.
11629         (File_read::View::View): Replace bool mapped_ with Data_ownership
11630         argument.
11631         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11632         (File_read::View::data_ownership_): New field.
11633         (File_read::contents_): Remove (replaced by whole_file_view_).
11634         (File_read::whole_file_view_): New field.
11635         * options.h (class General_options): Add --keep-files-mapped.
11636
11637 2009-10-27  Cary Coutant  <ccoutant@google.com>
11638
11639         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11640         * testsuite/Makefile.am (plugin_test_5): New test case.
11641         * testsuite/Makefile.in: Regenerate.
11642
11643 2009-10-25  Doug Kwan  <dougkwan@google.com>
11644
11645         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11646         from private to protected to allow access by child class.
11647         (Sized_relobj::do_relocate_sections): New method declaration.
11648         (Sized_relobj::relocate_sections): Virtualize.
11649         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11650         Sized_relobj::relocate_sections.  Instantiate template explicitly
11651         for different target sizes and endianity.
11652
11653 2009-10-24  Doug Kwan  <dougkwan@google.com>
11654
11655         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11656         (Arm_input_section::as_arm_input_section): New method.
11657         (Arm_output_section): New class definition.
11658         (Arm_output_section::create_stub_group,
11659         Arm_output_section::group_sections): New method definitions.
11660
11661 2009-10-22  Doug Kwan  <dougkwan@google.com>
11662
11663         * arm.cc (Arm_input_section): New class definition.
11664         (Arm_input_section::init, Arm_input_section:do_write,
11665         Arm_input_section::set_final_data_size,
11666         Arm_input_section::do_reset_address_and_file_offset): New method
11667         definitions.
11668
11669 2009-10-21  Doug Kwan  <dougkwan@google.com>
11670
11671         * arm.cc (Stub_table, Arm_input_section): New forward class
11672         declarations.
11673         (Stub_table): New class defintion.
11674         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11675         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11676         New method definition.
11677
11678 2009-10-21  Doug Kwan  <dougkwan@google.com>
11679
11680         * arm.cc: Update copyright comments.
11681         (Target_arm): New forward class template declaration.
11682         (Arm_address): New type.
11683         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11684         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11685         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11686         constants.
11687         (Insn_template): Same.
11688         (DEF_STUBS): New macro.
11689         (Stub_type): New enum type.
11690         (Stub_template): New class definition.
11691         (Stub): Same.
11692         (Reloc_stub): Same.
11693         (Stub_factory): Same.
11694         (Target_arm::Target_arm): Initialize may_use_blx_ and
11695         should_force_pic_veneer_.
11696         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11697         Target_arm::should_force_pic_veneer,
11698         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11699         Target_arm::using_thumb_only, Target_arm:;default_target): New
11700         method defintions.
11701         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11702         New data member declarations.
11703         (Insn_template::size, Insn_template::alignment): New method defintions.
11704         (Stub_template::Stub_template): New method definition.
11705         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11706         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11707         (Stub_factory::Stub_factory): New method definition.
11708         * gold.h (string_hash): New template.
11709         * output.h (Input_section_specifier::hash_value): Use
11710         gold::string_hash.
11711         (Input_section_specifier::string_hash): Remove.
11712         * stringpool.cc (Stringpool_template::string_hash): Use
11713         gold::string_hash.
11714
11715 2009-10-20  Doug Kwan  <dougkwan@google.com>
11716
11717         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11718         symbols of relaxed input sections.
11719         * output.h (Output_section::find_relaxed_input_section): Make
11720         method public.
11721
11722 2009-10-16  Doug Kwan  <dougkwan@google.com>
11723
11724         * dynobj.cc (Versions::Versions): Initialize version_script_.
11725         Only insert base version symbol definition for a shared object
11726         if version script defines any version versions.
11727         (Versions::define_base_version): New method definition.
11728         (Versions::add_def): Check that base version is not needed.
11729         (Versions::add_need): Define base version lazily.
11730         * dynobj.h (Versions::define_base_version): New method declaration.
11731         (Versions::needs_base_version_): New data member declaration.
11732         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11733         (check_DATA): Add no_version_test.stdout.
11734         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11735         New make rules.
11736         * testsuite/Makefile.in: Regenerate.
11737         * testsuite/no_version_test.c: New file.
11738         * testsuite/no_version_test.sh: Ditto.
11739
11740 2009-10-16  Doug Kwan  <dougkwan@google.com>
11741
11742         * expression.cc (class Segment_start_expression): New class definition.
11743         (Segment_start_expression::value): New method definition.
11744         (script_exp_function_segment_start): Return a new
11745         Segment_start_expression.
11746         * gold/script-c.h (script_saw_segment_start_expression): New function
11747         prototype.
11748         * script-sections.cc (Script_sections::Script_sections): Initialize
11749         SAW_SEGMENT_START_EXPRESSION_ to false.
11750         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11751         and -Tbbs options to specify section addresses if given in
11752         command line and no SEGMENT_START expression is seen in a script.
11753         * script-sections.h (Script_sections::saw_segment_start_expression,
11754         Script_sections::set_saw_segment_start_expression): New method
11755         definition.
11756         (Script_sections::saw_segment_start_expression_): New data member
11757         declaration.
11758         * script.cc (script_saw_segment_start_expression): New function.
11759         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11760         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11761         script_test_7.sh and script_test_8.sh.
11762         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11763         script_test_8.stdout.
11764         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11765         (script_test_6, script_test_6.stdout, script_test_7,
11766         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11767         * Makefile.in: Regenerate.
11768         * testsuite/script_test_6.sh: New file.
11769         * testsuite/script_test_6.t: Same.
11770         * testsuite/script_test_7.sh: Same.
11771         * testsuite/script_test_7.t: Same.
11772         * testsuite/script_test_8.sh: Same.
11773
11774 2009-10-16  Doug Kwan  <dougkwan@google.com>
11775
11776         * output.cc (Output_segment::set_section_list_address): Cast
11777         expressions to unsigned long long type to avoid format warnings.
11778
11779 2009-10-15  Ian Lance Taylor  <iant@google.com>
11780
11781         * script.cc (Script_options::add_symbol_assignment): Always add a
11782         dot assignment to script_sections_.
11783         * script-sections.cc (Script_sections::add_dot_assignment):
11784         Initialize if necessary.
11785
11786         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11787         program headers with no load segment if there is a linker script.
11788
11789         * layout.cc (Layout::set_segment_offsets): Align the file offset
11790         to the segment aligment for -N or -n with no load segment.
11791         * output.cc (Output_segment::add_output_section): Don't crash if
11792         the first section is a TLS section.
11793         (Output_segment::set_section_list_addresses): Print an error
11794         message if the address moves backward in a linker script.
11795         * script-sections.cc
11796         (Output_section_element_input::set_section_addresses): Don't
11797         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11798         (Orphan_output_section::set_section_addresses): Likewise.
11799
11800 2009-10-15  Doug Kwan  <dougkwan@google.com>
11801
11802         * layout.cc (Layout::finish_dynamic_section): Generate tags
11803         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11804         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11805         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11806
11807 2009-10-14  Ian Lance Taylor  <iant@google.com>
11808
11809         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11810         fields.
11811         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11812         data_shdr fields of relinfo.
11813         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11814         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11815         R_386_TLS_LDO_32, adjust based on section flags.
11816         (Target_i386::Relocate::fix_up_ldo): Remove.
11817
11818 2009-10-13  Ian Lance Taylor  <iant@google.com>
11819
11820         Add support for -pie.
11821         * options.h (class General_options): Add -pie and
11822         --pic-executable.
11823         (General_options::output_is_position_independent): Test -pie.
11824         (General_options::output_is_executable): Return true if not shared
11825         and not relocatable.
11826         (General_options::output_is_pie): Remove.
11827         * options.cc (General_options::finalize): Reject incompatible uses
11828         of -pie.
11829         * gold.cc (queue_middle_tasks): A -pie link is not static.
11830         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11831         * symtab.cc (Symbol::final_value_is_known): Return false if
11832         output_is_position_independent.
11833         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11834         output_is_position_independent.
11835         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11836         output_is_position_independent.
11837         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11838         output_is_position_independent.
11839         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11840         two_file_pie_test.
11841         (basic_pie_test.o, basic_pie_test): New targets.
11842         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11843         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11844         (two_file_pie_test): New target.
11845         * testsuite/Makefile.in: Rebuild.
11846         * README: Remove note saying that -pie is not supported.
11847
11848 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11849
11850         * options.h (class General_options): Add -init and -fini.
11851         * layout.cc (Layout::finish_dynamic_section): Emit
11852         given init and fini functions.
11853
11854 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11855
11856         * gc.h (gc_process_relocs): Check if icf is enabled using new
11857         function.
11858         * gold.cc (queue_initial_tasks): Likewise.
11859         (queue_middle_tasks): Likewise.
11860         * object.cc (do_layout): Likewise.
11861         * symtab.cc (is_section_folded): Likewise.
11862         * main.cc (main): Likewise.
11863         * reloc.cc (Read_relocs::run): Likewise.
11864         (Sized_relobj::do_scan_relocs): Likewise.
11865         * icf.cc (is_function_ctor_or_dtor): New function.
11866         (Icf::find_identical_sections): Check if function is ctor or dtor when
11867         safe icf is chosen.
11868         * options.h (General_options::icf): Change option to be an enum.
11869         (Icf_status): New enum.
11870         (icf_enabled): New method.
11871         (icf_safe_folding): New method.
11872         (set_icf_status): New method.
11873         (icf_status_): New variable.
11874         * (options.cc) (General_options::finalize): Set icf_status_.
11875         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11876         icf_test and icf_keep_unique_test to use the --icf enum flag.
11877         * testsuite/icf_safe_test.sh: New file.
11878         * testsuite/icf_safe_test.cc: New file.
11879
11880 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11881
11882         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11883         includes to gc.h and icf.h.
11884         * arm.cc: Include gc.h.
11885         * gold.cc: Likewise.
11886         * i386.cc: Likewise.
11887         * powerpc.cc: Likewise.
11888         * sparc.cc: Likewise.
11889         * x86_64.cc: Likewise.
11890         * gc.h: Include icf.h.
11891
11892 2009-10-11  Ian Lance Taylor  <iant@google.com>
11893
11894         * plugin.cc: Include "gold.h" before other header files.
11895
11896 2009-10-10  Chris Demetriou  <cgd@google.com>
11897
11898         * options.h (Input_file_argument::Input_file_type): New enum.
11899         (Input_file_argument::is_lib_): Replace with...
11900         (Input_file_argument::type_): New member.
11901         (Input_file_argument::Input_file_argument): Take Input_file_type
11902         'type' rather than boolean 'is_lib' as second argument.
11903         (Input_file_argument::is_lib): Use type_.
11904         (Input_file_argument::is_searched_file): New function.
11905         (Input_file_argument::may_need_search): Handle is_searched_file.
11906         * options.cc (General_options::parse_library): Support -l:filename.
11907         (General_options::parse_just_symbols): Update for Input_file_argument
11908         changes.
11909         (Command_line::process): Likewise.
11910         * archive.cc (Archive::get_file_and_offset): Likewise.
11911         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11912         * script.cc (read_script_file, script_add_file): Likewise.
11913         * fileread.cc (Input_file::Input_file): Likewise.
11914         (Input_file::will_search_for): Handle is_searched_file.
11915         (Input_file::open): Likewise.
11916         * readsyms.cc (Read_symbols::get_name): Likewise.
11917         * testsuite/Makefile.am (searched_file_test): New test.
11918         * testsuite/Makefile.in: Regenerate.
11919         * testsuite/searched_file_test.cc: New file.
11920         * testsuite/searched_file_test_lib.cc: New file.
11921
11922 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11923             Ian Lance Taylor  <iant@google.com>
11924
11925         * descriptor.cc: Include <cstdio> and "binary-io.h".
11926         (Descriptors::open): Open the files in binary mode always.
11927         * script.cc (Lex::get_token): Treat \r as whitespace.
11928
11929 2009-10-09  Ian Lance Taylor  <iant@google.com>
11930
11931         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11932
11933 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11934             Ian Lance Taylor  <iant@google.com>
11935
11936         * configure.ac: Check for readv function also.
11937         * fileread.cc (readv): Define if not HAVE_READV.
11938         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11939         does not exist.
11940         * config.in: Regenerate.
11941         * configure: Regenerate.
11942
11943 2009-10-09  Doug Kwan  <dougkwan@google.com>
11944
11945         * layout.cc (Layout::make_output_section): Call target hook to make
11946         ordinary output section.
11947         (Layout::finalize): Adjust parameter list of call the
11948         Target::may_relax().
11949         * layout.h (class Layout::section_list): New method.
11950         * merge.h (Output_merge_base::entsize): Change visibility to public.
11951         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11952         New methods.
11953         (Output_merge_string::do_is_string): New method.
11954         * object.cc (Sized_relobj::do_setup): renamed from
11955         Sized_relobj::set_up.
11956         * object.h (Sized_relobj::adjust_shndx,
11957         Sized_relobj::initializ_input_to_output_maps,
11958         Sized_relobj::free_input_to_output_maps): Change visibilities to
11959         protected.
11960         (Sized_relobj::setup): Virtualize.
11961         (Sized_relobj::do_setup): New method declaration.
11962         (Sized_relobj::invalidate_section_offset,
11963         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11964         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11965         * options.cc (parse_int): New function.
11966         * options.h (parse_int): New declaration.
11967         (DEFINE_int): New macro.
11968         (stub_group_size): New option.
11969         * output.cc (Output_section::Output_section): Initialize memebers
11970         merge_section_map_, merge_section_by_properties_map_,
11971         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11972         (Output_section::add_input_section): Handled deferred code-fill
11973         generation and remove an old comment.
11974         (Output_section::add_relaxed_input_section): New method definition.
11975         (Output_section::add_merge_input_section): Use merge section by
11976         properties map to speed to search.  Update merge section maps
11977         as appropriate.
11978         (Output_section::build_relaxation_map): New method definition.
11979         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11980         Same.
11981         (Output_section::relax_input_section): Renamed to
11982         Output_section::convert_input_sections_to_relaxed_sections and change
11983         interface to take a vector of pointers to relaxed sections.
11984         (Output_section::find_merge_section,
11985         Output_section::find_relaxed_input_section): New method definitions.
11986         (Output_section::is_input_address_mapped,
11987         Output_section::output_offset, Output_section::output_address):
11988         Use output section data maps to speed up searching.
11989         (Output_section::find_starting_output_address): Add comments.
11990         (Output_section::do_write,
11991         Output_section::write_to_postprocessing_buffer): Do code-fill
11992         generation as appropriate.
11993         (Output_section::get_input_sections): Invalidate relaxed input section
11994         map.
11995         (Output_section::restore_states): Adjust type of checkpoint .
11996         Invalidate relaxed input section map.
11997         * output.h (Output_merge_base): New class declaration.
11998         (Input_section_specifier): New class defintion.
11999         (class Output_relaxed_input_section) Change base class to
12000         Output_section_data_build.
12001         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12002         base class initializer.
12003         (Output_section::add_relaxed_input_section): New method declaration.
12004         (Output_section::Input_section): Change visibility to protected.
12005         (Output_section::Input_section::relobj,
12006         Output_section::Input_section::shndx): Handle relaxed input sections.
12007         Output_section::input_sections) Change visibility to protected.  Also
12008         define overload to return a non-const pointer.
12009         (Output_section::Merge_section_properties): New class defintion.
12010         (Output_section::Merge_section_by_properties_map,
12011         Output_section::Output_section_data_by_input_section_map,
12012         Output_section::Relaxation_map): New types.
12013         (Output_section::relax_input_section): Rename method to
12014         Output_section::convert_input_sections_to_relaxed_sections and change
12015         interface to take a vector of relaxed section pointers.
12016         (Output_section::find_merge_section,
12017         Output_section::find_relaxed_input_section,
12018         Output_section::build_relaxation_map,
12019         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12020         New method declarations.
12021         (Output_section::merge_section_map_
12022         Output_section::merge_section_by_properties_map_,
12023         Output_section::relaxed_input_section_map_,
12024         Output_section::is_relaxed_input_section_map_valid_,
12025         Output_section::generate_code_fills_at_write_): New data members.
12026         * script-sections.cc
12027         (Output_section_element_input::set_section_addresses): Call
12028         current_data_size and addralign methods of relaxed input sections.
12029         (Orphan_output_section::set_section_addresses): Call current_data_size
12030         and addralign methods of relaxed input sections.
12031         * symtab.cc (Symbol_table::compute_final_value): Extract template
12032         from the body of Symbol_table::sized_finalize_symbol.
12033         (Symbol_table::sized_finalized_symbol): Call
12034         Symbol_table::compute_final_value.
12035         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12036         (Symbol_table::compute_final_value): New templated method declaration.
12037         * target.cc (Target::do_make_output_section): New method defintion.
12038         * target.h (Target::make_output_section): New method declaration.
12039         (Target::relax): Add more parameters for input objects, symbol table
12040         and layout.  Adjust call to do_relax.
12041         (Target::do_make_output_section): New method declaration.
12042         (Target::do_relax): Add parameters for input objects, symbol table
12043         and layout.
12044
12045 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12046
12047         * pread.c: Include stdio.h.
12048
12049 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12050
12051         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12052         defined.
12053
12054 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12055
12056         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12057         Change read_shndx type to unsigned int.
12058         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12059         int.
12060         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12061         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12062         Change read_shndx type to unsigned int.
12063         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12064         int.
12065         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12066         * layout.cc (Layout::create_symtab_sections): Cast the result of
12067         local_symcount * symsize to off_t in the gold_assert.
12068
12069 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12070
12071         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12072         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12073         R_ARM_BASE_ABS.
12074         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12075         (Arm_relocate_functions::thm_abs5): New function.
12076         (Arm_relocate_functions::abs12): New function.
12077         (Arm_relocate_functions::abs16): New function.
12078         (Arm_relocate_functions::base_abs): New function.
12079         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12080         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12081         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12082         R_ARM_BASE_ABS.
12083         (Scan::global): Likewise.
12084         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12085         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12086         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12087         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12088         R_ARM_BASE_ABS.
12089
12090 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12091
12092         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12093         (Arm_relocate_functions::movt_prel): New function.
12094         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12095         (Arm_relocate_functions::thm_movt_prel): New function.
12096         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12097         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12098         (Scan::global, Relocate::relocate): Likewise.
12099         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12100
12101 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12102
12103         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12104         Incremental_checker.
12105         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12106         unsigned int.
12107         (class Incremental_inputs_header): New class.
12108         (Incremental_inputs_header_writer): Edit comment.
12109         (Incremental_inputs_entry): New class.
12110         (Incremental_inputs_entry_writer): Edit comment.
12111         (Sized_incremental_binary::do_find_incremental_inputs_section):
12112         Add *strtab_shndx parameter, fill it.
12113         (Sized_incremental_binary::do_check_inputs): New method.
12114         (Incremental_checker::can_incrementally_link_output_file): Use
12115         Sized_incremental_binary::check_inputs.
12116         (Incremental_inputs::report_command_line): Save command line in
12117         command_line_.
12118         * incremental.h:
12119         (Incremental_binary::find_incremental_inputs_section): New
12120         method.
12121         (Incremental_binary::do_find_incremental_inputs_section): Add
12122         strtab_shndx parameter.
12123         (Incremental_binary::do_check_inputs): New pure virtual method.
12124         (Sized_incremental_binary::do_check_inputs): Declare.
12125         (Incremental_checker::Incremental_checker): Add incremental_inputs
12126         parameter, use it to initialize incremental_inputs_.
12127         (Incremental_checker::incremental_inputs_): New field.
12128         (Incremental_checker::command_line): New method.
12129         (Incremental_checker::inputs): New method.
12130         (Incremental_checker::command_line_): New field.
12131
12132 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12133
12134         * incremental.cc: Include <cstdarg> and "target-select.h".
12135         (vexplain_no_incremental): New function.
12136         (explain_no_incremental): New function.
12137         (Incremental_binary::error): New method.
12138         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12139         method.
12140         (make_sized_incremental_binary): New function.
12141         (open_incremental_binary): New function.
12142         (can_incrementally_link_file): Add checks if output is ELF and has
12143         inputs section.
12144         * incremental.h: Include "elfcpp_file.h" and "output.h".
12145         (Incremental_binary): New class.
12146         (Sized_incremental_binary): New class.
12147         (open_incremental_binary): Declare.
12148         * object.cc (is_elf_object): Use
12149         elfcpp::Elf_recognizer::is_elf_file.
12150         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12151         * output.h (Output_file::filesize): New method.
12152
12153 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12154
12155         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12156         New function.
12157         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12158         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12159         function.
12160         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12161         function.
12162         (Arm_relocate_functions::movw_abs_nc): New function.
12163         (Arm_relocate_functions::movt_abs): New function.
12164         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12165         (Arm_relocate_functions::thm_movt_abs): New function.
12166         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12167         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12168         (Scan::global): Likewise.
12169         (Relocate::relocate): Likewise.
12170         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12171
12172 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12173
12174         * arm.cc (Arm_relocate_functions::got_prel) New function.
12175         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12176         (Relocate::relocate): Likewise.
12177         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12178
12179 2009-10-06  Ian Lance Taylor  <iant@google.com>
12180
12181         * options.h (class General_options): Define
12182         split_stack_adjust_size parameter.
12183         * object.h (class Object): Add uses_split_stack_ and
12184         has_no_split_stack_ fields.  Add uses_split_stack and
12185         has_no_split_stack accessor functions.  Declare
12186         handle_split_stack_section.
12187         (class Reloc_symbol_changes): Define.
12188         (class Sized_relobj): Define Function_offsets.  Declare
12189         split_stack_adjust, split_stack_adjust_reltype, and
12190         find_functions.
12191         * object.cc (Object::handle_split_stack_section): New function.
12192         (Sized_relobj::do_layout): Call handle_split_stack_section.
12193         * dynobj.cc (Sized_dynobj::do_layout): Call
12194         handle_split_stack_section.
12195         * reloc.cc (Sized_relobj::relocate_sections): Call
12196         split_stack_adjust for executable sections in split_stack
12197         objects.  Pass reloc_map to relocate_section.
12198         (Sized_relobj::split_stack_adjust): New function.
12199         (Sized_relobj::split_stack_adjust_reltype): New function.
12200         (Sized_relobj::find_functions): New function.
12201         * target-reloc.h: Include "object.h".
12202         (relocate_section): Add reloc_symbol_changes parameter.  Change
12203         all callers.
12204         * target.h (class Target): Add calls_non_split method.  Declare
12205         do_calls_non_split virtual method.  Declare match_view and
12206         set_view_to_nop.
12207         * target.cc: Include "elfcpp.h".
12208         (Target::do_calls_non_split): New function.
12209         (Target::match_view): New function.
12210         (Target::set_view_to_nop): New function.
12211         * gold.cc (queue_middle_tasks): Give an error if mixing
12212         split-stack and non-split-stack objects with -r.
12213         * i386.cc (Target_i386::relocate_section): Add
12214         reloc_symbol_changes parameter.
12215         (Target_i386::do_calls_non_split): New function.
12216         * x86_64.cc (Target_x86_64::relocate_section): Add
12217         reloc_symbol_changes parameter.
12218         (Target_x86_64::do_calls_non_split): New function.
12219         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12220         parameter.
12221         * powerpc.cc (Target_powerpc::relocate_section): Add
12222         reloc_symbol_changes parameter.
12223         * sparc.cc (Target_sparc::relocate_section): Add
12224         reloc_symbol_changes parameter.
12225         * configure.ac: Call AM_CONDITIONAL for the default target.
12226         * configure: Rebuild.
12227         * testsuite/Makefile.am (TEST_AS): New variable.
12228         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12229         (check_DATA): Add split_i386 and split_x86_64 files.
12230         (SPLIT_DEFSYMS): Define.
12231         (split_i386_[1234n].o): New targets.
12232         (split_i386_[124]): New targets.
12233         (split_i386_[1234r].stdout): New targets.
12234         (split_x86_64_[1234n].o): New targets.
12235         (split_x86_64_[124]): New targets.
12236         (split_x86_64_[1234r].stdout): New targets.
12237         (MOSTLYCLEANFILES): Add new executables.
12238         * testsuite/split_i386.sh: New file.
12239         * testsuite/split_x86_64.sh: New file.
12240         * testsuite/split_i386_1.s: New file.
12241         * testsuite/split_i386_2.s: New file.
12242         * testsuite/split_i386_3.s: New file.
12243         * testsuite/split_i386_4.s: New file.
12244         * testsuite/split_i386_n.s: New file.
12245         * testsuite/split_x86_64_1.s: New file.
12246         * testsuite/split_x86_64_2.s: New file.
12247         * testsuite/split_x86_64_3.s: New file.
12248         * testsuite/split_x86_64_4.s: New file.
12249         * testsuite/split_x86_64_n.s: New file.
12250         * testsuite/testfile.cc (Target_test): Update relocation_section
12251         function.
12252         * testsuite/Makefile.in: Rebuild.
12253
12254 2009-10-06  Ian Lance Taylor  <iant@google.com>
12255
12256         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12257         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12258         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12259         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12260         the address on ldo_addrs_.
12261         (Target_i386::Relocate::fix_up_ldo): New function.
12262
12263 2009-10-06   Rafael Espindola  <espindola@google.com>
12264
12265         * plugin.cc (add_input_library): New.
12266         (Plugin::load): Add add_input_library to tv.
12267         (Plugin_manager::add_input_file): Add the is_lib argument.
12268         (add_input_file): Update call to Plugin_manager::add_input_file.
12269         (add_input_library): New.
12270         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12271
12272 2009-09-30  Doug Kwan  <dougkwan@google.com>
12273
12274         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12275         symbol and call Symbol::may_need_copy_reloc to determine if
12276         a copy reloc is needed.
12277         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12278         nocopyreloc is given in command line.
12279         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12280         given in command line.
12281         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12282         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12283         of the removed Target_i386::may_need_copy_reloc.
12284         * options.h (copyreloc): New option with default value false.
12285         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12286         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12287         instead of the removed Target_powerpc::may_need_copy_reloc.
12288         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12289         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12290         instead of the removed Target_sparc::may_need_copy_reloc.
12291         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12292         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12293         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12294         instead of the removed Target_x86_64::may_need_copy_reloc.
12295
12296 2009-09-30  Ian Lance Taylor  <iant@google.com>
12297
12298         * object.h (class Object): Remove target_ field, and target,
12299         sized_target, and set_target methods.
12300         (Object::sized_target): Remove.
12301         (class Sized_relobj): Update declarations.  Remove sized_target.
12302         * object.cc (Sized_relobj::setup): Remove target parameter.
12303         Change all callers.
12304         (Input_objects::add_object): Don't do anything with the target.
12305         (make_elf_sized_object): Add punconfigured parameter.  Change all
12306         callers.  Set or test parameter target.
12307         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12308         Change all callers.
12309         * parameters.cc (Parameters::set_target): Change parameter type to
12310         be non-const.
12311         (Parameters::default_target): Remove.
12312         (set_parameters_target): Change parameter type to be non-const.
12313         (parameters_force_valid_target): New function.
12314         (parameters_clear_target): New function.
12315         * parameters.h (class Parameters): Update declarations.  Remove
12316         default_target method.  Add sized_target and clear_target
12317         methods.  Change target_ to be non-const.
12318         (set_parameters_target): Update declaration.
12319         (parameters_force_valid_target): Declare.
12320         (parameters_clear_target): Declare.
12321         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12322         as NULL if we aren't searching.
12323         (Add_symbols::run): Don't check for compatible target.
12324         * fileread.cc (Input_file::open_binary): Call
12325         parameters_force_valid_target.
12326         * gold.cc (queue_middle_tasks): Likewise.
12327         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12328         set_target on object.
12329         * dynobj.h (class Sized_dynobj): Update declarations.
12330         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12331         make_elf_object returns NULL.
12332         (Archive::include_member): Don't check whether object target is
12333         compatible.
12334         * output.cc (Output_section::add_input_section): Get target from
12335         parameters.
12336         (Output_section::relax_input_section): Likewise.
12337         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12338         parameters.
12339         (Sized_relobj::do_scan_relocs): Likewise.
12340         (Sized_relobj::relocate_sections): Likewise.
12341         * resolve.cc (Symbol_table::resolve): Likewise.
12342         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12343         parameter.  Change all callers.
12344         (Symbol_table::add_from_object): Get target from parameters.
12345         (Symbol_table::add_from_relobj): Don't check object target.
12346         (Symbol_table::add_from_dynobj): Likewise.
12347         (Symbol_table::define_special_symbol): Get target from
12348         parameters.
12349         * symtab.h (class Symbol_table): Update declaration.
12350         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12351         parameter.  Change all callers.  Clear parameter target.
12352         (Binary_test): Test target here.
12353         * testsuite/object_unittest.cc (gold_testsuite): Remove
12354         target_test_pointer parameter.  Change all callers.
12355         (Object_test): Test target here.
12356
12357 2009-09-26  Ian Lance Taylor  <iant@google.com>
12358
12359         * testsuite/initpri1.c: Don't try to use constructor priorities if
12360         compiling with gcc before 4.3.
12361
12362 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12363
12364         * testsuite/retain_symbols_file_test.sh (check_present): Change
12365         output file name to retain_symbols_file_test.stdout.
12366         (check_absent): Likewise.
12367
12368 2009-09-18  Craig Silverstein  <csilvers@google.com>
12369
12370         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12371         * options.cc: Include <cerrno> and <fstream>.
12372         (General_options::finalize): Parse -retain-symbols-file tag.
12373         * options.h: New flag.
12374         (General_options): New method should_retain_symbol, new
12375         variable symbols_to_retain.
12376         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12377         should_retain_symbol map.
12378         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12379         * testsuite/Makefile.in: Regenerate.
12380         * testsuite/retain_symbols_file_test.sh: New file.
12381
12382 2009-09-18  Nick Clifton  <nickc@redhat.com>
12383
12384         * po/es.po: Updated Spanish translation.
12385
12386 2009-09-17  Doug Kwan  <dougkwan@google.com>
12387
12388         * debug.h (DEBUG_RELAXATION): New constant.
12389         (DEBUG_ALL): Add DEBUG_RELAXATION.
12390         (debug_string_to_enum): Add relaxation debug option.
12391         * layout.cc
12392         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12393         Layout::Relaxation_debug_check::read_sections,
12394         Layout::Relaxation_debug_check::read_sections): New method definitions.
12395         (Layout::Layout): Initialize data members
12396         record_output_section_data_from_scrips_,
12397         script_output_section_data_list_ and relaxation_debug_check_.
12398         (Layout::save_segments, Layout::restore_segments,
12399         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12400         Layout::relaxation_loop_body): New method definitions.
12401         (Layout::finalize): Support relaxation.  Move section layout code to
12402         Layout::relaxation_loop_body.
12403         (Layout::set_asection_address_from_script): Move code for orphan
12404         section placement out.
12405         (Layout::place_orphan_sections_in_script): New method definition.
12406         * layout.h (Output_segment_headers, Output_file_header):
12407         New forward class declarations.
12408         (Layout::~Layout): Define.
12409         (Layout::new_output_section_data_from_script): New method definition.
12410         (Layout::place_orphan_sections_in_script): New method declaration.
12411         (Layout::Segment_states): New type declaration.
12412         (Layout::save_segments, Layout::restore_segments,
12413         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12414         Layout::relaxation_loop_body): New method declarations.
12415         (Layout::Output_section_data_list): New type declaration.
12416         (Layout::Relaxation_debug_check): New class definition.
12417         (Layout::record_output_section_data_from_script_,
12418         Layout::script_output_section_data_list_, Layout::segment_states_,
12419         Layout::relaxation_debug_check_): New data members.
12420         * output.cc: (Output_section_headers::do_size): New method definition.
12421         (Output_section_headers::Output_section_headers): Move size
12422         computation to Output_section_headers::do_size.
12423         (Output_segment_headers::do_size): New method definition.
12424         (Output_file_header::Output_file_header): Move size computation to
12425         Output_file_header::do_size and call it.
12426         (Output_file_header::do_size): New method definition.
12427         (Output_data_group::Output_data_group): Adjust call to
12428         Output_section_data.
12429         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12430         (Output_symtab_xindex::do_write): Add array bound check.
12431         (Output_section::Input_section::print_to_mapfile): Handle
12432         RELAXED_INPUT_SECTION_CODE.
12433         (Output_section::Output_section): Initialize data member checkpoint_.
12434         (Output_section::~Output_section): Delete checkpoint object pointed
12435         by checkpoint_.
12436         (Output_section::add_input_section): Always add an Input_section if
12437         relaxing.
12438         (Output_section::add_merge_input_section): Add assert.
12439         (Output_section::relax_input_section): New method definition.
12440         (Output_section::set_final_data_size): Set load address to zero for
12441         an unallocated section.
12442         (Output_section::do_address_and_file_offset_have_reset_values):
12443         New method definition.
12444         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12445         Handle relaxed input section.
12446         (Output_section::sort_attached_input_sections): Checkpoint input
12447         section list lazily.
12448         (Output_section::get_input_sections): Change type of input_sections to
12449         list of Simple_input_section pointers.  Checkpoint input section list
12450         lazily.  Also handle relaxed input sections.
12451         (Output_section::add_input_section_for_script): Take a reference to
12452         a Simple_input_section object instead of Relobj pointer and section
12453         index as parameter.  Handle relaxed input sections.
12454         (Output_section::save_states, Output_section::restore_states): New
12455         method definitions.
12456         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12457         (Output_data::is_data_size_fixed): New method definition.
12458         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12459         if it is fixed.
12460         (Output_data::address_and_file_offset_have_reset_values): New method
12461         definition.
12462         (Output_data::do_address_and_file_offset_have_reset_values): New method
12463         definition.
12464         (Output_data::set_data_size): Check that data size is not fixed.
12465         (Output_data::fix_data_size): New method definition.
12466         (Output_data::is_data_size_fixed_): New data member.
12467         (Output_section_headers::set_final_data_size): New method definition.
12468         (Output_section_headers::do_size): New method declaration.
12469         (Output_segment_headers::set_final_data_size): New method definition.
12470         (Output_segment_headers::do_size): New method declaration.
12471         (Output_file_header::set_final_data_size)::New method definition.
12472         (Output_file_header::do_size)::New method declaration.
12473         (Output_section_data::Output_section_data): Add new parameter
12474         is_data_size_fixed and use it to fix data size.
12475         (Output_data_const::Output_data_const): Adjust call to base class
12476         constructor and fix data size.
12477         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12478         base class constructor and fix data size.
12479         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12480         base class constructor and fix data size.
12481         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12482         class constructor and fix data size.
12483         (Output_data_group::set_final_data_size): New method definition.
12484         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12485         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12486         class constructor and fix data size.
12487         (Output_relaxed_input_section): New class definition.
12488         (Output_section::Simple_input_section): New class definition.
12489         (Output_section::get_input_sections): Adjust parameter list.
12490         (Output_section::add_input_section_for_script): Same.
12491         (Output_section::save_states, Output_section::restore_states,
12492         Output_section::do_address_and_file_offset_have_reset_values,
12493         (Output_section::Input_section::Input_section): Handle
12494         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12495         Output_relaxed_input_section.
12496         (Output_section::Input_section::is_input_section,
12497         Output_section::Input_section::set_output_section): Handle relaxed
12498         input section.
12499         (Output_section::Input_section::is_relaxed_input_section,
12500         Output_section::Input_section::output_section_data,
12501         Output_section::Input_section::relaxed_input_section): New method
12502         definitions.
12503         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12504         value.
12505         (Output_section::Input_section::u1_): Update comments.
12506         (Output_section::Input_section::u2_): Add new union member poris.
12507         (Output_section::Checkpoint_output_section): New classs definition.
12508         (Output_section::relax_input_section): New method declaration.
12509         (Output_section::checkpoint_): New data member.
12510         (Output_segment): Update comments.
12511         (Output_segment::Output_segment): Un-privatize copy constructor.
12512         (Output_segment::operator=): Un-privatize.
12513         * script-sections.cc (Output_section_element::Input_section_list):
12514         Change element type to Output_section::Simple_input_section.
12515         (Output_section_element_dot_assignment::set_section_addresses):
12516         Register output section data for relaxation clean up.
12517         (Output_data_exression::Output_data_expression): Adjust call to base
12518         constructor to fix data size.
12519         (Output_section_element_data::set_section_addresses): Register
12520         Output_data_expression object for relaxation clean up.
12521         (struct Input_section_info): Replace Relobj pointer and section index
12522         pair with Output_section::Simple_input_section and Convert struct to a
12523         class.
12524         (Input_section_sorter::operator()): Adjust access to
12525         Input_section_info data member to use accessors.
12526         (Output_section_element_input::set_section_addresses): Use layout
12527         parameter.  Adjust code to use Output_section::Simple_input_section
12528         and Input_secction_info classes.  Register filler for relaxation
12529         clean up.
12530         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12531         and section index pair with Output_section::Simple_input_section
12532         class.  Adjust code accordingly.
12533         (Phdrs_element::release_segment): New method definition.
12534         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12535         segment list.
12536         (Script_sections::release_segments): New method definition.
12537         * gold/script-sections.h (Script_sections::release_segments): New
12538         method declaration.
12539         * gold/target.h (Target::may_relax, Target::relax,
12540         Target::do_may_relax, Target::do_relax): New method definitions.
12541
12542 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12543
12544         * arm.cc (has_signed_unsigned_overflow): New function.
12545         (Arm_relocate_functions::abs8): New function.
12546         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12547         (Target_arm::Scan::global): Likewise.
12548         (Target_arm::relocate::relocate): Likewise.
12549         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12550         Likewise.
12551
12552 2009-09-16  Cary Coutant  <ccoutant@google.com>
12553
12554         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12555         * testsuite/Makefile.in: Regenerate.
12556
12557 2009-09-11  Nick Clifton  <nickc@redhat.com>
12558
12559         * po/gold.pot: Updated by the Translation project.
12560
12561 2009-09-08  Cary Coutant  <ccoutant@google.com>
12562
12563         * output.cc (Output_file::open): Add execute permission to empty file.
12564         * testsuite/Makefile.am (permission_test): New test.
12565         * testsuite/Makefile.in: Regenerate.
12566
12567 2009-09-02  Ian Lance Taylor  <iant@google.com>
12568
12569         * output.cc (Output_file::resize): Call map_no_anonymous rather
12570         than map.
12571
12572 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12573
12574         * gold.cc: Include "incremental.h".
12575         (queue_initial_tasks): Call Incremental_checker methods.
12576         * incremental.cc: Include "output.h".
12577         (Incremental_checker::can_incrementally_link_output_file): New
12578         method.
12579         * incremental.h (Incremental_checker): New class.
12580
12581         * output.cc (Output_file::open_for_modification): New method.
12582         (Output_file::map_anonymous): Changed return type to bool.  Record
12583         map in base_ field.
12584         (Output_file::map_no_anonymous): New method, broken out of map.
12585         (Output_file::map): Use map_no_anonymous and map_anonymous.
12586         * output.h (class Output_file): Update declarations.
12587
12588 2009-08-24  Cary Coutant  <ccoutant@google.com>
12589
12590         * options.h (Command_line::Pre_options): New class.
12591         (Command_line::pre_options): New member.
12592         * options.cc (gold::options::ready_to_register): New variable.
12593         (One_option::register_option): Do nothing if not registering options.
12594         Assert if same short option registered twice.
12595         (General_options::General_options): Turn off option registration when
12596         done constructing.
12597         (Command_line::Pre_options::Pre_options): New constructor.
12598
12599 2009-08-24  Cary Coutant  <ccoutant@google.com>
12600
12601         * options.h (General_options::no_keep_memory): Remove incorrect
12602         short option.
12603
12604 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12605
12606         * Makefile.am (am__skiplex, am__skipyacc): New.
12607         * Makefile.in: Regenerate.
12608
12609 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12610
12611         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12612         (INCLUDES): ... this.
12613         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12614         (AM_CPPFLAGS): Renamed from ...
12615         (INCLUDE): ... this.
12616         * Makefile.in, testsuite/Makefile.in: Regenerate.
12617
12618         * Makefile.in: Regenerate.
12619         * aclocal.m4: Likewise.
12620         * config.in: Likewise.
12621         * configure: Likewise.
12622         * testsuite/Makefile.in: Likewise.
12623
12624         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12625         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12626         * Makefile.in: Regenerate.
12627         * testsuite/Makefile.in: Regenerate.
12628
12629 2009-08-19  Cary Coutant  <ccoutant@google.com>
12630
12631         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12632         symbols in shared libraries overridden by hidden or internal symbols
12633         in the main program.
12634
12635 2009-08-19  Chris Demetriou  <cgd@google.com>
12636
12637         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12638         checking source file names in error messages.
12639
12640 2009-08-18  Doug Kwan  <dougkwan@google.com>
12641
12642         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12643         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12644         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12645         an elfcpp::Ehdr as parameter.
12646         * object.cc (Object::set_target): Remove the version that looks up
12647         a target and sets it.
12648         (Sized_relobj::setup): Take a Target object instead of
12649         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12650         (make_elf_sized_object): Find target and ask target to
12651         make an ELF object.
12652         * object.h: (Object::set_target): Remove the version that looks up
12653         a target and sets it.
12654         (Sized_relobj::setup): Take a Target object instead of
12655         an elfcpp:Ehdr as parameter.
12656         * target.cc: Include dynobj.h.
12657         (Target::do_make_elf_object_implementation): New.
12658         (Target::do_make_elf_object): New.
12659         * target.h (Target::make_elf_object): New template declaration.
12660         (Target::do_make_elf_object): New method declarations.
12661         (Target::do_make_elf_object_implementation): New template declaration.
12662
12663 2009-08-14  Ian Lance Taylor  <iant@google.com>
12664
12665         * gold.h (FUNCTION_NAME): Define.
12666         (gold_unreachable): Use FUNCTION_NAME.
12667
12668 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12669
12670         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12671         symbol in the --keep-unique list is not found.
12672
12673 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12674
12675         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12676         been maked as --keep-unique.
12677         (Icf::unfold_section): New function.
12678         * icf.h (Icf::unfold_section): New function.
12679         * options.h (General_options::keep_unique): New option.
12680         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12681         * testsuite/Makefile.in: Regenerate.
12682         * testsuite/icf_keep_unique_test.sh: New file.
12683         * testsuite/icf_keep_unique_test.cc: New file.
12684
12685 2009-08-12  Cary Coutant  <ccoutant@google.com>
12686
12687         PR 10471
12688         * resolve.cc (Symbol_table::resolve): Check for references from
12689         dynamic objects to hidden and internal symbols.
12690         * testsuite/Makefile.am (hidden_test.sh): New test.
12691         * testsuite/Makefile.in: Regenerate.
12692         * testsuite/hidden_test.sh: New script.
12693         * testsuite/hidden_test_1.c: New test source.
12694         * testsuite/hidden_test_main.c: New test source.
12695
12696 2009-08-11  Doug Kwan  <dougkwan@google.com>
12697
12698         * arm.cc: Update comments.
12699         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12700         segment to locate the .ARM.exidx section if present.
12701
12702 2009-08-09  Doug Kwan  <dougkwan@google.com>
12703
12704         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12705         patch.
12706
12707 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12708         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12709         compiler warnings.
12710
12711 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12712
12713         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12714         valid tls_segment only for non-debug-section relocations.
12715         * testsuite/Makefile.am: Add gc_tls_test.
12716         * testsuite/Makefile.in: Regenerate.
12717         * testsuite/gc_tls_test.cc: New file.
12718         * testsuite/gc_tls_test.sh: New file.
12719
12720 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12721
12722         * icf.cc: New file.
12723         * icf.h: New file.
12724         * Makefile.am (CCFILES): Add icf.cc.
12725         (HFILES): Add icf.h
12726         * Makefile.in: Regenerate.
12727         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12728         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12729         section, symbol and addend information for the relocs.
12730         * gold.cc (queue_middle_tasks): Call identical code folding.
12731         * gold.h: Add defines for multimap.
12732         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12733         to the call of finalize_local_symbols.
12734         * main.cc (main): Create object of class Icf.
12735         * object.cc (Sized_relobj::do_layout): Allow this function to be
12736         called twice during icf.
12737         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12738         to sections marked as identical by icf.
12739         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12740         when available.
12741         (Sized_relobj::do_section_entsize): New function.
12742         * object.h (Object::section_entsize): New function.
12743         (Object::do_section_entsize): New pure virtual function.
12744         (Relobj::finalize_local_symbols): Add new parameter.
12745         (Relobj::do_section_entsize): New function.
12746         * options.h (General_options::icf): New option.
12747         (General_options::icf_iterations): New option.
12748         (General_options::print_icf_sections): New option.
12749         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12750         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12751         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12752         icf.
12753         * symtab.cc (Symbol_table::is_section_folded): New function.
12754         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12755         to sections marked as identical by icf.
12756         * symtab.h (Symbol_table::set_icf): New function.
12757         (Symbol_table::icf): New function.
12758         (Symbol_table::is_section_folded): New function.
12759         (Symbol_table::icf_): New data member.
12760         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12761         * testsuite/Makefile.am: Add commands to build icf_test.
12762         * testsuite/Makefile.in: Regenerate.
12763         * testsuite/icf_test.sh: New file.
12764         * testsuite/icf_test.cc: New file.
12765
12766 2009-07-24  Chris Demetriou  <cgd@google.com>
12767
12768         * layout.cc (is_compressible_debug_section): Fix incorrect
12769         comment about compressed section names.
12770
12771 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12772
12773         PR 10419
12774         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12775
12776 2009-07-16  Ian Lance Taylor  <iant@google.com>
12777
12778         PR 10400
12779         * layout.h: #include <map>.
12780         (class Kept_section): Change from struct to class.  Add accessors
12781         and setters.  Add section size to Comdat_group mapping.  Change
12782         Comdat_group to std::map.  Add is_comdat_ field.  Add
12783         linkonce_size field in union.
12784         (class Layout): Update declaration of find_or_add_kept_section.
12785         Don't declare find_kept_object.
12786         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12787         parameter.  Add object, shndx, is_comdat, and is_group_name
12788         parameters.  Change all callers.  Adjust for new Kept_section.
12789         (Layout::find_kept_object): Remove.
12790         * object.cc (Sized_relobj::include_section_group): Update use of
12791         Kept_section.  Rename secnum to shndx.  Only record
12792         Kept_comdat_section if sections are the same size.
12793         (Sized_relobj::include_linkonce_section): Update use of
12794         Kept_section.  Only record Kept_comdat_section if sections are the
12795         same size.  Set size of linkonce section.
12796         (Sized_relobj::map_to_kept_section): Update call to
12797         get_kept_comdat_section.
12798         * object.h (class Sized_relobj): Rename fields in
12799         Kept_comdat_section to drop trailing underscores; change object
12800         field to Relobj*.  Change Kept_comdat_section_table to store
12801         struct rather than pointer.
12802         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12803         Add kept_object and kept_shndx parameters.  Change all callers.
12804         (Sized_relobj::get_kept_comdat_section): Change return type to
12805         bool.  Add kept_object and kept_shndx parameters.  Change all
12806         callers.
12807         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12808         Layout::find_or_add_kept_section.
12809
12810 2009-07-09  Ian Lance Taylor  <iant@google.com>
12811
12812         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12813         Reserve space in the hash table.
12814
12815 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12816
12817         * fileread.cc (File_read::get_mtime): New method.
12818         * fileread.h (Timespec): New structure.
12819         (File_read::get_mtime): New method.
12820         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12821         Renamed from timestamp_nsec.
12822         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12823         Elf_Xword.
12824         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12825         timestamp_nsec.
12826         (Incremental_inputs::report_archive): Save mtime; style fix.
12827         (Incremental_inputs::report_obejct): Save mtime; style fix.
12828         (Incremental_inputs::report_script): Save mtime; style fix.
12829         (Incremental_inputs::finalize_inputs): Style fix.
12830         (Incremental_inputs::finalize): Style fix.
12831         (Incremental_inputs::create_input_section_data): Store inputs
12832         mtime.
12833         * incremental.h (Incremental_inputs::report_script): Add mtime
12834         argument.
12835         (Incremental_inputs::Input_info::Input_info): Intialize only one
12836         union member.
12837         (Incremental_inputs::Input_info::archive): Move to nameless
12838         union.
12839         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12840         (Incremental_inputs::Input_info::script): Move to nameless union.
12841         (Incremental_inputs::mtime): New field.
12842         * script.cc (read_input_script): Pass file mtime to
12843         Incremental_input.
12844         * script.h (Script_info::inputs): Style fix.
12845
12846 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12847
12848         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12849         instead of 32.
12850
12851 2009-06-24  Ian Lance Taylor  <iant@google.com>
12852
12853         PR 10156
12854         * layout.cc (Layout::choose_output_section): If we find an
12855         existing section, update the flags.
12856         (Layout::create_notes): New function, broken out of
12857         Layout::finalize.
12858         (Layout::finalize): Don't create note sections.
12859         (Layout::create_note): Don't crash if linker script discards
12860         section.
12861         (Layout::create_gold_note): Likewise.
12862         (Layout::create_build_id): Likewise.  Don't set
12863         after_input_sections on the section.
12864         (Layout::create_executable_stack_info): Remove target parameter.
12865         Change caller.
12866         * layout.h (class Layout): Declare create_notes.  Update
12867         declaration of create_executable_stack_info.
12868         * gold.cc (queue_middle_tasks): Call create_notes.
12869         * output.cc (Output_section::update_flags_for_input_section): Move
12870         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12871         invalid.
12872         * output.h (Output_data::mark_address_invalid): New function.
12873         (class Output_section): Only declare, not define,
12874         update_flags_for_input_section.  Remove set_flags.
12875
12876 2009-06-24  Ian Lance Taylor  <iant@google.com>
12877
12878         * script-sections.cc (Output_section_definition::
12879         set_section_addresses): Rename shadowing local load_address to
12880         laddr.
12881
12882 2009-06-24  Ian Lance Taylor  <iant@google.com>
12883
12884         PR 10244
12885         * reloc.cc (relocate_sections): Skip empty relocation sections.
12886
12887 2009-06-23  Ian Lance Taylor  <iant@google.com>
12888
12889         PR 10156
12890         * layout.cc (Layout::create_note): Use choose_output_section
12891         rather than make_output_section.
12892
12893 2009-06-23  Ian Lance Taylor  <iant@google.com>
12894
12895         PR 10237
12896         * options.cc (General_options::parse_V): Set printed_version_.
12897         (General_options::General_options): Initialize printed_version_.
12898         * options.h (class General_options): Add printed_version_ field.
12899         * gold.cc (queue_initial_tasks): If there are no input files,
12900         don't give a fatal error if we printed the version information.
12901         (queue_middle_tasks): If using -r with a shared object, give a
12902         fatal error rather than an ordinary error.
12903
12904 2009-06-23  Ian Lance Taylor  <iant@google.com>
12905
12906         PR 10219
12907         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12908         (Layout::make_output_section): Set have_stabstr_section_ if we see
12909         a .stab*str section.
12910         (Layout::finalize): Call link_stabs_sections.
12911         (Layout::link_stabs_sections): New file.
12912         * layout.h (class Layout): Add have_stabstr_section_ field.
12913         Declare link_stabs_sections.
12914
12915 2009-06-23  Doug Kwan  <dougkwan@google.com>
12916
12917         * Makefile.am (libgold_a_LIBADD): New.
12918         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12919         * Makefile.in: Regenerate.
12920         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12921         * configure: Regenerate.
12922         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12923         * fileread.cc: Include sys/state.h
12924         * gold.h: Declare memmem and strndup if found missing.
12925         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12926
12927 2009-06-23  Ian Lance Taylor  <iant@google.com>
12928
12929         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12930         * configure: Rebuild.
12931
12932 2009-06-23  Ian Lance Taylor  <iant@google.com>
12933
12934         PR 10147
12935         * object.cc (Object::section_contents): Don't try to get a view if
12936         the section has length zero.
12937         (Object::handle_gnu_warning_section): If the section is empty, use
12938         the name of the section as the warning.
12939
12940 2009-06-23  Ian Lance Taylor  <iant@google.com>
12941
12942         PR 10133
12943         * stringpool.h (class Stringpool_template): Add optimize_ field.
12944         (Stringpool_template::set_optimize): New function.
12945         * stringpool.cc (Stringpool_template::Stringpool_template):
12946         Initialize optimize_ field.
12947         (Stringpool_template::set_string_offsets): Test local optimize
12948         fild rather than parameter.
12949         * layout.cc (Layout::Layout): Call set_optimize on the section
12950         name stringpool.
12951
12952 2009-06-22  Ian Lance Taylor  <iant@google.com>
12953
12954         PR 10030
12955         * yyscript.y: Parse TARGET.
12956         * script.cc (script_set_target): New function.
12957         * script-c.h (script_set_target): Declare.
12958         * options.cc (General_options::string_to_object_format): Rename
12959         from string_to_object_format in anonymous namespace.  Change
12960         callers.
12961         * options.h (class General_options): Declare
12962         string_to_object_format.
12963
12964 2009-06-22  Ian Lance Taylor  <iant@google.com>
12965
12966         * script-sections.cc (Script_sections::create_segments): Don't put
12967         program headers in a PT_LOAD segment if -n or -N.
12968
12969 2009-06-22  Ian Lance Taylor  <iant@google.com>
12970
12971         PR 10141
12972         * options.h (class General_options): Add -z lazy and -z now.  Sort
12973         -z options into alphabetical order.
12974         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12975
12976 2009-06-21  Ian Lance Taylor  <iant@google.com>
12977
12978         * layout.cc (Layout::make_output_section): Call
12979         Target::new_output_section.
12980         (Layout::attach_allocated_section_to_segment): Put large section
12981         sections in a separate load segment with the large segment flag
12982         set.
12983         (Layout::segment_precedes): Sort large data segments after other
12984         load segments.
12985         (align_file_offset): New static function.
12986         (Layout::set_segment_offsets): Use align_file_offset.
12987         * output.h (class Output_section): Add is_small_section_ and
12988         is_large_section_ fields.
12989         (Output_section::is_small_section): New function.
12990         (Output_section::set_is_small_section):  New function.
12991         (Output_section::is_large_section): New function.
12992         (Output_section::set_is_large_section): New function.
12993         (Output_section::is_large_data_section): New function.
12994         (class Output_segment): Add is_large_data_segment_ field.
12995         (Output_segment::is_large_data_segment): New function.
12996         (Output_segment::set_is_large_data_segment): New function.
12997         * output.cc (Output_section::Output_section): Initialize new
12998         fields.
12999         (Output_segment::Output_segment): Likewise.
13000         (Output_segment::add_output_section): Add assertion that large
13001         data sections always go in large data segments.  Force small data
13002         sections to the end of the list of data sections.  Force small BSS
13003         sections to the start of the list of BSS sections.  For large BSS
13004         sections to the end of the list of BSS sections.
13005         * symtab.h (class Symbol): Declare is_common_shndx.
13006         (Symbol::is_defined): Check Symbol::is_common_shndx.
13007         (Symbol::is_common): Likewise.
13008         (class Symbol_table): Define enum Commons_section_type.  Update
13009         declarations.  Add small_commons_ and large_commons_ fields.
13010         * symtab.cc (Symbol::is_common_shndx): New function.
13011         (Symbol_table::Symbol_table): Initialize new fields.
13012         (Symbol_table::add_from_object): Put small and large common
13013         symbols in the right list.
13014         (Symbol_table::sized_finalized_symbol): Check
13015         Symbol::is_common_shndx.
13016         (Symbol_table::sized_write_globals): Likewise.
13017         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13018         common symbol lists.  Don't call do_allocate_commons_list if the
13019         list is empty.
13020         (Symbol_table::do_allocate_commons_list): Remove is_tls
13021         parameter.  Add comons_section_type parameter.  Change all
13022         callers.  Handle small and large common symbols.
13023         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13024         Symbol::is_common_shndx.
13025         * resolve.cc (symbol_to_bits): Likewise.
13026         * target.h (Target::small_common_shndx): New function.
13027         (Target::small_common_section_flags): New function.
13028         (Target::large_common_shndx): New function.
13029         (Target::large_common_section_flags): New function.
13030         (Target::new_output_section): New function.
13031         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13032         small_common_section_flags, and large_common_section_flags
13033         fields.
13034         (Target::do_new_output_section): New virtual function.
13035         * arm.cc (Target_arm::arm_info): Initialize new fields.
13036         * i386.cc (Target_i386::i386_info): Likewise.
13037         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13038         Likewise.
13039         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13040         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13041         (Target_x86_64::do_new_output_section): New function.
13042         * configure.ac: Define conditional MCMODEL_MEDIUM.
13043         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13044         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13045         (large_LDFLAGS): Define.
13046         * testsuite/large.c: New file.
13047         * testsuite/testfile.cc (Target_test::test_target_info):
13048         Initialize new fields.
13049         * configure, testsuite/Makefile.in: Rebuild.
13050
13051 2009-06-05  Doug Kwan  <dougkwan@google.com>
13052
13053         * Makefile.am (CCFILES): Add target.cc.
13054         * Makefile.in: Regenerate.
13055         * i386.cc (class Target_i386): Define new virtual method to
13056         override do_is_local_label_name in parent.
13057         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13058         local symbols if --discard-locals or -X is given.
13059         * options.h (class General_options): Declare new options
13060         '--discard-locals' and '-X' for discarding locals.
13061         * target.h (class Target): Define new methods is_local_label_name.
13062         Declare new virtual method do_is_local_label_name.
13063         * target.cc: New file.
13064         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13065         (check_SCRIPTS): Add discard_locals_test.sh.
13066         (check_DATA): Add discard_local_tests.syms.
13067         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13068         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13069         * testsuite/Makefile.in: Regenerate.
13070         * testsuite/discard_locals_test.c: New file.
13071         * testsuite/discard_locals_test.sh: Same.
13072
13073 2009-06-05  Doug Kwan  <dougkwan@google.com>
13074
13075         * object.cc (Sized_relobj::Sized_relobj): Initialize
13076         discarded_eh_frame_shndx_ to -1U.
13077         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13078         section.
13079         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13080         a discarded .eh_frame section.
13081         (Sized_relobj::do_finalize_local_symbols): Ditto.
13082         * object.h (class Sized_relobj): Declare new member
13083         discarded_eh_frame_shndx_.
13084         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13085         (local_labels_test.o, local_labels_test): New rules.
13086         * testsuite/Makefile.in: Regenerate.
13087
13088 2009-06-04  Doug Kwan  <dougkwan@google.com>
13089
13090         * layout.cc (Layout::section_name_mapping): Add mapping for
13091         special ARM sections.
13092
13093 2009-06-03  Doug Kwan  <dougkwan@google.com>
13094
13095         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13096         (utils::has_overflow): Same.
13097
13098 2009-06-03  Ian Lance Taylor  <iant@google.com>
13099
13100         * layout.cc (Layout::section_name_mapping): New array, replacing
13101         Layout::linkonce_mapping.
13102         (Layout::section_name_mapping_count): New variable, replacing
13103         Layout::linkonce_mapping_count.
13104         (Layout::linkonce_output_name): Remove.
13105         (Layout::output_section_name): Rewrite.
13106         * layout.h (class Layout): Rename Linkonce_mapping to
13107         Section_name_mapping, linkonce_mapping to section_name_mapping,
13108         linkonce_mapping_count to section_name_mapping_count.  Don't
13109         declare linkonce_output_name.
13110
13111 2009-06-03  Doug Kwan  <dougkwan@google.com>
13112
13113         * gold/arm.cc (namespace utils): New.
13114         (Target_arm::reloc_is_non_pic): Define new method.
13115         (class Arm_relocate_functions): New.
13116         (Target_arm::Relocate::relocate): Handle relocation types used by
13117         Android.
13118
13119 2009-06-03  Ian Lance Taylor  <iant@google.com>
13120
13121         * arm.cc (Target_arm::scan::global): Use || instead of |.
13122
13123 2009-06-02  Doug Kwan  <dougkwan@google.com>
13124
13125         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13126         issued_non_pic_error_.
13127         (class Target_arm::Scan): Declare new method check_non_pic.
13128         Define new method symbol_needs_plt_entry.
13129         Declare new data member issued_non_pic_error_.
13130         (class Target_arm::Relocate): Declare new method
13131         should_apply_static_reloc.
13132         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13133         (Target_arm::Scan::check_non_pic): Define new method.
13134         (Target_arm::Scan::local): Handle a small subset of reloc types used
13135         by Android.
13136         (Target_arm::Scan::local): Same.
13137         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13138
13139 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13140
13141         * incremental.cc (Incremental_inputs::report_command_line): Filter
13142         out --incremental-* options.
13143
13144 2009-05-29  Doug Kwan  <dougkwan@google.com>
13145
13146         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13147         template class.
13148         (class Target_arm): Update comment.
13149         (Target_arm::Target_arm): Initialize new data members GOT_,
13150         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13151         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13152         and Target_arm::rel_dyn_section.
13153         Declare new_enum Target_arm::Got_type.
13154         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13155         and DYNBSS_.
13156         Update commments for member do_dynsym_value.
13157         (Target_arm::got_size, Target_arm::plt_section,
13158         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13159         new methods inside class defintion.
13160         (Target_arm::got_section): Define new method.
13161         (Target_arm::rel_dyn_section): Same.
13162         (Output_data_plt_arm): New template class.
13163         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13164         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13165         (Output_data_plt_arm::add_entry): Same.
13166         (Output_data_plt_arm::first_plt_entry): Define new
13167         static data member for PLT instruction template.
13168         (Output_data_plt_arm::plt_entry): Same.
13169         (Output_data_plt_arm::do_write): Define new method.
13170         (Target_arm::make_plt_entry): Same.
13171         (Target_arm::do_finalize_sections): Same.
13172         (Target_arm::do_dynsym_value): Same.
13173
13174 2009-05-28  Doug Kwan  <dougkwan@google.com>
13175
13176         * Makefile.am (TARGETSOURCES): Add arm.cc.
13177         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13178         * Makefile.in: Regenerate.
13179         * arm.cc: New file.
13180         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13181
13182 2009-05-26  Doug Kwan  <dougkwan@google.com>
13183
13184         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13185         (General_options::check_excluded_libs): Strip off directories in
13186         archive name before matching like GNU ld does.
13187         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13188         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13189         (exclude_libs_test_LDFLAGS): Add linker option
13190         -Wl,--exclude-libs,libexclude_libs_test_3
13191         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13192         an explicit archive without using -l.
13193         (alt/libexclude_libs_test_3.a): New make rule.
13194         * testsuite/Makefile.in: Regenerate.
13195         * testsuite/exclude_libs_test.c : Declare lib3_default().
13196         (main): Call it.
13197         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13198         * exclude_libs_test_3.c: New file.
13199
13200 2009-05-26  Nick Clifton  <nickc@redhat.com>
13201
13202         * po/id.po: New Indonesian translation.
13203         * po/gold.pot: Updated template file.
13204
13205 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13206
13207         * testsuite/Makefile.am: Add -ffunction-sections to compile
13208         gc_comdat_test files.  Add -Wl,--gc-sections to build
13209         gc_comdat_test.
13210         * testsuite/Makefile.in: Regenerate.
13211         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13212
13213 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13214
13215         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13216         kept comdat section was garbage collected.
13217         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13218         * testsuite/Makefile.in: Regenerate.
13219         * testsuite/gc_comdat_test.sh: New file.
13220         * testsuite/gc_comdat_test_1.cc: New file.
13221         * testsuite/gc_comdat_test_2.cc: New file.
13222
13223 2009-05-19  Doug Kwan  <dougkwan@google.com>
13224
13225         * archive.cc (Archive::Archive): Move constructor from archive.h
13226         to here.  Initialize no_export_.
13227         (Archive::get_elf_object_for_member): Set no_export flag of object.
13228         * archive.h (Archive::Archive): Move constructor body to
13229         archive.cc.
13230         (Archive::no_export): New method.
13231         (Archive::no_export_): New field.
13232         * object.h (Object::Object): Initialize no_export_ to false.
13233         (Object::no_export, Object::set_no_export): New methods.
13234         (Object::no_export_): New field.
13235         * options.cc (General_options::parse_exclude_libs): New method.
13236         (General_options::check_excluded_libs) Same.
13237         * options.h (exclude_libs): New option.
13238         (General_options::check_excluded_libs): New method declaration.
13239         (General_options::excluded_libs_): New field.
13240         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13241         default or protected visibility if an object has no-export flag set.
13242         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13243         (check_SCRIPTS): Add exclude_libs_test.sh.
13244         (check_DATA): Add exclude_libs_test.syms.
13245         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13246         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13247         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13248         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13249         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13250         libexclude_libs_test_2.a): New rules.
13251         * testsuite/Makefile.in: Regenerate.
13252         * testsuite/exclude_libs_test.c: New file.
13253         * testsuite/exclude_libs_test.sh: Ditto.
13254         * testsuite/exclude_libs_test_1.c: Ditto.
13255         * testsuite/exclude_libs_test_2.c: Ditto.
13256
13257 2009-05-15  Ian Lance Taylor  <iant@google.com>
13258
13259         * configure.ac: Check for declarations for cases where libiberty.h
13260         checks HAVE_DECL_xxx.
13261         * configure, config.in: Rebuild.
13262
13263 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13264
13265         * gold.h (Incremental_argument_list): Remove (invalid) forward
13266         declaration.
13267         * incremental.cc (Incremental_inputs::report_achive): New method.
13268         (Incremental_inputs::report_object): New method.
13269         (Incremental_inputs::report_script): New method.
13270         (Incremental_inputs::finalize_inputs): New method.
13271         (Incremental_inputs::finalize): Call finalize_inputs().
13272         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13273         Create inputs entries.
13274         * incremental.h (Incremental_input_type): New enum.
13275         (Incremental_inputs::Incremental_input): Initialize new fields.
13276         (Incremental_inputs::report_inputs): New method.
13277         (Incremental_inputs::report_achive): New method.
13278         (Incremental_inputs::report_object): New method.
13279         (Incremental_inputs::report_script): New method.
13280         (Incremental_inputs::finalize_inputs): New method.
13281         (Incremental_inputs::Input_info): New struct.
13282         (Incremental_inputs::Input_info_map): New typedef.
13283         (Incremental_inputs::lock_): New field.
13284         (Incremental_inputs::Inputs_): New field.
13285         (Incremental_inputs::Inputs_map): New field.
13286         * main.cc (main): Call Incremental_input::report_inputs.
13287         * options.h (Input_argument_list): Typedef moved from
13288         Input_arguments.
13289         (Input_file_group::Files): Remove, use ::Input_argument_list.
13290         (Input_file_group::Input_argument_list): Remove, use
13291         ::Input_argument_list.
13292         * plugin.cc (Plugin_manager::add_input_file): Add error in
13293         incremental build.
13294         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13295         functions.
13296         * script.cc (read_input_script): Call
13297         Incremental_input::report_script.
13298         * script.h (Script_info): New class.
13299
13300 2009-04-27  Ian Lance Taylor  <iant@google.com>
13301
13302         * x86_64.cc (do_adjust_output_section): Set entsize to
13303         plt_entry_size.
13304
13305 2009-04-23  Elliott Hughes  <enh@google.com>
13306
13307         * output.cc (Output_file::close): After short writes, continue
13308         writing from the correct offset in the buffer being written.
13309
13310 2009-04-23  Chris Demetriou  <cgd@google.com>
13311
13312         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13313         * configure: Regenerate.
13314         * config.in: Regenerate.
13315         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13316         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13317
13318 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13319
13320         * incremental.cc (Incremental_inputs_header_data): Renamed from
13321         Incremental_input_header_data.
13322         (Incremental_inputs_header_data::data_size): New field.
13323         (Incremental_inputs_header_data::put_input_file_count): Renamed
13324         from input_file_count.
13325         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13326         from command_line_offset.
13327         (Incremental_inputs_header_data::put_reserved): Renamed from
13328         put_reserved.
13329         (Incremental_inputs_entry_data): Renamed from
13330         Incremental_input_entry_data.
13331         (Incremental_inputs_entry_data::data_size): New field.
13332         (Incremental_inputs::report_command_line): New method.
13333         (Incremental_inputs::finalize): New method.
13334         (Incremental_inputs::create_incremental_inputs_data): New method.
13335         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13336         * incremental.h: New file.
13337         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13338         (Layout::finalize): Create incremental inputs section in
13339         incremental builds.
13340         (Layout::create_incremental_info_sections): New method.
13341         * layout.h (Layout::incremental_inputs): New method.
13342         (Layout::create_incremental_info_sections): New method.
13343         (Layout::incremental_inputs_): New field.
13344         * main.cc (main): Notify Incremental_input of the command line.
13345
13346 2009-04-01  Ian Lance Taylor  <iant@google.com>
13347             Mikolaj Zalewski  <mikolajz@google.com>
13348
13349         * gold.h (reserve_unordered_map): Define, three versions, one for
13350         each version of Unordered_map.
13351         * layout.cc (Layout::Layout): Remove options parameter.  Add
13352         number_of_input_files parameter.  Don't initialize options_.
13353         Initialize number_of_input_files_ and resized_signatures_.  Move
13354         sections_are_attached_.
13355         (Layout::layout_group): Reserve space for group_signatures_.
13356         (Layout::find_or_add_kept_section): Change name parameter to be a
13357         reference.  Resize signatures_ map when it gets large enough.
13358         (Layout::layout_eh_frame): Use parameters->options() instead of
13359         this->options_.
13360         (Layout::make_output_section): Likewise.
13361         (Layout::attach_allocated_section_to_segment): Likewise.
13362         (Layout::finalize, Layout::create_executable_stack): Likewise.
13363         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13364         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13365         * layout.h (class Layout): Update declarations.  Remove options_
13366         field.  Add number_of_input_files_ and resized_signatures_
13367         fields.  Move sections_are_attached_ field.
13368         * main.cc (main): Pass number of input files to Layout
13369         constructor.  Don't pass options.
13370
13371 2009-03-30  Ian Lance Taylor  <iant@google.com>
13372
13373         * ffsll.c (ffsll): Correct implementation.
13374
13375 2009-03-27  Ian Lance Taylor  <iant@google.com>
13376
13377         * ffsll.c: New file.
13378         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13379         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13380         * ftruncate.c (ftruncate): Declare before definition.
13381         * mremap.c (mremap): Likewise.
13382         * pread.c (pread): Likewise.
13383         * configure, Makefile.in, config.in: Rebuild.
13384
13385         * mremap.c: New file.
13386         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13387         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13388         (mremap): Declare if HAVE_MREMAP is not defined.
13389         * configure, Makefile.in, config.in: Rebuild.
13390
13391 2009-03-27  Cary Coutant  <ccoutant@google.com>
13392
13393         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13394         position independent.
13395         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13396         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13397
13398 2009-03-24  Cary Coutant  <ccoutant@google.com>
13399
13400         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13401         an executable.
13402         (needs_dynamic_reloc): Likewise.
13403
13404 2009-03-24  Ian Lance Taylor  <iant@google.com>
13405
13406         * yyscript.y (file_cmd): Recognize EXTERN.
13407         (extern_name_list, extern_name_list_body): New nonterminals.
13408         * script.cc (script_add_extern): Define.
13409         * script-c.h (script_add_extern): Declare.
13410
13411 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13412
13413         * object.cc (is_elf_object): Define.
13414         * object.h (is_elf_object): Declare.
13415         * archive.cc (Archive::get_elf_object_for_member): Call
13416         is_elf_object.
13417         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13418
13419 2009-03-24  Elliott Hughes  <enh@google.com>
13420
13421         * output.cc (Output_file::map_anonymous): Define.
13422         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13423         try an anonymous one.  Report the size if the mmap fails.
13424         * output.h (class Output_file): Declare map_anonymous.
13425
13426 2009-03-24  Ian Lance Taylor  <iant@google.com>
13427
13428         * target-select.cc (instantiate_target): Don't acquire the lock if
13429         the instantiated_target_ field has already been set.
13430
13431 2009-03-23  Ian Lance Taylor  <iant@google.com>
13432
13433         * gold-threads.h (class Initialize_lock): Define.
13434         * gold-threads.cc (class Initialize_lock_once): Define.
13435         (initialize_lock_control): New static variable.
13436         (initialize_lock_pointer): New static variable.
13437         (initialize_lock_once): New static function.
13438         (Initialize_lock::Initialize_lock): Define.
13439         (Initialize_lock::initialize): Define.
13440         * target-select.h: Include "gold-threads.h".
13441         (class Target_selector): Add lock_ and initialize_lock_ fields.
13442         Don't define instantiate_target, just declare it.
13443         * target-select.cc (Target_selector::Target_selector): Initialize
13444         new fields.
13445         (Target_selector::instantiate_target): Define.
13446         * descriptors.h: Include "gold-threads.h".
13447         (class Descriptors): Add initialize_lock_ field.
13448         * descriptors.cc (Descriptors::Descriptors): Initialize new
13449         field.
13450         (Descriptors::open): Use initialize_lock_ field
13451         * errors.h (class Errors): Add initialize_lock_ field.
13452         * errors.cc (Errors::Errors): Initialize new field.
13453         (Errors::initialize_lock): Use initialize_lock_ field.
13454         * powerpc.cc (class Target_selector_powerpc): Remove
13455         instantiated_target_ field.  In do_recognize call
13456         instantiate_target rather than do_instantiate_target.  In
13457         do_instantiate_target just allocate a new target.
13458         * sparc.cc (class Target_selector_sparc): Likewise.
13459
13460         * freebsd.h: New file.
13461         * i386.cc: Include "freebsd.h".
13462         (Target_i386): Derive from Target_freebsd rather than
13463         Sized_target.
13464         (Target_selector_i386): Derive from Target_selector_freebsd rather
13465         than Target_selector.
13466         * x86_64.cc: Include "freebsd.h".
13467         (Target_x86_64): Derive from Target_freebsd rather than
13468         Sized_target.
13469         (Target_selector_x86_64): Derive from Target_selector_freebsd
13470         rather than Target_selector.
13471         * target.h (class Target): Add adjust_elf_header and
13472         do_adjust_elf_header.
13473         * output.cc (Output_file_header:: do_sized_write): Call target
13474         adjust_elf_header routine.
13475         * configure.tgt: Set targ_osabi.
13476         * configure.ac: Define GOLD_DEFAULT_OSABI.
13477         * parameters.cc (Parameters::default_target): Pass
13478         GOLD_DEFAULT_OSABI to select_target.
13479         * target-select.h (class Target_selector): Make instantiate_target
13480         protected rather than private.
13481         * Makefile.am (HFILES): Add freebsd.h.
13482         * configure, Makefile.in, config.in: Rebuild.
13483
13484         * merge.cc (do_add_input_section): Correct pend value.  Change
13485         message about last entry not being null terminated from error to
13486         warning.
13487
13488 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13489
13490         * incremental.cc: New file.
13491         * Makefile.am (CCFILES): Add incremental.cc.
13492         * Makefile.in: Rebuild.
13493
13494 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13495
13496         * layout.cc (Layout::output_section_name): Preserve names
13497         of '.note.' sections.
13498
13499 2009-03-19  Ian Lance Taylor  <iant@google.com>
13500
13501         * descriptors.cc (Descriptors::open): Check that the options are
13502         valid before using them.
13503
13504 2009-03-18  Ian Lance Taylor  <iant@google.com>
13505
13506         * script-sections.h: Include <list>.
13507         (class Script_sections): Change Sections_elements from std::vector
13508         to std::list.  Typedef public Elements_iterator.  Add
13509         orphan_section_placement_, data_segment_align_start_, and
13510         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13511         field.
13512         * script-sections.cc (class Orphan_section_placement): New class.
13513         (class Sections_element): Add virtual functions is_relro and
13514         orphan_section_init.  Remove virtual function place_orphan_here.
13515         (class Output_section_definition): Add is_relro and
13516         orphan_section_init.  Remove place_orphan_here.
13517         (class Orphan_output_section): Likewise.
13518         (Script_sections::Script_sections): Update for field changes.
13519         (Script_sections::data_segment_align): Set saw_data_segment_align_
13520         and data_segment_align_start_, not data_segment_align_index.
13521         (Script_sections::data_segment_relro_end): Check
13522         saw_data_segment_align_.  Use data_segment_align_start_ rather
13523         than data_segment_align_index_.
13524         (Script_sections::place_orphan): Rewrite to use
13525         Orphan_section_placement.
13526
13527 2009-03-17  Ian Lance Taylor  <iant@google.com>
13528
13529         * archive.cc (Archive::add_symbols): Check for a version attached
13530         to the symbol name in the archive map.
13531         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13532         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13533         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13534         (ver_test_11.a): New target.
13535         * testsuite/Makefile.in: Rebuild.
13536
13537         * configure.ac: Check for chsize and posix_fallocate.  Replace
13538         ftruncate.
13539         * ftruncate.c: New file, from gnulib.
13540         * output.cc (posix_fallocate): Define dummy version if not
13541         HAVE_POSIX_FALLOCATE.
13542         (Output_file::map): Call posix_fallocate rather than lseek and
13543         write.
13544         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13545         * configure, Makefile.in, config.in: Rebuild.
13546
13547 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13548
13549         * layout.h (Layout::create_note): Add section_name parameter.
13550         * layout.cc (Layout::create_note): Likewise.
13551         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13552
13553 2009-03-17  Ian Lance Taylor  <iant@google.com>
13554
13555         * descriptors.cc: Include "options.h".
13556         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13557         (Descriptors::open): Always use O_CLOEXEC when opening a new
13558         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13559         then set FD_CLOEXEC.
13560
13561         * sparc.cc (class Target_sparc): Add has_got_section.
13562         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13563         make sure we have a GOT section.
13564
13565         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13566         (Target_sparc::Scan::local): Likewise.
13567         (Target_sparc::Scan::global): Likewise.
13568         (Target_sparc::Relocate::relocate): Likewise.
13569         (Target_sparc::Relocate::relocate_tls): Likewise.
13570
13571         * symtab.cc (Symbol_table::define_default_version): New function,
13572         broken out of add_from_object.
13573         (Symbol_table::add_from_object): Call define_default_version.
13574         (Symbol_table::define_special_symbol): Add resolve_oldsym
13575         parameter.  Change all callers.  If the version for a symbol comes
13576         from a version script, resolve it with the symbol with the same
13577         name with no version.  Also add the symbol without a version if
13578         appropriate.
13579         (do_define_in_output_data): If resolving with oldsym, don't delete
13580         sym.
13581         (do_define_in_output_segment): Likewise.
13582         (do_define_as_constant): Likewise.
13583         * symtab.h (class Symbol_table): Update declarations.
13584
13585 2009-03-13  Ian Lance Taylor  <iant@google.com>
13586
13587         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13588         (Read_symbols::requeue): New function.
13589         (Read_symbols::do_read_symbols): If make_elf_object fails because
13590         the target type is not configured, and the file was searched for,
13591         issue a warning and retry with the next directory.
13592         (Add_symbols::run): If the file has an incompatible format, and
13593         it was searched for, requeue the Read_symbols task.  On error,
13594         release the object.
13595         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13596         dirindex parameter to constructor.  Change all callers.  Declare
13597         incompatible_warning and requeue.
13598         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13599         input_argument_ and input_group_ fields.  Add them to
13600         constructor.  Change all callers.
13601         (class Read_script): Add dirindex_ field.  Add it to constructor.
13602         Change all callers.
13603         * archive.cc (Archive::setup): Remove input_objects parameter.
13604         Change all callers.
13605         (Archive::get_file_and_offset): Likewise.
13606         (Archive::read_all_symbols): Likewise.
13607         (Archive::read_symbols): Likewise.
13608         (Archive::get_elf_object_for_member): Remove input_objects
13609         parameter.  Add punconfigured parameter.  Change all callers.
13610         (Archive::add_symbols): Change return type to bool.  Check return
13611         value of include_member.
13612         (Archive::include_all_members): Likewise.
13613         (Archive::include_member): Change return type to bool.  Return
13614         false if first included object has incompatible target.  Set
13615         included_member_ field.
13616         (Add_archive_symbols::run): If add_symbols returns false, requeue
13617         Read_symbols task.
13618         * archive.h (class Archive): Add included_member_ field.
13619         Initialize it in constructor.  Add input_file and searched_for
13620         methods.  Update declarations.
13621         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13622         input_argument_ fields.  Add them to constructor.  Change all
13623         callers.
13624         * script.cc: Include "target-select.h".
13625         (class Parser_closure): Add skip_on_incompatible_target_ and
13626         found_incompatible_target_ fields.  Add
13627         skip_on_incompatible_target parameter to constructor.  Change all
13628         callers.  Add methods skip_on_incompatible_target,
13629         clear_skip_on_incompatible_target, found_incompatible_target, and
13630         set_found_incompatible_target.
13631         (read_input_script): Add dirindex parameter.  Change all callers.
13632         If parser finds an incompatible target, requeue Read_symbols
13633         task.
13634         (script_set_symbol): Clear skip_on_incompatible_target in
13635         closure.
13636         (script_add_assertion, script_parse_option): Likewise.
13637         (script_start_sections, script_add_phdr): Likewise.
13638         (script_check_output_format): New function.
13639         * script.h (read_input_script): Update declaration.
13640         * script-c.h (script_check_output_format): Declare.
13641         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13642         (ignore_cmd): Remove OUTPUT_FORMAT.
13643         * fileread.cc (Input_file::Input_file): Add explicit this.
13644         (Input_file::will_search_for): New function.
13645         (Input_file::open): Add pindex parameter.  Change all callers.
13646         * fileread.h (class Input_file): Add input_file_argument method.
13647         Declare will_search_for.  Update declarations.
13648         * object.cc (make_elf_object): Add punconfigured parameter.
13649         Change all callers.
13650         * object.h (class Object): Make input_file public.  Add
13651         searched_for method.
13652         (make_elf_object): Update declaration.
13653         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13654         restart search.
13655         * dirsearch.h (class Dirsearch): Update declaration.
13656         * options.h (class General_options): Add --warn-search-mismatch.
13657         * parameters.cc (Parameters::is_compatible_target): New function.
13658         * parameters.h (class Parameters): Declare is_compatible_target.
13659         * workqueue.cc (Workqueue::add_blocker): New function.
13660         * workqueue.h (class Workqueue): Declare add_blocker.
13661
13662         * fileread.cc (Input_file::open): Remove options parameter.
13663         Change all callers.
13664         (Input_file::open_binary): Likewise.
13665         * script.cc (read_input_script): Likewise.
13666         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13667         options parameter from constructor.  Change all callers.
13668         (class Read_script): Likewise.
13669         * fileread.h (class Input_file): Update declarations.
13670         * script.h (read_input_script): Update declaration.
13671
13672 2009-03-10  Nick Clifton  <nickc@redhat.com>
13673
13674         * po/es.po: New Spanish translation.
13675
13676 2009-03-06  Cary Coutant  <ccoutant@google.com>
13677
13678         * options.cc (parse_short_option): Keep dash_z from registering itself.
13679
13680 2009-03-03  Ian Lance Taylor  <iant@google.com>
13681
13682         PR 9918
13683         * target-reloc.h (relocate_section): Pass output_section to
13684         relocate.
13685         * i386.cc (Target_i386::should_apply_static_reloc): Add
13686         output_section parameter.  Change all callers.
13687         (Target_i386::Relocate::relocate): Add output_section parameter.
13688         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13689         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13690         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13691         * testsuite/two_file_shared.sh: New script.
13692         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13693         (check_DATA): Add two_file_shared.dbg.
13694         (two_file_shared.dbg): New target.
13695         * testsuite/Makefile.in: Rebuild.
13696
13697 2009-03-01  Ian Lance Taylor  <iant@google.com>
13698
13699         * configure.ac: Check for byteswap.h.
13700         * configure: Rebuild.
13701         * config.in: Rebuild.
13702
13703 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13704
13705         * layout.cc (Layout::find_or_add_kept_section): New function.
13706         (Layout::add_comdat): Removed.
13707         * layout.h (struct Kept_section): Move out of class Layout.
13708         Remove trailing underscores from field names.  Add group_sections
13709         field.  Rename group_ field to is_group.  Change all uses.
13710         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13711         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13712         comdat_groups_ field.
13713         (Sized_relobj::include_section_group): Use
13714         find_or_add_kept_section and Kept_section::group_sections.
13715         (Sized_relobj::include_linkonce_section): Likewise.
13716         * object.cc (class Sized_relobj): Don't define Comdat_group or
13717         Comdat_group_table.  Remove find_comdat_group and
13718         add_comdat_group.  Remove comdat_groups_ field.
13719         * plugin.cc (include_comdat_group): Use
13720         Layout::find_or_add_kept_section.
13721
13722 2009-02-28  Ian Lance Taylor  <iant@google.com>
13723
13724         * README: --gc-sections and map files are now supported.  Document
13725         some build requirements.
13726
13727         PR 6992
13728         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13729         relocatable link set the value of the section symbol to zero.
13730         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13731         relocatable link don't include the section address in the local
13732         symbol value.
13733
13734 2009-02-27  Ian Lance Taylor  <iant@google.com>
13735
13736         PR 6811
13737         * options.h (class Search_directory): Add is_system_directory.
13738         (class General_options): Declare is_in_system_directory.
13739         * options.cc (get_relative_sysroot): Make static.
13740         (get_default_sysroot): Make static.
13741         (General_optoins::is_in_system_directory): New function.
13742         * fileread.cc (Input_file::is_in_system_directory): New function.
13743         * fileread.h (class Input_file): Declare is_in_system_directory.
13744         * object.h (class Object): Add is_in_system_directory.
13745         (class Input_objects): Remove system_library_directory_ field.
13746         * object.cc (Input_objects::add_object): Don't set
13747         system_library_directory_.
13748         (input_objects::found_in_system_library_directory): Remove.
13749         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13750         parameter.  Change all callers.
13751         (Symbol_table::sized_write_globals): Likewise.
13752         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13753         Call Object::is_in_system_directory.
13754         * symtab.h (class Symbol_table): Update declarations.
13755
13756         PR 5990
13757         * descriptors.h (Open_descriptor): Add is_on_stack field.
13758         * descriptors.cc (Descriptors::open): If the descriptor is on the
13759         top of the stack, remove it.  Initialize is_on_stack field.
13760         (Descriptors::release): Only add pod to stack if it is not on the
13761         stack already.
13762         (Descriptors::close_some_descriptor): Clear stack_next and
13763         is_on_stack fields.
13764
13765         PR 7091
13766         * output.cc (Output_section::find_starting_output_address): Rename
13767         from starting_output_address; add PADDR parameter; change return
13768         type.
13769         * output.h (class Output_section): Declare
13770         find_starting_output_address instead of starting_output_address.
13771         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13772         section symbol for which we can't find a merge section.
13773
13774         PR 9836
13775         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13776         hidden or internal, force the symbol to be local.
13777         * resolve.cc (Symbol::override_visibility): Define.
13778         (Symbol::override_base): Use override_visibility.
13779         (Symbol_table::resolve): Likewise.
13780         (Symbol::override_base_with_special): Likewise.
13781         (Symbol_table::override_with_special): If the visibility is hidden
13782         or internal, force the symbol to be local.
13783         * symtab.h (class Symbol): Add set_visibility and
13784         override_visibility.
13785         * testsuite/ver_test_1.sh: New file.
13786         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13787         (check_DATA): Add ver_test_1.syms.
13788         (ver_test_1.syms): New target.
13789         * testsuite/Makefile.in: Rebuild.
13790
13791 2009-02-25  Cary Coutant  <ccoutant@google.com>
13792
13793         * layout.cc (Layout::choose_output_section): Don't rename sections
13794         when using a linker script that has a SECTIONS clause.
13795         * Makefile.in: Regenerate.
13796
13797         * testsuite/Makefile.am (script_test_5.sh): New test case.
13798         * testsuite/Makefile.in: Regenerate.
13799         * testsuite/script_test_5.cc: New file.
13800         * testsuite/script_test_5.sh: New file.
13801         * testsuite/script_test_5.t: New file.
13802
13803 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13804
13805         * archive.cc (Archive::include_member): Update calls to add_symbols.
13806         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13807         the Layout argument.
13808         * dynobj.h (do_add_symbols): Add the Layout argument.
13809         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13810         Layout argument.
13811         * object.h (Object::add_symbols): Add the Layout argument.
13812         (Object::do_add_symbols): Add the Layout argument.
13813         (Sized_relobj::do_add_symbols): Add the Layout argument.
13814         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13815         Unify the two versions.
13816         (Add_plugin_symbols): Remove.
13817         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13818         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13819         (Add_plugin_symbols): Remove.
13820         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13821         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13822         (Add_symbols::run): Make it work with Pulginobj.
13823
13824 2009-02-06  Ian Lance Taylor  <iant@google.com>
13825
13826         * object.cc (Sized_relobj::do_layout): Make info message start
13827         with lower case letter.
13828
13829 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13830
13831         * binary.cc: Fix file comment.
13832
13833         * options.h (enum Incremental_disposition): Define.
13834         (class General_options): Add new options: --incremental,
13835         --incremental_changed, --incremental_unchanged,
13836         --incremental_unknown.  Add incremental_disposition_ and
13837         implicit_incremental_ fields.
13838         (General_options::incremental_disposition): New function.
13839         (class Position_dependent_options): Add incremental_disposition
13840         option.
13841         (Position_dependent_options::copy_from_options): Set incremental
13842         dispositions.
13843         * options.cc (General_options::parse_incremental_changed): New
13844         function.
13845         (General_options::parse_incremental_unchanged): New function.
13846         (General_options::parse_incremental_unknown): New function.
13847         (General_options::General_options): Initialize new fields
13848         incremental_disposition_ and implicit_incremental_.
13849         (General_options::finalize): Check for uasge of --incremental-*
13850         without --incremental.
13851
13852 2009-02-06  Chris Demetriou  <cgd@google.com>
13853
13854         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13855         pointer and to report location as the file name associated with
13856         the symbol.
13857         (gold_undefined_symbol_at_location): New function to replace the
13858         old gold_undefined_symbol functionality.
13859         * target-reloc.h (relocate_section): Update to use
13860         gold_undefined_symbol_at_location.
13861         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13862         Call gold_undefined_symbol function rather than gold_error.
13863         * errors.h (Errors::undefined_symbol): Take location as a
13864         string, rather than calculating it from a relocation.
13865         * errors.cc (Errors::fatal): Print "fatal error:" before the
13866         formatted message.
13867         (Errors::error, Errors::error_at_location): Print "error: "
13868         before the formatted message.
13869         (Errors::undefined_symbol): Take location as a string, rather
13870         than calculating it from a relocation.
13871         (gold_undefined_symbol_at_location): New function akin to
13872         old gold_undefined_symbol, calculates location from relocation.
13873         (gold_undefined_symbol): Change to take only a Symbol pointer
13874         and to report location as the file name associated with the symbol.
13875         * testsuite/debug_msg.sh: Update for changed error messages.
13876         * testsuite/undef_symbol.sh: Likewise.
13877
13878 2009-02-04  Duncan Sands  <baldrick@free.fr>
13879
13880         PR 9812
13881         * reduced_debug_output.h
13882         (Output_reduced_debug_abbrev_section::failed): Use format for
13883         gold_warning.
13884         (Output_reduced_debug_info_section::faild): Likewise.
13885
13886 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13887
13888         * script.cc (Lazy_demangler): New class.
13889         (Version_script_info::get_symbol_version_helper): Demangle a
13890         symbol only once.
13891
13892 2009-01-29  Cary Coutant  <ccoutant@google.com>
13893
13894         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13895         to __tls_get_addr.
13896         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13897
13898 2009-01-28  Ian Lance Taylor  <iant@google.com>
13899
13900         * version.cc (version_string): Bump to 1.9.
13901
13902         * gold.h: Include <cstring> and <stdint.h>.
13903         * version.cc: Include <cstdio>.
13904         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13905         warning.
13906         * reduced_debug_output.cc (insert_into_vector): Rename from
13907         Insert_into_vector; change all callers.  Use Swap_unaligned to
13908         avoid aliasing issue; remove union since it is unnecessary.
13909
13910 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13911
13912         * Makefile.am (CCFILES): Add gc.cc.
13913         (HFILES): Add gc.h.
13914         * Makefile.in: Regenerate.
13915         * gold.cc (Gc_runner): New class.
13916         (queue_initial_tasks): Call garbage collection related tasks
13917         when corresponding options are invoked.
13918         (queue_middle_gc_tasks): New function.
13919         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13920         processed early before laying out sections during garbage collection.
13921         * gold.h (queue_middle_gc_tasks): New function.
13922         (is_prefix_of): Move from "layout.cc".
13923         * i386.cc (Target_i386::gc_process_relocs): New function.
13924         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13925         * main.cc (main): Create object of class "Garbage_collection".
13926         * object.cc (Relobj::copy_symbols_data): New function.
13927         (Relobj::is_section_name_included): New function.
13928         (Sized_relobj::do_layout): Allow this function to be called twice
13929         during garbage collection and defer layout of section during the
13930         first call.
13931         * object.h (Relobj::get_symbols_data): New function.
13932         (Relobj::is_section_name_included): New function.
13933         (Relobj::copy_symbols_data): New function.
13934         (Relobj::set_symbols_data): New function.
13935         (Relobj::get_relocs_data): New function.
13936         (Relobj::set_relocs_data): New function.
13937         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13938         (Relobj::gc_process_relocs): New function.
13939         (Relobj::do_gc_process_relocs): New pure virtual function.
13940         (Relobj::sd_): New data member.
13941         (Sized_relobj::is_output_section_offset_invalid): New function.
13942         (Sized_relobj::do_gc_process_relocs): New function.
13943         * options.h (General_options::gc_sections): Modify to not be a no-op.
13944         (General_options::print_gc_sections): New option.
13945         * plugin.cc (Plugin_finish::run): Remove function call to
13946         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13947         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13948         * reloc.cc (Read_relocs::run): Add task to process relocs and
13949         determine unreferenced sections when doing garbage collection.
13950         (Gc_process_relocs): New class.
13951         (Sized_relobj::do_gc_process_relocs): New function.
13952         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13953         sections that are garbage collected.
13954         * reloc.h (Gc_process_relocs): New class.
13955         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13956         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13957         symbols whose corresponding sections are garbage collected.
13958         (Symbol_table::Symbol_table): Add new parameter for the garbage
13959         collection object.
13960         (Symbol_table::gc_mark_undef_symbols): New function.
13961         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13962         (Symbol_table::gc_mark_dyn_syms): New function.
13963         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13964         as garbage.
13965         (Symbol_table::add_from_object): Likewise.
13966         (Symbol_table::add_from_relobj): When building shared objects, do not
13967         treat externally visible symbols as garbage.
13968         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13969         table information for static and relocatable links.
13970         * symtab.h (Symbol_table::set_gc): New function.
13971         (Symbol_table::gc): New function.
13972         (Symbol_table::gc_mark_undef_symbols): New function.
13973         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13974         (Symbol_table::gc_mark_dyn_syms): New function.
13975         (Symbol_table::gc_): New data member.
13976         * target.h (Sized_target::gc_process_relocs): New pure virtual
13977         function.
13978         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13979         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13980
13981 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13982
13983         * options.h (General_options::gc_sections): Define as a no-op for now.
13984         (General_options::no_keep_memory): Ditto.
13985         (General_options::Bshareable): Define.
13986         * options.cc (General_options::finalize): Honor -Bshareable.
13987
13988 2009-01-20  Andreas Schwab  <schwab@suse.de>
13989
13990         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13991         read the value in the contents, since we don't use it.  Use the
13992         template endianness when writing.
13993         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13994
13995 2009-01-19  Andreas Schwab  <schwab@suse.de>
13996
13997         * configure.tgt (powerpc64-*): Fix targ_obj.
13998
13999 2009-01-15  Ian Lance Taylor  <iant@google.com>
14000
14001         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14002         local symbols when stripping all symbols.
14003
14004 2009-01-14  Cary Coutant  <ccoutant@google.com>
14005
14006         * output.cc (Output_reloc): Add explicit instantiations.
14007
14008 2009-01-14  Cary Coutant  <ccoutant@google.com>
14009
14010         * archive.cc (Archive::get_elf_object_for_member): Remove call
14011         to File_read::claim_for_plugin.
14012         * descriptors.cc (Descriptors::open): Remove reference to
14013         is_claimed.
14014         (Descriptors::claim_for_plugin): Remove.
14015         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14016         (Descriptors::is_claimed): Remove.
14017         (claim_descriptor_for_plugin): Remove.
14018         * fileread.cc (File_read::claim_for_plugin): Remove.
14019         * fileread.h (File_read::claim_for_plugin): Remove.
14020         (File_read::descriptor): Reopen descriptor if necessary.
14021         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14022         (Plugin_manager::all_symbols_read): Add task parameter. Change
14023         all callers.
14024         (Plugin_manager::get_input_file): New function.
14025         (Plugin_manager::release_input_file): New function.
14026         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14027         corresponding data member.
14028         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14029         and pass to base constructor. Change all callers.
14030         (get_input_file, release_input_file): New functions.
14031         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14032         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14033         (Plugin_manager::all_symbols_read): Add task parameter.
14034         (Plugin_manager::get_input_file): New function.
14035         (Plugin_manager::release_input_file): New function.
14036         (Plugin_manager::task_): New data member.
14037         (Pluginobj::Pluginobj): Add filesize parameter.
14038         (Pluginobj::filename): New function.
14039         (Pluginobj::descriptor): New function.
14040         (Pluginobj::filesize): New function.
14041         (Pluginobj::filesize_): New data member.
14042         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14043         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14044         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14045
14046         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14047         with archive libraries.
14048         * testsuite/Makefile.in: Regenerate.
14049         * testsuite/plugin_test.c (struct sym_info): New type.
14050         (get_input_file, release_input_file): New static variables.
14051         (onload): Capture new transfer vector entries.
14052         (claim_file_hook): Stop reading at end of file according to filesize.
14053         Factor out parsing of readelf output into separate function.
14054         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14055         APIs and get the source file name from the symbol table.  Convert
14056         source file name to corresponding object file name.  Print info
14057         message when adding new input files.
14058         (parse_readelf_line): New function.
14059         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14060         * testsuite/plugin_test_2.sh: Likewise.
14061         * testsuite/plugin_test_3.sh: Likewise.
14062         * testsuite/plugin_test_4.sh: New test case.
14063
14064 2009-01-07  Ian Lance Taylor  <iant@google.com>
14065
14066         * version.cc (version_string): Bump to 1.8.
14067
14068 2008-12-23  Cary Coutant  <ccoutant@google.com>
14069
14070         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14071         * plugin.cc (Plugin_manager::finish): Rename as
14072         layout_deferred_objects.  Move cleanup to separate function.
14073         (Plugin_manager::cleanup): New function.
14074         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14075         separately.
14076         * plugin.h (Plugin_manager::finish): Rename as
14077         layout_deferred_objects.
14078         (Plugin_manager::cleanup): New function.
14079         (Plugin_manager::cleanup_done): New field.
14080
14081 2008-12-23  Cary Coutant  <ccoutant@google.com>
14082
14083         * plugin.cc (is_visible_from_outside): New function.
14084         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14085         so we don't return "IR only" status for exported symbols or -r links.
14086
14087         * testsuite/Makefile.am (plugin_test_3): New test case.
14088         * testsuite/Makefile.in: Regenerate.
14089         * testsuite/plugin_test_3.sh: New file.
14090
14091 2008-12-22  Cary Coutant  <ccoutant@google.com>
14092
14093         * object.cc (Sized_relobj::layout_section): New function.
14094         (Sized_relobj::do_layout): Defer layout of input sections until after
14095         plugin has provided replacement files.
14096         (Sized_relobj::do_layout_deferred_sections): New function.
14097         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14098         (Relobj::layout_deferred_sections): New function.
14099         (Relobj::do_layout_deferred_sections): New function.
14100         (Sized_relobj::do_layout_deferred_sections): New function.
14101         (Sized_relobj::layout_section): New function.
14102         (Sized_relobj::Deferred_layout): New structure.
14103         (Sized_relobj::deferred_layout_): New field.
14104         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14105         Change all callers.  Layout deferred sections.
14106         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14107         references.
14108         (Plugin_hook::run): Move code from do_plugin_hook inline.
14109         (Plugin_hook::do_plugin_hook): Remove.
14110         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14111         (Plugin_manager::finish): Renamed, was cleanup.
14112         (Plugin_manager::should_defer_layout): New function.
14113         (Plugin_manager::add_deferred_layout_object): New function.
14114         (Plugin_manager::Deferred_layout_list): New type.
14115         (Plugin_manager::deferred_layout_objects_): New field.
14116         (Plugin_hook::do_plugin_hook): Remove.
14117
14118 2008-12-17  Ian Lance Taylor  <iant@google.com>
14119
14120         * options.h (class General_options): Add --no case for
14121         --export-dynamic.
14122
14123 2008-12-16  Cary Coutant  <ccoutant@google.com>
14124
14125         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14126         vector.
14127         (Plugin_manager::claim_file): Create plugin object even if
14128         plugin did not call the add_symbols callback.
14129         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14130         asking for more symbols than were added.
14131         * testsuite/Makefile.am (plugin_test_1): Add test case with
14132         no global symbols.
14133         (empty.syms): New target.
14134         * testsuite/Makefile.in: Regenerate.
14135         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14136         message. Don't call add_symbols if no globals.
14137         (all_symbols_read_hook): Don't provide replacement for empty
14138         claimed file.
14139
14140 2008-12-12  Ian Lance Taylor  <iant@google.com>
14141
14142         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14143         r_type == 0 for a local symbol with r_sym == 0.
14144         (scan_relocatable_relocs): Pass r_sym to
14145         local_non_section_strategy.
14146         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14147         r_sym parameter.
14148
14149         * configure.ac: Update test for TLS descriptors: they are
14150         supported as of glibc 2.9.
14151         * configure: Rebuild.
14152
14153 2008-12-11  Ian Lance Taylor  <iant@google.com>
14154
14155         PR 7091
14156         * target-reloc.h (Default_scan_relocatable_relocs): For each
14157         function, map r_type == 0 to RELOC_DISCARD.
14158
14159 2008-12-10  Cary Coutant  <ccoutant@google.com>
14160
14161         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14162         object to override a kept COMDAT group from a plugin object.
14163
14164 2008-12-09  Ian Lance Taylor  <iant@google.com>
14165
14166         PR 7088
14167         * yyscript.y (file_cmd): Handle INPUT.
14168
14169         * testsuite/initpri1.c: Change all declarations to be full
14170         prototypes by adding void, to avoid compiler warnings.
14171
14172 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14173
14174         * options.cc (General_options::parse_plugin_opt): New.
14175         (General_options::add_plugin): The argument now is just the filename.
14176         (General_options::add_plugin_option): New.
14177         * options.h (plugin_opt): New.
14178         (add_plugin): Change argument name.
14179         (add_plugin_option): New.
14180         * plugin.cc (Plugin::load): Don't parse the plugin option.
14181         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14182         (Plugin::add_option): New.
14183         (Plugin::args_): Change type.
14184         (Plugin::filename_): New.
14185         (Plugin_manager::add_plugin_option): New.
14186         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14187         * testsuite/Makefile.in: Regenerate.
14188
14189 2008-12-05  Cary Coutant  <ccoutant@google.com>
14190
14191         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14192         Handle --strip-lto-sections option.
14193         * options.h (strip_lto_sections): New option.
14194
14195 2008-12-01  Cary Coutant  <ccoutant@google.com>
14196
14197         * plugin.cc (ld_plugin_message): Change format parameter to const.
14198         Fix mismatch between new[] and delete.
14199
14200 2008-11-14  Cary Coutant  <ccoutant@google.com>
14201
14202         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14203         instead of -1U.
14204
14205 2008-11-05  Craig Silverstein  <csilvers@google.com>
14206
14207         * options.cc (General_options::parse_dynamic_list): New function.
14208         * options.h (General_options): New flags dynamic_list,
14209         dynamic_list_data, dynamic_list_cpp_new, and
14210         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14211         (General_options::in_dynamic_list): New function.
14212         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14213         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14214         (Lex::can_continue_name): Likewise.
14215         (yylex): Likewise.
14216         (read_script_file): New parameter script_options.
14217         (read_dynamic_list): New function.
14218         (Script_options::define_dynamic_list): New function.
14219         (dynamic_list_keyword_parsecodes): New variable.
14220         (dynamic_list_keywords): New variable.
14221         * script.h (Script_options::define_dynamic_list): New function
14222         prototype.
14223         (read_dynamic_list): New function prototype.
14224         * symtab.cc (strprefix): New macro.
14225         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14226         dynamic_list_data, dynamic_list_cpp_new, and
14227         dynamic_list_cpp_typeinfo.
14228         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14229         (dynamic_list_expr): New rule.
14230         (dynamic_list_nodes): Likewise.
14231         (dynamic_list_node): Likewise.
14232         * testsuite/Makefile.am (dynamic_list): New test.
14233         * testsuite/Makefile.in: Regenerated.
14234         * testsuite/dynamic_list.t: New file.
14235         * testsuite/dynamic_list.sh: New file.
14236
14237 2008-11-05  Craig Silverstein  <csilvers@google.com>
14238
14239         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14240         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14241         (t11_last): Likewise.
14242         * testsuite/ver_test_6.c (main): Likewise.
14243
14244 2008-10-07  Cary Coutant  <ccoutant@google.com>
14245
14246         * options.c (General_options::finalize): Add check for -static and
14247         -shared.
14248         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14249         is not empty.
14250
14251 2008-10-02  Cary Coutant  <ccoutant@google.com>
14252
14253         * plugin.cc (make_sized_plugin_object): Fix conditional
14254         compilation to work when not all targets are enabled.
14255
14256 2008-09-29  Cary Coutant  <ccoutant@google.com>
14257
14258         * archive.cc (Archive::get_file_and_offset): Use filename instead
14259         of name to get library path.
14260         (Archive::include_member): Unlock external member of a thin archive.
14261
14262         * testsuite/Makefile.am (TEST_AR): New variable.
14263         (thin_archive_test_1): New test.
14264         (thin_archive_test_2): New test.
14265         * testsuite/Makefile.in: Regenerate.
14266         * testsuite/thin_archive_main.cc: New file.
14267         * testsuite/thin_archive_test_1.cc: New file.
14268         * testsuite/thin_archive_test_2.cc: New file.
14269         * testsuite/thin_archive_test_3.cc: New file.
14270         * testsuite/thin_archive_test_4.cc: New file.
14271
14272 2008-09-29  Cary Coutant  <ccoutant@google.com>
14273
14274         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14275         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14276         instead of -1U.
14277         (Sized_relobj::do_finalize_local_symbols): Likewise.
14278         (Sized_relobj::map_to_kept_section): Likewise.
14279         * object.h (Sized_relobj::invalid_address): New constant.
14280         (Sized_relobj::do_output_section_offset): Check for invalid_address
14281         and return -1ULL.
14282         * output.cc (Output_reloc::local_section_offset): Use constant
14283         invalid_address instead of -1U.
14284         (Output_reloc::get_address): Likewise.
14285         (Output_section::output_address): Change -1U to -1ULL.
14286         * output.h (Output_reloc::invalid_address): New constant.
14287         * reloc.cc (Sized_relobj::write_sections): Use constant
14288         invalid_address instead of -1U.
14289         (Sized_relobj::relocate_sections): Likewise.
14290         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14291         values for merge sections.
14292         * target-reloc.h (relocate_for_relocatable): Use constant
14293         invalid_address instead of -1U.
14294
14295 2008-09-19  Cary Coutant  <ccoutant@google.com>
14296
14297         Add plugin functionality for link-time optimization (LTO).
14298         * configure.ac (plugins): Add --enable-plugins option.
14299         * configure: Regenerate.
14300         * config.in: Regenerate.
14301         * Makefile.am (LIBDL): New variable.
14302         (CCFILES): Add plugin.cc.
14303         (HFILES): Add plugin.h.
14304         (ldadd_var): Add LIBDL.
14305         * Makefile.in: Regenerate.
14306
14307         * archive.cc: Include "plugin.h".
14308         (Archive::setup): Don't preread archive symbols when using a plugin.
14309         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14310         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14311         files.
14312         (Archive::include_member): Add symbols from plugin objects.
14313         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14314         * descriptors.cc (Descriptors::open): Check for file descriptors
14315         abandoned by plugins.
14316         (Descriptors::claim_for_plugin): New function.
14317         * descriptors.h (Descriptors::claim_for_plugin): New function.
14318         (Open_descriptor::is_claimed): New field.
14319         (claim_descriptor_for_plugin): New function.
14320         * fileread.cc (File_read::claim_for_plugin): New function.
14321         * fileread.h (File_read::claim_for_plugin): New function.
14322         (File_read::descriptor): New function.
14323         * gold.cc: Include "plugin.h".
14324         (queue_initial_tasks): Add task to call plugin hooks for generating
14325         new object files.
14326         * main.cc: Include "plugin.h".
14327         (main): Load plugin libraries.
14328         * object.h (Pluginobj): Declare.
14329         (Object::pluginobj): New function.
14330         (Object::do_pluginobj): New function.
14331         (Object::set_target): New function.
14332         * options.cc: Include "plugin.h".
14333         (General_options::parse_plugin): New function.
14334         (General_options::General_options): Initialize plugins_ field.
14335         (General_options::add_plugin): New function.
14336         * options.h (Plugin_manager): Declare.
14337         (General_options): Add --plugin option.
14338         (General_options::has_plugins): New function.
14339         (General_options::plugins): New function.
14340         (General_options::add_plugin): New function.
14341         (General_options::plugins_): New field.
14342         * plugin.cc: New file.
14343         * plugin.h: New file.
14344         * readsyms.cc: Include "plugin.h".
14345         (Read_symbols::do_read_symbols): Check for archive before checking
14346         for ELF file.  Call plugin hooks to claim files.
14347         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14348         from a real object file; force override when processing replacement
14349         files.
14350         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14351         (Symbol::init_base_object): Likewise.
14352         (Symbol::init_base_output_data): Likewise.
14353         (Symbol::init_base_output_segment): Likewise.
14354         (Symbol::init_base_constant): Likewise.
14355         (Symbol::init_base_undefined): Likewise.
14356         (Symbol::output_section): Assert that object is not a plugin.
14357         (Symbol_table::add_from_pluginobj): New function.
14358         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14359         undefined.
14360         (Symbol_table::sized_write_globals): Likewise.
14361         (Symbol_table::add_from_pluginobj): Instantiate template.
14362         * symtab.h (Sized_pluginobj): Declare.
14363         (Symbol::in_real_elf): New function.
14364         (Symbol::set_in_real_elf): New function.
14365         (Symbol::in_real_elf_): New field.
14366         (Symbol_table::add_from_pluginobj): New function.
14367
14368         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14369         (LIBDL): New variable.
14370         (LDADD): Add LIBDL.
14371         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14372         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14373         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14374         (MOSTLYCLEANFILES): Likewise.
14375         * testsuite/Makefile.in: Regenerate.
14376         * testsuite/plugin_test.c: New file.
14377         * testsuite/plugin_test_1.sh: New file.
14378         * testsuite/plugin_test_2.sh: New file.
14379
14380 2008-09-16  Ian Lance Taylor  <iant@google.com>
14381
14382         * target-reloc.h (relocate_section): Check whether a symbol is
14383         defined by the ABI before reporting an undefined symbol error.
14384         * target.h (Target::is_defined_by_abi): Make parameter const.
14385         (Target::do_is_defined_by_abi): Likewise.
14386         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14387         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14388         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14389         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14390         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14391         * testsuite/Makefile.in: Rebuild.
14392
14393         * fileread.cc (make_view): Add casts to avoid warning.
14394
14395 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14396
14397         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14398         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14399
14400 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14401
14402         * options.h (General_options::output_is_executable): New.
14403         (General_options::output_is_pie): New.
14404         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14405         for shared libraries.
14406         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14407
14408 2008-09-11  Chris Demetriou  <cgd@google.com>
14409
14410         * options.h (origin): New -z option.
14411         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14412         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14413         in DT_FLAGS_1.
14414
14415 2008-09-05  Cary Coutant  <ccoutant@google.com>
14416
14417         * fileread.cc (File_read::make_view): Add check for attempt to map
14418         beyond end of file.
14419
14420 2008-09-05  Cary Coutant  <ccoutant@google.com>
14421
14422         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14423         explicit instantiations.
14424
14425 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14426
14427         PR gold/6858
14428         * options.cc (General_options::finalize): Allow undefined symbols
14429         in shlibs if linking -shared.
14430
14431         PR gold/6859
14432         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14433         symbols as not needing a dynsym entry.
14434
14435 2008-08-20  Craig Silverstein  <csilvers@google.com>
14436
14437         * fileread.cc (File_read::open): Do not lock the file unless it
14438         was successfully opened.
14439
14440 2008-08-14  Cary Coutant  <ccoutant@google.com>
14441
14442         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14443         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14444         * testsuite/tls_test.cc (struct int128): 128-bit struct
14445         for testing TLS relocs with non-zero addend.
14446         (v12): New TLS variable.
14447         (t12): New test.
14448         (t_last): Add check for v12.
14449         * testsuite/tls_test.h (t12): New function.
14450         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14451
14452 2008-08-13  Ian Lance Taylor  <iant@google.com>
14453
14454         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14455         set tls_segment_ or relro_segment_.
14456         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14457         when appropriate.
14458         * output.h (Output_section::clear_is_relro): New function.
14459         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14460         sections specially even when output_data_ is empty.
14461         (Output_segment::maximum_alignment): When first section is relro,
14462         only force alignment for PT_LOAD segments.
14463         * script.cc (script_data_segment_align): New function.
14464         (script_data_segment_relro_end): New function.
14465         * script-c.h (script_data_segment_align): Declare.
14466         (script_data_segment_relro_end): Declare.
14467         * script-sections.h (class Script_sections): Declare
14468         data_segment_align and data_segment_relro_end.  Add fields
14469         segment_align_index_ and saw_relro_end_.
14470         * script-sections.cc (class Sections_element): Add set_is_relro
14471         virtual function.  Add new bool* parameter to place_orphan_here.
14472         Add get_output_section virtual function.
14473         (class Output_section_definition): Add set_is_relro.  Add new
14474         bool* parameter to place_orphan_here.  Add get_output_section.
14475         Add is_relro_ field.
14476         (Output_section_definition::Output_section_definition): Initialize
14477         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14478         and is_relro_ fields.
14479         (Output_section_definition::place_orphan_here): Add is_relro
14480         parameter.
14481         (Output_section_definition::set_section_addresses): Set relro for
14482         output section.
14483         (Output_section_definition::alternate_constraint): Likewise.
14484         (class Orphan_output_section): Add new bool* parameter to
14485         place_orphan_here.  Add get_output_section.
14486         (Orphan_output_section::place_orphan_here): Add is_relro
14487         parameter.
14488         (Script_sections::Script_sections): Initialize
14489         data_segment_align_index_ and saw_relro_end_.
14490         (Script_sections::data_segment_align): New function.
14491         (Script_sections::data_segment_relro_end): New function.
14492         (Script_sections::place_orphan): Set or clear is_relro.
14493         (Script_sections::set_section_addresses): Force alignment of first
14494         TLS section.
14495         * yyscript.y (exp): Call script_data_segment_align and
14496         script_data_segment_relro_end.
14497         * testsuite/relro_script_test.t: New file.
14498         * testsuite/relro_test.cc (using_script): Declare.
14499         (t1, t2): Test using_script.
14500         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14501         (relro_script_test_SOURCES): Define.
14502         (relro_script_test_DEPENDENCIES): Define.
14503         (relro_script_test_LDFLAGS): Define.
14504         (relro_script_test_LDADD): Define.
14505         (relro_script_test.so): New target.
14506         * testsuite/Makefile.in: Rebuild.
14507
14508 2008-08-06  Cary Coutant <ccoutant@google.com>
14509
14510         * archive.cc (Archive::total_archives, Archive::total_members)
14511         (Archive::total_members_loaded): New variables.
14512         (Archive::setup): Add parameter.  Add option to preread
14513         archive symbols.
14514         (Archive::read_armap): Add counter.
14515         (Archive::get_file_and_offset): New function.
14516         (Archive::get_elf_object_for_member): New function.
14517         (Archive::read_all_symbols): New function.
14518         (Archive::read_symbols): New function.
14519         (Archive::add_symbols): Add counters.
14520         (Archive::include_all_members): Use armap to find members if it's
14521         already built.
14522         (Archive::include_member): Skip reading symbols if already read.
14523         Factored code into Archive::get_file_and_offset and
14524         Archive::get_elf_object_for_member.  Changed call to
14525         Mapfile::report_include_archive_member.
14526         (Archive::print_stats): New function.
14527         * archive.h: Declare Object and Read_symbols_data classes.
14528         (Archive::Archive): Add initializers for new members.
14529         (Archive::setup): Add parameter.
14530         (Archive::print_stats): New function.
14531         (Archive::total_archives, Archive::total_members)
14532         (Archive::total_members_loaded): New variables.
14533         (Archive::get_file_and_offset): New function.
14534         (Archive::get_elf_object_for_member): New function.
14535         (Archive::read_all_symbols): New function.
14536         (Archive::read_symbols): New function.
14537         (Archive::Archive_member): New class.
14538         (Archive::members_): New member.
14539         (Archive::num_members_): New member.
14540         * main.cc: Include archive.h.
14541         (main): Call Archive::print_stats.
14542         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14543         archive parameter; member_name is now the fully-decorated name.
14544         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14545         * options.h: (General_options): Add --preread-archive-symbols option.
14546         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14547         Archive::setup.
14548
14549 2008-08-04  Ian Lance Taylor  <iant@google.com>
14550
14551         * symtab.h (Symbol::use_plt_offset): New function.
14552         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14553         * powerpc.cc (Relocate::relocate): Likewise.
14554         * sparc.cc (Relocate::relocate): Likewise.
14555         * x86_64.cc (Relocate::relocate): Likewise.
14556         * testsuite/weak_plt.sh: New test.
14557         * testsuite/weak_plt_main.cc: New test.
14558         * testsuite/weak_plt_shared.cc: New test.
14559         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14560         (check_PROGRAMS): Add weak_plt.
14561         (check_DATA): Add weak_plt_shared.so.
14562         (weak_plt_main_pic.o, weak_plt): New targets.
14563         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14564         * testsuite/Makefile.in: Rebuild.
14565
14566         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14567         gcctestdir/ld.
14568         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14569         * testsuite/Makefile.in: Rebuild.
14570
14571 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14572
14573         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14574         * Makefile.in: Regenerate.
14575         * po/POTFILES.in: Regenerate.
14576
14577 2008-07-29  Ian Lance Taylor  <iant@google.com>
14578
14579         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14580         symbols before other symbols.
14581         * testsuite/script_test_2.cc (test_addr): Declare.
14582         (test_addr_alias): Declare.
14583         (main): Check that test_addr and test_addr_alias have the right
14584         values.
14585         * testsuite/script_test_2.t: Define test_addr_alias and
14586         test_addr.
14587
14588 2008-07-24  Ian Lance Taylor  <iant@google.com>
14589
14590         PR 5990
14591         * descriptors.cc: New file.
14592         * descriptors.h: New file.
14593         * gold-threads.h (class Hold_optional_lock): New class.
14594         * fileread.cc: Include "descriptors.h".
14595         (File_read::~File_read): Release descriptor rather than closing
14596         it.
14597         (File_read::open) [file]: Call open_descriptor rather than open.
14598         Set is_descriptor_opened_.
14599         (File_read::open) [memory]: Assert that descriptor is not open.
14600         (File_read::reopen_descriptor): New function.
14601         (File_read::release): Release descriptor.
14602         (File_read::do_read): Make non-const.  Reopen descriptor.
14603         (File_read::read): Make non-const.
14604         (File_read::make_view): Reopen descriptor.
14605         (File_read::do_readv): Likewise.
14606         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14607         Update declarations.
14608         * layout.cc: Include "descriptors.h".
14609         (Layout::create_build_id): Use open_descriptor rather than open.
14610         * output.cc: Include "descriptors.h".
14611         (Output_file::open): Use open_descriptor rather than open.
14612         * archive.cc (Archive::const_iterator): Change Archive to be
14613         non-const.
14614         (Archive::begin, Archive::end): Make non-const.
14615         (Archive::count_members): Likewise.
14616         * archive.h (class Archive): Update declarations.
14617         * object.h (Object::read): Make non-const.
14618         * Makefile.am (CCFILES): Add descriptors.cc.
14619         (HFILES): Add descriptors.h.
14620         * Makefile.in: Rebuild.
14621
14622         PR 6716
14623         * gold.h: Always include <clocale>.  Add Solaris workarounds
14624         following code in binutils/sysdep.h.
14625
14626         PR 6048
14627         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14628         this->eh_frame_hdr_ is NULL before using it.
14629
14630         * dynobj.cc (Versions::Versions): Update comment.
14631
14632         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14633         the base version name.
14634
14635         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14636         array size plus one.
14637         (Stringpool_template::set_string_offsets): Subtract one from key
14638         before using it as an array index.
14639         (Stringpool_template::get_offset_with_length): Likewise.
14640         (Stringpool_template::write_to_buffer): Likewise.
14641         * stringpool.h (Stringpool_template::get_offset_from_key):
14642         Likewise.
14643
14644 2008-07-23  Ian Lance Taylor  <iant@google.com>
14645
14646         PR 6658
14647         * object.h (Merged_symbol_value::value): Do our best to handle a
14648         negative addend.
14649
14650         PR 6647
14651         * script.cc (Version_script_info::get_versions): Don't add empty
14652         version tag to return value.
14653         (Version_script_info::get_symbol_version_helper): Change return
14654         type to bool.  Add pversion parameter.  Change all callers.
14655         (script_register_vers_node): Don't require a non-NULL tag.
14656         * script.h (class Version_script_info): Update declarations.
14657         (Version_script_info::get_symbol_version): Change return type to
14658         bool.  Add version parameter.  Change all callers.
14659         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14660         handling.  Handle an empty version from a version script.
14661         (Symbol_table::define_special_symbol): Likewise.
14662         * testsuite/ver_test_10.script: New file.
14663         * testsuite/ver_test_10.sh: New file.
14664         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14665         (check_DATA): Add ver_test_10.syms.
14666         (ver_test_10.syms, ver_test_10.so): New target.
14667         * testsuite/Makefile.in: Rebuild.
14668
14669 2008-07-23  Simon Baldwin  <simonb@google.com>
14670
14671         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14672         to zero for undefined symbols from dynamic libraries.
14673
14674 2008-07-23  Ian Lance Taylor  <iant@google.com>
14675
14676         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14677         Change all callers.
14678         * symtab.h (class Symbol_table): Update declaration.
14679         * testsuite/ver_test_9.cc: New file.
14680         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14681         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14682         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14683         (ver_test_9.so, ver_test_9.o): New targets.
14684         * testsuite/Makefile.in: Rebuild.
14685
14686 2008-07-22  Ian Lance Taylor  <iant@google.com>
14687
14688         * options.h (class General_options): Define --check-sections.
14689         * layout.cc (Layout::set_segment_offsets): Handle
14690         --check-sections.
14691
14692         * options.h (class General_options): Define -n/--nmagic and
14693         -N/--omagic.
14694         * options.cc (General_options::finalize): For -n/--nmagic or
14695         -N/--omagic, set -static.
14696         * layout.cc (Layout::attach_allocated_section_to_segment): If
14697         -N/--omagic, don't put read-only and read-write sections in
14698         different segments.
14699         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14700         finding a read-only segment.
14701         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14702         don't set the minimum segment alignment to the common page size,
14703         and don't set the file offset to the address modulo the page size.
14704         * script-sections.cc (Script_sections::create_segments): If
14705         -n/--omagic, don't put read-only and read-write sections in
14706         different segments.
14707
14708         * cref.cc: New file.
14709         * cref.h: New file.
14710         * options.h (class General_options): Add --print-symbol-counts.
14711         * main.cc (main): Issue defined symbol report if requested.
14712         * archive.cc (Archive::interpret_header): Make into a const member
14713         function.
14714         (Archive::add_symbols): Call Input_objects::archive_start and
14715         archive_stop.
14716         (Archive::const_iterator): Define new class.
14717         (Archive::begin, Archive::end): New functions.
14718         (Archive::include_all_members): Rewrite to use iterator.
14719         (Archive::count_members): New function.
14720         * archive.h (class Archive): Update declarations.
14721         (Archive::filename): New function.
14722         * object.cc: Include "cref.h".
14723         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14724         (Sized_relobj::do_get_global_symbol_counts): New function.
14725         (Input_objects::add_object): Add object to cross-referencer.
14726         (Input_objects::archive_start): New function.
14727         (Input_objects::archive_stop): New function.
14728         (Input_objects::print_symbol_counts): New function.
14729         * object.h: Declare Cref and Archive.
14730         (Object::get_global_symbol_counts): New function.
14731         (Object::do_get_global_symbol_counts): New pure virtual function.
14732         (class Sized_relobj): Add defined_count_ field.  Update
14733         declarations.
14734         (class Input_objects): Add cref_ field.  Update constructor.
14735         Update declarations.
14736         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14737         defined_count_.
14738         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14739         symbol counts.
14740         (Sized_dynobj::do_get_global_symbol_counts): New function.
14741         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14742         defined_count_.  Update declarations.  Define Symbols typedef.
14743         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14744         parameter.  Change all callers.
14745         (Symbol_table::add_from_dynobj): Add sympointers and defined
14746         parameters.  Change all callers.
14747         * symtab.h (class Symbol_table): Update declarations.
14748         * Makefile.am (CCFILES): Add cref.cc.
14749         (HFILES): Add cref.h.
14750         * Makefile.in: Rebuild.
14751
14752 2008-07-22  Simon Baldwin  <simonb@google.com>
14753
14754         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14755         to zero when writing undefined symbols.
14756
14757 2008-07-22  Ian Lance Taylor  <iant@google.com>
14758
14759         * output.cc (Output_section::add_input_section): Don't try to
14760         merge empty merge sections.
14761
14762 2008-07-21  Craig Silverstein  <csilvers@google.com>
14763
14764         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14765         Include symbol version in error message.
14766
14767 2008-07-20  Chris Demetriou  <cgd@google.com>
14768
14769         * configure.ac (gold_cv_c_random_seed): New configured variable.
14770         (RANDOM_SEED_CFLAGS): New substituted variable.
14771         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14772         * configure: Rebuild.
14773         * Makefile.in: Likewise.
14774         * testsuite/Makefile.in: Likewise.
14775
14776 2008-07-18  Ian Lance Taylor  <iant@google.com>
14777
14778         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14779         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14780         * testsuite/ver_test_main.cc (main): Call t4.
14781         (t4, t4_2a): Define.
14782         * testsuite/ver_test_2.cc (t4_2): Define.
14783         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14784         * testsuite/ver_test_4.cc (t4_2a): Define.
14785         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14786         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14787
14788 2008-07-17  Ian Lance Taylor  <iant@google.com>
14789
14790         * dynobj.cc (Versions::add_def): If we give an error about a
14791         missing version, go ahead and create the version anyhow.
14792
14793 2008-07-10  Ian Lance Taylor  <iant@google.com>
14794
14795         Handle output sections with more than 0x7fffffff bytes.
14796         * object.h (class Relobj): Change map_to_output_ to
14797         output_sections_, and just keep a section pointer.  Change all
14798         uses.  Move comdat group support to Sized_relobj.
14799         (Relobj::is_section_specially_mapped): Remove.
14800         (Relobj::output_section): Remove poff parameter.  Change all
14801         callers.
14802         (Relobj::output_section_offset): New function.
14803         (Relobj::set_section_offset): Rewrite.
14804         (Relobj::map_to_output): Remove.
14805         (Relobj::output_sections): New function.
14806         (Relobj::do_output_section_offset): New pure virtual function.
14807         (Relobj::do_set_section_offset): Likewise.
14808         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14809         group support from Relobj.  Update declarations.
14810         (Sized_relobj::get_output_section_offset): New function.
14811         (Sized_relobj::do_output_section_offset): New function.
14812         (Sized_relobj::do_set_section_offset): New function.
14813         * object.cc (Relobj::output_section_address): Remove.
14814         (Sized_relobj::Sized_relobj): Initialize new fields.
14815         (Sized_relobj::include_section_group): Cast find_kept_object to
14816         Sized_relobj.
14817         (Sized_relobj::include_linkonce_section): Likewise.
14818         (Sized_relobj::do_layout): Use separate arrays for output section
14819         and output offset.
14820         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14821         output_sections.
14822         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14823         output_sections and section_offsets.
14824         (Sized_relobj::write_local_symbols): Likewise.
14825         (map_to_kept_section): Compute output address directly.
14826         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14827         output_sections and section_offsets.
14828         (Sized_relobj::write_sections): Likewise.
14829         (Sized_relobj::relocate_sections): Likewise.
14830         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14831         * output.h (class Output_reloc): Update declarations.  Change
14832         u2_.relobj to Sized_relobj*.
14833         (class Output_data_reloc): Change add functions to use
14834         Sized_relobj*.
14835         * output.cc (Output_reloc::Output_reloc): Change relobj to
14836         Sized_relobj*.
14837         (Output_reloc::local_section_offset): Change return type to
14838         Elf_Addr.  Use get_output_section_offset.
14839         (Output_reloc::get_address): Likewise.
14840         (Output_section::is_input_address_mapped): Don't call
14841         is_section_specially_mapped.
14842         (Output_section::output_offset): Likewise.
14843         (Output_section::output_address): Likewise.
14844         (Output_section::starting_output_address): Likewise.
14845         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14846         parameter to Sized_relobj*.
14847         (Copy_relocs::need_copy_reloc): Likewise.
14848         (Copy_relocs::save): Likewise.
14849         * copy-relocs.h (class Copy_relocs): Update declarations.
14850         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14851         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14852         * target-reloc.h (relocate_for_relocatable): Change
14853         offset_in_output_section type to Elf_Addr.  Change code that uses
14854         it as well.
14855         * layout.cc (Layout::layout): Always set *off.
14856         * mapfile.cc (Mapfile::print_input_section): Use
14857         output_section_offset.
14858         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14859         Sized_relobj*.
14860         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14861         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14862         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14863
14864 2008-07-03  Ian Lance Taylor  <iant@google.com>
14865
14866         * layout.cc (Layout::include_section): Do not discard unrecognized
14867         SHT_STRTAB sections.
14868
14869 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14870
14871         * script.cc (Lex::can_continue_name): Make '?' allowable in
14872         version-script names.
14873         * testsuite/version_script.map: Change glob pattern to use '?'
14874
14875 2008-06-30  Manish Singh  <yosh@gimp.org>
14876
14877         PR 6585
14878         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14879         Correct typo.
14880
14881 2008-06-30  Ian Lance Taylor  <iant@google.com>
14882
14883         PR 6660
14884         PR 6682
14885         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14886         versions]: Don't try to read the value in the contents, since we
14887         don't use it.  Use the template endianness when writing.
14888
14889 2008-06-25  Cary Coutant  <ccoutant@google.com>
14890
14891         * fileread.cc (File_read::make_view): Assert on zero-length view.
14892         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14893         symbol table when there are no symbols to read.
14894
14895 2008-06-23  Craig Silverstein  <csilvers@google.com>
14896
14897         * version.cc (version_string): Bump to 1.7
14898
14899 2008-06-18  Craig Silverstein  <csilvers@google.com>
14900
14901         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14902         constant 0xFFFF to type Valtype.
14903         (Powerpc_relocate_functions::rel16_ha): Likewise.
14904
14905 2008-06-17  Ian Lance Taylor  <iant@google.com>
14906
14907         * output.h (Output_section::Input_section): Initialize p2align_ to
14908         zero for Output_section_data constructors.
14909         (Output_section::Input_section::addralign): If not an input
14910         section, return the alignment of the Output_section_data.
14911         * testsuite/copy_test.cc: New file.
14912         * testsuite/copy_test_1.cc: New file.
14913         * testsuite/copy_test_2.cc: New file.
14914         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14915         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14916         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14917         (copy_test_1_pic.o, copy_test_1.so): New targets.
14918         (copy_test_2_pic.o, copy_test_2.so): New targets.
14919         * testsuite/Makefile.in: Rebuild.
14920
14921         * script-sections.cc (Script_sections::place_orphan): Initialize
14922         local variable exact.
14923
14924 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14925
14926         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14927
14928 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14929             David S. Miller  <davem@davemloft.net>
14930
14931         * powerpc.cc: New file.
14932         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14933         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14934         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14935         * Makefile.in: Rebuild.
14936
14937 2008-06-09  Ian Lance Taylor  <iant@google.com>
14938
14939         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14940         <exception>.
14941         (throwing, orig_terminate): New static variables.
14942         (terminate_handler): New static function.
14943         (t2): Set terminate handler.
14944
14945 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14946
14947         PR 6584
14948         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14949         alignment.
14950
14951 2008-05-30  Cary Coutant  <ccoutant@google.com>
14952
14953         * archive.cc (Archive::include_all_members) Correct to step
14954         over symbol table and extended name table in thin archives.
14955
14956 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14957
14958         PR 6407
14959         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14960         calculation.
14961
14962 2008-05-28  Caleb Howe  <cshowe@google.com>
14963
14964         * reduced_debug_output.cc: New file.
14965         * reduced_debug_output.h: New file.
14966         * options.h (class General_options): Add --strip-debug-non-line.
14967         * options.cc (General_options::finalize): Add strip_debug_non_line
14968         to the strip heirarchy.
14969         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14970         fields.
14971         * layout.cc: Include "reduced_debug_output.h".
14972         (Layout::Layout): Initialize new fields.
14973         (line_only_debug_sections): New static array.
14974         (is_lines_only_debug_sections): New static inline function.
14975         (Layout::include_section): Handle --strip-debug-non-line.
14976         (Layout::make_output_section): If --strip-debug-non-line, build
14977         new output sections for .debug_abbrev and .debug_info.
14978         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14979         gold.  Warn about possible overflow.
14980         (read_signed_LEB_128): Likewise.
14981         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14982         (read_signed_LEB_128): Declare.
14983         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14984         (HFILES): Add reduced_debug_output.h.
14985         * Makefile.in: Rebuild.
14986
14987 2008-05-21  Ian Lance Taylor  <iant@google.com>
14988
14989         * mapfile.cc: New file.
14990         * mapfile.h: New file.
14991         * options.h (class General_options): Add -M/--print-map and -Map.
14992         * options.cc (General_options::finalize): Make -M equivalent to
14993         -Map -.
14994         * main.cc: Include <cstdio> and "mapfile.h".
14995         (main): Open mapfile if requested.
14996         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14997         constructor.  Change caller.
14998         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14999         (queue_middle_tasks): Likewise.
15000         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15001         declarations.
15002         * archive.cc: Include "mapfile.h".
15003         (Archive::add_symbols): Add mapfile parameter.  Change all
15004         callers.  Pass mapfile, symbol, and reason to include_member.
15005         (Archive::include_all_members): Add mapfile parameter.  Change all
15006         callers.
15007         (Archive::include_member): Add mapfile, sym, and why parameters.
15008         Change all callers.  Report inclusion to map file.
15009         * archive.h: Include "fileread.h".
15010         (class Archive): Update declarations.
15011         (Archive::file): New const method.
15012         (class Add_archive_symbols): Add mapfile_ field.  Update
15013         constructor.  Change all callers.
15014         * readsyms.h (class Read_symbols): Likewise.
15015         (class Finish_group): Likewise.
15016         (class Read_script): Likewise.
15017         * common.cc: Include "mapfile.h".
15018         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15019         all callers.
15020         (Symbol_table::do_allocate_commons): Likewise.
15021         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15022         symbol allocation to mapfile.
15023         * common.h (class Allocate_commons_task): Add mapfile_ field.
15024         Update constructor.  Change all callers.
15025         * symtab.h (class Symbol_table): Update declarations.
15026         * layout.cc: Include "mapfile.h".
15027         (Layout_task_runner::run): Print information to mapfile.
15028         (Layout::create_gold_note): Change Output_data_fixed_space to
15029         Output_data_zero_fill.
15030         (Layout::create_build_id): Likewise.
15031         (Layout::print_to_mapfile): New function.
15032         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15033         constructor.  Change caller.
15034         (class Layout): Declare print_to_mapfile.
15035         * output.cc (Output_section::Input_section::print_to_mapfile): New
15036         function.
15037         (Output_section::add_input_section): If producing a map, always
15038         add to input_sections_ list.
15039         (Output_section::do_print_to_mapfile): New function.
15040         (Output_segment::print_sections_to_mapfile): New function.
15041         (Output_segment::print_section_list_to_mapfile): New function.
15042         * output.h: Include "mapfile.h".
15043         (Output_data::print_to_mapfile): New function.
15044         (Output_data::do_print_to_mapfile): New virtual function.
15045         (Output_segment_headers::do_print_to_mapfile): New function.
15046         (Output_file_header::do_print_to_mapfile): New function.
15047         (Output_data_const::do_print_to_mapfile): New function.
15048         (class Output_data_const_buffer): Add map_name_ field.  Update
15049         constructor.  Change all callers.  Add do_print_to_mapfile
15050         function.
15051         (class Output_data_fixed_space): Likewise.
15052         (class Output_data_space): Likewise.
15053         (class Output_data_zero_fill): New class.
15054         (Output_data_strtab::do_print_to_mapfile): New function.
15055         (Output_data_reloc_base::do_print_to_mapfile): New function.
15056         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15057         (Output_data_group::do_print_to_mapfile): New function.
15058         (Output_data_got::do_print_to_mapfile): New function.
15059         (Output_data_dynamic::do_print_to_mapfile): New function.
15060         (Output_symtab_xindex::do_print_to_mapfile): New function.
15061         (class Output_section): Declare do_print_to_mapflie.  Declare
15062         print_to_mapfile in Input_section.
15063         (class Output_segment): Declare new functions.
15064         * object.h (Sized_relobj::symbol_count): New function.
15065         * script-sections.cc
15066         (Output_section_element_dot_assignment::set_section_addresses):
15067         Change Output_data_fixed_space to Output_data_zero_fill.
15068         (Output_data_expression::do_print_to_mapfile): New function.
15069         * script.cc (read_input_script): Add mapfile parameter.  Change
15070         all callers.
15071         * script.h (read_input_script): Update declaration.
15072         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15073         (Eh_frame::do_print_to_mapfile): New function.
15074         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15075         (Output_merge_string::do_print_to_mapfile): New function.
15076         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15077         function.
15078         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15079         function.
15080         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15081         function.
15082         * Makefile.am (CCFILES): Add mapfile.cc.
15083         (HFILES): Add mapfile.h.
15084         * Makefile.in: Rebuild.
15085
15086 2008-05-19  Ian Lance Taylor  <iant@google.com>
15087
15088         * options.h (class General_options): Add -z relro.
15089         * layout.cc (Layout::Layout): Initialize relro_segment_.
15090         (Layout::add_output_section_data): Return the output section.
15091         (Layout::make_output_section): Rcognize relro sections and mark
15092         them appropriately.
15093         (Layout::attach_allocated_section_to_segment): Put relro sections
15094         in a PT_GNU_RELRO segment.
15095         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15096         section as relro.
15097         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15098         PT_TLS segments.
15099         (Layout::linkonce_mapping): Map d.rel.ro.local to
15100         .data.rel.ro.local.
15101         (Layout::output_section_name): Us .data.rel.ro.local for any
15102         section which begins with that.
15103         * layout.h (class Layout): Update add_output_section_data
15104         declaration.  Add relro_segment_ field.
15105         * output.cc (Output_section::Output_section): Initialize is_relro_
15106         and is_relro_local_ fields.
15107         (Output_segment::add_output_section): Group relro sections.
15108         (Output_segment::is_first_section_relro): New function.
15109         (Output_segment::maximum_alignment): If there is a relro section,
15110         align the segment to the common page size.
15111         (Output_segment::set_section_addresses): Track whether we are
15112         looking at relro sections.  If the last section is a relro
15113         section, align to the common page size.
15114         (Output_segment::set_section_list_addresses): Add in_relro
15115         parameter.  Change all callers.  Align to the page size when
15116         moving from relro to non-relro section.
15117         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15118         segment.
15119         * output.h (class Output_section): Add is_relro_ and
15120         is_relro_local_ fields.
15121         (Output_section::is_relro): New function.
15122         (Output_section::set_is_relro): New function.
15123         (Output_section::is_relro_local): New function.
15124         (Output_section::set_is_relro_local): New function.
15125         (class Output_segment): Update declarations.
15126         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15127         * sparc.cc (Target_sparc::got_section): Likewise.
15128         * x86_64.cc (Target_x86_64::got_section): Likewise.
15129         * testsuite/relro_test_main.cc: New file.
15130         * testsuite/relro_test.cc: New file.
15131         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15132         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15133         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15134         (relro_test.so, relro_test_pic.o): New targets.
15135         * testsuite/Makefile.in: Rebuild.
15136
15137 2008-05-16  Ian Lance Taylor  <iant@google.com>
15138
15139         * output.cc (Output_segment::add_output_section): Remove front
15140         parameter.
15141         * output.h (class Output_segment): Remove
15142         add_initial_output_section and overloaded add_output_section.
15143         Update declaration of remaining add_output_section.
15144         * layout.cc (Layout::create_interp): Call add_output_section
15145         rather than add_initial_output_section.
15146         (Layout::finish_dynamic_section): Likewise.
15147
15148         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15149         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15150         know the dynamic type.
15151         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15152         field.  Initialize it in constructor.
15153         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15154         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15155         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15156         reloc.
15157
15158         * output.cc (Output_reloc::get_address): Change return type to
15159         Elf_Addr.
15160         * output.h (class Output_reloc): Update get_address declaration.
15161         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15162         for section addresses.
15163
15164 2008-05-09  Ian Lance Taylor  <iant@google.com>
15165
15166         PR 6493
15167         * gold.cc (gold_nomem): Use return value of write.
15168
15169 2008-05-08  Ian Lance Taylor  <iant@google.com>
15170
15171         * symtab.c (Symbol::init_base_output_data): Add version
15172         parameter.  Change all callers.
15173         (Symbol::init_base_output_segment): Likewise.
15174         (Symbol::init_base_constant): Likewise.
15175         (Symbol::init_base_undefined): Likewise.
15176         (Sized_symbol::init_output_data): Likewise.
15177         (Sized_symbol::init_output_segment): Likewise.
15178         (Sized_symbol::init_constant): Likewise.
15179         (Sized_symbol::init_undefined): Likewise.
15180         (Symbol_table::do_define_in_output_data): If the new symbol has a
15181         version, mark it as the default.
15182         (Symbol_table::do_define_in_output_segment): Likewise.
15183         (Symbol_table::do_define_as_constant): Likewise.
15184         * symtab.h (class Symbol): Update declarations.
15185         (class Sized_symbol): Likewise.
15186         * resolve.cc (Symbol::override_version): New function.
15187         (Symbol::override_base): Call override_version.
15188         (Symbol::override_base_with_special): Likewise.
15189         * testsuite/ver_script_8.script: New file.
15190         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15191         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15192         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15193         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15194
15195 2008-05-06  Ian Lance Taylor  <iant@google.com>
15196
15197         PR 6049
15198         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15199         functions.
15200         (class General_options): Remove existing --undefined, and add
15201         --no-undefined instead.  Add new --undefined as synonym for -u.
15202         * archive.cc (Archive::add_symbols): Check whether symbol was
15203         named with -u.
15204         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15205         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15206         all uses.  Add IS_UNDEFINED.  Update declarations to split
15207         different versions of init_base.  Declare init_base_undefined.
15208         (Symbol::is_defined): Handle IS_UNDEFINED.
15209         (Symbol::is_undefined): Likewise.
15210         (Symbol::is_weak_undefined): Call is_undefined.
15211         (Symbol::is_absolute): Handle IS_CONSTANT.
15212         (class Sized_symbol): Update declarations to split different
15213         versions of init.  Declare init_undefined.
15214         (class Symbol_table): Declare new functions.
15215         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15216         Change all callers.
15217         (Symbol::init_base_output_data): Likewise.
15218         (Symbol::init_base_output_segment): Likewise.
15219         (Symbol::init_base_constant): Likewise.
15220         (Symbol::init_base_undefined): New function.
15221         (Sized_symbol::init_object): Rename from init.  Change all
15222         callers.
15223         (Sized_symbol::init_output_data): Likewise.
15224         (Sized_symbol::init_output_segment): Likewise.
15225         (Sized_symbol::init_constant): Likewise.
15226         (Sized_symbol::init_undefined): New function.
15227         (Symbol_table::add_undefined_symbols_from_command_line): New
15228         function.
15229         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15230         function.
15231         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15232         (Symbol::output_section): Likewise.
15233         (Symbol::set_output_section): Likewise.
15234         (Symbol_table::sized_finalize_symbol): Likewise.
15235         (Symbol_table::sized_write_globals): Likewise.
15236         * resolve.cc (Symbol_table::should_override): Likewise.
15237         (Symbol::override_base_with_special): Likewise.
15238
15239         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15240         symbol, change it to have default visibility.
15241         * testsuite/protected_1.cc: New file.
15242         * testsuite/protected_2.cc: New file.
15243         * testsuite/protected_3.cc: New file.
15244         * testsuite/protected_main_1.cc: New file.
15245         * testsuite/protected_main_2.cc: New file.
15246         * testsuite/protected_main_3.cc: New file.
15247         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15248         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15249         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15250         (protected_1.so): New target.
15251         (protected_1_pic.o, protected_2_pic.o): New targets.
15252         (protected_3_pic.o): New target.
15253         (check_PROGRAMS): Add protected_2.
15254         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15255         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15256         * testsuite/Makefile.in: Rebuild.
15257
15258         * options.h (DEFINE_var): Add set_user_set_##varname__.
15259         (DEFINE_bool_alias): New macro.
15260         (class General_options): Define -Bstatic using DEFINE_bool_alias
15261         rather than DEFINE_special.  Add --undefined as an alias for -z
15262         defs.
15263         * options.cc (General_options::parse_Bstatic): Remove.
15264
15265         * options.h (class General_options): Add --fatal-warnings.
15266         * main.cc (main): Implement --fatal-warnings.
15267         * errors.h (Errors::warning_count): New function.
15268
15269         * options.h (class General_options): Add -Bsymbolic-functions.
15270         * symtab.h (Symbol::is_preemptible): Check for
15271         -Bsymbolic-functions.
15272
15273 2008-05-05  Ian Lance Taylor  <iant@google.com>
15274
15275         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15276         as noVARNAME rather than no-VARNAME.
15277         (class General_options): Add option -z combreloc.
15278         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15279         get_address.
15280         (Output_reloc::sort_before) [SHT_REL]: New function.
15281         (Output_reloc::sort_before) [SHT_RELA]: New function.
15282         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15283         Sort_relocs_comparison.
15284         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15285         parameter.  Change all callers.
15286         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15287         sort_relocs parameter.  Change all callers.
15288         * output.cc (Output_reloc::get_address): New function, broken out
15289         of write_rel.
15290         (Output_reloc::write_rel): Call it.
15291         (Output_reloc::compare): New function.
15292         (Output_data_reloc_base::do_write): Optionally sort relocs.
15293
15294         * configure.ac: If targ_extra_obj is set, link it in.
15295         * configure.tgt: Initialize all variables.
15296         (x86_64*): Set targ_extra_obj and targ_extra_size.
15297         * configure: Rebuild.
15298
15299         * object.cc (Sized_relobj::include_section_group): Adjust section
15300         indexes read from group data.  Build vector to pass to
15301         layout_group.
15302         * layout.cc (Layout::layout_group): Add flags and shndxes
15303         parameters.  Remove contents parameter.  Change caller.  Update
15304         explicit instantiations.
15305         * layout.h (class Layout): Update layout_group declaration.
15306         * output.cc (Output_data_group::Output_data_group): Add flags and
15307         input_shndxes parameters.  Remove contents parameter.  Change
15308         caller.
15309         (Output_data_group::do_write): Change input_sections_ to
15310         input_shndxes_.
15311         * output.h (class Output_data_group): Update constructor
15312         declaration.  Rename input_sections_ to input_shndxes_.
15313         * testsuite/many_sections_test.cc: Add template.
15314
15315 2008-04-30  Cary Coutant  <ccoutant@google.com>
15316
15317         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15318
15319         * layout.cc (Layout::include_section): Refactored check for debug
15320         info section.
15321         (Layout::add_comdat): Add new parameters.  Change type
15322         of signature parameter.  Add object and shndx to signatures table.
15323         (Layout::find_kept_object): New function.
15324         * layout.h: Include <cstring>.
15325         (Layout::is_debug_info_section): New function.
15326         (Layout::add_comdat): Add new parameters.
15327         (Layout::find_kept_object): New function.
15328         (Layout::Kept_section): New struct.
15329         (Layout::Signatures): Change type of map range.
15330         * object.cc (Relobj::output_section_address): New function.
15331         (Sized_relobj::include_section_group): Add new parameters.  Change
15332         calls to Layout::add_comdat.  Change to build table of kept comdat
15333         groups and table mapping discarded sections to kept sections.
15334         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15335         (Sized_relobj::do_layout): Change calls to include_section_group and
15336         include_linkonce_section.
15337         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15338         value to zero when section is discarded.
15339         (Sized_relobj::map_to_kept_section): New function.
15340         * object.h (Relobj::output_section_address): New function.
15341         (Relobj::Comdat_group): New type.
15342         (Relobj::find_comdat_group): New function.
15343         (Relobj::Comdat_group_table): New type.
15344         (Relobj::Kept_comdat_section): New type.
15345         (Relobj::Kept_comdat_section_table): New type.
15346         (Relobj::add_comdat_group): New function.
15347         (Relobj::set_kept_comdat_section): New function.
15348         (Relobj::get_kept_comdat_section): New function.
15349         (Relobj::comdat_groups_): New field.
15350         (Relobj::kept_comdat_sections_): New field.
15351         (Symbol_value::input_value): Update comment.
15352         (Sized_relobj::map_to_kept_section) New function.
15353         (Sized_relobj::include_linkonce_section): Add new parameter.
15354         * target-reloc.h (Comdat_behavior): New type.
15355         (get_comdat_behavior): New function.
15356         (relocate_section): Add code to map a discarded section to the
15357         corresponding kept section when applying a relocation.
15358
15359 2008-04-30  Craig Silverstein  <csilvers@google.com>
15360
15361         * dwarf_reader.cc (next_generation_count): New static var.
15362         (Addr2line_cache_entry): New struct.
15363         (addr2line_cache): New static var.
15364         (Dwarf_line_info::one_addr2line): Added caching.
15365         (Dwarf_line_info::clear_addr2line_cache): New function.
15366         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15367         cache-size parameter.
15368         (Dwarf_line_info::one_addr2line_cache): New function.
15369         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15370         new cache-size argument to one_addr2line(), and clear cache.
15371
15372 2008-04-28  Cary Coutant  <ccoutant@google.com>
15373
15374         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15375         R_386_PC8 relocations.
15376
15377 2008-04-23  Ian Lance Taylor  <iant@google.com>
15378
15379         * object.cc (Sized_relobj::include_section_group): Check for
15380         invalid section group.
15381
15382         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15383         header size.
15384
15385         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15386         than read for file header.
15387         * archive.cc (Archive::include_member): Likewise.
15388
15389 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15390
15391         * aclocal.m4: Regenerate.
15392         * configure: Regenerate.
15393
15394 2008-04-19  Ian Lance Taylor  <iant@google.com>
15395
15396         * version.cc (version_string): Bump to 1.6.
15397
15398         * testsuite/Makefile.am (many_sections_r_test): New target.
15399         (many_sections_r_test_SOURCES): Remove.
15400         (many_sections_r_test_DEPENDENCIES): Remove.
15401         (many_sections_r_test_LDFLAGS): Remove.
15402         (many_sections_r_test_LDADD): Remove.
15403
15404         * object.cc (Sized_relobj::do_add_symbols): Always pass
15405         local_symbol_count_ to add_from_relobj.
15406
15407         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15408         every thousand variables.
15409         * testsuite/Makefile.in: Rebuild.
15410
15411         * object.cc (Xindex::initialize_symtab_xindex): New function.
15412         (Xindex::read_symtab_xindex): New function.
15413         (Xindex::sym_xindex_to_shndx): New function.
15414         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15415         available.
15416         (Sized_relobj::do_initialize_xindex): New function.
15417         (Sized_relobj::do_read_symbols): Adjust section links.
15418         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15419         parameter.  Change all callers.
15420         (Sized_relobj::include_section_group): Adjust section links and
15421         symbol section indexes.
15422         (Sized_relobj::do_layout): Adjust section links.
15423         (Sized_relobj::do_count_local_symbols): Adjust section links and
15424         symbol section indexes.
15425         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15426         ordinary and special symbols.
15427         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15428         dynsym_xindex parameters.  Change all callers.  Adjust section
15429         links.  Use SHN_XINDEX when needed.
15430         (Sized_relobj::get_symbol_location_info): Adjust section links.
15431         Don't get fooled by special symbols.
15432         * object.h (class Xindex): Define.
15433         (class Object): Add xindex_ parameter.  Declare virtual functoin
15434         do_initialize_xindex.
15435         (Object::adjust_sym_shndx): New function.
15436         (Object::set_xindex): New protected function.
15437         (class Symbol_value): Add is_ordinary_shndx_ field.
15438         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15439         (Symbol_value::value): Assert ordinary section.
15440         (Symbol_value::initialize_input_to_output_map): Likewise.
15441         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15442         Change all callers.
15443         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15444         all callers.
15445         (class Sized_relobj): Update declarations.
15446         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15447         parameter.  Change all callers.
15448         (Sized_relobj::adjust_shndx): New function.
15449         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15450         field.
15451         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15452         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15453         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15454         (Sized_dynobj::read_dynsym_section): Adjust section links.
15455         (Sized_dynobj::read_dynamic): Likewise.
15456         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15457         section links.
15458         (Sized_dynobj::do_initialize_xindex): New function.
15459         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15460         do_initialize_xindex.
15461         (Sized_dynobj::adjust_shndx): New function.
15462         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15463         dynsym_xindex_ fields.
15464         (Layout::finalize): Add a call to set_section_indexes before
15465         creating the symtab sections.
15466         (Layout::set_section_indexes): Don't do anything if the section
15467         already has a section index.
15468         (Layout::create_symtab_sections): Add shnum parameter.  Change
15469         caller.  Create .symtab_shndx section if needed.
15470         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15471         caller.
15472         (Layout::allocated_output_section_count): New function.
15473         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15474         needed.
15475         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15476         fields.  Update declarations.
15477         (Layout::symtab_xindex): New function.
15478         (Layout::dynsym_xindex): New function.
15479         (class Write_symbols_task): Add layout_ field.
15480         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15481         Change caller.
15482         * output.cc (Output_section_headers::Output_section_headers): Add
15483         shstrtab_section parameter.  Change all callers.
15484         (Output_section_headers::do_sized_write): Store overflow values
15485         for section count and section string table section index in
15486         section header zero.
15487         (Output_file_header::do_sized_write): Check for overflow of
15488         section count and section string table section index.
15489         (Output_symtab_xindex::do_write): New function.
15490         (Output_symtab_xindex::endian_do_write): New function.
15491         * output.h (class Output_section_headers): Add shstrtab_section_.
15492         Update declarations.
15493         (class Output_symtab_xindex): Define.
15494         (Output_section::has_out_shndx): New function.
15495         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15496         field.
15497         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15498         Change all callers.
15499         (Sized_symbol::init): Likewise.
15500         (Symbol::output_section): Check for ordinary symbol.
15501         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15502         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15503         callers.
15504         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15505         Change all callers.  Simplify handling of symbols from sections
15506         not included in the link.
15507         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15508         distinction.
15509         (Weak_alias_sorter::operator()): Assert that symbols are
15510         ordinary.
15511         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15512         distinction.
15513         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15514         parameters.  Change all callers.
15515         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15516         symbol distinction.  Use SHN_XINDEX when needed.
15517         (Symbol_table::write_section_symbol): Add symtab_xindex
15518         parameter.  Change all callers.
15519         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15520         SHN_XINDEX when needed.
15521         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15522         declarations.
15523         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15524         (Symbol::is_defined): Check is_ordinary.
15525         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15526         (Symbol::is_absolute, Symbol::is_common): Likewise.
15527         (class Sized_symbol): Update declarations.
15528         (class Symbol_table): Update declarations.
15529         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15530         parameters.  Change all callers.
15531         (Sized_symbol::override): Likewise.
15532         (Symbol_table::override): Likewise.
15533         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15534         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15535         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15536         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15537         to be in an ordinary section.
15538         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15539         object and is_ordinary parameters.  Change all callers.
15540         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15541         Change all callers.  Don't add undefined or non-ordinary symbols
15542         to reloc_map_.
15543         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15544         Change all callers.
15545         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15546         declarations.
15547         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15548         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15549         (Sized_relobj::relocate_sections): Likewise.
15550         * target-reloc.h (scan_relocs): Adjust section symbol index.
15551         (scan_relocatable_relocs): Likewise.
15552         * i386.cc (Scan::local): Check for ordinary symbols.
15553         * sparc.cc (Scan::local): Likewise.
15554         * x86_64.cc (Scan::local): Likewise.
15555         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15556         to symbol_section_and_value.
15557         * testsuite/many_sections_test.cc: New file.
15558         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15559         (check_PROGRAMS): Add many_sections_test.
15560         (many_sections_test_SOURCES): Define.
15561         (many_sections_test_DEPENDENCIES): Define.
15562         (many_sections_test_LDFLAGS): Define.
15563         (BUILT_SOURCES): Add many_sections_define.h.
15564         (many_sections_define.h): New target.
15565         (BUILT_SOURCES): Add many_sections_check.h.
15566         (many_sections_check.h): New target.
15567         (check_PROGRAMS): Add many_sections_r_test.
15568         (many_sections_r_test_SOURCES): Define.
15569         (many_sections_r_test_DEPENDENCIES): Define.
15570         (many_sections_r_test_LDFLAGS): Define.
15571         (many_sections_r_test_LDADD): Define.
15572         (many_sections_r_test.o): New target.
15573         * testsuite/Makefile.in: Rebuild.
15574
15575 2008-04-17  Cary Coutant  <ccoutant@google.com>
15576
15577         * errors.cc (Errors::info): New function.
15578         (gold_info): New function.
15579         * errors.h (Errors::info): New function.
15580         * gold.h (gold_info): New function.
15581         * object.cc (Input_objects::add_object): Print trace output.
15582         * options.cc (options::parse_set): New function.
15583         (General_options::parse_wrap): Deleted.
15584         (General_options::General_options): Deleted initializer.
15585         * options.h (options::String_set): New typedef.
15586         (options::parse_set): New function.
15587         (DEFINE_set): New macro.
15588         (General_options::wrap): Changed to use DEFINE_set. Changed
15589         callers of any_wrap_symbols and is_wrap_symbol.
15590         (General_options::trace, General_options::trace_symbol):
15591         New options.
15592         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15593         (General_options::wrap_symbols_): Deleted.
15594         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15595
15596 2008-04-17  David S. Miller  <davem@davemloft.net>
15597
15598         * options.cc (General_options::parse_V): New function.
15599         * options.h: Add entries for -V and -Qy.
15600
15601 2008-04-17  Ian Lance Taylor  <iant@google.com>
15602
15603         * common.cc (Symbol_table::allocate_commons): Remove options
15604         parameter.  Change caller.
15605         (Symbol_table::do_allocate_commons): Remove options parameter.
15606         Change caller.  Just call do_allocate_commons_list twice.
15607         (Symbol_table::do_allocate_commons_list): New function, broken out
15608         of do_allocate_commons.
15609         * common.h (class Allocate_commons_task): Remove options_ field.
15610         Update constructor.
15611         * symtab.cc (Symbol_table::Symbol_table): Initialize
15612         tls_commons_.
15613         (Symbol_table::add_from_object): Put TLS common symbols on
15614         tls_commons_ list.
15615         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15616         which are IN_OUTPUT_DATA.
15617         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15618         allocate_commons and do_allocate_commons declarations.  Declare
15619         do_allocate_commons_list.
15620         * gold.cc (queue_middle_tasks): Update creation of
15621         Allocate_commons_task to not pass options.
15622         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15623         (TLS_TEST_C_FLAGS): New variable.
15624         (tls_test_c_pic.o): New target.
15625         (tls_test_shared.so): Link in tls_test_c_pic.o.
15626         (tls_test_c_pic_ie.o): New target.
15627         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15628         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15629         (tls_test_c.o): New target.
15630         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15631         (tls_pic_test_LDADD): Likewise.
15632         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15633         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15634         (tls_test_c_gnu2.o): New target.
15635         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15636         tls_test_c_gnu2.o.
15637         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15638         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15639         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15640         * testsuite/tls_test.cc: Include "config.h".
15641         (t_last): Call t11_last.
15642         * testsuite/tls_test.h (t11, t11_last): Declare.
15643         * testsuite/tls_test_c.c: New file.
15644         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15645         * configure.ac: Check for OpenMP support.
15646         * configure, config.in, Makefile.in: Rebuild.
15647         * testsuite/Makefile.in: Rebuild.
15648
15649 2008-04-16  Cary Coutant  <ccoutant@google.com>
15650
15651         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15652         (Target_i386::tls_base_symbol_defined_): New field.
15653         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15654         (Target_i386::Scan::global): Likewise.
15655         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15656         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15657         (Target_x86_64::tls_base_symbol_defined_): New field.
15658         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15659         (Target_x86_64::Scan::global): Likewise.
15660
15661 2008-04-16  Cary Coutant  <ccoutant@google.com>
15662
15663         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15664         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15665         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15666         building shared libraries.
15667         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15668         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15669         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15670         * testsuite/Makefile.in: Rebuild.
15671         * testsuite/weak_undef.h: New file.
15672         * testsuite/weak_undef_file1.cc: Add extra test cases.
15673         * testsuite/weak_undef_file2.cc: Likewise.
15674         * testsuite/weak_undef_test.cc: Likewise.
15675
15676 2008-04-16  David S. Miller  <davem@davemloft.net>
15677
15678         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15679         Add issued_non_pic_error_ field.  Declare check_non_pic.
15680         (Target_sparc::Scan::check_non_pic): New function.
15681         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15682         (Target_sparc::Scan::global): Likewise.
15683
15684         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15685         * configure: Rebuild.
15686
15687         * options.h (DEFINE_enable): New macro.
15688         (new_dtags): New enable option.
15689         (initfirst, interpose, loadfltr, nodefaultlib,
15690         nodelete, nodlopen, nodump): New -z options.
15691         * layout.cc (Layout:finish_dynamic_section): If new
15692         dtags enabled, emit DT_RUNPATH.  Also, emit a
15693         DT_FLAGS_1 containing any specified -z flags.
15694
15695 2008-04-16  Ian Lance Taylor  <iant@google.com>
15696
15697         * copy-relocs.cc: New file.
15698         * copy-relocs.h: New file.
15699         * reloc.cc: Remove Copy_relocs code.
15700         * reloc.h: Likewise.
15701         * reloc-types.h (struct Reloc_types) [both versions]: Add
15702         get_reloc_addend_noerror.
15703         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15704         variants of add_global which take an addend which must be zero.
15705         * i386.cc: Include "copy-relocs.h".
15706         (class Target_i386): Change type of copy_relocs_ to variable,
15707         update initializer.
15708         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15709         Change all callers.
15710         (Target_i386::do_finalize_sections): Change handling of
15711         copy_relocs_.
15712         * sparc.cc: Include "copy-relocs.h".
15713         (class Target_sparc): Change type of copy_relocs_ to variable,
15714         update initializer.
15715         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15716         Change all callers.
15717         (Target_sparc::do_finalize_sections): Change handling of
15718         copy_relocs_.
15719         * x86_64.cc: Include "copy-relocs.h".
15720         (class Target_x86_64): Change type of copy_relocs_ to variable,
15721         update initializer.
15722         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15723         class.  Change all callers.
15724         (Target_x86_64::do_finalize_sections): Change handling of
15725         copy_relocs_.
15726         * Makefile.am (CCFILES): Add copy-relocs.cc.
15727         (HFILES): Add copy-relocs.h.
15728
15729         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15730
15731         * testsuite/script_test_4.sh: Permit leading zeroes.
15732
15733 2008-04-15  Ian Lance Taylor  <iant@google.com>
15734
15735         * script-sections.cc (Script_sections::create_segments): Use
15736         header_size_adjustment even when there is enough room for the
15737         headers.
15738         * testsuite/script_test_4.sh: New file.
15739         * testsuite/script_test_4.t: New file.
15740         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15741         (check_DATA): Add script_test_4.stdout.
15742         (MOSTLYCLEANFILES): Likewise.
15743         (script_test_4): New target.
15744         (script_test_4.stdout): New target.
15745         * testsuite/Makefile.in: Rebuild.
15746
15747         * sparc.cc: Add definitions for Output_data_plt_sparc class
15748         constants.
15749
15750 2008-04-14  David S. Miller  <davem@davemloft.net>
15751
15752         * sparc.cc: New file.
15753         * Makefile.am (TARGETSOURCES): Add sparc.cc
15754         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15755         * configure.tgt: Document targ_extra_size and
15756         targ_extra_big_endian.  Add entries for sparc-* and
15757         sparc64-*.
15758         * configure.ac: Handle targ_extra_size and
15759         targ_extra_big_endian.
15760         * Makefile.in: Rebuild.
15761         * configure: Likewise.
15762         * po/POTFILES.in: Likewise.
15763         * po/gold.pot: Likewise.
15764
15765 2008-04-14  Ian Lance Taylor  <iant@google.com>
15766
15767         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15768         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15769         in the name/type/flags to section mapping.  Don't call
15770         allocate_output_section.
15771         (Layout::choose_output_section): Change parameter from adjust_name
15772         to is_input_section.  Don't permit input sections after sections
15773         are attached to segments.  Don't call allocate_output_section.
15774         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15775         not write_enable_output_section.
15776         (Layout::make_output_section): Don't push to
15777         unattached_section_list_ nor call attach_to_segment.  Call
15778         attach_section_to_segment if sections are attached.
15779         (Layout::attach_sections_to_segments): New function.
15780         (Layout::attach_section_to_segment): New function.
15781         (Layout::attach_allocated_section_to_segment): Rename from
15782         attach_to_segment.  Remove flags parameter.
15783         (Layout::allocate_output_section): Remove function.
15784         (Layout::write_enable_output_section): Remove function.
15785         * layout.h (class Layout): Update for above changes.  Add new
15786         field sections_are_attached_.
15787         * output.h (Output_section::update_flags_for_input_section): New
15788         function.
15789         * output.cc (Output_section::add_input_section): Call
15790         update_flags_for_input_section.
15791         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15792
15793 2008-04-11  Cary Coutant  <ccoutant@google.com>
15794
15795         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15796         thought unnecessary.
15797         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15798
15799 2008-04-11  Ian Lance Taylor  <iant@google.com>
15800
15801         * output.h (class Output_section_data): Remove inline definition
15802         of set_addralign.
15803         * output.cc (Output_section_data::set_addralign): New function.
15804
15805 2008-04-11  Cary Coutant  <ccoutant@google.com>
15806
15807         Add support for TLS descriptors for i386 and x86_64.
15808         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15809         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15810         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15811         GOT_TYPE_TLS_DESC.
15812         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15813         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15814         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15815         relocations.
15816         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15817         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15818         Fix problem with initial-exec relocations.
15819         (Target_i386::Relocate::relocate_tls): Likewise.
15820         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15821         relaxation.
15822         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15823         support for section-plus-offset dynamic table entries.
15824         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15825         (Output_data_dynamic::Dynamic_entry): Add support for
15826         section-plus-offset dynamic table entries.
15827         (Output_data_dynamic::Classification): Likewise.
15828         (Output_data_dynamic::classification_): Renamed offset_.
15829         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15830         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15831         (Target_x86_64::make_plt_section): New function.
15832         (Target_x86_64::reserve_tlsdesc_entries): New function.
15833         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15834         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15835         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15836         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15837         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15838         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15839         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15840         add extra PLT entry for TLS descriptors.
15841         (Output_data_plt_x86_64::got_): New field.
15842         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15843         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15844         fields.
15845         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15846         descriptors.
15847         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15848         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15849         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15850         R_386_TLS_DESC_CALL relocations.
15851         (Target_x86_64::Scan::global): Likewise.
15852         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15853         for TLS descriptors.
15854         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15855         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15856         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15857         GD-to-IE relaxation.
15858         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15859         and TLS_DESCRIPTORS.
15860         * Makefile.in: Rebuild.
15861         * configure: Rebuild.
15862         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15863         (tls_test_shared2.so): New target.
15864         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15865         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15866         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15867         (tls_shared_gd_to_ie_test_LDADD): New variable.
15868         (tls_shared_gnu2_gd_to_ie_test): New target.
15869         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15870         New targets.
15871         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15872         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15873         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15874         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15875         (tls_shared_gnu2_test): New target.
15876         (tls_test_gnu2_shared.so): New target.
15877         (tls_shared_gnu2_test_SOURCES): New variable.
15878         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15879         (tls_shared_gnu2_test_LDFLAGS): New variable.
15880         (tls_shared_gnu2_test_LDADD): New variable.
15881         * testsuite/Makefile.in: Rebuild.
15882         * testsuite/Makefile.
15883
15884 2008-04-11  Ian Lance Taylor  <iant@google.com>
15885
15886         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15887         justsyms.t.
15888         * testsuite/Makefile.in: Rebuild.
15889
15890         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15891         long.
15892         * testsuite/script_test_2.cc (main): Adjust test.
15893
15894 2008-04-11  David S. Miller  <davem@davemloft.net>
15895             Ian Lance Taylor  <iant@google.com>
15896
15897         * options.h (General_options): Add entries for '-Y' and
15898         '-relax'.
15899         * options.cc (General_options:finalize): If -Y was used, add those
15900         entries to the library path instead of the default "/lib" and
15901         "/usr/lib".
15902
15903 2008-04-11  David S. Miller  <davem@davemloft.net>
15904
15905         * testsuite/justsyms.t: Start at 0x100.
15906         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15907         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15908         long.
15909         * testsuite/script_test_2.cc: Adjust string and section length
15910         checks.
15911
15912 2008-04-09  Ian Lance Taylor  <iant@google.com>
15913
15914         PR gold/5996
15915         * script-sections.cc (Sections_element::allocate_to_segment): Add
15916         orphan parameter.
15917         (Output_section_definition::allocate_to_segment): Likewise.
15918         (Orphan_output_section::allocate_to_segment): Likewise.
15919         (Script_sections::attach_sections_using_phdrs_clause): Don't
15920         propagate non-PT_LOAD segments to orphan sections.
15921         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15922         readelf rather than objdump.
15923         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15924         .interp section and PT_INTERP segment are the same size.
15925         * testsuite/Makefile.in: Rebuild.
15926
15927         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15928         aliases for symbols defined in the same object.
15929         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15930         (weak_alias_test_SOURCES): New variable.
15931         (weak_alias_test_DEPENDENCIES): New variable.
15932         (weak_alias_test_LDFLAGS): New variable.
15933         (weak_alias_test_LDADD): New variable.
15934         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15935         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15936         (weak_alias_test_3.o): New target.
15937         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15938         * testsuite/weak_alias_test_main.cc: New file.
15939         * testsuite/weak_alias_test_1.cc: New file.
15940         * testsuite/weak_alias_test_2.cc: New file.
15941         * testsuite/weak_alias_test_3.cc: New file.
15942
15943 2008-04-08  Ian Lance Taylor  <iant@google.com>
15944
15945         * options.h (class General_options): Add --noinhibit-exec option.
15946         * main.cc (main): Check --noinhibit-exec.
15947
15948         * options.h (class General_options): Define --wrap as a special
15949         option.  Add wrap_symbols_ field.
15950         (General_options::any_wrap_symbols): New function.
15951         (General_options::is_wrap_symbol): New function.
15952         * options.cc (General_options::parse_wrap): New function.
15953         (General_options::General_options): Initialize wrap_symbols_.
15954         * symtab.cc (Symbol_table::wrap_symbol): New function.
15955         (Symbol_table::add_from_object): Handle --wrap.
15956         * symtab.h (class Symbol_table): Declare wrap_symbol.
15957         * target.h (Target::wrap_char): New function.
15958         (Target::Target_info): Add wrap_char field.
15959         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15960         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15961         * testsuite/testfile.cc (Target_test::test_target_info):
15962         Likewise.
15963
15964         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15965         there is one.
15966
15967         * layout.h (class Layout): Add added_eh_frame_data_ field.
15968         * layout.cc (Layout::Layout): Initialize new field.
15969         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15970         output section until we find a section we merged successfully.
15971         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15972         that the size be non-zero.
15973
15974         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15975         qualifier.
15976
15977 2008-04-08  Craig Silverstein  <csilvers@google.com>
15978
15979         * configure.ac: Export new conditional variable HAVE_ZLIB.
15980         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15981         on HAVE_ZLIB.
15982         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15983         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15984
15985 2008-04-07  Ian Lance Taylor  <iant@google.com>
15986
15987         * version.cc (version_string): Set to "1.5".
15988
15989         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15990         Add issued_non_pic_error_ field.  Declare check_non_pic.
15991         (Target_x86_64::Scan::check_non_pic): New function.
15992         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15993         (Target_x86_64::Scan::global): Likewise.
15994
15995         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15996         addend parameter.  Change caller.  Handle merge sections.
15997         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15998         Address to Addend.  Don't add in the result of
15999         local_section_offset, pass down the addend and use the returned
16000         value.
16001         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16002         Update declarations of local_section_offset and symbol_value.
16003         * testsuite/two_file_test_1.cc (t18): New function.
16004         * testsuite/two_file_test_2.cc (f18): New function.
16005         * testsuite/two_file_test_main.cc (main): Call t18.
16006         * testsuite/two_file_test.h (t18, f18): Declare.
16007
16008         * configure.ac: Don't test for objdump, c++filt, or readelf.
16009         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16010         conditionals.
16011         (TEST_READELF): New variable.
16012         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16013         (check_PROGRAMS): Add two_file_strip_test.
16014         (two_file_strip_test): New target.
16015         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16016         (two_file_same_shared_strip_test_SOURCES): New variable.
16017         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16018         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16019         (two_file_same_shared_strip_test_LDADD): New variable.
16020         (two_file_shared_strip.so): New target.
16021         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16022         (ver_test_5.syms, ver_test_7.syms): Likewise.
16023         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16024         (strip_test_3.stdout): Use TEST_OBJDUMP.
16025         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16026
16027 2008-04-04  Cary Coutant  <ccoutant@google.com>
16028
16029         * symtab.h (Symbol::is_weak_undefined): New function.
16030         (Symbol::is_strong_undefined): New function.
16031         (Symbol::is_absolute): New function.
16032         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16033         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16034         absolute symbols.
16035         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16036         (weak_undef_test): New target.
16037         * testsuite/Makefile.in: Rebuild.
16038         * testsuite/weak_undef_file1.cc: New file.
16039         * testsuite/weak_undef_file2.cc: New file.
16040         * testsuite/weak_undef_test.cc: New file.
16041
16042 2008-04-03  Craig Silverstein  <csilvers@google.com>
16043
16044         * compressed_output.h (class Output_compressed_section): Use
16045         unsigned buffer.
16046         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16047         add zlib header.
16048         (zlib_compressed_suffix): Removed.
16049         (Output_compressed_section::set_final_data_size): Use unsigned
16050         buffers.
16051         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16052         Fix linker invocation.
16053         (flagstest_o_specialfile_and_compress_debug_sections):
16054         Likewise.
16055         * testsuite/Makefile.in: Regenerated.
16056
16057 2008-04-02  David S. Miller  <davem@davemloft.net>
16058
16059         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16060         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16061
16062 2008-04-02  Craig Silverstein  <csilvers@google.com>
16063
16064         * TODO: New file.
16065
16066 2008-04-02  Ian Lance Taylor  <iant@google.com>
16067
16068         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16069         parameters.  Update for new key type to views_.  Change all
16070         callers.
16071         (File_read::read): Adjust for byteshift in returned view.
16072         (File_read::add_view): New function, broken out of
16073         find_and_make_view.
16074         (File_read::make_view): New function, broken out of
16075         find_and_make_view.
16076         (File_read::find_or_make_view): Add offset and aligned
16077         parameters.  Rewrite accordingly.  Change all callers.
16078         (File_read::get_view): Add offset and aligned parameters.  Adjust
16079         for byteshift in return value.
16080         (File_read::get_lasting_view): Likewise.
16081         * fileread.h (class File_read): Update declarations.
16082         (class File_read::View): Add byteshift_ field.  Add byteshift to
16083         constructor.  Add byteshift method.
16084         * archive.h (Archive::clear_uncached_views): New function.
16085         (Archive::get_view): Add aligned parameter.  Change all callers.
16086         * object.h (Object::get_view): Add aligned parameter.  Change all
16087         callers.
16088         (Object::get_lasting_view): Likewise.
16089
16090         * fileread.cc (File_read::release): Don't call clear_views if
16091         there are multiple objects.
16092         * fileread.h (File_read::clear_uncached_views): New function.
16093         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16094         on the archive.
16095
16096 2008-03-31  Cary Coutant  <ccoutant@google.com>
16097
16098         Add thin archive support.
16099         * archive.cc (Archive::armagt): New const.
16100         (Archive::setup): Remove task parameter and calls to unlock.
16101         (Archive::unlock_nested_archives): New function.
16102         (Archive::read_header): Add nested_off parameter. Change
16103         all callers.
16104         (Archive::interpret_header): Likewise.
16105         (Archive::include_all_members): Change to handle thin
16106         archives.
16107         (Archive::include_member): Likewise.
16108         * archive.h (Archive::Archive): Add new parameters and
16109         initializers.
16110         (Archive::armagt): New const.
16111         (Archive::setup): Remove task parameter.
16112         (Archive::unlock_nested_archives): New function.
16113         (Archive::read_header): Add nested_off parameter.
16114         (Archive::interpret_header): Likewise.
16115         (Archive::Nested_archive_table): New typedef.
16116         (Archive::is_thin_archive_): New field.
16117         (Archive::nested_archives_): New field.
16118         (Archive::options_): New field.
16119         (Archive::dirpath_): New field.
16120         (Archive::task_): New field.
16121         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16122         for thin archives.  Pass additional parameters to
16123         Archive::Archive.  Unlock the archive file after calling
16124         Archive::setup.
16125
16126 2008-03-29  Ian Lance Taylor  <iant@google.com>
16127
16128         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16129         version symbol to be local.
16130         * testsuite/ver_test_4.sh: New file.
16131         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16132         (check_DATA): Add ver_test_4.syms.
16133         (ver_test_4.syms): New target.
16134         * testsuite/Makefile.in: Rebuild.
16135
16136         * output.cc
16137         (Output_section::Input_section_sort_entry::has_priority): New
16138         function.
16139         (Output_section::Input_section_sort_entry::match_file_name): New
16140         function.
16141         (Output_section::Input_section_sort_entry::match_section_name):
16142         Remove.
16143         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16144         Remove.
16145         (Output_section::Input_section_sort_entry::match_section_file):
16146         Remove.
16147         (Output_section::Input_section_sort_compare::operator()): Rewrite
16148         using new Input_section_sort_entry functions.  Sort crtbegin and
16149         crtend first.  Sort sections with no priority before sections with
16150         a priority.
16151         * testsuite/initpri1.c (d3): Check j != 4.
16152         (cd5): New constructor/destructor function.
16153         (main): Check j != 2.
16154
16155         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16156         new symbol when resolving, don't call set_is_default.
16157         * testsuite/ver_test_7.cc: New file.
16158         * testsuite/ver_test_7.sh: New file.
16159         * testsuite/Makefile.am (ver_test_7.so): New target.
16160         (ver_test_7.o): New target.
16161         (check_SCRIPTS): Add ver_test_7.sh.
16162         (check_DATA): Add ver_test_7.syms.
16163         (ver_test_7.syms): New target.
16164
16165 2008-03-28  Ian Lance Taylor  <iant@google.com>
16166
16167         * layout.cc (Layout::layout): If we see an input section with a
16168         name that needs sorting, set the must_sort flag for the output
16169         section.
16170         (Layout::make_output_section): If the name of the output section
16171         indicates that it might require sorting, set the may_sort flag.
16172         * output.h (Output_section::may_sort_attached_input_sections): New
16173         function.
16174         (Output_section::set_may_sort_attached_input_sections): New
16175         function.
16176         (Output_section::must_sort_attached_input_sections): New
16177         function.
16178         (Output_section::set_must_sort_attached_input_sections): New
16179         function.
16180         (class Output_section): Declare Input_section_sort_entry.  Define
16181         Input_section_sort_compare.  Declare
16182         sort_attached_input_sections.  Add new fields:
16183         may_sort_attached_input_sections_,
16184         must_sort_attached_input_sections_,
16185         attached_input_sections_are_sorted_.
16186         * output.cc (Output_section::Output_section): Initialize new
16187         fields.
16188         (Output_section::add_input_section): Add an entry to
16189         input_sections_ if may_sort or must_sort are true.
16190         (Output_section::set_final_data_size): Call
16191         sort_attached_input_sections if necessary.
16192         (Output_section::Input_section_sort_entry): Define new class.
16193         (Output_section::Input_section_sort_compare::operator()): New
16194         function.
16195         (Output_section::sort_attached_input_sections): New function.
16196         * configure.ac: Check whether the compiler supports constructor
16197         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16198         * testsuite/initpri1.c: New file.
16199         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16200         CONSTRUCTOR_PRIORITY.
16201         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16202         (initpri1_LDFLAGS): New variable.
16203         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16204
16205 2008-03-27  Ian Lance Taylor  <iant@google.com>
16206
16207         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16208         * testsuite/common_test_1.c: New file.
16209         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16210         (common_test_1_SOURCES): New variable.
16211         (common_test_1_DEPENDENCIES): New variable.
16212         (common_test_1_LDFLAGS): New variable.
16213
16214         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16215         and commons_ correctly when NAME/VERSION does not override
16216         NAME/NULL.
16217         * testsuite/ver_test_6.c: New file.
16218         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16219         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16220         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16221
16222 2008-03-26  Ian Lance Taylor  <iant@google.com>
16223
16224         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16225         of an undefined symbol from a version script.
16226         * testsuite/Makefile.am (ver_test_5.so): New target.
16227         (ver_test_5.o): New target.
16228         (check_SCRIPTS): Add ver_test_5.sh.
16229         (check_DATA): Add ver_test_5.syms.
16230         (ver_test_5.syms): New target.
16231         * testsuite/ver_test_5.cc: New file.
16232         * testsuite/ver_test_5.script: New file.
16233         * testsuite/ver_test_5.sh: New file.
16234         * Makefile.in, testsuite/Makefile.in: Rebuild.
16235
16236         PR gold/5986
16237         Fix problems building gold with gcc 4.3.0.
16238         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16239         (gold_error_at_location, gold_warning_at_location): Use it.
16240         * configure.ac: Check whether we can compile and use a template
16241         function with a printf attribute.
16242         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16243         when jumping over bytes.
16244         * object.cc: Instantiate Object::read_section_data.
16245         * debug.h: Include <cstring>
16246         * dwarf_reader.cc: Include <algorithm>
16247         * main.cc: Include <cstring>.
16248         * options.cc: Include <cstring>.
16249         * output.cc: Include <cstring>.
16250         * script.cc: Include <cstring>.
16251         * script.h: Include <string>.
16252         * symtab.cc: Include <cstring> and <algorithm>.
16253         * target-select.cc: Include <cstring>.
16254         * version.cc: Include <string>.
16255         * testsuite/testmain.cc: Include <cstdlib>.
16256         * configure, config.in: Rebuild.
16257
16258 2008-03-25  Ian Lance Taylor  <iant@google.com>
16259
16260         * options.cc: Include "../bfd/bfdver.h".
16261         (options::help): Print bug reporting address.
16262
16263         * version.cc (print_version): Adjust output for current value of
16264         BFD_VERSION_STRING.
16265
16266         * NEWS: New file.
16267
16268         * options.cc (options::help): Print list of supported targets.
16269         * target-select.h: Include <vector>.
16270         (class Target_selector): Make machine_, size_, and is_big_endian_
16271         fields const.  Add bfd_name_ and instantiated_target_ fields.
16272         (Target_selector::Target_selector): Add bfd_name parameter.
16273         (Target_selector::recognize): Make non-virtual, call
16274         do_recognize.
16275         (Target_selector::recognize_by_name): Make non-virtual, call
16276         do_recognize_by_name.
16277         (Target_selector::supported_names): New function.
16278         (Target_selector::bfd_name): New function.
16279         (Target_selector::do_instantiate_target): New pure virtual
16280         function.
16281         (Target_selector::do_recognize): New virtual function.
16282         (Target_selector::do_recognize_by_name): New virtual function.
16283         (Target_selector::instantiate_target): New private function.
16284         (supported_target_names): Declare.
16285         * target-select.cc (Target_selector::Target_selector): Update for
16286         new parameter and fields.
16287         (select_target_by_name): Check that the name matches before
16288         calling recognize_by_name.
16289         (supported_target_names): New function.
16290         * i386.cc (class Target_selector_i386): Update Target_selector
16291         constructor call.  Remove recognize and recognize_by_name.  Add
16292         do_instantiate_target.
16293         * x86_64.cc (class Target_selector_x86_64): Likewise.
16294         * testsuite/testfile.cc (class Target_selector_test): Update for
16295         changes to Target_selector.
16296
16297         * README: Rewrite, with some notes on unsupported features.
16298
16299 2008-03-24  Cary Coutant  <ccoutant@google.com>
16300
16301         * i386.cc (Target_i386::Got_type): New enum declaration.
16302         (Target_i386::Scan::local): Updated callers of Output_data_got
16303         member functions.
16304         (Target_i386::Scan::global): Likewise.
16305         (Target_i386::Relocate::relocate): Likewise.
16306         (Target_i386::Relocate::relocate_tls): Likewise.
16307         * object.h (Got_offset_list): New class.
16308         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16309         (Sized_relobj::local_got_offset): Likewise.
16310         (Sized_relobj::set_local_got_offset): Likewise.
16311         (Sized_relobj::local_has_tls_got_offset): Removed.
16312         (Sized_relobj::local_tls_got_offset): Removed.
16313         (Sized_relobj::set_local_tls_got_offset): Removed.
16314         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16315         * output.cc (Output_data_got::add_global): Added got_type parameter.
16316         (Output_data_got::add_global_with_rel): Likewise.
16317         (Output_data_got::add_global_with_rela): Likewise.
16318         (Output_data_got::add_global_pair_with_rel): New function.
16319         (Output_data_got::add_global_pair_with_rela): New function.
16320         (Output_data_got::add_local): Added got_type parameter.
16321         (Output_data_got::add_local_with_rel): Likewise.
16322         (Output_data_got::add_local_with_rela): Likewise.
16323         (Output_data_got::add_local_pair_with_rel): New function.
16324         (Output_data_got::add_local_pair_with_rela): New function.
16325         (Output_data_got::add_global_tls): Removed.
16326         (Output_data_got::add_global_tls_with_rel): Removed.
16327         (Output_data_got::add_global_tls_with_rela): Removed.
16328         (Output_data_got::add_local_tls): Removed.
16329         (Output_data_got::add_local_tls_with_rel): Removed.
16330         (Output_data_got::add_local_tls_with_rela): Removed.
16331         * output.h (Output_data_got::add_global): Added got_type parameter.
16332         (Output_data_got::add_global_with_rel): Likewise.
16333         (Output_data_got::add_global_with_rela): Likewise.
16334         (Output_data_got::add_global_pair_with_rel): New function.
16335         (Output_data_got::add_global_pair_with_rela): New function.
16336         (Output_data_got::add_local): Added got_type parameter.
16337         (Output_data_got::add_local_with_rel): Likewise.
16338         (Output_data_got::add_local_with_rela): Likewise.
16339         (Output_data_got::add_local_pair_with_rel): New function.
16340         (Output_data_got::add_local_pair_with_rela): New function.
16341         (Output_data_got::add_global_tls): Removed.
16342         (Output_data_got::add_global_tls_with_rel): Removed.
16343         (Output_data_got::add_global_tls_with_rela): Removed.
16344         (Output_data_got::add_local_tls): Removed.
16345         (Output_data_got::add_local_tls_with_rel): Removed.
16346         (Output_data_got::add_local_tls_with_rela): Removed.
16347         * resolve.cc (Symbol::override_base_with_special): Removed
16348         reference to has_got_offset_ field.
16349         * symtab.cc (Symbol::init_fields): Replaced initialization
16350         of got_offset_ with got_offsets_.  Removed initialization
16351         of has_got_offset_
16352         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16353         (Symbol::got_offset): Likewise.
16354         (Symbol::set_got_offset): Likewise.
16355         (Symbol::has_tls_got_offset): Removed.
16356         (Symbol::tls_got_offset): Removed.
16357         (Symbol::set_tls_got_offset): Removed.
16358         (Symbol::got_offset_): Removed.
16359         (Symbol::tls_mod_got_offset_): Removed.
16360         (Symbol::tls_pair_got_offset_): Removed.
16361         (Symbol::got_offsets_): New field.
16362         (Symbol::has_got_offset): Removed.
16363         (Symbol::has_tls_mod_got_offset): Removed.
16364         (Symbol::has_tls_pair_got_offset): Removed.
16365         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16366         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16367         member functions.
16368         (Target_x86_64::Scan::global): Likewise.
16369         (Target_x86_64::Relocate::relocate): Likewise.
16370         (Target_x86_64::Relocate::relocate_tls): Likewise.
16371
16372 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16373
16374         * yyscript.y: Fix spelling error in comment.
16375
16376 2008-03-24  Ian Lance Taylor  <iant@google.com>
16377
16378         * options.h (class General_options): Define build_id option.
16379         * layout.h (class Layout): Declare write_build_id, create_note,
16380         create_build_id.  Add build_id_note_ member.
16381         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16382         "libiberty.h", "md5.h", "sha1.h".
16383         (Layout::Layout): Initialize eh_frame_data_,
16384         eh_frame_hdr_section_, and build_id_note_.
16385         (Layout::finalize): Call create_build_id.
16386         (Layout::create_note): New function, broken out of
16387         Layout::create_gold_note.
16388         (Layout::create_gold_note): Call create_note.
16389         (Layout::create_build_id): New function.
16390         (Layout::write_build_id): New function.
16391         (Close_task_runner::run): Call write_build_id.
16392
16393         * x86_64.cc: Correct license to GPLv3.
16394
16395 2008-03-23  Ian Lance Taylor  <iant@google.com>
16396
16397         * options.cc: Include "demangle.h".
16398         (parse_optional_string): New function.
16399         (parse_long_option): Handle takes_optional_argument.
16400         (parse_short_option): Update dash_z initializer.  Handle
16401         takes_optional_argument.
16402         (General_options::General_options): Initialize do_demangle_.
16403         (General_options::finalize): Set do_demangle_.  Handle demangling
16404         style.
16405         * options.h (parse_optional_string): Declare.
16406         (struct One_option): Add optional_arg field.  Update constructor.
16407         Update call constructor calls.  Add takes_optional_argument
16408         function.
16409         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16410         (DEFINE_optional_string): Define.
16411         (General_options::demangle): Change from DEFINE_bool to
16412         DEFINE_optional_string.
16413         (General_options::no_demangle): New function.
16414         (General_options::do_demangle): New function.
16415         (General_options::set_do_demangle): New function.
16416         (General_options::execstack_status_): Move definition to end of
16417         class definition.
16418         (General_options::static_): Likewise.
16419         (General_options::do_demangle_): New field.
16420         * object.cc (big_endian>::get_symbol_location_info): Call
16421         Options::do_demangle, not Options::demangle.
16422         * symtab.cc (demangle): Likewise.
16423
16424 2008-03-22  Ian Lance Taylor  <iant@google.com>
16425
16426         * gold.h: Include <cstddef> and <sys/types.h>
16427         * options.h: Include <cstring>.
16428
16429 2008-03-21  Ian Lance Taylor  <iant@google.com>
16430
16431         * Added source code to GNU binutils.
16432 \f
16433 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16434
16435 Copying and distribution of this file, with or without modification,
16436 are permitted in any medium without royalty provided the copyright
16437 notice and this notice are preserved.
16438
16439 Local Variables:
16440 mode: change-log
16441 left-margin: 8
16442 fill-column: 74
16443 version-control: never
16444 End: