1 2014-12-03 Alan Modra <amodra@gmail.com>
4 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
5 when adding dynamic relocations against section symbols.
7 2014-12-01 Dimitry Ivanov <dimitry@google.com>
9 * layout.cc (Layout::finish_dynamic_section): When '-z global'
10 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
11 * options.h (General_options): New -z option (global).
13 2014-12-01 Cary Coutant <ccoutant@google.com>
16 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
18 (Layout::create_executable_stack_info): Warn when -z noexecstack is
19 given but some inputs require executable stack.
21 2014-11-26 Cary Coutant <ccoutant@google.com>
23 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
24 .debug_str_offsets; strip .debug_gnu_pubnames and
26 (lines_only_debug_sections): Strip all four new sections.
28 2014-11-26 Jing Yu <jingyu@google.com>
30 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
31 register to be x0 when to relax TLSDESC_LD64_LO12.
33 2014-11-26 Alan Modra <amodra@gmail.com>
35 * powerpc.cc (struct Stub_table_owner): New.
36 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
37 unsigned int vector. Update all references.
38 (powerpc_relobj::set_stub_table): Take an unsigned int param
39 rather than a Stub_table. Update callers.
40 (Powerpc_relobj::clear_stub_table): New function.
41 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
42 stub_group_size_ vars.
43 (Target_powerpc::new_stub_table): Delete.
44 (max_branch_delta): New function, extracted from..
45 (Target_powerpc::Relocate::relocate): ..here..
46 (Target_powerpc::Branch_info::make_stub): ..and here. Return
47 status on whether stub created successfully.
48 (Stub_control::Stub_control): Add "no_size_errors" param. Move
50 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
51 reduce on relax failure.
52 (Target_powerpc::group_sections): Add "no_size_errors" param.
53 Use stub_group_size_. Set up group info in a temp vector,
54 before building Stub_table vector. Account for input sections
55 possibly already converted to relaxed sections.
56 (Stub_table::init): Delete. Merge into..
57 (Stub_table::Stub_table): ..here.
58 (Stub_table::can_reach_stub): New function.
59 (Stub_table::add_plt_call_entry): Add "from" parameter and
60 return true iff stub could be reached.
61 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
63 (Stub_table::clear_stubs): Add "all" param.
65 2014-11-26 Alan Modra <amodra@gmail.com>
67 * powerpc.cc (Stub_control::set_output_and_owner): New function.
68 (Target_powerpc::group_sections): Use it.
70 2014-11-25 Cary Coutant <ccoutant@google.com>
72 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
73 (Binary_to_elf::write_symbol): Add st_size parameter.
74 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
76 2014-11-25 Cary Coutant <ccoutant@google.com>
79 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
80 (Sized_relobj_file::do_layout): Handle deferred sections properly
81 during GC pass 1. Don't add reloc sections to deferred list twice.
82 * object.h (Sized_relobj_file::is_deferred_layout): New function.
83 (Sized_relobj_file::is_deferred_layout_): New data member.
85 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
88 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
89 Check PC-relative offset overflow in PLT entry.
91 2014-11-21 Alan Modra <amodra@gmail.com>
93 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
96 2014-11-20 Alan Modra <amodra@gmail.com>
98 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
99 from --stub-group-size parameter divided by 1024.
100 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
101 template parameter. Update all uses.
102 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
103 has_stub_value. Set for long branches. Don't report overflow for
104 branch to undefined weak symbols. Print info message on
105 overflowing branch to stub.
107 2014-11-20 Alan Modra <amodra@gmail.com>
109 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
111 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
113 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
114 entry for R_X86_64_GOTPLT64.
115 (Target_x86_64<size>::Relocate::relocate): Update comments for
118 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
120 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
121 * plugin.h: add lock definition
123 2014-10-29 Han Shen <shenhan@google.com>
124 Jing Yu <jingyu@google.com>
126 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
127 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
128 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
130 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
132 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
133 (Target_aarch64::tls_ld_to_le): New method.
134 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
136 (Output_data_plt_aarch64::irelative_rel_): New data member.
137 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
138 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
139 (Output_data_plt_aarch64::add_relocation): New method.
140 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
141 offset. Add got_irelative size to got size.
142 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
143 type string with the new typename.
144 (AArch64_relocate_functions::update_adr): Replace parameter x with
146 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
147 (AArch64_relocate_functions::reloc_common): New method.
148 (AArch64_relocate_funcsions::rela_general): Extract common part out
149 into reloc_common method.
150 (AArch64_relocate_functions::rela_general): Likewise.
151 (AArch64_relocate_functions::pcrela_general): Likewise.
152 (AArch64_relocate_functions::adr): New method.
153 (AArch64_relocate_functions::adrp): Calculate immed before calling
155 (AArch64_relocate_functions::adrp): Likewise.
156 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
157 comparing x to 0. Calculate immed from ~x when x < 0.
158 (Target_aarch64::optimize_tls_reloc): Add new cases for
159 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
160 TLSLD_MOVW_DTPREL_G0_NC.
161 (Target_aarch64::possible_function_pointer_reloc): Implement this
163 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
165 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
166 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
167 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
168 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
169 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
170 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
171 (Target_aarch64::make_plt_entry): Call add_entry with two more
173 (Target_aarch64::make_local_ifunc_plt_entry): New method.
174 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
175 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
176 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
177 (Target_aarch64::Relocate::relocate_tls): Add cases for
178 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
179 TLSLD_MOVW_DTPREL_G0_NC.
180 * testsuite/icf_safe_so_test.cc: Correct test comment.
181 * testsuite/icf_safe_test.sh: Add AArch64 arch.
183 2014-10-22 Alan Modra <amodra@gmail.com>
185 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
188 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
190 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
192 2014-10-17 Cary Coutant <ccoutant@google.com>
194 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
195 Add "typename" keyword.
197 2014-10-15 Han Shen <shenhan@google.com>
198 Jing Yu <jingyu@google.com>
200 Patch for gold aarch64 backend to support relaxation.
201 * aarch64-reloc.def: Change format.
202 * aarch64.cc (class Reloc_stub): New class.
203 (class Stub_table): New class.
204 (class AArch64_relobj): New class.
205 (class AArch64_input_section): New class.
206 (class AArch64_output_section): New class.
207 (Target_aarch64::new_stub_table): New method.
208 (Target_aarch64::new_aarch64_input_section): New method.
209 (Target_aarch64::find_aarch64_input_section): New method.
210 (Target_aarch64::scan_section_for_stubs): New method.
211 (Target_aarch64::scan_reloc_section_for_stubs): New method.
212 (Target_aarch64::relocate_stub): New method.
213 (Target_aarch64::current_target): New method.
214 (Target_aarch64::do_make_elf_object): New method.
215 (Target_aarch64::do_may_relax): New method.
216 (Target_aarch64::do_relax): New method.
217 (Target_aarch64::group_sections): New method.
218 (Target_aarch64::scan_reloc_for_stub): New method.
219 (Target_aarch64::do_make_output_section): New method.
220 (Target_aarch64::stub_tables_): New data member.
221 (Target_aarch64::aarch64_input_section_map_): New data member.
222 (AArch64_relocate_functions::maybe_apply_stub): New method.
224 2014-09-30 Cary Coutant <ccoutant@google.com>
227 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
229 2014-09-30 Kito Cheng <kito@0xlab.org>
232 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
233 hash table before sysv-style hash table.
235 2014-09-29 Sriraman Tallam <tmsriram@google.com>
237 * options.h (--pic-executable): Add negative to alias to -no-pie.
239 2014-09-26 Cary Coutant <ccoutant@google.com>
242 * object.cc (Sized_relobj_file): Compute value of section symbols
243 for TLS sections the same as TLS symbols.
245 2014-09-25 Cary Coutant <ccoutant@google.com>
248 * resolve.cc (Symbol_table::resolve): Override common placeholder
249 symbols, but adjust sizes.
250 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
251 symbols to common lists.
253 2014-09-24 Alan Modra <amodra@gmail.com>
255 * po/POTFILES.in: Regenerate.
257 2014-09-23 Taiju Tsuiki <tzik@google.com>
258 Cary Coutant <ccoutant@google.com>
261 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
262 on input_sections_blocker.
263 * layout.cc (Write_sections_task::locks): Unblock
264 input_sections_blocker_.
265 * layout.h (Write_sections_task::Write_sections_task): Add
266 input_sections_blocker.
267 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
269 * testsuite/Makefile.in: Regenerate.
271 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
273 * testsuite/Makefile.am (plugin_test_10): New test.
274 * testsuite/Makefile.in: Regenerate
275 * testsuite/plugin_common_test_2.c (c1): Align to 8.
276 * testsuite/plugin_test_10.sh: New file.
278 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
280 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
281 * resolve.cc (Symbol_table::resolve): Don't override common symbols
282 during the replacement phase.
284 2014-09-17 Han Shen <shenhan@google.com>
285 Jing Yu <jingyu@google.com>
287 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
288 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
289 * aarch64.cc (Target_aarch64): Add data members
290 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
291 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
293 (Target_aarch64::do_reloc_symbol_index): New method.
294 (Target_aarch64::do_reloc_addend): New method.
295 (Target_aarch64::add_tlsdesc_info): New method.
296 (Target_aarch64::do_dynsym_value): New method.
297 (Target_aarch64::do_make_data_plt): Add new parameters: got,
298 got_irelative. Pass them to Output_data_plt_aarch64_standard.
299 (Target_aarch64::make_data_plt): Add new parameters: got,
300 got_irelative. Pass them to do_make_data_plt.
301 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
302 (Target_aarch64::Relocate:tls_gd_to_le): New method.
303 (Target_aarch64::Relocate:tls_ie_to_le): New method.
304 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
305 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
306 (Target_aarch64::got_tlsdesc_section): New method.
307 (Target_aarch64::make_local_ifunc_plt_entry): New method.
308 (Target_aarch64::define_tls_base_symbol): New method.
309 (Target_aarch64::reserve_tlsdesc_entries): New method.
310 (Target_aarch64::got_mod_index_entry): New method.
311 (Target_aarch64::rela_tlsdesc_section): New method.
312 (Target_aarch64::rela_irelative_section): New method.
313 (Target_aarch64::Tlsdesc_info): New struct.
314 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
315 relocations and tlsdesc relocations.
316 (Target_aarch64::optimize_tls_reloc): Implement method.
317 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
318 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
320 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
321 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
322 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
323 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
324 (Output_data_plt_aarch64::rela_tlsdesc): New method.
325 (Output_data_plt_aarch64::rela_irelative): New method.
326 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
327 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
328 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
329 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
330 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
331 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
332 (Output_data_plt_aarch64_standard): New member variables:
333 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
334 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
335 New parameter: got, got_irelative.
336 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
337 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
338 (Output_data_plt_aarch64::do_write): Replace got_address with
339 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
340 (AArch64_relocate_functions::update_movnz): New method.
341 (AArch64_relocate_functions): Correct format.
342 (AArch64_relocate_functions::movnz): New method.
343 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
344 before the switch. Add new cases to switch.
345 Check ie_to_le relaxation on tlsie relocations. Add code handling
347 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
348 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
349 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
350 Call reloc_name_in_error_message to print unsupported reloc.
351 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
353 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
354 relocs. Fill in some more dynamic tags.
355 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
356 Skip call tls_get_addr when tlsgd is relaxed.
357 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
358 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
359 tlsdesc->ie relaxation.
361 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
363 * mips.cc (Target_mips_nacl): New class.
364 (Target_selector_mips_nacl): New class.
365 (target_selector_mips32): Rename from target_selector_mips32be and use
366 Target_selector_mips_nacl instead of Target_selector_mips.
367 (target_selector_mips32el): Rename from target_selector_mips32 and use
368 Target_selector_mips_nacl instead of Target_selector_mips.
369 (target_selector_mips64): Rename from target_selector_mips64be and use
370 Target_selector_mips_nacl instead of Target_selector_mips.
371 (target_selector_mips64el): Rename from target_selector_mips64 and use
372 Target_selector_mips_nacl instead of Target_selector_mips.
373 (Target_mips::mips_info): Add const attribute.
375 2014-09-02 Cary Coutant <ccoutant@google.com>
377 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
378 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
379 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
380 (Sized_incr_dynobj::do_section_name): Likewise.
381 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
382 (Sized_incr_dynobj::do_section_name): Likewise.
383 * object.h (Object::section_name): Likewise.
384 (Object::do_section_name): Likewise.
385 (Sized_relobj_file::do_section_name): Likewise.
386 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
387 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
389 2014-09-02 Cary Coutant <ccoutant@google.com>
392 * ehframe.cc (Fde::write): Add output_offset parameter.
393 (Cie::write): Likewise.
394 (Eh_frame::set_final_data_size): Account for offset within output
396 (Eh_frame::do_sized_write): Likewise.
397 * ehframe.h (Fde::write): Add output_offset parameter.
398 (Cie::write): Likewise.
399 * output.cc (Output_section::Input_section_sort_entry): Remove
400 section_has_name_; add output_section_name parameter. Use
401 output section name for non-input sections.
402 (Output_section::Input_section_sort_entry::section_has_name): Remove.
403 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
404 (Output_section::Input_section_sort_compare): Remove logic for
405 sections without names.
406 (Output_section::Input_section_sort_init_fini_compare): Likewise.
407 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
409 (Output_section::Input_section_sort_section_name_compare): Likewise.
411 2014-08-29 Han Shen <shenhan@google.com>
412 Jing Yu <jingyu@google.com>
414 * aarch64-reloc-property.cc
415 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
416 reference reloc property in the table.
417 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
419 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
420 2 new overloaded methods.
421 (Output_data_got_aarch64::do_write): Add code to write out
423 (class Output_data_got_aarch64::Static_reloc): New class to wrap
425 (Output_data_got_aarch64::static_relocs): New vector to
427 (Target_aarch64::TCB_SIZE): New const static memeber.
428 (Target_aarch64::tcb_size): New method.
429 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
430 (Target_aarch64::Relocate::relocate_tls): New method.
431 (Target_aarch64::Scan::local): Add code handling new reloc types.
432 (Target_aarch64::Scan::global): Add code handling new reloc types.
434 2014-08-13 Sriraman Tallam <tmsriram@google.com>
436 * options.h (-no-pie): Add option.
438 2014-08-08 Jing Yu <jingyu@google.com>
439 Han Shen <shenhan@google.com>
441 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
442 (DEFFILES): add aarch64-reloc.def.
443 (TARGETSOURCES): Add aarch64-reloc-property.cc.
444 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
445 * Makefile.in: Regenerate.
446 * aarch64-reloc-property.cc: New file.
447 * aarch64-reloc-property.h: New file.
448 * aarch64-reloc.def: New file.
449 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
450 with tab to make the format consistent.
451 (Output_data_got_aarch64::symbol_table_): New method.
452 (Target_aarch64::do_plt_address_for_global): New method.
453 (Target_aarch64::do_plt_address_for_local): New method.
454 (Target_aarch64::do_select_as_default_target): New method.
455 (Target_aarch64::do_make_data_plt): New method.
456 (Target_aarch64::make_data_plt): New method.
457 (Output_data_plt_aarch64::has_irelative_section): New method.
458 (Output_data_plt_aarch64::address_for_global): New method.
459 (Output_data_plt_aarch64::address_for_local): New method.
460 (Output_data_plt_aarch64::irelative_rel_): New parameter.
461 (Output_data_plt_aarch64::add_entry): Implement contents.
462 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
463 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
464 the got_pov entry to plt0.
465 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
467 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
468 (AArch64_howto): New struct.
469 (aarch64_howto[]): New static const array.
470 (AArch64_relocate_functions): New class.
471 (Target_aarch64::Scan::get_reference_flags): Remove method.
472 (Target_aarch64::Scan::local): Implement to support a few relocations.
473 (Target_aarch64::Scan::global): Implement to support a few relocations.
474 (Target_aarch64::make_plt_section): Implement contents.
475 (Target_aarch64::make_plt_entry): Implement contents.
476 (Target_aarch64::do_finalize_sections): Implement contents.
477 (Target_aarch64::Relocate::relocate): Implement a few relocations.
478 (Target_aarch64::relocate_section): Implement contents.
480 2014-08-06 Alan Modra <amodra@gmail.com>
482 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
484 2014-08-06 Alan Modra <amodra@gmail.com>
487 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
489 2014-07-21 Sriraman Tallam <tmsriram@google.com>
491 * object.cc (Relobj::is_section_name_included): Add
492 ".rodata.nptl_version" to not garbage collect this section.
494 2014-07-08 Cary Coutant <ccoutant@google.com>
496 * expression.cc (struct Expression::Expression_eval_info): Add
497 new fields type_pointer, vis_pointer, and nonvis_pointer.
498 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
499 nonvis_pointer parameters. Adjust all calls.
500 (Symbol_expression::value): Update type, visibility, and nonvis bits
502 * script.cc (Symbol_assignment::sized_finalize): Update type,
503 visibility, and remaining st_other bits for new symbol.
504 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
505 vis_pointer, and nonvis_pointer parameters.
506 * symtab.h (Symbol::set_type): New method.
508 * testsuite/Makefile.am (defsym_test): New test.
509 * testsuite/Makefile.in: Regenerate.
510 * testsuite/defsym_test.c: New file.
511 * testsuite/defsym_test.sh: New file.
513 2014-07-08 Cary Coutant <ccoutant@google.com>
516 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
517 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
518 (Sized_dynobj::base_read_symbols): ...new method.
519 * object.h (Sized_relobj_file::base_read_symbols): New method.
520 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
521 (Sized_relobj_file::base_read_symbols): ...new method.
522 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
523 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
524 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
526 2014-07-04 Alan Modra <amodra@gmail.com>
528 * po/POTFILES.in: Regenerate.
530 2014-07-02 Jing Yu <jingyu@google.com>
532 * aarch64.cc: New file
533 * Makefile.am (TARGETSOURCES): Add aarch64.cc
534 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
535 * Makefile.in: Regenerate.
536 * configure.tgt: Add entries for aarch64*.
537 * configure.ac: Likewise.
538 * configure: Likewise.
540 2014-06-27 Alan Modra <amodra@gmail.com>
542 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
544 2014-06-24 Cary Coutant <ccoutant@google.com>
546 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
548 (Dwo_file::sized_read_unit_index): Likewise.
550 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
553 * Makefile.am (TARGETSOURCES): Add mips.cc
554 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
555 * configure.tgt: Add entries for mips*.
556 * configure.ac: Likewise.
557 * Makefile.in: Regenerate.
558 * configure: Likewise.
560 2014-06-09 Cary Coutant <ccoutant@google.com>
562 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
563 unit_length is within section bounds.
565 2014-06-09 Cary Coutant <ccoutant@google.com>
568 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
571 2014-06-07 Alan Modra <amodra@gmail.com>
573 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
575 2014-06-06 Cary Coutant <ccoutant@google.com>
577 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
578 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
579 (Dwarf_pubnames_table::read_header): Likewise.
580 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
583 2014-06-05 Joel Brobecker <brobecker@adacore.com>
585 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
586 * Makefile.in, configure: Regenerate.
588 2014-06-03 Alan Modra <amodra@gmail.com>
590 * powerpc.cc (addis_12_2): Define.
591 (Stub_table::do_write): Support fusion on ELFv2 stubs.
593 2014-06-03 Alan Modra <amodra@gmail.com>
595 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
598 2014-06-02 Alan Modra <amodra@gmail.com>
600 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
601 Only ignore relocs on ELFv1.
602 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
604 2014-05-30 Cary Coutant <ccoutant@google.com>
606 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
607 * testsuite/Makefile.in: Regenerate.
608 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
610 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
613 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
614 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
616 2014-05-15 Alan Modra <amodra@gmail.com>
618 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
619 Compare FDE contents with DW_CFA_nop rather than 0.
621 2014-05-13 Sriraman Tallam <tmsriram@google.com>
623 * symtab.h (may_need_copy_reloc): Remove check for position independent
625 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
626 position independence before pc absolute may_need_copy_reloc call.
627 Add check for executable output befor pc relative may_need_copy_reloc
633 * powerpc.cc: Add check for no position independence before
634 may_need_copy_reloc calls.
635 * testsuite/pie_copyrelocs_test.cc: New file.
636 * testsuite/pie_copyrelocs_shared_test.cc: New file.
637 * Makefile.am (pie_copyrelocs_test): New test.
638 * Makefile.in: Regenerate.
640 2014-05-08 Martin Liška <mliska@suse.cz>
642 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
644 2014-05-06 Cary Coutant <ccoutant@google.com>
647 * i386.cc (Output_data_got_plt_i386): New class.
648 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
649 parameter. Change all callers.
650 (Output_data_plt_i386::layout_): Remove.
651 (Output_data_plt_i386::got_plt_): Change type.
652 (Target_i386::got_plt_): Change type. Change all references.
653 (Target_i386::got_section): Create instance of new class.
654 (Output_data_got_plt_i386::do_write): New function.
655 * x86_64.cc (Output_data_got_plt_x86_64): New class.
656 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
657 parameter. Change all callers.
658 (Output_data_plt_x86_64::layout_): Remove.
659 (Output_data_plt_x86_64::got_plt_): Change type.
660 (Target_x86_64::got_plt_): Change type. Change all references.
661 (Target_x86_64::got_section): Create instance of new class.
662 (Output_data_got_plt_x86_64::do_write): New function.
663 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
664 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
667 2014-05-05 Cary Coutant <ccoutant@google.com>
669 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
670 if we have pubnames/pubtypes.
672 2014-05-02 Cary Coutant <ccoutant@google.com>
674 * defstd.cc (in_segment): Define __ehdr_start here...
675 * layout.cc (Layout::finalize): ...Instead of here. Set the
676 output segment when known.
677 * resolve.cc (Symbol::override_base_with_special): Remember
678 the original binding.
679 * symtab.cc (Symbol::set_output_segment): New function.
680 (Symbol::set_undefined): New function.
681 * symtab.h (Symbol::is_weak_undefined): Check original undef
683 (Symbol::is_strong_undefined): New function.
684 (Symbol::set_output_segment): New function.
685 (Symbol::set_undefined): New function.
686 * target-reloc.h (is_strong_undefined): Remove.
687 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
688 Check for hidden undefs.
689 (relocate_section): Call Symbol::is_strong_undefined.
691 * testsuite/Makefile.am (ehdr_start_test_1)
692 (ehdr_start_test_2, ehdr_start_test_3)
693 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
694 * testsuite/Makefile.in: Regenerate.
695 * testsuite/ehdr_start_def.cc: New source file.
696 * testsuite/ehdr_start_test.cc: New source file.
697 * testsuite/ehdr_start_test.t: New linker script.
698 * testsuite/ehdr_start_test_4.sh: New shell script.
700 2014-04-23 Cary Coutant <ccoutant@google.com>
703 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
705 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
707 * layout.cc (Layout::include_section): Allow a target to decide
708 whether to include a section.
709 * target.h (Target::should_include_section): New function.
710 (Target::do_should_include_section): New function.
712 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
714 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
716 (Copy_relocs::emit): ... here.
717 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
718 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
719 (Copy_reloc_entry::entries_): Change from private to protected.
721 2014-04-02 Sriraman Tallam <tmsriram@google.com>
723 * icf.cc (get_section_contents): Replace copies of reloc
724 vectors with const references.
726 2014-04-02 Cary Coutant <ccoutant@google.com>
728 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
729 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
730 * configure: Regenerate.
731 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
732 -fno-use-linker-plugin.
733 (LINK1, CXXLINK1): Add it to the link command.
734 * testsuite/Makefile.in: Regenerate.
736 2014-03-12 Alan Modra <amodra@gmail.com>
738 * Makefile.in: Regenerate.
740 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
742 * symtab.h (Symbol::set_nonvis): New function.
744 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
746 * symtab.cc (Sized_symbol<32>::init_output_data):
747 Instantiate the template.
748 (Sized_symbol<64>::init_output_data): Likewise.
750 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
752 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
753 adjust dynamic symbol value.
754 * target.h (Target::adjust_dyn_symbol): New function.
755 (Target::do_adjust_dyn_symbol): New function.
757 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
759 * output.cc (Output_data_dynamic::Dynamic_entry::write):
760 Get the value of DYNAMIC_CUSTOM dynamic entry.
761 * output.h (Output_data_dynamic::add_custom): New function.
762 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
764 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
765 * target.h (Target::dynamic_tag_custom_value): New function.
766 (Target::do_dynamic_tag_custom_value): New function.
768 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
770 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
772 * target.h (Target::has_custom_set_dynsym_indexes): New function.
773 (Target::do_has_custom_set_dynsym_indexes): New function.
774 (Target::set_dynsym_indexes): New function.
775 (Target::do_set_dynsym_indexes): New function.
777 2014-03-07 Alan Modra <amodra@gmail.com>
779 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
780 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
781 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
782 (Powerpc_relocate_functions::has_overflow_bitfield,
783 overflowed): Use the above.
784 (Target_powerpc::Relocate::relocate): Correct overflow checking
785 for a number of relocations. Modify overflow test for 16-bit
786 fields in instructions to signed/unsigned according to whether
787 the field takes a signed or unsigned value.
789 2014-03-05 Alan Modra <amodra@gmail.com>
791 Update copyright years.
793 2014-03-05 Alan Modra <amodra@gmail.com>
795 * powerpc.cc (Target_powerpc::Scan::local, global): Support
796 R_PPC64_ADDR64_LOCAL.
797 (Target_powerpc::Relocate::relocate): Likewise.
799 2014-03-03 Alan Modra <amodra@gmail.com>
801 * dwp.cc (print_version): Update copyright year to current.
803 2014-02-10 Alan Modra <amodra@gmail.com>
805 * po/gold.pot: Regenerate.
807 2014-02-06 Cary Coutant <ccoutant@google.com>
809 Fix problem where -u is ignored when a weak undef is seen.
811 * archive.cc (Library_base::should_include_member): Reorder
812 code to check for -u option if a weak undef has already been seen.
813 * testsuite/Makefile.am (weak_undef_test_2): New test case.
814 * testsuite/Makefile.in: Regenerate.
815 * testsuite/weak_undef_file3.cc: New file.
816 * testsuite/weak_undef_file4.cc: New file.
817 * testsuite/weak_undef_test_2.cc: New file.
819 2014-02-05 Cary Coutant <ccoutant@google.com>
821 Fix issues with gold undefined symbol diagnostics.
824 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
826 * target-reloc.h (is_strong_undefined): New function.
827 (relocate_section): Move undef vtable symbol check from here.
828 Check for is_strong_undefined.
830 2014-02-05 Cary Coutant <ccoutant@google.com>
832 Fix problems with the --dynamic-list option.
835 * options.cc (General_options::parse_dynamic_list):
836 Set have_dynamic_list_.
837 (General_options::General_options): Initialize have_dynamic_list_.
838 (General_options::finalize): Turn off -Bsymbolic and
839 -Bsymbolic-functions if --dynamic-list provided.
840 * options.h (General_options::have_dynamic_list): New function.
841 (General_options::have_dynamic_list_): New data member.
842 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
846 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
847 in --dynamic-list, mark it.
849 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
850 (dynamic_list_2): New test case.
851 * testsuite/Makefile.in: Regenerate.
852 * testsuite/dynamic_list_2.cc: New file.
853 * testsuite/dynamic_list_2.t: New file.
854 * testsuite/dynamic_list_lib1.cc: New file.
855 * testsuite/dynamic_list_lib2.cc: New file.
856 * testsuite/gc_dynamic_list_test.c: New file.
857 * testsuite/gc_dynamic_list_test.sh: New file.
858 * testsuite/gc_dynamic_list_test.t: New file.
860 2014-01-28 Cary Coutant <ccoutant@google.com>
862 Add .gdb_index version 7 support.
864 * gold/dwarf_reader.cc: include <utility> (for make_pair).
865 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
867 (Dwarf_ranges_table::read_ranges_table): Likewise.
868 (Dwarf_pubnames_table::read_section): Check for GNU-style
869 sections, and for compressed debug sections.
870 (Dwarf_pubnames_table::read_header): Compute end address of table.
871 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
872 for end of list by offset, not by offset == 0.
873 (Dwarf_info_reader::do_read_string_table): Check for compressed
875 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
876 Initialize new data members.
877 (Dwarf_pubnames_table::next_name): return flag_byte.
878 (Dwarf_pubnames_table::end_of_table_): New data member.
879 (Dwarf_pubnames_table::is_gnu_style_): New data member.
880 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
881 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
882 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
883 read skeleton type unit DIEs.
884 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
885 (Gdb_index::do_write): Write flag_byte.
886 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
887 (Gdb_index::Cu_vector): Store flags along with cu indexes.
888 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
889 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
891 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
893 * version.cc (print_version): Update copyright year to 2014.
895 2013-12-19 Dimitry Andric <dimitry@andric.com>
897 * stringpool.cc (Stringpool_template::reserve): Add
898 HAVE_UNORDERED_MAP case.
899 * stringpool.cc (Stringpool_template::print_stats): Likewise.
901 2013-12-18 Cary Coutant <ccoutant@google.com>
903 * configure.ac: Check for <unordered_set> and <unordered_map>.
904 * config.in: Regenerate.
905 * configure: Regenerate.
906 * system.h: Use <unordered_set> and <unordered_map> if available.
908 2013-12-10 Roland McGrath <mcgrathr@google.com>
910 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
911 with $(INSTALL_PROGRAM_ENV).
912 * Makefile.in: Regenerate.
914 2013-11-22 Cary Coutant <ccoutant@google.com>
916 * configure.ac: Add check for which library is needed for
918 * configure: Regenerate.
920 2013-11-22 Cary Coutant <ccoutant@google.com>
922 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
924 * testsuite/Makefile.in: Regenerate.
926 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
928 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
929 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
930 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
931 (Target_x86_64<size>::Scan::local): Likewise.
932 (Target_x86_64<size>::Scan::global): Likewise.
933 (Target_x86_64<size>::Relocate::relocate): Likewise.
934 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
936 (Target_x86_64<size>::Scan::check_non_pic(): Handle
939 * testsuite/Makefile.am (check_PROGRAMS): Add
940 exception_x86_64_bnd_test.
941 (exception_x86_64_bnd_test_SOURCES): New macro.
942 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
943 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
944 (exception_x86_64_bnd_test_LDADD): Likewise.
945 (exception_x86_64_bnd_1.o): New rule.
946 (exception_x86_64_bnd_2.o): Likewise.
947 * testsuite/Makefile.in: Regenerated.
949 2013-11-15 Alan Modra <amodra@gmail.com>
951 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
953 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
954 Only call ppc64_local_entry_offset for 64-bit. Restrict
955 symval_for_branch lookup to ELFv1.
956 (Stub_table::add_plt_call_entry): Use unsigned int off.
957 (Output_data_glink::Address, invalid_address): New.
958 (Output_data_glink::add_eh_frame): Move out of line. Add
960 (Output_data_glink::add_global_entry, find_global_entry,
961 global_entry_address): New functions.
962 (Output_data_glink::global_entry_stubs_, end_branch_table_,
963 ge_size): New variables.
964 (Output_data_glink::set_final_data_size): Add global entry
966 (Output_data_glink::do_write): Write global entry stubs.
967 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
968 parameter. Return true for ELFv2. Adjust callers.
969 (Target_powerpc::Scan::local, global): Restrict opd lookup to
970 ELFv1. Similarly for ifunc and dynamic relocation processing
971 specific to ELFv1. Recognize that symbols are defined on
972 their plt entries for ELFv2.
973 (Target_powerpc::symval_for_branch): Assert if called for
975 (Target_powerpc::Relocate::relocate): Use global entry plt
976 stub for symbol value if such exists on ELFv2.
977 (Target_powerpc::Relocate::relocate): Don't call
978 symval_for_branch when ELFv2. Do adjust for local entry
980 (Target_powerpc::do_dynsym_value): Set symbols to global entry
982 (Target_powerpc::do_plt_address_for_global): Similarly.
984 2013-11-14 Cary Coutant <ccoutant@google.com>
986 Revert patch -- this did not fix the problem, and there is
989 2013-11-14 Cary Coutant <ccoutant@google.com>
992 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
993 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
994 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
995 updating fde_offsets_.
996 (Eh_frame_hdr::lock_): New data member.
998 2013-11-14 Cary Coutant <ccoutant@google.com>
1000 * dwp.cc (Dwo_file_entry): New type.
1001 (File_list): Use Dwo_file_entry.
1002 (Dwo_file::verify): New function.
1003 (Dwo_file::verify_dwo_list): New function.
1004 (Dwo_file::sized_verify_dwo_list): New function.
1005 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1007 (Dwp_options): New enum type.
1008 (dwp_options): Add --verify-only.
1011 * dwp.h (gold_info): Add declaration.
1013 2013-11-14 Cary Coutant <ccoutant@google.com>
1016 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1017 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1018 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1019 updating fde_offsets_.
1020 (Eh_frame_hdr::lock_): New data member.
1022 2013-11-06 Cary Coutant <ccoutant@google.com>
1025 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1026 before reloc sections.
1028 2013-11-04 Alan Modra <amodra@gmail.com>
1030 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1031 (Symbol::needs_dynamic_reloc): Test new flag.
1032 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1033 (Target_powerpc::Scan::get_reference_flags): Add target param.
1034 Return FUNC_DESC_ABI for 64-bit ELFv1.
1035 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1037 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1038 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1040 2013-10-31 Cary Coutant <ccoutant@google.com>
1042 Restore support for dwp v2 DWARF package file format.
1044 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1045 tu_length parameter. Adjust all callers.
1046 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1047 * dwp.cc: Include dwarf.h.
1048 (Section_bounds): New struct type.
1049 (Unit_set): New struct type.
1050 (Dwo_file::Dwo_file): Initialize new data member.
1051 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1052 Combine and rename to...
1053 (Dwo_file::read_unit_index): ...this.
1054 (Dwo_file::sized_read_compunit_index)
1055 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1056 (Dwo_file::sized_read_unit_index): ...this.
1057 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1058 parameters; add section_id parameter.
1059 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1060 (Dwo_file::add_unit_set): ...this.
1061 (Dwo_file::shndx_map_): Remove.
1062 (Dwo_file::sect_offsets_): New data member.
1063 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1064 (Dwp_output_file::add_section): Rename to...
1065 (Dwp_output_file::add_contribution): ...this.
1066 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1067 (Dwp_output_file::add_tu_set): Likewise.
1068 (Dwp_output_file::Contribution): New type.
1069 (Dwp_output_file::Section::contributions): New data member.
1070 (Dwp_output_file::Cu_or_tu_set): Remove.
1071 (Dwp_output_file::Section::Section): New ctor.
1072 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1073 (Dwp_output_file::Dwp_index::Section_table): New type.
1074 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1075 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1077 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1078 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1079 (Dwp_output_file::Dwp_index::section_table): New member function.
1080 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1081 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1082 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1083 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1084 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1085 (Dwp_output_file::Dwp_index::section_table_): New data member.
1086 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1087 (Dwp_output_file::add_output_section): New member function.
1088 (Dwp_output_file::write_new_section): New member function.
1089 (Dwp_output_file::write_contributions): New member function.
1090 (Dwp_output_file::section_id_map_): New data member.
1091 (class Dwo_id_info_reader): Remove.
1092 (class Unit_reader): New class.
1093 (get_dwarf_section_name): New function.
1094 (Dwo_file::read_executable): Adjust initializations of class data.
1095 (Dwo_file::read): Add support for v2 package file format.
1096 (Dwo_file::read_unit_index): Likewise.
1097 (Dwo_file::sized_read_unit_index): Likewise.
1098 (Dwo_file::copy_section): Likewise.
1099 (Dwo_file::add_unit_set): Likewise.
1100 (Dwp_output_file::add_output_section): Likewise.
1101 (Dwp_output_file::add_contribution): Likewise.
1102 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1104 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1106 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1108 (Dwp_output_file::initialize): Remove unused function.
1109 (Dwp_output_file::finalize): Add support for v2 package file format.
1110 (Dwp_output_file::write_index): Likewise.
1111 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1114 2013-10-31 Cary Coutant <ccoutant@google.com>
1116 * configure.ac: Fix check for -fmerge-constants.
1117 * configure.ac: Regenerate.
1119 2013-10-30 Roland McGrath <mcgrathr@google.com>
1121 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1122 Correct 9-byte nop sequence to match what the assembler generates.
1124 2013-10-30 Alan Modra <amodra@gmail.com>
1126 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1127 ppc64_local_entry_offset, ppc64_local_entry_offset,
1128 do_read_symbols): New functions.
1129 (Powerpc_relobj::e_flags_, st_other_): New vars.
1130 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1131 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1132 (Powerpc_relobj::e_flags_): New var.
1133 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1134 and adjust for ELFv2.
1135 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1136 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1137 (Powerpc_dynobj::do_find_special_sections): Likewise.
1138 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1139 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1140 to ELFv2 local entry.
1141 (Target_powerpc::do_relax): No thread safe barriers needed for
1143 (Output_data_plt_powerpc::initial_plt_entry_size_,
1144 plt_entry_size): Delete. Replace all uses with
1145 first_plt_entry_offset() and plt_entry_size().
1146 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1147 reserved_size parm. Update callers.
1148 (Output_data_plt_powerpc::entry_count): Update.
1149 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1150 and use Target_powerpc::first_plt_entry_offset().
1151 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1152 rename to plt_entry_size.
1153 (Output_data_plt_powerpc::add_ifunc_entry,
1154 add_local_ifunc_entry): Adjust reloc for ELFv2.
1155 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1156 (glink_eh_frame_fde_64v2): New.
1157 (Stub_table::plt_call_size): Support ELFv2 sizing.
1158 (Output_data_glink::add_eh_frame): Use the new FDE.
1159 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1160 (Stub_table::do_write): Write ELFv2 stubs and glink.
1161 (Target_powerpc::Relocate::relocate): Replaces nop after call
1162 with ld 2,24(1) and adjust local offset destination for ELFv2.
1164 2013-10-30 Alan Modra <amodra@gmail.com>
1166 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1167 (Target_powerpc::Scan::global, local): Likewise.
1168 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
1169 on all ppc64 @h and @ha relocs.
1171 2013-10-14 Alan Modra <amodra@gmail.com>
1173 * output.h (Output_data_got::add_constant): Tidy.
1174 (Output_data_got::add_constant_pair): New function.
1175 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1176 methods used so as to first call reserve_ent().
1178 2013-10-11 Roland McGrath <mcgrathr@google.com>
1180 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1181 add_got_entry and add_got_entry_pair.
1183 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1184 (HAVE_PUBNAMES): Likewise.
1185 * configure: Regenerate.
1187 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1188 * testsuite/Makefile.in: Regenerate.
1190 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1191 Remove const from declaration.
1192 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1193 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1194 * output.h (Output_file_header): Remove const from member target_
1195 and corresponding constructor argument.
1196 * output.cc (Output_file_header::Output_file_header): Update prototype.
1197 (Output_file_header::do_sized_write): Use this->target_ in place
1198 of parameters()->target().
1200 * testsuite/undef_symbol.cc (Foo::get_a): New method.
1202 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1203 * configure: Regenerate.
1204 * Makefile.in: Regenerate.
1205 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1206 * testsuite/merge_string_literals_2.c: Likewise.
1207 * testsuite/Makefile.am
1208 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1209 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1210 literal -fmerge-constants.
1211 * testsuite/Makefile.in: Regenerate.
1213 * i386.cc (Target_i386): Remove unused member dynbss_.
1214 * arm.cc (Target_arm): Likewise.
1215 * powerpc.cc (Target_powerpc): Likewise.
1216 * sparc.cc (Target_sparc): Likewise.
1217 * tilegx.cc (Target_tilegx): Likewise.
1218 * x86_64.cc (Target_x86_64): Likewise.
1219 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1220 type_signature_, type_offset_.
1221 * plugin.h (Plugin_hook): Remove unused member layout_.
1222 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1224 (Read_member): Remove unused members input_objects_, symtab_,
1226 (Check_library): Remove unused member symtab_.
1227 * archive.h (Lib_group): Remove unused member lib_.
1228 * archive.cc (Lib_group::Lib_group): Update initializer.
1229 * incremental.h (Incremental_binary): Remove unused member target_.
1230 (Incremental_script_entry): Removed unused member script_.
1231 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1232 * icf.h (Icf): Remove unused member num_tracked_relocs.
1234 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1235 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1237 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1239 * archive.h: Use struct rather than class for forward declaration
1240 of Read_symbols_data.
1242 2013-10-07 Cary Coutant <ccoutant@google.com>
1245 * testsuite/Makefile.am (icf_test): Fix dependencies.
1246 (icf_safe_test): Likewise.
1247 (icf_safe_so_test): Likewise.
1248 (large_symbol_alignment): Add empty _LDADD rule.
1249 * testsuite/Makefile.in: Regenerate.
1251 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
1254 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1255 relocation for R_X86_64_32 on x32.
1257 2013-08-27 Roland McGrath <mcgrathr@google.com>
1259 * output.cc (Output_segment::set_section_addresses): Take new
1260 Target* argument. If target->isolate_execinstr() and the segment
1261 is executable and starts at a target->abi_pagesize() boundary,
1262 pad its end out to a target->abi_pagesize() boundary with code fill.
1263 * output.h (Output_segment::set_section_addresses): Update decl.
1264 * layout.h (Layout::check_output_data_for_reset_values): Take new
1265 argument RELAX_OUTPUTS.
1266 (Layout): New member relax_output_list_.
1267 (Layout::add_relax_output): New method.
1268 * layout.cc (Layout::Layout): Update constructor.
1269 (Layout::reset_relax_output): New method.
1270 (Layout::clean_up_after_relaxation): Call it.
1271 (Layout::prepare_for_relaxation): Update caller.
1272 (Layout::set_segment_offsets): Update callers of set_section_addresses.
1273 Call reset_relax_output before re-processing segments for
1274 isolate_execinstr case.
1275 (Layout::write_data): Handle relax_output_list_.
1276 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1277 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1279 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1282 * object.h: Fix typos.
1284 2013-08-16 Roland McGrath <mcgrathr@google.com>
1286 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1287 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1289 2013-08-07 Cary Coutant <ccoutant@google.com>
1291 Revert support for v2 DWP files:
1293 2013-03-01 Cary Coutant <ccoutant@google.com>
1295 Add dwp support for v2 DWARF package file format.
1296 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1297 tu_length parameter. Adjust all callers.
1298 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1299 * dwp.cc: Include dwarf.h.
1300 (Section_bounds): New struct type.
1301 (Unit_set): New struct type.
1302 (Dwo_file::Dwo_file): Initialize new data member.
1303 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1304 Combine and rename to...
1305 (Dwo_file::read_unit_index): ...this.
1306 (Dwo_file::sized_read_compunit_index)
1307 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1308 (Dwo_file::sized_read_unit_index): ...this.
1309 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1310 parameters; add section_id parameter.
1311 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1312 (Dwo_file::add_unit_set): ...this.
1313 (Dwo_file::shndx_map_): Remove.
1314 (Dwo_file::sect_offsets_): New data member.
1315 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1316 (Dwp_output_file::add_section): Rename to...
1317 (Dwp_output_file::add_contribution): ...this.
1318 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1319 (Dwp_output_file::add_tu_set): Likewise.
1320 (Dwp_output_file::Contribution): New type.
1321 (Dwp_output_file::Section::contributions): New data member.
1322 (Dwp_output_file::Cu_or_tu_set): Remove.
1323 (Dwp_output_file::Section::Section): New ctor.
1324 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1325 (Dwp_output_file::Dwp_index::Section_table): New type.
1326 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1327 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1329 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1330 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1331 (Dwp_output_file::Dwp_index::section_table): New member function.
1332 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1333 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1334 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1335 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1336 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1337 (Dwp_output_file::Dwp_index::section_table_): New data member.
1338 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1339 (Dwp_output_file::add_output_section): New member function.
1340 (Dwp_output_file::write_new_section): New member function.
1341 (Dwp_output_file::write_contributions): New member function.
1342 (Dwp_output_file::section_id_map_): New data member.
1343 (class Dwo_id_info_reader): Remove.
1344 (class Unit_reader): New class.
1345 (get_dwarf_section_name): New function.
1346 (Dwo_file::read_executable): Adjust initializations of class data.
1347 (Dwo_file::read): Add support for v2 package file format.
1348 (Dwo_file::read_unit_index): Likewise.
1349 (Dwo_file::sized_read_unit_index): Likewise.
1350 (Dwo_file::copy_section): Likewise.
1351 (Dwo_file::add_unit_set): Likewise.
1352 (Dwp_output_file::add_output_section): Likewise.
1353 (Dwp_output_file::add_contribution): Likewise.
1354 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1356 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1358 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1360 (Dwp_output_file::initialize): Remove unused function.
1361 (Dwp_output_file::finalize): Add support for v2 package file format.
1362 (Dwp_output_file::write_index): Likewise.
1363 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1366 2013-07-31 Cary Coutant <ccoutant@google.com>
1368 * object.cc (Sized_relobj::do_output_section_address): New function.
1369 (Sized_relobj): Instantiate explicitly.
1370 * object.h (Object::output_section_address): New function.
1371 (Object::do_output_section_address): New function.
1372 (Sized_relobj::do_output_section_address): New function.
1373 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1375 2013-07-30 Cary Coutant <ccoutant@google.com>
1376 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1378 * parameters.cc (Parameters::entry): Return target-specific entry
1380 * target.h (Target::entry_symbol_name): New function.
1381 (Target_info::entry_symbol_name): New data member.
1383 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1384 * i386.cc (Target_i386::i386_info): Likewise.
1385 (Target_i386_nacl::i386_nacl_info): Likewise.
1386 * sparc.cc (Target_sparc::sparc_info): Likewise.
1387 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1388 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1389 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1390 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1392 2013-07-22 Sterling Augustine <saugustine@google.com>
1394 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1395 Convert parameter shndx to local variable. Add parameters symtab
1396 and symtab_size. Scan over section names. Find relocation
1397 section corresponding to current section. Create and initialize
1398 reloc_mapper_ and reloc_type_.
1399 (Dwarf_pubnames_table::read_header): Add assertion. Change
1400 unit_length to off_t. Initialize member unit_length_. Fill in field
1402 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1403 Initialize new fields unit_length_ and cu_offset_.
1404 (Dwarf_pubnames_table::read_section): Update prototype.
1405 (Dwarf_pubnames_table::cu_offset): New member function.
1406 (Dwarf_pubnames_table::subsection_size): Likewise.
1407 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1409 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1410 member functions public.
1411 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1412 Update comment. Rework logic. Move repeated parts to...
1413 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1414 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1415 pubtypes_table_, and stmt_list_offset.
1416 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1417 Gdb_index::find_pubtype_offset,
1418 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1419 (Gdb_index::pubnames_read): Update prototype and rework logic.
1420 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1422 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1423 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1424 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1425 Gdb_index::map_pubtable_to_dies):
1427 (Gdb_index::pubnames_read): Update declaration.
1428 (Gdb_index::Pubname_offset_map): New type.
1429 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1430 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1431 Gdb_index::stmt_list_offset): Declare.
1432 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1433 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1434 Gdb_index::pubtypes_offset_): Remove.
1436 2013-07-19 Roland McGrath <mcgrathr@google.com>
1438 * options.h (General_options): Add -Trodata-segment option.
1439 * parameters.cc (Parameters::check_rodata_segment): New function.
1440 (Parameters::set_target_once): Call it.
1441 * parameters.h (Parameters): Declare it (private member function).
1442 * layout.cc (load_seg_unusable_for_headers): New function, broken
1443 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1444 then validate rodata segment rather than text segment.
1445 (relaxation_loop_body): Call that.
1446 (is_text_segment): New function. Don't admit a non-executable
1447 segment if TARGET->isolate_execinstr().
1448 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1450 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1453 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1454 * nacl.h (Sniff_file::View::View): Request aligned view.
1456 2013-07-11 Cary Coutant <ccoutant@google.com>
1458 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1459 correct BRLT entry size.
1461 2013-07-03 Alan Modra <amodra@gmail.com>
1463 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1466 2013-07-01 Cary Coutant <ccoutant@google.com>
1468 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1470 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1471 (Dwarf_ranges_table::lookup_reloc): New function.
1472 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1474 (Dwarf_ranges_table::lookup_reloc): New function.
1475 (Dwarf_ranges_table::reloc_type_): New data member.
1477 2013-06-27 Jing Yu <jingyu@google.com>
1480 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1482 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1483 (Target_powerpc::do_relax): Call the above.
1485 2013-06-27 Cary Coutant <ccoutant@google.com>
1487 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1488 on garbage collected .opd section.
1490 2013-06-27 Alan Modra <amodra@gmail.com>
1492 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1494 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1495 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1497 2013-06-14 Cary Coutant <ccoutant@google.com>
1499 * resolve.cc (Symbol::override_base): Don't override st_type
1500 from plugin placeholder symbols.
1501 (Symbol_table::resolve): Likewise.
1502 (Symbol_table::should_override): Don't complain about TLS mismatch
1503 if the TO symbol is a plugin placeholder.
1504 * testsuite/Makefile.am (plugin_test_tls): New test.
1505 * testsuite/Makefile.in: Regenerate.
1506 * testsuite/plugin_test_tls.sh: New test script.
1507 * testsuite/two_file_test_2_tls.cc: New test source.
1508 * testsuite/two_file_test_tls.cc: New test source.
1510 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1512 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1513 the maximum segment alignment is larger than the page size.
1514 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1515 correctly aligns the symbols with large alignemnt.
1516 * testsuite/Makefile.in: Regenerate.
1517 * testsuite/large_symbol_alignment.cc: New file.
1519 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1520 Sriraman Tallam <tmsriram@google.com>
1522 * options.h (sort_section): New option.
1523 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1524 Rename from Input_section_sort_section_name_special_ordering_compare.
1525 (Input_section_sort_section_name_compare): New struct.
1526 * output.cc (Output_section::Input_section_sort_section_name_compare::
1527 operator()): New function.
1528 (Output_section::sort_attached_input_sections): Use new sort function
1529 for .text if --sort-section=name is specified.
1530 * layout.cc (Layout::make_output_section):
1531 Add sorting by name when --sort-section=name is specified.
1532 * testsuite/Makefile.am (text_section_grouping): Test option
1533 --sort-section=name.
1534 * testsuite/Makefile.in: Regenerate.
1535 * testsuite/section_sorting_name.cc: New file.
1536 * testsuite/section_sorting_name.sh: New file.
1538 2013-05-21 Cary Coutant <ccoutant@google.com>
1540 * symtab.h (Symbol::is_cxx_vtable): New function.
1541 * target-reloc.h (relocate_section): Check for vtable symbol.
1542 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1543 * testsuite/Makefile.in: Regenerate.
1544 * testsuite/missing_key_func.cc: New test source.
1545 * testsuite/missing_key_func.sh: New test script.
1547 2013-05-21 Cary Coutant <ccoutant@google.com>
1549 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1550 type of enclosing symbol.
1551 (Relocate_info::location): Check symbol type when describing symbol.
1552 * object.h (Symbol_location_info): Remove unused line_number;
1553 add enclosing_symbol_type.
1554 * testsuite/debug_msg.sh: Adjust expected output.
1556 2013-05-13 Cary Coutant <ccoutant@google.com>
1558 * configure.ac: Export DEFAULT_TARGET.
1559 * configure: Regenerate.
1560 * Makefile.in: Regenerate.
1561 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1562 * testsuite/Makefile.in: Regenerate.
1563 * testsuite/debug_msg.sh: Delete duplicate tests.
1564 Don't check undef_int error message match for powerpc where the
1565 source file and line number aren't available.
1567 2013-05-10 Roland McGrath <mcgrathr@google.com>
1569 * options.h (General_options): Add --rosegment-gap option.
1570 * options.cc (finalize): --rosegment-gap implies --rosegment.
1571 * layout.cc (set_segment_offsets): Let user option override
1572 target->rosegment_gap().
1574 2013-05-10 Roland McGrath <mcgrathr@google.com>
1576 * options.h (General_options): Remove leading space from help
1577 messages for -nostdlib and --rosegment.
1579 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1582 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1584 2013-05-03 Alan Modra <amodra@gmail.com>
1586 * merge.cc (Output_merge_string::do_add_input_section): Correct
1587 scan for number of strings. Rename vars to avoid shadowing.
1588 Include missing terminator in input_size_.
1590 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1592 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1593 Restore empty string handling.
1595 2013-05-01 Cary Coutant <ccoutant@google.com>
1597 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1598 uninitialized warning.
1600 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1602 * output.cc (Output_section::add_merge_input_section): Allow
1603 to merge sections if the alignment is more than character size.
1604 * merge.h (Output_merge_string::Output_merge_string): Remove
1606 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1607 only not-null strings. Check the alignment of strings.
1609 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1610 alignment as the argument.
1611 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1612 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1613 Align non-zero length strings according to the addralign_.
1614 (Stringpool_template<Stringpool_char>::set_string_offsets):
1615 Updating offsets according to the given alignment.
1616 * testsuite/Makefile.am (text_section_grouping): Test if string
1617 literals are getting merged.
1618 * testsuite/Makefile.in: Regenerate.
1619 * testsuite/merge_string_literals_1.c: New file.
1620 * testsuite/merge_string_literals_2.c: Ditto.
1621 * testsuite/merge_string_literals.sh: Ditto.
1623 2013-04-26 Ian Lance Taylor <iant@google.com>
1625 * target-reloc.h (relocate_section): If the reloc offset is out of
1626 range, pass VIEW as NULL to relocate.relocate.
1627 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1628 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1629 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1630 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1631 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1632 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1634 2013-04-26 Geoff Pike <gpike@chromium.org>
1636 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1637 * layout.cc (Hash_task): New class.
1638 (Layout::queue_build_id_tasks): New function.
1639 (Layout::write_build_id): Handle single-thread portion of build ID
1640 computation. (In some cases, all of it is single-threaded.) Replace
1641 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1642 functionality in fewer lines of code.
1643 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1644 * options.h (General_options): make "--build-id" default to tree
1645 rather than sha1. Add two new options related to --build-id=tree:
1646 --build-id-chunk-size-for-treehash and
1647 --build-id-min-file-size-for-treehash.
1648 * Makefile.am: add testing of --build-id=tree and related new options
1649 (these tests will be invoked by "make check").
1650 * Makefile.in: Regenerate.
1652 2013-04-25 Alan Modra <amodra@gmail.com>
1654 * configure.tgt: Add powerpcle and powerpc64le.
1656 2013-04-22 Alan Modra <amodra@gmail.com>
1659 * layout.cc (Layout::segment_precedes): Allow more than one
1660 segment with the same type and flags.
1662 2013-04-15 Cary Coutant <ccoutant@google.com>
1664 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1665 allocate space in file for BSS sections.
1667 2013-04-15 Cary Coutant <ccoutant@google.com>
1669 * script-sections.cc (Orphan_output_section): Reset address
1670 to zero after each orphaned section for relocatable links.
1672 2013-04-15 Cary Coutant <ccoutant@google.com>
1674 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1675 section starting address for relocatable link.
1676 * testsuite/Makefile.am (script_test_11): New test.
1677 * testsuite/Makefile.in: Regenerate.
1678 * testsuite/script_test_11.c: New source file.
1679 * testsuite/script_test_11.t: New linker script.
1681 2013-04-13 Alan Modra <amodra@gmail.com>
1683 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1684 owner when sections are not adjacent and exceed group size.
1685 (Target_powerpc::group_sections): Handle corner case.
1686 (Target_powerpc::Branch_info::make_stub): Handle case where
1687 stub table doesn't exist due to branches in non-exec sections.
1688 (Target_powerpc::Relocate::relocate): Likewise.
1690 2013-04-11 Alan Modra <amodra@gmail.com>
1693 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1694 .branch_lt to match bfd ld. Adjust comments throughout file.
1696 2013-04-04 Ian Lance Taylor <iant@google.com>
1699 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1700 sections before checking whether they are included in the link.
1702 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1704 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1705 object before calling the plugin claim_file handler. Pass the elf
1706 object of the archive to the plugin. Delete the elf object if the
1707 plugin claims the file.
1709 2013-03-21 Alan Modra <amodra@gmail.com>
1711 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1712 segment when omagic.
1714 2013-03-21 Alan Modra <amodra@gmail.com>
1716 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1718 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1719 uninitialized" warning.
1721 2013-03-20 Alan Modra <amodra@gmail.com>
1723 * symtab.h (Symbol::clear_version): New function.
1724 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1725 is_needed by weak references. Clear version for symbols defined
1726 in as-needed objects that are not needed.
1728 2013-03-15 Alan Modra <amodra@gmail.com>
1730 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1731 static and public. Add report_err param. Return false for data refs.
1732 (Target_powerpc::rela_dyn_section): New overloaded function.
1733 (Target_powerpc::plt_, iplt_): Elucidate.
1734 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1735 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1736 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1737 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1738 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1739 push_branch and make_plt_entry for ifunc syms when
1740 reloc_needs_plt_for_ifunc.
1741 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1742 for ifunc unless reloc_needs_plt_for_ifunc.
1744 2013-03-15 Alan Modra <amodra@gmail.com>
1746 * gc.h (gc_process_relocs): Don't look through function descriptors.
1747 * icf.cc (get_section_contents): Do so here instead.
1749 2013-03-13 Alan Modra <amodra@gmail.com>
1751 * powerpc.cc (is_branch_reloc): Forward declare.
1752 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1753 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1754 false for 64-bit, true for 32-bit non-branch relocs.
1755 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1756 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1758 (icf_safe_test): Generate linker map file as well as nm output.
1759 (icf_safe_so_test): Likewise.
1760 * testsuite/Makefile.in: Regenerate.
1761 * testsuite/icf_test.sh: Parse linker map file to determine
1763 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1764 * testsuite/icf_safe_so_test.sh: Likewise.
1765 (X86_32_or_ARM_specific_safe_fold): Merge into..
1766 (arch_specific_safe_fold): ..this.
1767 (X86_64_specific_safe_fold): Delete unused function.
1769 2013-03-12 Alan Modra <amodra@gmail.com>
1771 * gc.h (gc_process_relocs): Look through function descriptors
1772 to determine shndx, symvalue and addend used by ICF. Tidy
1773 variable duplication.
1775 2013-03-11 Alan Modra <amodra@gmail.com>
1777 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1778 * layout.cc (Layout_task_runner::run): ..to here.
1779 * symtab.h (struct Symbol_location): Extract from..
1780 (class Symbol_table): ..here.
1781 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1782 * target.h (class Target): Add function_location and
1783 do_function_location functions.
1784 (class Sized_target): Add do_function_location.
1785 * object.h (class Sized_relobj_file): Move find_shdr..
1786 (class Object): ..to here.
1787 * object.cc: Likewise. Update to suit. Instantiate.
1788 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1789 * powerpc.cc (class Powerpc_dynobj): New.
1790 (Target_powerpc::do_function_location): New function.
1791 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1792 (Powerpc_dynobj::do_read_symbols): New function.
1793 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1795 2013-03-08 Ian Lance Taylor <iant@google.com>
1797 * options.cc (General_options::string_to_object_format): Accept
1800 2013-03-08 Alan Modra <amodra@gmail.com>
1802 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1803 pointer to Post_fde.
1804 (struct Post_fde): Move definition to here..
1805 * ehframe.cc (struct Post_fde): ..from here.
1806 (Cie::write): Don't alloc Post_fde.
1807 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1809 2013-03-07 Alan Modra <amodra@gmail.com>
1811 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1812 relocation referencing .LC0.
1813 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1815 2013-03-07 Alan Modra <amodra@gmail.com>
1817 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1818 always_inline. Add assembly for powerpc to avoid GOT.
1820 2013-03-07 Alan Modra <amodra@gmail.com>
1822 * testsuite/script_test_10.sh: Don't test .bss section
1825 2013-03-06 Alan Modra <amodra@gmail.com>
1827 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1828 (Target_powerpc::symval_for_branch): Add symtab param. Update
1829 all callers. Handle folded sections.
1830 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1832 (Global_symbol_visitor_opd::operator()): Likewise.
1834 2013-03-04 Alan Modra <amodra@gmail.com>
1836 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1837 * testsuite/Makefile.in: Regenerate.
1839 2013-03-01 Cary Coutant <ccoutant@google.com>
1841 Add dwp support for v2 DWARF package file format.
1842 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1843 tu_length parameter. Adjust all callers.
1844 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1845 * dwp.cc: Include dwarf.h.
1846 (Section_bounds): New struct type.
1847 (Unit_set): New struct type.
1848 (Dwo_file::Dwo_file): Initialize new data member.
1849 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1850 Combine and rename to...
1851 (Dwo_file::read_unit_index): ...this.
1852 (Dwo_file::sized_read_compunit_index)
1853 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1854 (Dwo_file::sized_read_unit_index): ...this.
1855 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1856 parameters; add section_id parameter.
1857 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1858 (Dwo_file::add_unit_set): ...this.
1859 (Dwo_file::shndx_map_): Remove.
1860 (Dwo_file::sect_offsets_): New data member.
1861 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1862 (Dwp_output_file::add_section): Rename to...
1863 (Dwp_output_file::add_contribution): ...this.
1864 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1865 (Dwp_output_file::add_tu_set): Likewise.
1866 (Dwp_output_file::Contribution): New type.
1867 (Dwp_output_file::Section::contributions): New data member.
1868 (Dwp_output_file::Cu_or_tu_set): Remove.
1869 (Dwp_output_file::Section::Section): New ctor.
1870 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1871 (Dwp_output_file::Dwp_index::Section_table): New type.
1872 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1873 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1875 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1876 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1877 (Dwp_output_file::Dwp_index::section_table): New member function.
1878 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1879 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1880 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1881 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1882 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1883 (Dwp_output_file::Dwp_index::section_table_): New data member.
1884 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1885 (Dwp_output_file::add_output_section): New member function.
1886 (Dwp_output_file::write_new_section): New member function.
1887 (Dwp_output_file::write_contributions): New member function.
1888 (Dwp_output_file::section_id_map_): New data member.
1889 (class Dwo_id_info_reader): Remove.
1890 (class Unit_reader): New class.
1891 (get_dwarf_section_name): New function.
1892 (Dwo_file::read_executable): Adjust initializations of class data.
1893 (Dwo_file::read): Add support for v2 package file format.
1894 (Dwo_file::read_unit_index): Likewise.
1895 (Dwo_file::sized_read_unit_index): Likewise.
1896 (Dwo_file::copy_section): Likewise.
1897 (Dwo_file::add_unit_set): Likewise.
1898 (Dwp_output_file::add_output_section): Likewise.
1899 (Dwp_output_file::add_contribution): Likewise.
1900 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1902 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1904 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1906 (Dwp_output_file::initialize): Remove unused function.
1907 (Dwp_output_file::finalize): Add support for v2 package file format.
1908 (Dwp_output_file::write_index): Likewise.
1909 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1912 2013-03-01 Cary Coutant <ccoutant@google.com>
1914 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1915 function into class definition in header file.
1916 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1917 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1919 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1921 2013-02-28 Alan Modra <amodra@gmail.com>
1923 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1924 * target.cc (Target::do_plt_fde_location): New function.
1925 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1926 accessor function, and constructor param.
1927 (struct Post_fde, Post_fdes): Declare.
1928 (Cie::write): Add post_fdes param.
1929 * ehframe.cc (Fde::write): Use plt_fde_location.
1930 (struct Post_fde): Define.
1931 (Cie::write): Stash FDEs added post merge mapping.
1932 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1933 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1934 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1936 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1937 (Target_powerpc::has_glink): New function.
1938 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1939 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1940 glink_eh_frame_fde_32, default_fde): New data.
1941 (Stub_table::eh_frame_added_): New var.
1942 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1944 (Stub_table::add_eh_frame): New function.
1945 (Output_data_glink::add_eh_frame): New function.
1946 (Target_powerpc::make_glink_section): Call add_eh_frame.
1948 2013-02-15 Ian Lance Taylor <iant@google.com>
1950 * options.h (DEFINE_uint64_alias): Define.
1951 (class General_options): Add -Ttext-segment as an alias for
1954 2013-02-15 Alan Modra <amodra@gmail.com>
1956 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1957 (Stub_table::do_write): ..here, two places.
1958 (Stub_table::plt_call_size): Use it here too.
1960 2013-02-11 Ian Lance Taylor <iant@google.com>
1962 * descriptors.cc (Descriptors::close_all): New function.
1963 * descriptors.h (class Descriptors): Declare close_all.
1964 (close_all_descriptors): New inline function.
1965 * plugin.cc: Include "descriptors.h".
1966 (Plugin_manager::cleanup): Call close_all_descriptors.
1968 2013-02-06 Alan Modra <amodra@gmail.com>
1970 * README: Update coding style link.
1972 2013-01-28 Cary Coutant <ccoutant@google.com>
1974 * dwp.cc (File_list): New typedef.
1975 (Dwo_name_info_reader): New class.
1976 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1977 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1978 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1979 (Dwo_file::read_executable): New function.
1980 (Dwo_file::read): Move common setup code to ...
1981 (Dwo_file::make_object): ... here.
1982 (dwp_options): Add --exec/-e.
1986 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1988 * layout.cc (Layout::layout): Check for option text_reorder.
1989 (Layout::make_output_section): Ditto.
1990 * options.h (text_reorder): New option.
1991 * output.cc (Input_section_sort_compare): Remove special ordering
1994 Input_section_sort_section_name_special_ordering_compare::
1995 operator()): New function.
1996 (Output_section::sort_attached_input_sections): Use new sort function
1998 * output.h (Input_section_sort_section_name_special_ordering_compare):
2000 * testsuite/Makefile.am (text_section_grouping): Test option
2002 * testsuite/Makefile.in: Regenerate.
2003 * testsuite/text_section_grouping.sh: Check order of functions without
2004 default text reordering.
2006 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2008 * options.h (General_options): Change default to true for new_dtags.
2010 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2012 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2013 when enable_new_dtags is false. Only add DT_RUNPATH when
2014 enable_new_dtags is true.
2016 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
2018 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2019 used in declaration and definition consistent.
2020 (Target_powerpc::symval_for_branch): Ditto.
2022 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2024 * testsuite/plugin_final_layout.cc: Fix comment.
2026 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2028 * layout.cc (Layout::layout): Do not do default sorting for
2029 text sections when section ordering is specified.
2030 (make_output_section): Ditto.
2031 * testsuite/plugin_final_layout.cc: Name the function sections
2032 to catch reordering issues.
2034 2013-01-15 Alan Modra <amodra@gmail.com>
2036 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2039 2013-01-15 Alan Modra <amodra@gmail.com>
2041 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2042 * testsuite/Makefile.in: Regenerate.
2044 2013-01-14 Alan Modra <amodra@gmail.com>
2046 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2047 * testsuite/Makefile.in: Regenerate.
2049 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
2052 Fix mingw gold build with plugins enabled
2053 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2054 * configure.ac: Export DLOPEN_LIBS and add headers check.
2055 * plugin.cc: Handle non-dlfcn case.
2056 * Makefile.in: Regenerate.
2057 * config.in: Regenerate.
2058 * configure: Regenerate.
2059 * testsuite/Makefile.in: Regenerate.
2061 2013-01-09 Sriraman Tallam <tmsriram@google.com>
2063 * output.h (sort_attached_input_sections): Change to be public.
2064 * script-sections.cc
2065 (Output_section_definition::set_section_addresses): Sort
2066 attached input sections according to section order before linker
2067 script assigns section addresses.
2068 (Orphan_output_section::set_section_addresses): Sort
2069 attached input sections according to section order before linker
2070 script assigns section addresses.
2071 * Makefile.am (final_layout.sh): Use a simple linker script to
2072 check if section ordering still works.
2073 * Makefile.in: Regenerate.
2075 2013-01-09 Ben Cheng <bccheng@google.com>
2077 * arm.cc (Target_arm::attributes_accept_div): New function.
2078 (Target_arm::attributes_forbid_div): New function.
2079 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2080 attribute using the same new functions as what bfd/elf32_arm.c
2083 2013-01-07 Cary Coutant <ccoutant@google.com>
2086 * output.cc (Output_section::add_input_section): For incremental
2087 updates, don't track input sections that are allocated from patch
2090 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2091 Ian Lance Taylor <iant@google.com>
2094 * configure.ac (--enable-ld): Removed.
2095 (install_as_default): Set to yes only for --enable-gold=default
2097 * configure: Regenerated.
2099 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2101 * options.h (General_options): Add -fuse-ld= for GCC linker
2102 option compatibility.
2104 2013-01-04 Cary Coutant <ccoutant@google.com>
2106 * configure.ac: Fix typo restoring CXXFLAGS.
2107 * configure: Regenerate.
2109 2013-01-04 Cary Coutant <ccoutant@google.com>
2111 * testsuite/Makefile.am (CXXLINK_S): New macro.
2112 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2113 * testsuite/Makefile.in: Regenerate.
2115 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
2117 * version.cc (print_version): Update copyright year to 2013.
2119 2012-12-20 Ian Lance Taylor <iant@google.com>
2121 * layout.cc (Layout::special_ordering_of_input_section): New
2123 (Layout::layout): If input section requires special ordering, must
2124 sort input sections.
2125 (Layout::make_output_section): May sort .text input sections.
2126 (Layout::is_section_name_prefix_grouped): Remove.
2127 * layout.h (class Layout): Declare
2128 special_ordering_of_input_section. Don't declare
2129 is_section_name_prefix_grouped.
2130 * output.cc (Output_section::add_input_section): Revert last
2132 (Output_section::Input_section_sort::match_file_name): Don't crash
2133 if called on output section data.
2134 (Output_section::Input_section_sort_compare): Sort based on
2136 (Output_section::Input_section_sort_section_order_index_compare):
2138 (Output_section::sort_attached_input_sections): Likewise.
2140 2012-12-18 Sriraman Tallam <tmsriram@google.com>
2142 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2143 * layout.h (Layout::is_section_name_prefix_grouped): New function.
2144 * output.cc (Output_section::add_input_section): Check if section
2145 name contains special prefix. Keep input sections to sort such
2147 (Output_section::Input_section_sort_section_order_index_compare
2148 ::operator()): Group sections according to prefixes.
2149 (Output_section::sort_attached_input_sections): Add condition to
2150 Input_section_entry constructor call.
2151 * testsuite/Makefile.am (text_section_grouping): New test.
2152 * testsuite/Makefile.in: Regenerate.
2153 * testsuite/text_section_grouping.cc: New file.
2154 * testsuite/text_section_grouping.sh: New file.
2156 2012-12-17 Nick Clifton <nickc@redhat.com>
2158 * Makefile.am: Add copyright notice.
2161 * configure.ac: Likewise.
2162 * ftruncate.c: Likewise.
2163 * Makefile.in: Regenerate.
2165 2012-12-14 Cary Coutant <ccoutant@google.com>
2167 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2168 --no-as-needed flag.
2169 (exception_separate_shared_12_test): Likewise.
2170 (incremental_copy_test): Likewise.
2171 * testsuite/Makefile.in: Regenerate.
2173 2012-12-14 Cary Coutant <ccoutant@google.com>
2175 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2176 (Dwp_output_file::Dwp_index::enter_set): Add assert.
2178 2012-12-12 Alan Modra <amodra@gmail.com>
2180 * powerpc.cc (class Track_tls): New.
2181 (class Relocate, class Scan): Inherit Track_tls.
2182 (Target_powerpc::Scan::local, global): Track tls optimization
2183 and avoid creating plt entry for __tls_get_addr if all uses
2185 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2187 2012-12-12 Alan Modra <amodra@gmail.com>
2189 * options.h (General_options): Add --toc-sort/--no-toc-sort.
2190 Replace no_toc_optimize with toc_optimize.
2191 * output.h (Output_section::input_sections): Provide non-const variant.
2192 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2193 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2195 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2196 (class Sort_toc_sections): New.
2197 (Target_powerpc::do_finalize_sections): Sort toc sections.
2198 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2200 2012-12-10 Roland McGrath <mcgrathr@google.com>
2202 * testsuite/binary_unittest.cc (read_all): New function.
2203 (Sized_binary_test): Use it instead of ::read.
2204 * fileread.cc (do_read): Don't assume pread always reads the whole
2205 amount in a single call.
2207 2012-12-10 Alan Modra <amodra@gmail.com>
2209 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2210 Set EM_PPC64 or EM_PPC here.
2211 (Target_selector_powerpc::do_recognize): Delete.
2213 2012-12-10 Alan Modra <amodra@gmail.com>
2215 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2217 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2219 2012-12-07 Roland McGrath <mcgrathr@google.com>
2221 * testsuite/binary_unittest.cc (Sized_binary_test):
2222 Use open_descriptor rather than ::open.
2224 2012-12-07 Alan Modra <amodra@gmail.com>
2226 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2227 typedef and invalid_address constant.
2228 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2229 instantiate constants.
2231 2012-12-06 Roland McGrath <mcgrathr@google.com>
2233 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2234 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2235 * aclocal.m4: Regenerate.
2236 * configure: Regenerate.
2237 * Makefile.in: Regenerate.
2238 * testsuite/Makefile.in: Regenerate.
2240 2012-12-07 Alan Modra <amodra@gmail.com>
2242 * options.h (General_options): Add no_toc_optimize.
2243 * powerpc.cc (ok_lo_toc_insn): New function.
2244 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2246 2012-12-06 Alan Modra <amodra@gmail.com>
2248 * options.h (General_options): Add plt_align, plt_static_chain,
2249 plt_thread_safe. Update stub_group_size help text.
2250 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2251 for new plt_thread_safe_ var.
2252 (use_plt_offset): Correct comments.
2253 (Target_powerpc::do_relax): Look for thread creation symbols to
2254 determine default plt_thread_safe value. Clear plt call stubs
2255 as well as branch stubs each iteration.
2256 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2258 (l, hi, ha, write_insn): Move earlier.
2259 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2260 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2262 (Stub_table::update_size): Adjust.
2263 (Stub_table::prev_size, set_prev_size): Delete.
2264 (Stub_table::stub_align): Let --plt-align affect result.
2265 (Stub_table::plt_call_size): Calculate sizes for various stubs.
2266 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2267 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2268 (Stub_table::do_write): Support more stub variants.
2270 2012-12-04 Alan Modra <amodra@gmail.com>
2272 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2273 (Target_powerpc::do_define_standard_symbols): New function.
2275 2012-12-03 Alan Modra <amodra@gmail.com>
2277 * output.h: Formatting, whitespace.
2279 2012-12-03 Alan Modra <amodra@gmail.com>
2281 * layout.h (Layout::get_executable_sections): Declare.
2282 * layout.cc (Layout::get_executable_sections): New function.
2283 * arm.cc (Target_arm::group_sections): Use it.
2284 (Arm_output_section::group_sections): Delete now redundant test.
2285 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2286 param to handle relative relocs.
2287 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2288 (Output_data_reloc::add_absolute): Adjust.
2289 (Output_data_reloc::add_relative): New function.
2290 (Output_data::reset_data_size): New function.
2291 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2292 (Output_section::set_addralign): New function.
2293 (Output_section::checkpoint_set_addralign): New function.
2294 (Output_section::clear_section_offsets_need_adjustment): New function.
2295 (Output_section::input_sections): Make public.
2296 * powerpc.cc (class Output_data_brlt_powerpc): New.
2297 (class Stub_table, class Stub_control): New.
2298 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2299 stub_table_, set_stub_table, stub_table): New vectors and accessor
2301 (Target_powerpc::do_may_relax, do_relax, push_branch,
2302 new_stub_table, stub_tables, brlt_section, group_sections,
2303 add_branch_lookup_table, find_branch_lookup_table,
2304 write_branch_lookup_table, make_brlt_section): New functions.
2305 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2306 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2307 branch_info_): New vars.
2308 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2309 make call stubs here.
2310 (Output_data_glink): Remove all call stub handling from this class.
2311 (Target_powerpc::Scan::local, global): Save interesting branch
2312 relocs and relocs for ifunc. Adjust calls to plt entry functions.
2313 (Target_powerpc::do_finalize_sections): Only make reg save/restore
2314 functions on final link.
2315 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2316 Handle long branch destinations too.
2317 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2318 do_plt_address_for_local): Adjust lookup of plt call stubs.
2320 2012-11-30 Alan Modra <amodra@gmail.com>
2322 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2323 relocs against protected symbols when building 32-bit shared libs.
2325 2012-11-30 Alan Modra <amodra@gmail.com>
2327 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2328 param. Call got_section() to make .got. Update all callers
2329 and their callers and so on.
2331 2012-11-30 Alan Modra <amodra@gmail.com>
2333 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2334 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2335 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2336 value if it already exists.
2338 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
2341 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2343 2012-11-14 Roland McGrath <mcgrathr@google.com>
2345 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2346 than bfc instruction for data sandboxing.
2348 2012-11-08 Alan Modra <amodra@gmail.com>
2350 * po/POTFILES.in: Regenerate.
2352 2012-11-05 Alan Modra <amodra@gmail.com>
2354 * configure.ac: Apply 2012-09-10 change to config.in here.
2355 * configure: Regenerate.
2357 2012-11-05 Alan Modra <amodra@gmail.com>
2359 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2360 (struct Opd_ent): Use "Address" rather than "Offset".
2361 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2362 (Target_powerpc::got_section): Make public.
2363 (Target_powerpc::scan_relocs): Move code setting symbols..
2364 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2365 Create _SDA_BASE_ only when referenced.
2367 2012-11-02 Roland McGrath <mcgrathr@google.com>
2369 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2372 2012-11-01 Roland McGrath <mcgrathr@google.com>
2374 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2375 for offset_in_output_section parameter.
2376 (Sized_target::relocate_special_relocatable): Likewise.
2377 * arm.cc (Target_arm::relocate_relocs): Likewise.
2378 (Target_arm::relocate_special_relocatable): Likewise.
2379 * i386.cc (Target_i386::relocate_relocs): Likewise.
2380 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2381 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2382 * target-reloc.h (relocate_relocs): Likewise.
2383 * testsuite/testfile.cc (Target_test): Likewise.
2384 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2385 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2387 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2388 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2390 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2391 parameter, which is unused in the [!F_SETFD] case.
2393 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2394 SYMNDX to off_t before comparing it to this->data_size().
2395 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2396 * incremental.cc (Output_section_incremental_inputs::do_write):
2397 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2399 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2401 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2403 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2404 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2407 2012-10-29 Cary Coutant <ccoutant@google.com>
2409 * dwp.cc (usage): Add file and exit status parameters;
2410 add --help and --version options.
2411 (print_version): New function.
2412 (main): Add --help and --version options.
2414 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2416 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2417 final_layout_sequence.txt.
2418 * testsuite/Makefile.in: Regenerated.
2420 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2422 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2423 COMPILE generated by automake.
2425 (CXXCOMPILE1): Likewise.
2426 (CXXLINK1): Likewise.
2427 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2429 (CXXCOMPILE): Likewise.
2430 (CXXLINK): Likewise.
2431 * testsuite/Makefile.in: Regenerated.
2433 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2435 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2436 on bad fwrite return.
2438 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2440 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2443 2012-10-23 Cary Coutant <ccoutant@google.com>
2445 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2446 * testsuite/Makefile.in: Regenerate.
2447 * testsuite/dwp_test.h: New source file.
2448 * testsuite/dwp_test_1.cc: New source file.
2449 * testsuite/dwp_test_1.s: New source file.
2450 * testsuite/dwp_test_1.sh: New source file.
2451 * testsuite/dwp_test_1b.cc: New source file.
2452 * testsuite/dwp_test_1b.s: New source file.
2453 * testsuite/dwp_test_2.cc: New source file.
2454 * testsuite/dwp_test_2.s: New source file.
2455 * testsuite/dwp_test_2.sh: New source file.
2456 * testsuite/dwp_test_main.cc: New source file.
2457 * testsuite/dwp_test_main.s: New source file.
2459 2012-10-23 Cary Coutant <ccoutant@google.com>
2461 * dwp.h: New header file.
2462 * dwp.cc: New source file.
2463 * gold.h: Move shared declarations to system.h.
2464 * system.h: New header file.
2465 * Makefile.am: Add dwp.
2466 * Makefile.in: Regenerate.
2468 2012-10-23 Cary Coutant <ccoutant@google.com>
2470 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2471 Dwarf_info_reader::read_from_pointer.
2472 (Dwarf_pubnames_table::read_header): Likewise.
2473 (Dwarf_pubnames_table::next_name): Likewise.
2474 (Dwarf_die::read_attributes): Likewise.
2475 (Dwarf_die::skip_attributes): Likewise.
2476 (Dwarf_info_reader::read_from_pointer): New function template.
2477 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2478 (Dwarf_pubnames_table): Likewise.
2479 (Dwarf_info_reader::read_from_pointer): New function template.
2480 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2481 Dwarf_pubnames_table ctor.
2483 2012-10-23 Cary Coutant <ccoutant@google.com>
2485 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2487 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2489 (Dwarf_info_reader::set_abbrev_shndx): New method.
2490 (Dwarf_info_reader::abbrev_shndx_): New data member.
2492 2012-10-23 Cary Coutant <ccoutant@google.com>
2494 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2495 from object, not parameters.
2496 (Dwarf_info_reader::parse): Likewise.
2497 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2498 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2499 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2502 2012-10-23 Cary Coutant <ccoutant@google.com>
2504 * fileread.cc (Input_file::Input_file): New constructor.
2505 * fileread.h (class Input_file): Add new constructor.
2507 2012-10-18 Alan Modra <amodra@gmail.com>
2510 * object.cc (Relobj::is_section_name_included): Also match
2511 .sdata personality section.
2513 2012-10-18 Alan Modra <amodra@gmail.com>
2515 * target-reloc.h (class Default_comdat_behavior): New, package up..
2516 (get_comdat_behaviour): ..this.
2517 (relocate_section): Add Relocate_comdat_behavior template arg,
2518 adjust code to suit.
2519 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2520 (Target_arm::scan_reloc_section): Likewise.
2521 * i386.cc (Target_i386::relocate_section): Likewise.
2522 * sparc.cc (Target_sparc::relocate_section): Likewise.
2523 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2524 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2525 * powerpc.cc (class Relocate_comdat_behavior): New.
2526 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2527 gold::relocate_section with new template arg.
2529 2012-10-18 Alan Modra <amodra@gmail.com>
2531 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2532 dynamic relocs for GOT_TPREL got entries, without symbol if
2534 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2535 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2536 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2538 2012-10-17 Alan Modra <amodra@gmail.com>
2541 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2543 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2545 * layout.cc (Layout::include_section): Keep sections marked
2546 SHF_EXCLUDE when doing relocatable links.
2548 2012-10-16 Alan Modra <amodra@gmail.com>
2550 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2551 (Target_powerpc::do_finalize_sections): Call it.
2552 (Output_data_save_res): New class and supporting functions.
2553 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2554 normal symbols defined in object files.
2556 2012-10-12 Alan Modra <amodra@gmail.com>
2558 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2559 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2560 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2561 section if scan_opd_relocs not yet called.
2562 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2564 2012-10-12 Alan Modra <amodra@gmail.com>
2566 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2567 add_local_ifunc_entry): Revert last change.
2568 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2570 2012-10-05 Alan Modra <amodra@gmail.com>
2572 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2573 do_plt_address_for_global): New functions.
2574 (Output_data_got_powerpc::do_write): Don't segfault when linking
2576 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2577 add_local_ifunc_entry): Return true on adding entry..
2578 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2579 glink->add_entry call. Remove unused symtab param. Adjust calls.
2580 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2581 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2582 set up symbols here.
2583 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2584 syms here. Do so even when no .iplt. Don't segfault when linking
2586 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2587 new variants without reloc param.
2588 (Glink_sym_ent::Glink_sym_ent): Likewise.
2589 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2590 reloc when refs will resolve to plt call stub.
2591 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2592 R_PPC_PLTREL24 to resolve locally.
2593 (Target_powerpc::Scan::global): Correct ifunc handling.
2594 (Target_powerpc::Relocate::relocate): Correct local sym glink
2595 lookup. Don't destroy "value" when we have a plt call stub,
2596 and when checking plt call validity.
2597 (Target_powerpc::do_dynsym_value): Simplify.
2599 2012-10-05 Alan Modra <amodra@gmail.com>
2601 * i386.cc (Output_data_plt_i386::address_for_global,
2602 address_for_local): Add plt offset to returned value. Adjust uses.
2603 * sparc.cc (Output_data_plt_sparc::address_for_global,
2604 address_for_local): Likewise.
2605 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2606 address_for_local): Likewise.
2607 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2608 address_for_local): Likewise.
2609 * target.h (Target::plt_address_for_global, plt_address_for_local):
2611 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2612 (Output_data_got::Got_entry::write): Nor here.
2613 * output.h: Comment fix.
2615 2012-10-02 Jiong Wang <jiwang@tilera.com>
2617 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2618 global_offset_table_ value for larget got.
2619 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2621 2012-09-29 Alan Modra <amodra@gmail.com>
2623 * powerpc.cc (Target_powerpc::iplt_): New output section.
2624 (Target_powerpc::iplt_section, make_iplt_section,
2625 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2626 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2627 Target_powerpc::plt_entry_count): Count iplt entries too.
2628 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2629 reloc section in constructor. New params.
2630 (Target_powerpc::make_plt_section): Create reloc section here instead.
2631 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2633 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2634 (Output_data_glink::add_entry, find_entry): New functions to
2635 deal with local syms.
2636 (Glink_sym_ent): Add support for local syms.
2637 (Output_data_glink::do_write): Handle ifunc plt entries.
2638 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2639 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2640 (Target_powerpc::Relocate::relocate): Likewise.
2641 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2643 2012-09-25 Alan Modra <amodra@gmail.com>
2645 * object.h (Sized_relobj_file::adjust_local_symbol,
2646 do_adjust_local_symbol): New functions.
2647 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2648 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2649 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2650 and irregular opd entry spacing.
2651 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2652 (Global_symbol_visitor_opd): New functor.
2653 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2654 on deleted opd entries.
2656 2012-09-15 Jiong Wang <jiwang@tilera.com>
2658 * tilegx.cc: New file.
2659 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2660 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2661 * configure.tgt: Add entries for tilegx*.
2662 * configure.ac: Likewise.
2663 * Makefile.in: Rebuild.
2664 * configure: Likewise.
2665 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2668 2012-09-13 Alan Modra <amodra@gmail.com>
2670 * target-reloc.h (scan_relocs): Call scan.local for relocs
2671 against symbols in discarded sections. Pass is_discarded
2673 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2674 Add is_discarded param.
2675 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2676 is_discarded to flag opd entry as discarded. Don't emit dyn
2677 relocs on such entries.
2678 (Target_powerpc::Scan::global): Similarly detect and handle
2680 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2681 opd_ent_. Update all uses.
2682 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2683 (Target_powerpc::relocate_section): Zero out discarded opd
2686 2012-09-12 Ian Lance Taylor <iant@google.com>
2689 * output.cc: Rename Output_data_got template parameter from size
2690 to got_size for all functions. Compile all variants of
2692 (Output_data_got::Got_entry::write): Correct use of size for
2693 symbol value. Use local_is_tls rather than casting to
2695 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2696 (class Sized_relobj_file): Add do_local_is_tls.
2697 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2699 2012-09-11 Alan Modra <amodra@gmail.com>
2702 * layout.cc (Layout::set_segment_offsets): When using
2703 common-page-size alignment, ensure we are on a new max-page-size
2705 * output.cc (Output_segment::set_section_addresses): Use
2706 abi_pagesize, not common_pagesize for relro boundary.
2707 (Output_segment::set_offset): Likewise.
2709 2012-09-11 Alan Modra <amodra@gmail.com>
2711 * output.h (Output_data_got::add_global_tls, add_local_tls,
2712 add_local_tls_pair): New functions.
2713 (Output_data_got::add_local_pair_with_rel): Remove second
2714 reloc param. Expand comment.
2715 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2716 use_plt_or_tls_offset_, similarly for constructor param.
2717 (Output_data_got::Got_entry::write): Add got_index param.
2718 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2719 add_local_tls_pair): New functions.
2720 (Output_data_got::Got_entry::write): Handle tls symbols
2721 with use_plt_or_tls_offset_ set specially.
2722 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2723 (Output_data_got::do_write): Replace iterator with index, pass
2724 index to entry write function.
2725 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2726 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2727 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2729 * i386.cc (Target_i386::Scan::local): Likewise.
2730 * sparc.cc (Target_sparc::Scan::local): Likewise.
2731 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2732 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2733 do_tls_offset_for_global): New functions.
2734 (Target_powerpc::Scan::local): Correct TLS relocations and got
2736 (Target_powerpc::Scan::global): Don't emit unnecessary
2737 dynamic relocations on TLS GOT entries.
2739 2012-09-10 Matthias Klose <doko@ubuntu.com>
2741 * config.in: Disable sanity check for kfreebsd.
2743 2012-09-10 Sterling Augustine <saugustine@google.com>
2745 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2746 (Gdb_index::pubtypes_read): New parameter.
2747 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2749 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2752 2012-09-09 Alan Modra <amodra@gmail.com>
2754 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2755 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2756 * gc.h (gc_process_relocs): Call target gc_add_reference.
2757 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2758 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2759 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2761 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2762 to cater for when we don't need code offset. Update use.
2763 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2764 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2765 set_opd_valid): New functions.
2766 (Target_powerpc::do_gc_add_reference): New function.
2767 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2769 (Target_powerpc::do_gc_mark_symbol): New function.
2771 2012-09-06 Cary Coutant <ccoutant@google.com>
2773 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2774 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2775 (Dwarf_die::skip_attributes): Likewise.
2776 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2777 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2779 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2781 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2783 * testsuite/script_test_3.t: Add .got.plt output section
2785 * testsuite/script_test_4.t: Likewise.
2787 2012-09-05 Alan Modra <amodra@gmail.com>
2789 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2790 update all uses and lose "enum" when using type.
2792 2012-09-05 Alan Modra <amodra@gmail.com>
2794 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2795 * configure: Regenerate.
2796 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2797 (plugin_final_layout.stdout): Likewise.
2798 (memory_test): Set page sizes to 0x1000.
2799 * testsuite/Makefile.in: Regenerate.
2800 * testsuite/discard_locals_test.sh: Add FIXME comment.
2801 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2802 * testsuite/pr14265.t: Add .got output section statement.
2803 * testsuite/script_test_2.t: Likewise.
2804 * testsuite/script_test_3.t: Likewise.
2805 * testsuite/script_test_4.t: Likewise.
2806 * testsuite/script_test_5.t: Likewise.
2807 * testsuite/script_test_6.t: Likewise.
2808 * testsuite/script_test_7.t: Likewise.
2809 * testsuite/script_test_9.t: Likewise.
2811 2012-09-05 Alan Modra <amodra@gmail.com>
2813 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2814 (Powerpc_relocate_functions::Status): New typedef.
2815 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2816 (Target_powerpc::Scan::local): Handle REL64.
2817 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2818 for REL32 and REL64.
2819 (Target_powerpc::symval_for_branch): New function, extracted from..
2820 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2821 checks. Report overflow errors.
2823 2012-09-05 Alan Modra <amodra@gmail.com>
2825 * object.h (Sized_relobj_file::emit_relocs): Delete.
2826 (Sized_relobj_file::emit_relocs_reltype): Delete.
2827 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2828 relocate_relocs for --emit-relocs.
2829 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2830 * output.h: Update comment.
2831 (Output_segment::first_section): New function.
2832 (Output_segment::first_section_load_address): Use first_section.
2833 * output.cc (Output_segment::first_section): New function extracted..
2834 (Output_segment::first_section_load_address): ..from here. Delete.
2835 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2836 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2837 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2838 adjust call to target.h function.
2839 * i386.cc (Target_i386): Likewise.
2840 * sparc.cc (Target_sparc): Likewise.
2841 * x86_64.cc (Target_x86_64): Likewise.
2842 * powerpc.cc (Target_powerpc): Likewise.
2843 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2844 first tls section has section symbol for optimised local dynamic
2846 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2847 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2849 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2850 Rename to relocate_relocs. Update error message.
2852 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2854 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2857 2012-08-31 Alan Modra <amodra@gmail.com>
2859 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2860 (Powerpc_relobj::toc_base_offset): New stub function.
2861 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2862 got_mod_index_offset to tlsld_got_offset. Update all refs.
2863 (Target_powerpc::Relocate::enum skip_tls): New.
2864 (Target_powerpc::call_tls_get_addr_): New var.
2865 (Target_powerpc::is_branch_reloc): Move to file scope.
2866 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2867 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2869 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2870 (powerpc_info): Correct common_pagesize for ppc64.
2871 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2872 (Powerpc_relocate_functions): Add overflow check enums and functions.
2873 Add non-shift version of rela, rela_ua. Delete all rel public
2874 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2875 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2876 addr16_ha3, addr14 functions.
2877 (Output_data_got_powerpc::add_constant_pair): New function.
2878 (Output_data_got_powerpc::got_base_offset): Likewise.
2879 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2880 (instruction constants): Sort, add some more.
2881 (Output_data_glink::do_write): Add and use Address typedef. Use
2882 object->toc_base_offset() stub for 64-bit.
2883 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2884 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2885 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2886 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2887 Always treat .opd relocs as against locally defined symbol.
2888 Correct condition for RELATIVE relocs.
2889 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2890 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2891 for 32-bit syms with a plt entry. Correct ppc64 toc base
2892 calculations. Handle TLS relocs, and more. Add overflow
2893 checking and adjust for Powerpc_relocate_functions changes.
2894 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2895 Reinstate --emit-relocs code with FIXME.
2897 2012-08-30 Alan Modra <amodra@gmail.com>
2899 * layout.cc (Layout::set_segment_offsets): Set p_align to
2900 abi_pagesize, not common_pagesize.
2901 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2902 to determine whether file header can go in segment.
2904 2012-08-30 Alan Modra <amodra@gmail.com>
2906 * output.h (Output_reloc::Output_reloc <output section>): Add
2907 is_relative param. Adjust calls.
2908 (Output_reloc::add_output_section_relative): New functions.
2909 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2911 (Output_reloc::symbol_value): Handle SECTION_CODE.
2913 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2915 * gold.cc (queue_middle_tasks): Call layout again when unique
2916 segments for sections is desired.
2917 * layout.cc (Layout::Layout): Initialize new members.
2918 (Layout::get_output_section_flags): New function.
2919 (Layout::choose_output_section): Call get_output_section_flags.
2920 (Layout::layout): Make output section for mapping to a unique segment.
2921 (Layout::insert_section_segment_map): New function.
2922 (Layout::attach_allocated_section_to_segment): Make unique segment for
2923 output sections marked so.
2924 (Layout::segment_precedes): Check for unique segments when sorting.
2925 * layout.h (Layout::Unique_segment_info): New struct.
2926 (Layout::Section_segment_map): New typedef.
2927 (Layout::insert_section_segment_map): New function.
2928 (Layout::get_output_section_flags): New function.
2929 (Layout::is_unique_segment_for_sections_specified): New function.
2930 (Layout::set_unique_segment_for_sections_specified): New function.
2931 (Layout::unique_segment_for_sections_specified_): New member.
2932 (Layout::section_segment_map_): New member.
2933 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2934 Rename is_gc_pass_one to is_pass_one.
2935 Rename is_gc_pass_two to is_pass_two.
2936 Rename is_gc_or_icf to is_two_pass.
2937 Check for which pass based on whether symbols data is present.
2938 Make it two pass when unique segments for sections is desired.
2939 * output.cc (Output_section::Output_section): Initialize new
2941 * output.h (Output_section::is_unique_segment): New function.
2942 (Output_section::set_is_unique_segment): New function.
2943 (Output_section::is_unique_segment_): New member.
2944 (Output_section::extra_segment_flags): New function.
2945 (Output_section::set_extra_segment_flags): New function.
2946 (Output_section::extra_segment_flags_): New member.
2947 (Output_section::segment_alignment): New function.
2948 (Output_section::set_segment_alignment): New function.
2949 (Output_section::segment_alignment_): New member.
2950 (Output_segment::Output_segment): Initialize is_unique_segment_.
2951 (Output_segment::is_unique_segment): New function.
2952 (Output_segment::set_is_unique_segment): New function.
2953 (Output_segment::is_unique_segment_): New member.
2954 * plugin.cc (allow_unique_segment_for_sections): New function.
2955 (unique_segment_for_sections): New function.
2956 (Plugin::load): Add new functions to transfer vector.
2957 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2958 * Makefile.in: Regenerate.
2959 * testsuite/plugin_final_layout.sh: Check if unique segment
2960 functionality works.
2961 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2963 (allow_unique_segment_for_sections): New global.
2964 (unique_segment_for_sections): New global.
2965 (claim_file_hook): Call allow_unique_segment_for_sections.
2966 (all_symbols_read_hook): Call unique_segment_for_sections.
2968 2012-08-22 Cary Coutant <ccoutant@google.com>
2970 * layout.cc (Layout::include_section): Don't assert on GROUP
2971 sections with --emit-relocs.
2973 2012-08-21 Cary Coutant <ccoutant@google.com>
2975 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2976 if --export-dynamic-symbol names an undef symbol.
2978 2012-08-18 Alan Modra <amodra@gmail.com>
2980 * powerpc.cc: Formatting and white space.
2981 (Powerpc_relobj): Rename got2_section_ to special_.
2982 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2983 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2984 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2985 (Target_powerpc): Add Address typedef and invalid_address. Use
2987 (Target_powerpc::is_branch_reloc): New function.
2988 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2989 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2990 for dst_mask, value and addend.
2991 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2992 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2993 (Output_data_glink::do_write): Correct toc base. Don't try to use
2994 uint16_t for 24-bit offset. Use get_output_section_offset and
2996 (Target_powerpc::Scan::local): Handle more relocs.
2997 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2998 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2999 Plug in toc restoring insn after plt calls. Translate branches
3000 to function descriptor symbols to corresponding entry point.
3001 (Target_powerpc::relocate_for_relocatable): Check return from
3002 get_output_section_offset.
3003 * symtab.h: Comment typo.
3005 2012-08-14 Ian Lance Taylor <iant@google.com>
3007 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3008 unsupported_relocal_local to call unsupported_reloc_global.
3010 2012-08-14 Nick Clifton <nickc@redhat.com>
3013 * script-sections.cc (Sections_element::output_section_name): Add
3014 keep return parameter.
3015 (Output_section_element::match_name): Add keep return parameter.
3016 Return the value of the keep_ member.
3017 * script-sections.h (class Output_section): Update
3018 output_section_name prototype.
3019 * layout.cc (Layout::keep_input_section): New public member
3021 (Layout::choose_output_section): Pass keep parameter to
3022 output_section_name.
3023 * layout.h (class Layout): Add keep_input_section.
3024 * object.cc (Sized_relobj_file::do_layout): Check for kept input
3026 * testsuite/Makefile.am: Add a test.
3027 * testsuite/Makefile.in: Regenerate.
3028 * testsuite/pr14265.c: Source file for the test.
3029 * testsuite/pr14265.t: Linker script for the test.
3030 * testsuite/pr14265.sh: Shell script for the test.
3032 2012-08-14 Alan Modra <amodra@gmail.com>
3034 * target.h (Target::output_section_name): New function.
3035 (Target::do_output_section_name): New function.
3036 * layout.cc (Layout::choose_output_section): Call the above.
3037 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3039 2012-08-14 Alan Modra <amodra@gmail.com>
3041 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3042 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3043 for replace_constant call.
3044 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3045 (Output_data_glink::do_print_to_mapfile): New function.
3046 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3047 (Target_powerpc::Relocate::relocate): Likewise.
3049 2012-08-14 Alan Modra <amodra@gmail.com>
3051 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3052 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3053 (Output_data_glink::add_entry,find_entry): Remove shndx param.
3054 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
3055 all references to shndx_. Handle special case for R_PPC_PLTREL24
3057 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3058 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3059 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3061 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3062 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3064 2012-08-12 Alan Modra <amodra@gmail.com>
3066 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
3067 (glink insn constants): Use uint32_t.
3068 (Output_data_glink::add_entry): Use insert, not [] operator.
3070 2012-08-11 Alan Modra <amodra@gmail.com>
3072 * object.h (Sized_relobj_file::find_shdr): New function.
3073 (Sized_relobj_file::find_special_sections): New function.
3074 * object.cc (Sized_relobj_file::find_shdr): New function.
3075 (Sized_relobj_file::find_eh_frame): Use find_shdr.
3076 (Sized_relobj_file::find_special_sections): New function, split out..
3077 (Sized_relobj_file::do_read_symbols): ..from here.
3078 * output.h (Output_data_got::replace_constant): New function.
3079 (Output_data_got::num_entries): New function.
3080 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3081 (Output_data_got::got_offset): Protected rather than private.
3082 (Output_data_got::replace_got_entry): New function.
3083 * output.cc (Output_data_got::replace_got_entry): New function.
3084 * powerpc.cc (class Powerpc_relobj): New.
3085 (class Powerpc_relocate_functions): Delete all psymval variants or
3086 convert to value,addend type. Delete pcrela, pcrela_unaligned.
3087 Implement _ha functions using corresponding _hi function.
3088 (Powerpc_relobj::find_special_sections): New function.
3089 (Target_powerpc::do_make_elf_object): New function.
3090 (class Output_data_got_powerpc): New.
3091 (class Output_data_glink): New.
3092 (class Powerpc_scan_relocatable_reloc): New.
3093 Many more changes througout file.
3095 2012-08-09 Nick Clifton <nickc@redhat.com>
3097 * po/vi.po: Updated Vietnamese translation.
3099 2012-08-07 Ian Lance Taylor <iant@google.com>
3101 * layout.cc (Layout::add_target_dynamic_tags): If
3102 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3105 2012-07-30 Nick Clifton <nickc@redhat.com>
3107 * po/gold.pot: Updated template.
3108 * po/es.po: Updated Spanish translation.
3110 2012-07-18 Cary Coutant <ccoutant@google.com>
3113 * configure.ac: Add check for -gpubnames support.
3114 * configure: Regenerate.
3115 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3116 support; force -gno-pubnames.
3117 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3119 (gdb_index_test_4): New test.
3120 * testsuite/Makefile.in: Regenerate.
3121 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3122 * testsuite/gdb_index_test_2.sh: Likewise.
3123 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3124 * testsuite/gdb_index_test_4.sh: New script.
3125 * testsuite/gdb_index_test_comm.sh: New script with common code;
3126 don't look for space after colon.
3128 2012-07-16 Sriraman Tallam <tmsriram@google.com>
3130 * gold.cc (queue_middle_tasks): Update function order only after
3131 deferred objects due to plugins are processed.
3133 2012-07-11 Ian Lance Taylor <iant@google.com>
3135 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3136 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3137 (Target_arm::scan_reloc_for_stub): Likewise.
3138 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3139 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3140 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3141 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3142 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3144 2012-07-10 Dodji Seketeli <dodji@redhat.com>
3145 Ian Lance Taylor <iant@google.com>
3148 * configure.ac: Test whether std::tr1::hash<off_t> works.
3149 * gold.h: Add a specialization for std::tr1::hash<off_t> if
3151 * output.h (class Output_fill): Add virtual destructor.
3152 * configure, config.in: Rebuild.
3154 2012-06-22 Roland McGrath <mcgrathr@google.com>
3156 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3158 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
3160 * plugin.cc (Plugin::load): Handle position independent executables.
3162 2012-06-06 Cary Coutant <ccoutant@google.com>
3164 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3166 (lines_only_debug_sections): Likewise.
3167 (gdb_fast_lookup_sections): New static array.
3168 (is_gdb_debug_section): Rename formal parameter.
3169 (is_lines_only_debug_section): Likewise.
3170 (is_gdb_fast_lookup_section): New function.
3171 (Layout::include_section): Check for ".zdebug_" prefix; pass
3172 section name suffix to is_gdb_debug_section, et al.; check for
3173 fast-lookup sections when building .gdb_index.
3174 * options.h (--strip-debug-gdb): Update GDB version number.
3176 2012-06-06 Cary Coutant <ccoutant@google.com>
3178 * configure.ac: Add check for fallocate.
3179 * configure: Regenerate.
3180 * config.in: Regenerate.
3182 * options.h (class General_options): Add --mmap-output-file and
3183 --posix-fallocate options.
3184 * output.cc: (posix_fallocate): Remove; replace with...
3185 (gold_fallocate): New function.
3186 (Output_file::map_no_anonymous): Call gold_fallocate.
3187 (Output_file::map): Check --mmap-output-file option.
3189 2012-06-05 Jing Yu <jingyu@google.com>
3191 * gold.h (textdomain): Add do {} to empty while(0).
3192 (bindtextdomain): Likewise.
3194 2012-06-04 Cary Coutant <ccoutant@google.com>
3196 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3199 2012-05-25 Sriraman Tallam <tmsriram@google.com>
3201 * symtab.cc (Symbol_table::define_special_symbol):
3202 Initialize *poldsym to prevent uninitialized variable errors.
3204 2012-05-23 Cary Coutant <ccoutant@google.com>
3206 * layout.cc (Layout::section_name_mapping): Add rules to handle
3207 exact match on .data.rel.ro.local or .data.rel.ro.
3208 (Layout::output_section_name): Check for exact matches.
3210 2012-05-23 Cary Coutant <ccoutant@google.com>
3212 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3215 2012-05-22 Cary Coutant <ccoutant@google.com>
3217 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3218 object before exporting symbol.
3220 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
3222 * testsuite/tls_test.cc: Include "config.h" first.
3223 * testsuite/tls_test_c.c: Likewise.
3225 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
3226 Nick Clifton <nickc@redhat.com>
3229 * configure.in: Add check that sysdep.h has been included before
3230 any system header files.
3231 * configure: Regenerate.
3232 * config.in: Regenerate.
3234 2012-05-14 Cary Coutant <ccoutant@google.com>
3236 * layout.cc (Layout::make_output_section): Mark .tdata section
3238 * testsuite/relro_test.cc: Add a TLS variable.
3240 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
3243 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3244 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3247 2012-05-08 Cary Coutant <ccoutant@google.com>
3249 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3250 (lines_only_debug_sections): Likewise.
3252 2012-05-02 Roland McGrath <mcgrathr@google.com>
3254 * nacl.cc: New file.
3256 * Makefile.am (CCFILES, HFILES): Add them.
3257 * Makefile.in: Regenerate.
3258 * i386.cc (Output_data_plt_i386_nacl): New class.
3259 (Output_data_plt_i386_nacl_exec): New class.
3260 (Output_data_plt_i386_nacl_dyn): New class.
3261 (Target_i386_nacl): New class.
3262 (Target_selector_i386_nacl): New class.
3263 (target_selector_i386): Use it instead of Target_selector_i386.
3264 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3265 (Target_x86_64_nacl): New class.
3266 (Target_selector_x86_64_nacl): New class.
3267 (target_selector_x86_64, target_selector_x32): Use it instead of
3268 Target_selector_x86_64.
3269 * arm.cc (Output_data_plt_arm_nacl): New class.
3270 (Target_arm_nacl): New class.
3271 (Target_selector_arm_nacl): New class.
3272 (target_selector_arm, target_selector_armbe): Use it instead of
3273 Target_selector_arm.
3275 * target-select.cc (select_target): Take new Input_file* and off_t
3276 arguments, pass them on to recognize method of selector.
3277 * object.cc (make_elf_sized_object): Update caller.
3278 * parameters.cc (parameters_force_valid_target): Likewise.
3279 * incremental.cc (make_sized_incremental_binary): Likewise.
3280 * target-select.h: Update decl.
3281 (Target_selector::recognize): Take new Input_file* argument,
3282 pass it on to do_recognize.
3283 (Target_selector::do_recognize): Take new Input_file* argument.
3284 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3285 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3286 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3287 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3289 * target.h (Target::Target_info): New members isolate_execinstr
3291 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3292 * arm.cc (Target_arm::arm_info): Update initializer.
3293 * i386.cc (Target_i386::i386_info): Likewise.
3294 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3295 * sparc.cc (Target_sparc::sparc_info): Likewise.
3296 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3297 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3298 * layout.cc (Layout::attach_allocated_section_to_segment):
3299 Take new const Target* argument. If target->isolate_execinstr(), act
3301 (Layout::find_first_load_seg): Take new const Target* argument;
3302 if target->isolate_execinstr(), reject PF_X segments.
3303 (Layout::relaxation_loop_body): Update caller.
3304 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3305 reset file offset to zero when we hit LOAD_SEG, and then do a second
3306 loop over the segments before LOAD_SEG to reassign offsets after
3307 addresses have been determined. Handle target->rosegment_gap().
3308 (Layout::attach_section_to_segment): Take new const Target* argument;
3309 pass it to attach_allocated_section_to_segment.
3310 (Layout::make_output_section): Update caller.
3311 (Layout::attach_sections_to_segments): Take new const Target* argument;
3312 pass it to attach_section_to_segment.
3313 * gold.cc (queue_middle_tasks): Update caller.
3314 * layout.h (Layout): Update method decls with new arguments.
3316 * arm.cc (Target_arm::Target_arm): Take optional argument for the
3317 Target_info pointer to use.
3318 (Target_arm::do_make_data_plt): New virtual method.
3319 (Target_arm::make_data_plt): New method that calls it.
3320 (Target_arm::make_plt_entry): Use it.
3321 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3322 for the section alignment.
3323 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3325 (Output_data_plt_arm::first_plt_entry_offset): Call it.
3326 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3328 (Output_data_plt_arm::get_plt_entry_size): Call it.
3329 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3330 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3331 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3333 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3334 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3335 method instead of sizeof(plt_entry).
3336 (Output_data_plt_arm::add_entry): Likewise.
3337 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3338 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3340 (Target_arm::plt_entry_size): Likewise.
3341 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3343 (Output_data_plt_arm_standard): ... here, new class.
3344 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3345 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3346 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3348 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3349 Take additional argument for the PLT entry size.
3350 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3351 Use get_plt_entry_size method rather than plt_entry_size variable.
3352 (Output_data_plt_x86_64::reserve_slot): Likewise.
3353 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3354 (Output_data_plt_x86_64::add_entry): Likewise.
3355 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3356 (Output_data_plt_x86_64::address_for_global): Likewise.
3357 (Output_data_plt_x86_64::address_for_local): Likewise.
3358 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3359 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3360 Make method non-static.
3361 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3363 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3364 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3365 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3366 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3368 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3369 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3371 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3372 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3374 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3375 (Output_data_plt_x86_64::plt_entry_size)
3376 (Output_data_plt_x86_64::first_plt_entry)
3377 (Output_data_plt_x86_64::plt_entry)
3378 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3379 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3380 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3381 (Output_data_plt_x86_64_standard): ... here, new class.
3382 (Target_x86_64::Target_x86_64): Take optional argument for the
3383 Target_info pointer to use.
3384 (Target_x86_64::do_make_data_plt): New virtual method.
3385 (Target_x86_64::make_data_plt): New method to call it.
3386 (Target_x86_64::init_got_plt_for_update): Use that.
3387 Call this->plt_->add_eh_frame method here.
3388 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3389 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3390 rather than static method.
3391 (Target_x86_64::plt_entry_size): Likewise.
3392 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3393 rather than plt_entry_size variable. Move guts of PLT filling to...
3394 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3395 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3396 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3398 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3399 additional argument for the section alignment.
3400 Don't do add_eh_frame_for_plt here.
3401 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3402 non-static. Use get_plt_entry_size method rather than plt_entry_size
3404 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3406 (Output_data_plt_i386::get_plt_entry_size): Call it.
3407 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3408 (Output_data_plt_i386::add_eh_frame): New method to call it.
3409 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3411 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3412 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3414 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3415 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3416 method instead of plt_entry_size.
3417 (Output_data_plt_i386::plt_entry_size)
3418 (Output_data_plt_i386::plt_eh_frame_fde_size)
3419 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3420 (Output_data_plt_i386_standard): ... here, new class.
3421 (Output_data_plt_i386_exec): New class.
3422 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3423 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3424 (Output_data_plt_i386::exec_plt_entry): Move to ...
3425 (Output_data_plt_i386_exec::plt_entry): ... here.
3426 (Output_data_plt_i386_dyn): New class.
3427 (Output_data_plt_i386::first_plt_entry): Move to ...
3428 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3429 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3430 (Output_data_plt_i386_dyn::plt_entry): ... here.
3431 (Target_i386::Target_i386): Take optional argument for the Target_info
3433 (Target_i386::do_make_data_plt): New virtual method.
3434 (Target_i386::make_data_plt): New method to call it.
3435 (Target_i386::make_plt_section): Use that.
3436 Call this->plt_->add_eh_frame method here.
3437 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3438 rather than plt_entry_size variable.
3439 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3440 (Output_data_plt_i386::address_for_local): Likewise.
3441 (Output_data_plt_i386::do_write): Likewise.
3442 Move guts of PLT filling to...
3443 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3444 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3445 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3446 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3448 2012-05-01 Cary Coutant <ccoutant@google.com>
3450 * dwarf_reader.cc (Dwarf_die::read_attributes)
3451 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3452 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3453 * reduced_debug_output.cc
3454 (Output_reduced_debug_info_section::get_die_end): Remove
3455 DW_FORM_GNU_ref_index. Add default case.
3457 2012-04-26 Mark Wielaard <mjw@redhat.com>
3459 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3460 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3461 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3462 DW_AT_high_pc as offset from DW_AT_low_pc.
3464 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3465 * testsuite/Makefile.in: Regenerate.
3466 * testsuite/gdb_index_test_3.c: New test source file.
3467 * testsuite/gdb_index_test_3.sh: New test source file.
3469 2012-04-25 Ian Lance Taylor <iant@google.com>
3471 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3473 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3474 as a class, not a struct.
3475 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3476 (Target_arm::apply_cortex_a8_workaround): Likewise.
3477 * gc.h: Declare Reloc_types as a struct, not a class.
3478 * object.h: Declare Symbols_data as a struct.
3479 * reloc.h: Declare Read_relocs_data as a struct.
3480 * target.h: Declare Relocate_info as a struct.
3482 2012-04-24 David S. Miller <davem@davemloft.net>
3484 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3485 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3488 2012-04-24 Cary Coutant <ccoutant@google.com>
3490 * incremental-dump.cc (find_input_containing_global): Replace
3491 magic number with symbolic constant.
3492 (dump_incremental_inputs): Update version number.
3493 * incremental.cc (Output_section_incremental_inputs): Update version
3494 number; import symbolic constants from Incremental_inputs_reader.
3495 (Incremental_inputs::create_data_sections): Align relocations
3496 section correctly for 64-bit targets.
3497 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3498 constants; add padding.
3499 (Output_section_incremental_inputs::write_header): Add assert for
3501 (Output_section_incremental_inputs::write_input_files): Add assert
3502 for input_entry_size.
3503 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3504 add assert for object_info_size, input_section_entry_size,
3505 global_sym_entry_size.
3506 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3507 for data structure sizes; use them.
3508 (Incremental_input_entry_reader): Import symbolic constants from
3509 Incremental_inputs_reader; use them.
3511 2012-04-23 David S. Miller <davem@davemloft.net>
3513 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3515 (Target_sparc::Target_sparc): Initialize new fields.
3516 (Target_sparc::do_make_elf_object): New function.
3517 (Target_sparc::do_adjust_elf_header): New function.
3519 2012-04-23 Cary Coutant <ccoutant@google.com>
3521 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3522 CU range table of gdb index.
3524 2012-04-20 David S. Miller <davem@davemloft.net>
3526 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3529 2012-04-16 David S. Miller <davem@davemloft.net>
3531 * sparc.cc (Target_sparc::got_address): New function.
3532 (Sparc_relocate_functions::gdop_hix22): New function.
3533 (Sparc_relocate_functions::gdop_lox10): New function.
3534 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3536 (Target_sparc::Scan::local): Likewise if the global symbol is not
3537 preemptible and is not IFUNC.
3538 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3539 transformations for local and non-preemptible non-IFUNC global
3542 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3543 writing out 64-bit part of ranges.
3545 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3546 -fpic and -fpie respectively.
3547 * Makefile.in: Regenerate.
3549 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3550 (Target_sparc::Target_sparc): Initialize new field.
3551 (Target_sparc::do_plt_section_for_global): New function.
3552 (Target_sparc::do_plt_section_for_local): New function.
3553 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3554 (Target_sparc::make_plt_section): New function, broken out of
3555 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3556 (Target_sparc::make_plt_entry): Call make_plt_section.
3557 (Target_sparc::make_local_ifunc_plt_entry): New function.
3558 (Target_sparc::rela_ifunc_section): New function.
3559 (Target_sparc::plt_section): Remove const.
3560 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3561 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3562 and ifunc_count_ fields.
3563 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3564 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3565 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3566 (Output_data_plt_sparc::rela_ifunc): New function.
3567 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3568 (Output_data_plt_sparc::has_ifunc_section): New function.
3569 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3570 (Output_data_plt_sparc::address_for_global): New function.
3571 (Output_data_plt_sparc::address_for_local): New function.
3572 (Output_data_plt_sparc::plt_index_to_offset): New function.
3573 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3575 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3577 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3578 R_SPARC_JMP_IREL to switch.
3579 (Target_sparc::Scan::check_non_pic): Likewise.
3580 (Target_sparc::Scan::local): Handle IFUNC symbols.
3581 (Target_sparc::Scan::local): Likewise.
3582 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3583 and plt_address_for_local.
3584 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3585 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3587 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3588 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3589 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3590 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3592 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3593 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3595 * sparc.cc (Target_sparc::Scan::global): Likewise.
3596 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3598 2012-04-16 Cary Coutant <ccoutant@google.com>
3600 * archive.cc (Library_base::should_include_member): Check for
3601 --export-dynamic-symbol.
3602 * options.h (class General_options): Add --export-dynamic-symbol.
3603 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3604 --export-dynamic-symbol.
3605 (Symbol_table::gc_mark_undef_symbols): Likewise.
3606 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3608 2012-04-12 David S. Miller <davem@davemloft.net>
3610 * sparc.cc (Reloc::wdisp10): New relocation method.
3611 (Reloc::h34): Likewise.
3612 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3613 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3615 (Target_sparc::Scan::local): Likewise.
3616 (Target_sparc::Scan::global): Likewise.
3617 (Target_sparc::Relocate::relocate): Likewise.
3619 2012-04-09 Cary Coutant <ccoutant@google.com>
3621 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3624 2012-04-06 Ian Lance Taylor <iant@google.com>
3626 * timer.cc: #include <unistd.h>.
3628 2012-04-06 Roland McGrath <mcgrathr@google.com>
3630 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3631 * config.in: Regenerate.
3632 * configure: Regenerate.
3634 2012-04-05 Nick Clifton <nickc@redhat.com>
3636 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3637 (AM_LC_MESSAGES): Add.
3638 * aclocal.m4: Regenerate.
3639 * config.in: Regenerate.
3640 * configure: Regenerate.
3642 2012-03-21 Cary Coutant <ccoutant@google.com>
3644 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3645 * Makefile.in: Regenerate.
3646 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3647 (Sized_elf_reloc_mapper::symbol_section): New function.
3648 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3649 (make_elf_reloc_mapper): New function.
3650 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3651 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3652 (Dwarf_abbrev_table::do_get_abbrev): New function.
3653 (Dwarf_ranges_table::read_ranges_table): New function.
3654 (Dwarf_ranges_table::read_range_list): New function.
3655 (Dwarf_pubnames_table::read_section): New function.
3656 (Dwarf_pubnames_table::read_header): New function.
3657 (Dwarf_pubnames_table::next_name): New function.
3658 (Dwarf_die::Dwarf_die): New function.
3659 (Dwarf_die::read_attributes): New function.
3660 (Dwarf_die::skip_attributes): New function.
3661 (Dwarf_die::set_name): New function.
3662 (Dwarf_die::set_linkage_name): New function.
3663 (Dwarf_die::attribute): New function.
3664 (Dwarf_die::string_attribute): New function.
3665 (Dwarf_die::int_attribute): New function.
3666 (Dwarf_die::uint_attribute): New function.
3667 (Dwarf_die::ref_attribute): New function.
3668 (Dwarf_die::child_offset): New function.
3669 (Dwarf_die::sibling_offset): New function.
3670 (Dwarf_info_reader::check_buffer): New function.
3671 (Dwarf_info_reader::parse): New function.
3672 (Dwarf_info_reader::do_parse): New function.
3673 (Dwarf_info_reader::do_read_string_table): New function.
3674 (Dwarf_info_reader::lookup_reloc): New function.
3675 (Dwarf_info_reader::get_string): New function.
3676 (Dwarf_info_reader::visit_compilation_unit): New function.
3677 (Dwarf_info_reader::visit_type_unit): New function.
3678 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3679 Sized_elf_reloc_mapper.
3680 (Sized_dwarf_line_info::symbol_section): Remove function.
3681 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3682 (Sized_dwarf_line_info::read_line_mappings): Remove object
3683 parameter, adjust callers.
3684 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3685 * dwarf_reader.h: Include <sys/types.h>.
3686 (class Track_relocs): Remove forward declaration.
3687 (class Elf_reloc_mapper): New class.
3688 (class Sized_elf_reloc_mapper): New class.
3689 (class Dwarf_abbrev_table): New class.
3690 (class Dwarf_range_list): New class.
3691 (class Dwarf_ranges_table): New class.
3692 (class Dwarf_pubnames_table): New class.
3693 (class Dwarf_die): New class.
3694 (class Dwarf_info_reader): New class.
3695 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3696 (Sized_dwarf_line_info::symbol_section): Remove member function.
3697 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3699 * gdb-index.cc: New source file.
3700 * gdb-index.h: New source file.
3701 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3702 and .debug_types sections, call Layout::add_to_gdb_index.
3703 (Sized_relobj_incr::do_section_name): Implement.
3704 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3705 return type; Implement.
3706 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3708 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3709 parameter list and return type.
3710 (Sized_incr_dynobj::do_section_contents): Likewise.
3711 * layout.cc: Include gdb-index.h.
3712 (Layout::Layout): Initialize gdb_index_data_.
3713 (Layout::init_fixed_output_section): Check for .gdb_index section.
3714 (Layout::add_to_gdb_index): New function. Instantiate.
3715 * layout.h: Add forward declaration for class Gdb_index.
3716 (Layout::add_to_gdb_index): New member function.
3717 (Layout::gdb_index_data_): New data member.
3718 * main.cc: Include gdb-index.h.
3719 (main): Print statistics for gdb index.
3720 * object.cc (Object::section_contents): Move code into
3721 do_section_contents.
3722 (need_decompressed_section): Check for sections needed when building
3724 (build_compressed_section_map): Likewise.
3725 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3727 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3728 sections; call Layout::add_to_gdb_index.
3729 (Sized_relobj_file::do_decompressed_section_contents): Call
3730 do_section_contents directly.
3731 * object.h (Object::do_section_contents): Adjust parameter list and
3733 (Object::do_decompressed_section_contents): Call do_section_contents
3735 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3737 * options.h (class General_options): Add --gdb-index option.
3738 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3739 list and return type.
3740 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3741 * reloc.h (Track_relocs::checkpoint): New function.
3742 (Track_relocs::reset): New function.
3744 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3746 * testsuite/Makefile.in: Regenerate.
3747 * testsuite/gdb_index_test.cc: New test source file.
3748 * testsuite/gdb_index_test_1.sh: New test source file.
3749 * testsuite/gdb_index_test_2.sh: New test source file.
3751 2012-03-19 Doug Kwan <dougkwan@google.com>
3753 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3754 (Target_arm::do_finalize_sections): Remove code which defines
3755 __exidx_start and __exidx_end. Make symbol table parameter
3756 anonymous as it is not used.
3757 * gold.cc (queue_middle_tasks): Call target hook to define any
3758 target-specific symbols.
3759 * target.h (Target::define_standard_symbols): New method.
3760 (Target::do_define_standard_symbols): Same.
3761 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3762 * testsuite/Makefile.in: Regenerate.
3763 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3765 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3766 relocations are generated for __exidx_start and __exidx_end.
3768 2012-03-16 Doug Kwan <dougkwan@google.com>
3770 * testsuite/Makefile.am: Disable test initpri3b.
3771 * testsuite/Makefile.in: Regenerate.
3773 2012-03-15 Doug Kwan <dougkwan@google.com>
3775 * arm.cc (Target_arm::got_section): Make .got section read-only
3778 2012-03-15 Ian Lance Taylor <iant@google.com>
3781 * layout.cc (Layout::make_output_section): Correctly mark
3782 SHT_INIT_ARRAY, et. al., as relro.
3784 2012-03-14 Doug Kwan <dougkwan@google.com>
3786 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3787 dynamic relocations for protected symbols in shared objects.
3789 2012-03-13 Ian Lance Taylor <iant@google.com>
3791 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3792 keep the larger alignment.
3794 2012-03-12 Cary Coutant <ccoutant@google.com>
3796 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3797 handling of DW_LNE_define_file.
3799 2012-03-12 Cary Coutant <ccoutant@google.com>
3801 * reduced_debug_output.cc
3802 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3805 2012-02-29 Cary Coutant <ccoutant@google.com>
3807 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3809 2012-02-29 Cary Coutant <ccoutant@google.com>
3811 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3812 Call Object::decompressed_section_contents.
3813 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3815 (Sized_dwarf_line_info::buffer_start_): New data member.
3816 * merge.cc (Output_merge_data::do_add_input_section): Call
3817 Object::decompressed_section_contents.
3818 (Output_merge_string::do_add_input_section): Likewise.
3819 * object.cc (need_decompressed_section): New function.
3820 (build_compressed_section_map): Decompress sections needed later.
3821 (Sized_relobj_file::do_decompressed_section_contents): New function.
3822 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3823 * object.h (Object::decompressed_section_contents): New function.
3824 (Object::discard_decompressed_sections): New function.
3825 (Object::do_decompressed_section_contents): New function.
3826 (Object::do_discard_decompressed_sections): New function.
3827 (Compressed_section_info): New type.
3828 (Compressed_section_map): Include decompressed section contents.
3829 (Sized_relobj_file::do_decompressed_section_contents): New function.
3830 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3832 2012-02-16 Cary Coutant <ccoutant@google.com>
3834 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3835 * testsuite/Makefile.in: Regenerate.
3837 2012-02-14 Cary Coutant <ccoutant@google.com>
3839 * options.cc (General_options::finalize): Disallow -pie and -static.
3841 2012-02-03 Doug Kwan <dougkwan@google.com>
3843 * arm.cc (Arm_relocate_functions::abs8,
3844 Arm_relocate_functions::abs16): Use
3845 Bits::has_signed_unsigned_overflow32.
3846 (Arm_relocate_functions::thm_abs8): Correct range of
3848 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3851 2012-02-02 Doug Kwan <dougkwan@google.com>
3853 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3854 position independent outputs, not just shared objects.
3856 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3858 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3859 * configure: Regenerated.
3861 2012-01-27 Ian Lance Taylor <iant@google.com>
3863 * reloc.h (Bits): New class with static functions, copied from
3864 namespace utils in arm.cc.
3865 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3868 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3870 * incremental.cc (write_info_blocks): Correct relocation offset.
3872 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3874 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3875 (Relocate::tls_gd_to_le): Likewise.
3877 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3879 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3881 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3883 * configure.ac: Check if -mcmodel=medium works.
3884 * configure: Regenerated.
3886 2012-01-24 Cary Coutant <ccoutant@google.com>
3888 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3890 (read_unsigned_LEB_128_x): ... this new function.
3891 (read_signed_LEB_128): Replaced with inline definition and ...
3892 (read_signed_LEB_128_x): ... this new function.
3893 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3894 (read_unsigned_LEB_128): Add inline definition.
3895 (read_signed_LEB_128_x): New function.
3896 (read_signed_LEB_128): Add inline definition.
3897 * testsuite/Makefile.am (leb128_unittest): New unit test.
3898 * testsuite/Makefile.in: Regenerate.
3899 * testsuite/leb128_unittest.cc: New unit test.
3901 2012-01-23 Ian Lance Taylor <iant@google.com>
3904 * i386.cc (Target_i386::do_code_fill): When using a jmp
3905 instruction, pad with nop instructions.
3906 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3908 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3910 * x86_64.cc (gc_process_relocs): Add typename on types used in
3912 (scan_relocs): Likewise.
3913 (relocate_section): Likewise.
3914 (apply_relocation): Likewise.
3916 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3918 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3919 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3922 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3924 * x86_64.cc: Initial support for x32.
3926 2012-01-03 Cary Coutant <ccoutant@google.com>
3928 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3929 Use abstract base class for GOT.
3930 * gold/output.h (class Output_data_got_base): New abstract base class.
3931 (class Output_data_got): Derive from new base class, adjust ctors.
3932 (Output_data_got::reserve_slot): Make virtual; rename to
3933 do_reserve_slot; Adjust callers.
3934 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3935 pointer to abstract base class.
3936 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3938 2011-12-18 Ian Lance Taylor <iant@google.com>
3940 * object.h (Relobj::local_symbol_value): New function.
3941 (Relobj::local_plt_offset): New function.
3942 (Relobj::local_has_got_offset): New function.
3943 (Relobj::local_got_offset): New function.
3944 (Relobj::set_local_got_offset): New function.
3945 (Relobj::do_local_symbol_value): New pure virtual function.
3946 (Relobj::do_local_plt_offset): Likewise.
3947 (Relobj::do_local_has_got_offset): Likewise.
3948 (Relobj::do_local_got_offset): Likewise.
3949 (Relobj::do_set_local_got_offset): Likewise.
3950 (Sized_relobj::do_local_has_got_offset): Rename from
3951 local_has_got_offset.
3952 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3953 (Sized_relobj::do_set_local_got_offset): Rename from
3954 set_local_got_offset.
3955 (Sized_relobj_file::do_local_plt_offset): Rename from
3957 (Sized_relobj_file::do_local_symbol_value): New function.
3958 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3960 * output.cc (Output_data_got::Got_entry::write): Change object to
3961 Relobj. Use local_symbol_value.
3962 (Output_data_got::add_global_with_rel): Change rel_dyn to
3963 Output_data_reloc_generic*. Use add_global_generic.
3964 (Output_data_got::add_global_with_rela): Remove. Change all
3965 callers to use add_global_with_rel.
3966 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3967 Output_data_reloc_generic*. Use add_global_generic.
3968 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3969 callers to use add_global_pair_with_rel.
3970 (Output_data_got::add_local): Change object to Relobj*.
3971 (Output_data_got::add_local_plt): Likewise.
3972 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3973 change rel_dyn to Output_data_reloc_generic*. Use
3975 (Output_data_got::add_local_with_rela): Remove. Change all
3976 callers to use all_local_with_rel.
3977 (Output_data_got::add_local_pair_with_rel): Change object to
3978 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3979 add_output_section_generic.
3980 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3981 callers to use add_local_pair_with_rel.
3982 (Output_data_got::reserve_local): Change object to Relobj*.
3983 * output.h: (class Output_data_reloc_generic): Add pure virtual
3984 declarations for add_global_generic, add_local_generic,
3985 add_output_section_generic.
3986 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3987 functions for Output_data_reloc_generic. Update declarations for
3988 changes listed in output.cc.
3989 (class Output_data_got): Change template parameter to got_size.
3990 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3991 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3993 (Sized_relobj_incr::do_local_plt_offset): New function.
3994 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3997 2011-12-17 Cary Coutant <ccoutant@google.com>
3999 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4000 * resolve.cc (Symbol_table::resolve): Likewise.
4001 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4003 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4005 2011-12-16 Ian Lance Taylor <iant@google.com>
4007 * output.h (Output_data_reloc_generic::add): Only call
4008 add_dynamic_reloc if this is a dynamic reloc section.
4010 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
4013 * target-reloc.h (apply_relocation): Replace <64, false> with
4016 2011-11-25 Nick Clifton <nickc@redhat.com>
4018 * po/it.po: New Italian translation.
4020 2011-11-17 Sterling Augustine <saugustine@google.com>
4022 * script.cc (script_include_directive): Implement.
4023 (read_script_file): New local variables name and search_path. Update
4024 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4025 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4026 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4028 2011-11-11 Sterling Augustine <saugustine@google.com>
4030 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4031 (file_or_sections_cmd): Likewise.
4033 2011-11-11 Doug Kwan <dougkwan@google.com>
4035 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4036 if --just-symbols is given.
4038 2011-11-10 Doug Kwan <dougkwan@google.com>
4041 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4042 when processing data relocs.
4043 * reloc.h (Relocate_functions::rel_unaligned): New method.
4044 (Relocate_functions::pcrel_unaligned): Ditto.
4045 (Relocate_functions::rel32_unaligned): Ditto.
4046 (Relocate_functions::pcrel32_unaligned): Ditto.
4048 2011-11-09 Doug Kwan <dougkwan@google.com>
4051 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4052 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4053 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4054 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4055 (Relocate_functions::rel_unaligned): New.
4056 (Relocate_functions::rel32_unaligned): New.
4057 * target-reloc.h (relocate_for_relocatable): Add code to handle
4058 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4059 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4060 arm_unaligned_reloc_r): New targets.
4061 * testsuite/Makefile.in: Regenerate.
4062 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4065 2011-11-02 Ian Lance Taylor <iant@google.com>
4067 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
4069 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4070 * options.cc (General_options::finalize): Use library search path
4071 from configure script if specified. If not native and no sysroot,
4072 only search TOOLLIBDIR.
4073 * options.h (Search_directory::Search_directory): Change name to
4075 (General_options::add_to_library_path_with_sysroot): Change arg to
4077 * configure, Makefile.in, config.in: Rebuild.
4079 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4081 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4082 we are working around the ARM1176 Erratum.
4083 * options.h (General_options::fix_arm1176): Add option.
4084 * testsuite/Makefile.am: Add testcases, and keep current ones
4086 * testsuite/Makefile.in: Regenerate.
4087 * testsuite/arm_fix_1176.s: New file.
4088 * testsuite/arm_fix_1176.sh: Likewise.
4090 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4092 * arm.cc (Target_arm::Target_arm): Remove initialisation of
4094 (Target_arm::may_use_blx): Remove method.
4095 (Target_arm::set_may_use_blx): Likewise.
4096 (Target_arm::may_use_v4t_interworking): New method.
4097 (Target_arm::may_use_v5t_interworking): Likewise.
4098 (Target_arm::may_use_blx_): Remove member variable.
4099 (Arm_relocate_functions::arm_branch_common): Check for v5T
4101 (Arm_relocate_functions::thumb_branch_common): Likewise.
4102 (Reloc_stub::stub_type_for_reloc): Likewise.
4103 (Target_arm::do_finalize_sections): Correct interworking checks.
4104 * testsuite/Makefile.am: Add new tests.
4105 * testsuite/Makefile.in: Regenerate.
4106 * testsuite/arm_farcall_arm_arm.s: New test.
4107 * testsuite/arm_farcall_arm_arm.sh: Likewise.
4108 * testsuite/arm_farcall_arm_thumb.s: Likewise.
4109 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4110 * testsuite/arm_farcall_thumb_arm.s: Likewise.
4111 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4112 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4113 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4115 2011-10-31 Cary Coutant <ccoutant@google.com>
4118 * expression.cc (Expression::eval_with_dot): Add
4119 is_section_dot_assignment parameter.
4120 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
4121 absolute and assigning to dot within a section.
4122 * script-sections.cc
4123 (Output_section_element_assignment::set_section_addresses): Pass
4124 dot_section to set_if_absolute.
4125 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4126 as is_section_dot_assignment flag to eval_with_dot.
4127 (Output_section_element_dot_assignment::set_section_addresses):
4129 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4130 parameter. Also set value if relative to dot_section; set the
4131 symbol's output_section.
4132 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4133 parameter. Adjust all callers.
4134 (Expression::eval_maybe_dot): Likewise.
4135 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4137 * testsuite/script_test_2.t: Test assignment of an absolute value
4138 to dot within an output section element.
4140 2011-10-31 Cary Coutant <ccoutant@google.com>
4142 * options.h (class General_options): Add --[no-]gnu-unique options.
4143 * symtab.cc (Symbol_table::sized_write_globals): Convert
4144 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4146 2011-10-31 Cary Coutant <ccoutant@google.com>
4149 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4150 unnecessary assertion.
4151 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4153 2011-10-31 Sriraman Tallam <tmsriram@google.com>
4155 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4157 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4159 Change to just keep the section associated with symbol.
4160 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4161 they are externally visible and --export-dynamic is turned on.
4162 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4164 2011-10-19 Ian Lance Taylor <iant@google.com>
4167 * script-sections.cc
4168 (Output_section_element_dot_assignment::needs_output_section): New
4171 2011-10-19 Ian Lance Taylor <iant@google.com>
4174 * layout.cc (Layout::segment_precedes): Don't assert failure if a
4175 --section-start option was seen.
4176 * options.h (General_options::any_section_start): New function.
4178 2011-10-18 David S. Miller <davem@davemloft.net>
4181 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4182 member to track relocation locations that have moved during TLS
4183 reloc optimizations.
4184 (Target_sparc::Relocate::Relocate): Initialize to NULL.
4185 (Target_sparc::Relocate::relocate): Adjust view down by 4
4186 bytes if it matches reloc_adjust_addr_.
4187 (Target_sparc::Relocate::relocate_tls): Always move the
4188 __tls_get_addr call delay slot instruction forward 4 bytes when
4189 performing relaxation.
4191 2011-10-18 Cary Coutant <ccoutant@google.com>
4193 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4194 (Output_file::map_no_anonymous): Check for non-zero
4195 return code from posix_fallocate.
4197 2011-10-17 Cary Coutant <ccoutant@google.com>
4200 * plugin.cc (is_visible_from_outside): Check for symbols
4201 referenced from dynamic objects.
4202 * resolve.cc (Symbol_table::resolve): Don't count references
4203 from dynamic objects as references from real ELF files.
4204 * testsuite/plugin_test_2.sh: Adjust expected result.
4206 2011-10-17 Cary Coutant <ccoutant@google.com>
4208 * gold.cc: Include timer.h.
4209 (queue_middle_tasks): Stamp time.
4210 (queue_final_tasks): Likewise.
4211 * main.cc (main): Store timer in parameters. Print timers
4213 * parameters.cc (Parameters::Parameters): Initialize timer_.
4214 (Parameters::set_timer): New function.
4215 (set_parameters_timer): New function.
4216 * parameters.h (Parameters::set_timer): New function.
4217 (Parameters::timer): New function.
4218 (Parameters::timer_): New data member.
4219 (set_parameters_timer): New function.
4220 * timer.cc (Timer::stamp): New function.
4221 (Timer::get_pass_time): New function.
4222 * timer.h (Timer::stamp): New function.
4223 (Timer::get_pass_time): New function.
4224 (Timer::pass_times_): New data member.
4226 2011-10-17 Cary Coutant <ccoutant@google.com>
4228 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4229 task for members of lib groups.
4231 2011-10-17 Cary Coutant <ccoutant@google.com>
4234 * fileread.cc (File_read::find_view): Add assert.
4235 (File_read::make_view): Move bounds check (replace with assert)...
4236 (File_read::find_or_make_view): ... to here.
4238 2011-10-12 Cary Coutant <ccoutant@google.com>
4240 * output.cc (Output_file::open_base_file): Handle case where
4241 ::read returns less than requested size.
4243 2011-10-10 Cary Coutant <ccoutant@google.com>
4245 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4246 Initialize defined_count_.
4247 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4248 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4249 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4250 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4251 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4252 * incremental.h (Sized_relobj_incr::defined_count_): New data
4254 (Sized_incr_dynobj::defined_count_): New data member.
4255 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4256 Return zeroes instead of internal error.
4258 2011-10-10 Cary Coutant <ccoutant@google.com>
4261 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4262 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4263 * output.h (class Output_reloc): Add use_plt_offset flag.
4264 (Output_reloc::type_): Adjust size of bit field.
4265 (Output_reloc::use_plt_offset_): New bit field.
4266 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4267 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4268 flag. Adjust all callers.
4269 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4270 creating RELATIVE relocations.
4272 2011-10-10 Nick Clifton <nickc@redhat.com>
4274 * po/es.po: Updated Spanish translation.
4275 * po/fi.po: Updated Finnish translation.
4277 2011-10-03 Diego Novillo <dnovillo@google.com>
4279 * options.cc (parse_uint): Fix dereference of RETVAL.
4281 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4283 * layout.h (section_order_map_): New member.
4284 (get_section_order_map): New member function.
4285 * output.cc (Output_section::add_input_section): Check for patterns
4286 only when --section-ordering-file is specified.
4287 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4288 output_sections have been formed.
4289 * layout.cc (Layout_Layout): Initialize section_order_map_.
4290 * plugin.cc (update_section_order): Store order in order_map. Do not
4292 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4293 * testsuite/Makefile.in: Regenerate.
4294 * testsuite/plugin_section_order.c: New file.
4295 * testsuite/plugin_final_layout.cc: New file.
4296 * testsuite/plugin_final_layout.sh: New file.
4298 2011-09-29 Cary Coutant <ccoutant@google.com>
4300 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4302 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4303 symbols during incremental update.
4304 (Symbol_table::add_from_dynobj): Likewise.
4306 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4307 Ian Lance Taylor <iant@google.com>
4309 * symtab.cc (Symbol_table::define_special_symbol): Always
4310 canonicalize version string.
4312 2011-09-26 Cary Coutant <ccoutant@google.com>
4314 * gold.cc (queue_initial_tasks): Move option checks ...
4315 * options.cc (General_options::finalize): ... to here. Disable
4316 some options; make others fatal.
4318 2011-09-26 Cary Coutant <ccoutant@google.com>
4321 * plugin.cc (get_symbols_v2): New function.
4322 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4323 (is_referenced_from_outside): New function.
4324 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4325 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4326 (get_symbols): Pass version parameter.
4327 (get_symbols_v2): New function.
4328 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4330 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4331 (onload): Add LDPT_GET_SYMBOLS_V2.
4332 (all_symbols_read_hook): Use get_symbols_v2; check for
4333 LDPR_PREVAILING_DEF_IRONLY_EXP.
4334 * testsuite/plugin_test_3.sh: Update expected results.
4336 2011-09-23 Simon Baldwin <simonb@google.com>
4338 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4339 configuration options.
4340 * configure: Regenerate.
4341 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4342 * Makefile.in: Regenerate.
4343 * testsuite/Makefile.in: Regenerate.
4345 2011-09-19 Sriraman Tallam <tmsriram@google.com>
4347 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4349 2011-09-19 Cary Coutant <ccoutant@google.com>
4351 * incremental.cc (can_incremental_update): Fix typo in comment.
4352 * incremental.h (can_incremental_update): Likewise.
4354 2011-09-18 Cary Coutant <ccoutant@google.com>
4356 * incremental.cc (can_incremental_update): New function.
4357 * incremental.h (can_incremental_update): New function.
4358 * layout.cc (Layout::init_fixed_output_section): Call it.
4359 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4360 * object.cc (Sized_relobj_file::do_layout): Call
4361 can_incremental_update.
4363 2011-09-13 Cary Coutant <ccoutant@google.com>
4365 * configure.ac: Check for glibc support for gnu_indirect_function
4366 support with static linking, setting automake conditional
4368 * Makefile.in: Regenerate.
4369 * configure: Regenerate.
4371 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4372 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4374 * testsuite/Makefile.in: Regenerate.
4376 2011-09-13 Cary Coutant <ccoutant@google.com>
4378 * incremental.cc (Sized_relobj_incr::do_layout): Call
4379 report_comdat_group for kept comdat sections.
4380 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4381 * testsuite/Makefile.in: Regenerate.
4382 * testsuite/incr_comdat_test_1.cc: New source file.
4383 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4384 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4385 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4387 2011-09-13 Ian Lance Taylor <iant@google.com>
4389 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4390 variable external_symbols_offset.
4392 2011-09-12 Ian Lance Taylor <iant@google.com>
4394 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4395 triggered if object has no symbols.
4397 2011-09-09 David S. Miller <davem@davemloft.net>
4399 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4400 (Output_fill_debug_line::do_write): Likewise.
4402 2011-08-29 Cary Coutant <ccoutant@google.com>
4404 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4405 casts to match formatting specs.
4406 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4408 2011-08-26 Cary Coutant <ccoutant@google.com>
4410 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4411 remaining hole size when allocating.
4412 (Layout::make_output_section): Set fill methods for debug sections.
4413 * layout.h (Free_list::Free_list_node): Move from private to
4415 (Free_list::set_min_hole_size): New function.
4416 (Free_list::begin, Free_list::end): New functions.
4417 (Free_list::min_hole_): New data member.
4418 * output.cc: Include dwarf.h.
4419 (Output_fill_debug_info::do_minimum_hole_size): New function.
4420 (Output_fill_debug_info::do_write): New function.
4421 (Output_fill_debug_line::do_minimum_hole_size): New function.
4422 (Output_fill_debug_line::do_write): New function.
4423 (Output_section::Output_section): Initialize new data member.
4424 (Output_section::set_final_data_size): Ensure patch space is larger
4425 than minimum hole size.
4426 (Output_section::do_write): Fill holes in debug sections.
4427 * output.h (Output_fill): New class.
4428 (Output_fill_debug_info): New class.
4429 (Output_fill_debug_line): New class.
4430 (Output_section::set_free_space_fill): New function.
4431 (Output_section::free_space_fill_): New data member.
4432 * testsuite/Makefile.am (incremental_test_3): Add
4433 --incremental-patch option.
4434 (incremental_test_4): Likewise.
4435 (incremental_test_5): Likewise.
4436 (incremental_test_6): Likewise.
4437 (incremental_copy_test): Likewise.
4438 (incremental_common_test_1): Likewise.
4439 * testsuite/Makefile.in: Regenerate.
4441 2011-08-26 Nick Clifton <nickc@redhat.com>
4443 * po/es.po: Updated Spanish translation.
4445 2011-08-01 Cary Coutant <ccoutant@google.com>
4447 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4448 * gold/testsuite/Makefile.in: Regenerate.
4449 * gold/testsuite/justsyms_exec.c: New source file.
4450 * gold/testsuite/justsyms_lib.c: New source file.
4452 2011-08-01 Cary Coutant <ccoutant@google.com>
4454 * layout.cc (Layout::set_segment_offsets): Don't realign text
4455 segment if -Ttext was specified.
4456 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4458 * object.h (Sized_relobj_file::e_type): New function.
4459 (Sized_relobj_file::e_type_): New data member.
4460 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4461 base address for ET_EXEC files.
4462 * target.cc (Target::do_make_elf_object_implementation): Allow
4463 ET_EXEC files with --just-symbols option.
4465 2011-07-28 Cary Coutant <ccoutant@google.com>
4467 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4468 Add thread_number parameter.
4469 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4470 * workqueue-threads.cc
4471 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4472 current thread if its thread number is greater than desired thread
4474 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4475 Add thread_number parameter.
4476 (Workqueue::should_cancel_thread): Likewise.
4477 (Workqueue::find_runnable_or_wait): Pass thread_number to
4478 should_cancel_thread.
4479 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4482 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4484 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4485 only after checking if it cannot be forced local.
4486 * symtab.h (is_externally_visible): Check if the symbol is not forced
4489 2011-07-15 Ian Lance Taylor <iant@google.com>
4491 * options.h (class General_options): Add --print-output-format.
4492 Move -EL next to -EB, for better --help output.
4493 * target-select.cc: Include <cstdio>, "options.h", and
4495 (Target_selector::do_target_bfd_name): New function.
4496 (print_output_format): New function.
4497 * target-select.h (class Target_selector): Update declarations.
4498 (Target_selector::target_bfd_name): New function.
4499 (print_output_format): Declare.
4500 * main.cc: Include "target-select.h".
4501 (main): Handle --print-output-format.
4502 * gold.cc: Include "target-select.h".
4503 (queue_initial_tasks): Handle --print-output-format when there are
4505 * parameters.cc (parameters_force_valid_target): Give a better
4506 error message if -EB/-EL does not match target.
4507 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4510 2011-07-15 Ian Lance Taylor <iant@google.com>
4512 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4513 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4514 (Output_data_plt_i386::do_write): Write address of .dynamic
4515 section to first entry in .got.plt section.
4516 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4517 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4519 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4520 section to first entry in .got.plt section.
4521 * layout.h (Layout::dynamic_section): New function.
4523 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4525 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4527 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4528 input_section_position_, and input_section_glob_.
4529 (read_layout_from_file): Call function section_ordering_specified.
4530 * layout.h (is_section_ordering_specified): New function.
4531 (section_ordering_specified): New function.
4532 (section_ordering_specified_): New boolean member.
4533 * main.cc(main): Call load_plugins after layout object is defined.
4534 * output.cc (Output_section::add_input_section): Use
4535 function section_ordering_specified to check if section ordering is
4537 * output.cc (Output_section::add_relaxed_input_section): Use
4538 function section_ordering_specified to check if section ordering is
4540 (Output_section::update_section_layout): New function.
4541 (Output_section::sort_attached_input_sections): Check if input section
4543 * output.h (Output_section::update_section_layout): New function.
4544 * plugin.cc (get_section_count): New function.
4545 (get_section_type): New function.
4546 (get_section_name): New function.
4547 (get_section_contents): New function.
4548 (update_section_order): New function.
4549 (allow_section_ordering): New function.
4550 (Plugin::load): Add the new interfaces to the transfer vector.
4551 (Plugin_manager::load_plugins): New parameter.
4552 (Plugin_manager::all_symbols_read): New parameter.
4553 (Plugin_manager::claim_file): New parameter. Save the elf object for
4555 (Plugin_manager::get_elf_object): New function.
4556 (Plugin_manager::get_view): Change to directly use the bool to check
4557 if get_view is called from claim_file_hook.
4558 * plugin.h (input_objects): New function
4559 (Plugin__manager::load_plugins): New parameter.
4560 (Plugin_manager::claim_file): New parameter.
4561 (Plugin_manager::get_elf_object): New function.
4562 (Plugin_manager::in_claim_file_handler): New function.
4563 (Plugin_manager::in_claim_file_handler_): New member.
4564 (layout): New function.
4565 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4566 handler with an extra parameter. Make the elf object before calling
4568 * testsuite/plugin_test.c (get_section_count): New function pointer.
4569 (get_section_type): New function pointer.
4570 (get_section_name): New function pointer.
4571 (get_section_contents): New function pointer.
4572 (update_section_order): New function pointer.
4573 (allow_section_ordering): New function pointer.
4574 (onload): Check if the new interfaces exist.
4576 2011-07-13 Ian Lance Taylor <iant@google.com>
4578 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4580 * x86_64.cc (Target_x86_64::got_section): Likewise.
4581 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4582 (relro_now_test_SOURCES): New variable.
4583 (relro_now_test_DEPENDENCIES): New variable.
4584 (relro_now_test_LDFLAGS): New variable.
4585 (relro_now_test_LDADD): New variable.
4586 (relro_now_test.so): New target.
4587 * testsuite/Makefile.in: Rebuild.
4589 2011-07-12 Ian Lance Taylor <iant@google.com>
4592 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4593 GLOB_DAT relocation rather than a RELATIVE relocation for a
4594 protected symbol when creating a shared library.
4595 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4596 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4597 * testsuite/protected_main_1.cc (main): Test that protected
4598 function has same address.
4600 2011-07-11 Ian Lance Taylor <iant@google.com>
4603 * options.h (class General_options): Add -Bgroup.
4604 * options.cc (General_options::finalize): If -Bgroup is set,
4605 default to --unresolved-symbols=report-all.
4606 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4607 * target-reloc.h (issue_undefined_symbol_error): Handle
4608 --unresolved-symbols=report-all.
4610 2011-07-08 Ian Lance Taylor <iant@google.com>
4613 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4614 if linker script discards key sections.
4615 (Layout::create_dynamic_symtab): Likewise.
4616 (Layout::assign_local_dynsym_offsets): Likewise.
4617 (Layout::sized_create_version_sections): Likewise.
4618 (Layout::create_interp): Likewise.
4619 (Layout::finish_dynamic_section): Likewise.
4620 (Layout::set_dynamic_symbol_size): Likewise.
4622 2011-07-08 Ian Lance Taylor <iant@google.com>
4625 * options.h (class General_options): Add --unresolved-symbols.
4626 * target-reloc.h (issue_undefined_symbol_error): Check
4627 --unresolved-symbols. Add comments.
4629 2011-07-08 Ian Lance Taylor <iant@google.com>
4631 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4632 expression more complex.
4634 2011-07-08 Ian Lance Taylor <iant@google.com>
4637 * target-reloc.h (issue_undefined_symbol_error): New inline
4638 function, broken out of relocate_section.
4639 (relocate_section): Call issue_undefined_symbol_error.
4640 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4641 there is no TLS segment if we are about to issue an undefined
4643 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4645 2011-07-08 Ian Lance Taylor <iant@google.com>
4648 * resolve.cc (Symbol_table::should_override): Add fromtype
4649 parameter. Change all callers. Give error when linking together
4650 TLS and non-TLS symbol.
4651 (Symbol_table::should_override_with_special): Add fromtype
4652 parameter. Change all callers.
4653 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4654 there is no TLS segment if we have reported some errors.
4655 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4657 2011-07-08 Ian Lance Taylor <iant@google.com>
4660 * target.h (Target::plt_address_for_global): New function.
4661 (Target::plt_address_for_local): New function.
4662 (Target::plt_section_for_global): Remove.
4663 (Target::plt_section_for_local): Remove.
4664 (Target::do_plt_address_for_global): New virtual function.
4665 (Target::do_plt_address_for_local): New virtual function.
4666 (Target::do_plt_section_for_global): Remove.
4667 (Target::do_plt_section_for_local): Remove.
4668 (Target::register_global_plt_entry): Add Symbol_table and Layout
4670 * output.cc (Output_data_got::Got_entry::write): Use
4671 plt_address_for_global and plt_address_for_local.
4672 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4673 address of output section.
4674 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4675 got_irelative_, and irelative_count_ fields. Update
4677 (Output_data_plt_i386::has_irelative_section): New function.
4678 (Output_data_plt_i386::entry_count): Add irelative_count_.
4679 (Output_data_plt_i386::set_final_data_size): Likewise.
4680 (class Target_i386): Add got_irelative_ and rel_irelative_
4681 fields. Update declarations.
4682 (Target_i386::Target_i386): Initialize new fields.
4683 (Target_i386::do_plt_address_for_global): New function replacing
4684 do_plt_section_for_global.
4685 (Target_i386::do_plt_address_for_local): New function replacing
4686 do_plt_section_for_local.
4687 (Target_i386::got_section): Create got_irelative_.
4688 (Target_i386::rel_irelative_section): New function.
4689 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4690 fields. Don't define __rel_iplt_{start,end}.
4691 (Output_data_plt_i386::add_entry): Add symtab and layout
4692 parameters. Change all callers. Use different PLT and GOT for
4694 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4695 layout parameters. Change all callers. Use different PLT and
4697 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4698 (Output_data_plt_i386::rel_irelative): New function.
4699 (Output_data_plt_i386::address_for_global): New function.
4700 (Output_data_plt_i386::address_for_local): New function.
4701 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4702 IRELATIVE GOT when changing IFUNC GOT entries.
4703 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4705 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4706 if we didn't create an IRELATIVE GOT.
4707 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4708 plt_address_for_local.
4709 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4710 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4711 got_irelative_, and irelative_count_ fields. Update
4713 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4714 Initialize new fields. Remove symtab parameter. Change all
4716 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4718 (Output_data_plt_x86_64::has_irelative_section): New function.
4719 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4720 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4721 fields. Update declarations.
4722 (Target_x86_64::Target_x86_64): Initialize new fields.
4723 (Target_x86_64::do_plt_address_for_global): New function replacing
4724 do_plt_section_for_global.
4725 (Target_x86_64::do_plt_address_for_local): New function replacing
4726 do_plt_section_for_local.
4727 (Target_x86_64::got_section): Create got_irelative_.
4728 (Target_x86_64::rela_irelative_section): New function.
4729 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4730 all callers. Don't create __rel_iplt_{start,end}.
4731 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4732 parameters. Change all callers. Use different PLT and GOT for
4734 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4735 layout parameters. Change all callers. Use different PLT and
4737 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4738 parameters. Change all callers. Use different PLT and GOT for
4740 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4741 (Output_data_plt_x86_64::rela_irelative): New function.
4742 (Output_data_plt_x86_64::address_for_global): New function.
4743 (Output_data_plt_x86_64::address_for_local): New function.
4744 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4745 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4746 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4747 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4749 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4751 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4752 symbols if we didn't create an IRELATIVE GOT.
4753 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4754 plt_address_for_local.
4755 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4756 * testsuite/ifuncvar1.c: New test file.
4757 * testsuite/ifuncvar2.c: New test file.
4758 * testsuite/ifuncvar3.c: New test file.
4759 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4760 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4761 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4762 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4763 * testsuite/Makefile.in: Rebuild.
4765 2011-07-07 Cary Coutant <ccoutant@google.com>
4767 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4768 (two_file_test_1_ndebug.o): Likewise.
4769 (two_file_test_1b_ndebug.o): Likewise.
4770 (two_file_test_2_ndebug.o): Likewise.
4771 (two_file_test_main_ndebug.o): Likewise.
4772 (incremental_test_2): Link with no-debug versions.
4774 2011-07-06 Cary Coutant <ccoutant@google.com>
4776 * gold/incremental.cc
4777 (Output_section_incremental_inputs::write_info_blocks): Check for
4778 hidden and internal symbols.
4780 2011-07-06 Cary Coutant <ccoutant@google.com>
4782 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4783 Check disposition for startup file.
4784 (Incremental_inputs::report_command_line): Ignore
4785 --incremental-startup-unchanged option.
4786 * options.cc (General_options::parse_incremental_startup_unchanged):
4788 (General_options::General_options): Initialize new data member.
4789 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4790 (General_options): Add --incremental-startup-unchanged option.
4791 (General_options::incremental_startup_disposition): New function.
4792 (General_options::incremental_startup_disposition_): New data member.
4794 2011-07-06 Cary Coutant <ccoutant@google.com>
4796 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4797 input file index to Script_info ctor.
4798 (Sized_incremental_binary::do_file_has_changed): Find the
4799 command-line argument for files named in scripts.
4800 * incremental.h (Script_info::Script_info): New ctor
4801 with input file index.
4802 (Script_info::input_file_index): New function.
4803 (Script_info::input_file_index_): New data member.
4804 (Incremental_binary::get_library): Add const.
4805 (Incremental_binary::get_script_info): Add const.
4806 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4807 * testsuite/Makefile.am (incremental_test_5): New test case.
4808 (incremental_test_6): New test case.
4809 * testsuite/Makefile.in: Regenerate.
4811 2011-07-06 Cary Coutant <ccoutant@google.com>
4813 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4814 debug output when command lines differ.
4816 2011-07-06 Cary Coutant <ccoutant@google.com>
4818 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4819 --incremental-patch option.
4820 * layout.cc (Free_list::allocate): Extend allocation beyond original
4822 (Layout::make_output_section): Mark sections that should get
4824 * options.cc (parse_percent): New function.
4825 * options.h (parse_percent): New function.
4826 (DEFINE_percent): New macro.
4827 (General_options): Add --incremental-patch option.
4828 * output.cc (Output_section::Output_section): Initialize new data
4830 (Output_section::add_input_section): Print section name when out
4832 (Output_section::add_output_section_data): Likewise.
4833 (Output_section::set_final_data_size): Add patch space when
4834 doing --incremental-full.
4835 (Output_section::do_reset_address_and_file_offset): Remove patch
4837 (Output_segment::set_section_list_addresses): Print debug output
4838 only if --incremental-update.
4839 * output.h (Output_section::set_is_patch_space_allowed): New function.
4840 (Output_section::is_patch_space_allowed_): New data member.
4841 (Output_section::patch_space_): New data member.
4842 * parameters.cc (Parameters::incremental_full): New function.
4843 * parameters.h (Parameters::incremental_full): New function
4844 * testsuite/Makefile.am (incremental_test_2): Add test for
4845 --incremental-patch option.
4846 * testsuite/Makefile.in: Regenerate.
4847 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4848 (t18): Remove function body.
4850 2011-07-05 Doug Kwan <dougkwan@google.com>
4853 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4854 Arm_Address type for relocation result.
4855 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4857 (Arm_relocate_functions::abs32): Use unaligned access.
4858 (Arm_relocate_functions::rel32): Ditto.
4859 (Arm_relocate_functions::prel31): Ditto.
4860 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4861 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4862 static data relocations.
4863 * testsuite/Makefile.in: Regnerate.
4864 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4866 2011-07-05 Ian Lance Taylor <iant@google.com>
4869 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4870 symbols if necessary.
4871 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4873 2011-07-05 Ian Lance Taylor <iant@google.com>
4876 * resolve.cc (Symbol::override_base_with_special): Simply override
4877 version with special symbol version, ignoring previous version.
4879 2011-07-05 Ian Lance Taylor <iant@google.com>
4881 * object.cc (Sized_relobj_file::include_section_group): Add
4882 information to comment about signature location.
4884 2011-07-02 Ian Lance Taylor <iant@google.com>
4887 * options.h (class General_options): Add -f and -F.
4888 * options.cc (General_options::finalize): Fatal error if -f/-F
4889 are used without -shared.
4890 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4892 2011-07-02 Ian Lance Taylor <iant@google.com>
4894 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4896 2011-07-01 Ian Lance Taylor <iant@google.com>
4900 * resolve.cc (Symbol::override_base_with_special): Don't override
4901 the version if the overriding symbol has a different name.
4902 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4903 all callers. If we give an error about an undefined version,
4904 define the base version if necessary.
4905 * dynobj.h (class Versions): Update declaration.
4906 * testsuite/weak_alias_test_5.cc: New file.
4907 * testsuite/weak_alias_test.script: New file.
4908 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4909 and versioned_alias have the right value, and call t2.
4910 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4911 weak_alias_test_5.so.
4912 (weak_alias_test_LDADD): Likewise.
4913 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4914 * testsuite/Makefile.in: Rebuild.
4916 2011-07-01 Ian Lance Taylor <iant@google.com>
4919 * options.h (class General_options): Support -z notext.
4920 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4922 (two_file_shared_nonpic.so): Likewise.
4923 (two_file_shared_mixed.so): Likewise.
4924 (two_file_shared_mixed_1.so): Likewise.
4925 (weak_undef_lib_nonpic.so): Likewise.
4926 (alt/weak_undef_lib_nonpic.so): Likewise.
4927 (tls_test_shared_nonpic.so): Likewise.
4928 * testsuite/Makefile.in: Rebuild.
4930 2011-07-01 Ian Lance Taylor <iant@google.com>
4933 * configure.ac: Test whether static linking works, setting
4934 the automake conditional HAVE_STATIC.
4935 * testsuite/Makefile.am: Disable tests using -static if
4936 HAVE_STATIC is not true.
4937 * configure, testsuite/Makefile.in: Rebuild.
4939 2011-07-01 Ian Lance Taylor <iant@google.com>
4942 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4943 Assert if we see DW_EH_PE_indirect.
4944 * target.h (Target::ehframe_datarel_base): New function.
4945 (Target::do_ehframe_datarel_base): New target function.
4946 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4947 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4950 2011-07-01 Ian Lance Taylor <iant@google.com>
4953 * options.h (class General_options): Add
4954 --ld-generated-unwind-info.
4955 * ehframe.cc (Fde::write): Add address parameter. Change all
4956 callers. If associated with PLT, fill in address and size.
4957 (Cie::set_output_offset): Only add merge mapping if there is an
4959 (Cie::write): Add address parameter. Change all callers.
4960 (Eh_frame::add_ehframe_for_plt): New function.
4961 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4962 input_offset_ fields into union u_, with new plt field.
4963 (Fde::Fde): Adjust for new union field.
4964 (Fde::Fde) [Output_data version]: New constructor.
4965 (Fde::add_mapping): Only add merge mapping if there is an object.
4966 (class Cie): Update declarations.
4967 (class Eh_frame): Declare add_ehframe_for_plt.
4968 * layout.cc (Layout::layout_eh_frame): Break out code into
4969 make_eh_frame_section, and call it.
4970 (Layout::make_eh_frame_section): New function.
4971 (Layout::add_eh_frame_for_plt): New function.
4972 * layout.h (class Layout): Update declarations.
4973 * merge.cc (Merge_map::add_mapping): Add assertion.
4974 * i386.cc: Include "dwarf.h".
4975 (class Output_data_plt_i386): Make first_plt_entry,
4976 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4977 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4978 and plt_eh_frame_fde.
4979 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4980 boundary. Call add_eh_frame_for_plt if appropriate.
4981 * x86_64.cc: Include "dwarf.h".
4982 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4983 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4984 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4985 and plt_eh_frame_fde.
4986 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4989 2011-06-29 Ian Lance Taylor <iant@google.com>
4992 * object.cc (Sized_relobj_file::layout_section): Change shdr
4993 parameter to be const.
4994 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4996 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4997 appropriate. Call layout_eh_frame_section.
4998 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5000 * object.h (class Sized_relobj_file): Update declarations.
5002 2011-06-29 Ian Lance Taylor <iant@google.com>
5005 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5007 (Lex::gather_token): Accept trailing M/m/K/k for integers.
5009 2011-06-29 Ian Lance Taylor <iant@google.com>
5012 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5014 * layout.cc (Layout::layout_eh_frame): Likewise.
5016 2011-06-29 Ian Lance Taylor <iant@google.com>
5019 * layout.cc (Layout::symtab_section_shndx): New function.
5020 * layout.h (class Layout): Declare symtab_section_shndx.
5021 * output.cc (Output_section::write_header): Call it.
5023 2011-06-29 Ian Lance Taylor <iant@google.com>
5026 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5027 symbols which are not used in a relocation.
5029 2011-06-28 Ian Lance Taylor <iant@google.com>
5032 * layout.cc (Layout::segment_precedes): Don't crash if a linker
5033 script create indistinguishable segments.
5034 (Layout::set_segment_offsets): Use stable_sort when sorting
5035 segments. Pass this to Compare_segments constructor.
5036 * layout.h (class Layout): Make segment_precedes non-static.
5037 (class Compare_segments): Change from struct to class. Add
5038 layout_ field. Add constructor.
5039 * script-sections.cc
5040 (Script_sections::attach_sections_using_phdrs_clause): Rename
5041 local orphan to is_orphan. Don't report failure to put empty
5042 section in segment. On attachment failure, report name of
5043 section, and attach to first PT_LOAD segment.
5045 2011-06-28 Ian Lance Taylor <iant@google.com>
5048 * target-select.cc (Target_selector::Target_selector): Add
5049 emulation parameter. Change all callers.
5050 (select_target_by_bfd_name): Rename from select_target_by_name.
5052 (select_target_by_emulation): New function.
5053 (supported_emulation_names): New function.
5054 * target-select.h (class Target_selector): Add emulation_ field.
5055 Update declarations.
5056 (Target_selector::recognize_by_bfd_name): Rename from
5057 recognize_by_name. Change all callers.
5058 (Target_selector::supported_bfd_names): Rename from
5059 supported_names. Change all callers.
5060 (Target_selector::recognize_by_emulation): New function.
5061 (Target_selector::supported_emulations): New function.
5062 (Target_selector::emulation): New function.
5063 (Target_selector::do_recognize_by_bfd_name): Rename from
5064 do_recognize_by_name. Change all callers.
5065 (Target_selector::do_supported_bfd_names): Rename from
5066 do_supported_names. Change all callers.
5067 (Target_selector::do_recognize_by_emulation): New function.
5068 (Target_selector::do_supported_emulations): New function.
5069 (select_target_by_bfd_name): Change name in declaration.
5070 (select_target_by_emulation): Declare.
5071 (supported_emulation_names): Declare.
5072 * parameters.cc (parameters_force_valid_target): Try to find
5073 target based on emulation from -m option.
5074 * options.h (class General_options): Change doc string for -m.
5075 * options.cc (help): Print emulations.
5076 (General_options::parse_V): Likewise.
5077 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5078 Add emulation parameter. Change all callers.
5080 2011-06-28 Ian Lance Taylor <iant@google.com>
5082 * target.h (class Target): Add osabi_ field.
5083 (Target::osabi): New function.
5084 (Target::set_osabi): New function.
5085 (Target::Target): Initialize osabi_.
5086 (Target::do_adjust_elf_header): Make pure virtual.
5087 (Sized_target::do_adjust_elf_header): Declare.
5088 * target.cc (Sized_target::do_adjust_elf_header): New function.
5089 (class Sized_target): Instantiate all versions.
5090 * freebsd.h (class Target_freebsd): Remove.
5091 (Target_selector_freebsd::do_recognize): Call set_osabi on
5093 (Target_selector_freebsd::do_recognize_by_name): Likewise.
5094 (Target_selector_freebsd::set_osabi): Remove.
5095 * i386.cc (class Target_i386): Inherit from Sized_target rather
5096 than Target_freebsd.
5097 * x86_64.cc (class Target_x86_64): Likewise.
5099 2011-06-28 Ian Lance Taylor <iant@google.com>
5101 * target.h (Target::can_check_for_function_pointers): Rewrite.
5103 (Target::can_icf_inline_merge_sections): Likewise.
5104 (Target::section_may_have_icf_unsafe_poineters): Likewise.
5105 (Target::Target_info): Add can_icf_inline_merge_sections field.
5106 (Target::do_can_check_for_function_pointers): New virtual
5108 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5109 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5110 from can_check_for_function_pointers, move in file.
5111 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5112 section_may_have_icf_unsafe_poineters, move in file.
5113 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5114 * i386.cc (Target_i386::do_can_check_for_function_pointers):
5115 Rename from can_check_for_function_pointers, move in file.
5116 (Target_i386::can_icf_inline_merge_sections): Remove.
5117 (Target_i386::i386_info): Initialize
5118 can_icf_inline_merge_sections.
5119 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5120 Initialize can_icf_inline_merge_sections.
5121 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5122 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5123 Rename from can_check_for_function_pointers, move in file.
5124 (Target_x86_64::can_icf_inline_merge_sections): Remove.
5125 (Target_x86_64::x86_64_info): Initialize
5126 can_icf_inline_merge_sections.
5127 * testsuite/testfile.cc (Target_test::test_target_info):
5129 * icf.cc (get_section_contents): Correct formatting.
5131 2011-06-27 Ian Lance Taylor <iant@google.com>
5133 * symtab.cc (Symbol::versioned_name): New function.
5134 (Symbol_table::add_to_final_symtab): Use versioned_name when
5136 (Symbol_table::sized_write_symbol): Likewise.
5137 * symtab.h (class Symbol): Declare versioned_name.
5138 * stringpool.h (class Stringpool_template): Add variant of add
5139 which takes a std::basic_string.
5140 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5141 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5142 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5143 (ver_test_12.o): New target.
5144 * testsuite/Makefile.in: Rebuild.
5146 2011-06-27 Doug Kwan <dougkwan@google.com>
5148 * arm.cc (Arm_relocate_functions::thm_jump8,
5149 Arm_relocate_functions::thm_jump11): Use a wider signed
5150 type to compute offset.
5151 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5153 * testsuite/Makefile.in: Regenerate.
5154 * testsuite/arm_branch_in_range.sh: Check test results of
5155 arm_thm_jump11 and arm_thm_jump8.
5156 * testsuite/arm_thm_jump11.s: New test source file.
5157 * testsuite/arm_thm_jump11.t: New linker script.
5158 * testsuite/arm_thm_jump8.s: New test source file.
5159 * testsuite/arm_thm_jump8.t: New linker script.
5161 2011-06-24 Ian Lance Taylor <iant@google.com>
5163 * layout.cc: Include "object.h".
5164 (ctors_sections_in_init_array): New static variable.
5165 (Layout::is_ctors_in_init_array): New function.
5166 (Layout::layout): Add entry to ctors_sections_in_init_array if
5168 * layout.h (class Layout): Declare is_ctors_in_init_array.
5169 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5170 is_ctors_reverse_view is set.
5171 (Sized_relobj_file::write_sections): Add layout parameter. Change
5172 all callers. Set is_ctors_reverse_view field of View_size.
5173 (Sized_relobj_file::reverse_words): New function.
5174 * object.h (Sized_relobj_file::View_size): Add
5175 is_ctors_reverse_view field.
5176 (class Sized_relobj_file): Update declarations.
5177 * testsuite/initpri3.c: New test.
5178 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5180 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5181 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5182 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5183 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5184 * testsuite/Makefile.in: Rebuild.
5186 2011-06-24 Cary Coutant <ccoutant@google.com>
5188 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5189 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5190 (debug_msg_cdebug.err): New targets.
5191 * testsuite/Makefile.in: Regenerate.
5192 * testsuite/debug_msg.sh: Check output of link with compressed debug.
5193 Fix checks for link with shared library.
5195 2011-06-24 Doug Kwan <dougkwan@google.com>
5197 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5198 skip empty text sections.
5199 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5201 2011-06-22 Ian Lance Taylor <iant@google.com>
5204 * options.h (class General_options): Add --ctors-in-init-array.
5205 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5206 friends as SHT_PROGBITS for merging sections.
5207 (Layout::layout): Remove special handling of .init_array and
5208 friends. Don't sort if doing relocatable link. Sort for .ctors
5209 and .dtors if ctors_in_init_array.
5210 (Layout::make_output_section): Force correct section types for
5211 .init_array and friends. Don't sort if doing relocatable link,
5212 Don't sort .ctors and .dtors if ctors_in_init_array.
5213 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5214 (Layout::output_section_name): Add relobj parameter. Change all
5215 callers. Handle .ctors. and .dtors. in code rather than table.
5216 Handle .ctors and .dtors if ctors_in_init_array.
5217 (Layout::match_file_name): New function, moved from output.cc.
5218 * layout.h (class Layout): Update declarations.
5219 * output.cc: Include "layout.h".
5220 (Input_section_sort_entry::get_priority): New function.
5221 (Input_section_sort_entry::match_file_name): Just call
5222 Layout::match_file_name.
5223 (Output_section::Input_section_sort_init_fini_compare::operator()):
5224 Handle .ctors and .dtors. Sort by explicit priority rather than
5226 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5227 * testsuite/initpri2.c: New test.
5228 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5229 (check_PROGRAMS): Add initpri2.
5230 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5231 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5232 * configure, testsuite/Makefile.in: Rebuild.
5234 2011-06-19 Ian Lance Taylor <iant@google.com>
5237 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5238 .interp section to a PT_INTERP segment even if we have seen a
5239 --dynamic-linker option. Don't do it if we have seen a PHDRS
5240 clause in a linker script.
5241 (Layout::finalize): Don't create a .interp section if we've
5242 already create a PT_INTERP segment.
5243 (Layout::create_interp): Always call choose_output_section (revert
5244 patch of 2011-06-17). Don't create PT_INTERP segment.
5245 * script-sections.cc
5246 (Script_sections::create_note_and_tls_segments): Add a .interp
5247 section to a PT_INTERP segment even if we have seen a
5248 --dynamic-linker option.
5250 2011-06-18 Ian Lance Taylor <iant@google.com>
5252 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5253 merely because a non-PT_LOAD segment has a dynamic reloc.
5255 2011-06-18 Ian Lance Taylor <iant@google.com>
5257 * layout.cc (Layout::finish_dynamic_section): Don't create
5258 DT_FLAGS entry if not needed.
5260 2011-06-18 Ian Lance Taylor <iant@google.com>
5263 * layout.cc (Layout::layout_eh_frame): Correct handling of
5264 writable .eh_frame section.
5266 2011-06-17 Ian Lance Taylor <iant@google.com>
5269 * resolve.cc (Symbol_table::resolve): Don't give an error if a
5270 symbol is redefined with the exact same object and value.
5272 2011-06-17 Ian Lance Taylor <iant@google.com>
5275 * layout.h (class Layout): Add interp_segment_ field.
5276 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5277 (Layout::attach_allocated_section_to_segment): If making shared
5278 library, put .interp section in PT_INTERP segment.
5279 (Layout::finalize): Also call create_interp if -dynamic-linker
5281 (Layout::create_interp): Assert that there is no PT_INTERP
5282 segment. If not using a SECTIONS clause, use make_output_section.
5283 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5284 * script-sections.cc
5285 (Script_sections::create_note_and_tls_segments): If making shared
5286 library, put .interp section in PT_INTERP segment.
5288 2011-06-17 Ian Lance Taylor <iant@google.com>
5290 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5291 when making a shared library.
5293 2011-06-17 Ian Lance Taylor <iant@google.com>
5295 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5296 parameter. Change all callers. Don't issue warning about PC32
5297 against locally defined symbol.
5299 2011-06-16 Ian Lance Taylor <iant@google.com>
5301 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5302 occurs in same object.
5304 2011-06-14 Alan Modra <amodra@gmail.com>
5306 * po/POTFILES.in: Regenerate.
5308 2011-06-09 Ian Lance Taylor <iant@google.com>
5310 * script-sections.cc
5311 (Orphan_output_section::set_section_addresses): For a relocatable
5312 link set address to 0.
5314 2011-06-09 Cary Coutant <ccoutant@google.com>
5317 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5318 used with --compress-debug-sections.
5319 * gold/object.cc (Sized_relobj_file::do_layout): Report
5320 uncompressed size of compressed input sections.
5322 2011-06-08 Cary Coutant <ccoutant@google.com>
5325 * testsuite/two_file_test_2_v1.cc: Change initialization of
5326 v2 to keep it in .data.
5328 2011-06-07 Cary Coutant <ccoutant@google.com>
5330 * common.cc (Symbol_table::do_allocate_commons_list): Call
5332 * errors.cc (Errors::fatal): Adjust call to gold_exit.
5333 (Errors::fallback): New function.
5334 (gold_fallback): New function.
5335 * errors.h (Errors::fallback): New function.
5336 * gold.cc (gold_exit): Change status parameter to enum; adjust
5338 (queue_initial_tasks): Call gold_fallback.
5339 * gold.h: Include cstdlib.
5340 (Exit_status): New enum type.
5341 (gold_exit): Change status parameter to enum.
5342 (gold_fallback): New function.
5343 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5344 (Layout::create_symtab_sections): Likewise.
5345 (Layout::create_shdrs): Likewise.
5346 * main.cc (main): Adjust call to gold_exit.
5347 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5348 (Output_data_got::add_got_entry_pair): Likewise.
5349 (Output_section::add_input_section): Likewise.
5350 (Output_section::add_output_section_data): Likewise.
5351 (Output_segment::set_section_list_addresses): Likewise.
5352 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5354 2011-06-07 Cary Coutant <ccoutant@google.com>
5356 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5357 for incremental links.
5358 * output.cc (Output_segment::set_section_list_addresses): Remove
5359 FIXME and test for TLS or BSS.
5361 2011-06-07 Cary Coutant <ccoutant@google.com>
5363 * testsuite/Makefile.am: Add incremental_copy_test,
5364 incremental_common_test_1.
5365 * testsuite/Makefile.in: Regenerate.
5366 * testsuite/common_test_1_v1.c: New source file.
5367 * testsuite/common_test_1_v2.c: New source file.
5368 * testsuite/copy_test_v1.cc: New source file.
5370 2011-06-07 Cary Coutant <ccoutant@google.com>
5372 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5373 update, allocate common from bss section's free list.
5374 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5375 linker-defined symbols.
5376 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5377 Skip GOT and PLT entries that are no longer referenced.
5378 (Output_section_incremental_inputs::write_info_blocks): Mark
5379 linker-defined symbols.
5380 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5381 * output.cc (Output_section::allocate): New function.
5382 * output.h (Output_section::allocate): New function.
5383 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5384 linker-defined symbols.
5385 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5386 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5387 (Symbol::init_base_output_data): Likewise.
5388 (Symbol::init_base_output_segment): Likewise.
5389 (Symbol::init_base_constant): Likewise.
5390 (Sized_symbol::init_output_data): Likewise.
5391 (Sized_symbol::init_output_segment): Likewise.
5392 (Sized_symbol::init_constant): Likewise.
5393 (Symbol_table::do_define_in_output_data): Likewise.
5394 (Symbol_table::do_define_in_output_segment): Likewise.
5395 (Symbol_table::do_define_as_constant): Likewise.
5396 * symtab.h (Symbol::is_predefined): New function.
5397 (Symbol::init_base_output_data): Add is_predefined parameter.
5398 (Symbol::init_base_output_segment): Likewise.
5399 (Symbol::init_base_constant): Likewise.
5400 (Symbol::is_predefined_): New data member.
5401 (Sized_symbol::init_output_data): Add is_predefined parameter.
5402 (Sized_symbol::init_output_segment): Likewise.
5403 (Sized_symbol::init_constant): Likewise.
5404 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5406 2011-06-07 Cary Coutant <ccoutant@google.com>
5408 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5409 instead of emit_copy_reloc.
5410 (Copy_relocs::emit_copy_reloc): Refactor.
5411 (Copy_relocs::make_copy_reloc): New function.
5412 (Copy_relocs::add_copy_reloc): Remove.
5413 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5415 (Copy_relocs::make_copy_reloc): New function.
5416 (Copy_relocs::add_copy_reloc): Remove.
5417 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5418 unchanged input files.
5419 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5420 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5421 Reserve BSS space for COPY relocations.
5422 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5423 (Output_section_incremental_inputs::write_info_blocks): Record
5424 whether a symbol is copied from a shared object.
5425 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5426 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5427 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5428 (Incremental_input_entry_reader::get_output_symbol_index): Add
5430 (Incremental_binary::emit_copy_relocs): New function.
5431 (Incremental_binary::do_emit_copy_relocs): New function.
5432 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5434 (Sized_incremental_binary::add_copy_reloc): New function.
5435 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5436 (Sized_incremental_binary::Copy_reloc): New struct.
5437 (Sized_incremental_binary::Copy_relocs): New typedef.
5438 (Sized_incremental_binary::copy_relocs_): New data member.
5439 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5440 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5441 * target.h (Sized_target::emit_copy_reloc): New function.
5442 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5444 2011-06-02 Cary Coutant <ccoutant@google.com>
5447 * gold/archive.cc (Archive::Archive): Initialize new data member.
5448 (Archive::include_all_members): Return if archive has already been
5450 * gold/archive.h (Archive::include_all_members_): New data member.
5452 2011-06-02 Nick Clifton <nickc@redhat.com>
5454 * dynobj.h: Fix spelling mistake in comment.
5455 * output.cc: Likewise.
5457 2011-05-31 Doug Kwan <dougkwan@google.com>
5461 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5462 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5463 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5464 redundant arm_exidx_test.so.
5465 * testsuite/Makefile.in: Regenerate.
5466 (check_SCRIPTS): Add pr12826.sh
5467 (check_DATA): Add pr12826.stdout
5468 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5469 * testsuite/pr12826.sh: New file.
5470 * testsuite/pr12826_1.s: Ditto.
5471 * testsuite/pr12826_1.s: Ditto.
5473 2011-05-30 Ian Lance Taylor <iant@google.com>
5475 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5478 2011-05-29 Ian Lance Taylor <iant@google.com>
5481 * testsuite/Makefile.am: Use different file name for two_file_test
5482 temporary file for each incremental test.
5483 * testsuite/Makefile.in: Rebuild.
5485 2011-05-29 Ian Lance Taylor <iant@google.com>
5487 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5488 binary input file is empty.
5490 2011-05-27 Ian Lance Taylor <iant@google.com>
5492 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5493 (ver_test_9.so): Likewise.
5494 * testsuite/Makefile.in: Rebuild.
5496 2011-05-26 Cary Coutant <ccoutant@google.com>
5498 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5499 * incremental.cc (Incremental_inputs::report_input_section): Fix
5500 comment, indentation.
5501 (Incremental_inputs::report_comdat_group): New function.
5502 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5503 of data for incremental input file entry.
5504 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5505 group count, COMDAT group signatures.
5506 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5507 an unchanged input file.
5508 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5509 Initialize new data member.
5510 (Incremental_object_entry::add_comdat_group): New function.
5511 (Incremental_object_entry::get_comdat_group_count): New function.
5512 (Incremental_object_entry::get_comdat_signature_key): New function.
5513 (Incremental_object_entry::groups_): New data member.
5514 (Incremental_inputs::report_comdat_group): New function.
5515 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5516 data for incremental input file entry.
5517 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5518 (Incremental_input_entry_reader::get_input_section): Adjust size of
5519 data for incremental input file entry.
5520 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5521 (Incremental_input_entry_reader::get_comdat_group_signature): New
5523 * object.cc (Sized_relobj::include_section_group): Report kept
5524 COMDAT groups for incremental links.
5526 2011-05-24 David Meyer <pdox@google.com>
5528 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5529 with name parameter. Add found_name parameter.
5530 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5531 * dirsearch.h (class Dirsearch): Update declaration.
5533 2011-05-24 Ian Lance Taylor <iant@google.com>
5535 * archive.cc (Library_base::should_include_member): Pull in object
5536 from archive if it defines the entry symbol.
5537 * parameters.cc (Parameters::entry): New function.
5538 * parameters.h (class Parameters): Declare entry.
5539 * output.h (class Output_file_header): Remove entry_ field.
5540 * output.cc (Output_file_header::Output_file_header): Remove entry
5541 parameter. Change all callers.
5542 (Output_file_header::entry): Use parameters->entry.
5543 * gold.cc (queue_middle_tasks): Likewise.
5544 * plugin.cc (Plugin_hook::run): Likewise.
5546 2011-05-24 Cary Coutant <ccoutant@google.com>
5548 * gold.cc (queue_initial_tasks): Pass incremental base filename
5549 to Output_file::open_base_file; don't print error message.
5550 * incremental-dump.cc (main): Adjust call to
5551 Output_file::open_for_modification.
5552 * incremental-dump.cc (main): Likewise.
5553 * incremental.cc (Incremental_inputs::report_command_line):
5554 Ignore --incremental-base option when comparing command lines.
5555 Ignore parameter when given as separate argument.
5556 * options.h (class General_options): Add --incremental-base.
5557 * output.cc (Output_file::Output_file):
5558 (Output_file::open_base_file): Add base_name and writable parameters;
5559 read base file into new file; print error message here.
5560 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5562 * output.h (Output_file::open_for_modification): Rename to...
5563 (Output_file::open_base_file): ...this; add base_name and
5564 writable parameters; adjust all callers.
5565 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5567 * testsuite/Makefile.am (incremental_test_4): Test
5569 * testsuite/Makefile.in: Regenerate.
5571 2011-05-24 Cary Coutant <ccoutant@google.com>
5573 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5575 * testsuite/Makefile.in: Regenerate.
5576 * testsuite/two_file_test_1_v1.cc: New test source file.
5577 * testsuite/two_file_test_1b_v1.cc: New test source file.
5578 * testsuite/two_file_test_2_v1.cc: New test source file.
5580 2011-05-24 Cary Coutant <ccoutant@google.com>
5582 * dynobj.h (Dynobj::do_dynobj): New function.
5583 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5584 flag and soname for shared objects.
5585 * incremental.cc (Incremental_inputs::report_object): Make
5586 either Incremental_object_entry or Incremental_dynobj_entry; add
5587 soname to string table.
5588 (Incremental_inputs::report_input_section): Add assertion.
5589 (Output_section_incremental_inputs::set_final_data_size): Adjust
5590 type of input file entry for shared libraries; adjust size of
5591 shared library info entry.
5592 (Output_section_incremental_inputs::write_input_files): Write
5593 as_needed flag for shared libraries.
5594 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5595 of input file entry for shared libraries; write soname.
5596 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5597 soname from incremental info.
5598 * incremental.h (enum Incremental_input_flags): Add
5599 INCREMENTAL_INPUT_AS_NEEDED.
5600 (Incremental_input_entry::Incremental_input_entry): Initialize new
5602 (Incremental_input_entry::set_as_needed): New function.
5603 (Incremental_input_entry::as_needed): New function.
5604 (Incremental_input_entry::do_dynobj_entry): New function.
5605 (Incremental_input_entry::as_needed_): New data member.
5606 (Incremental_object_entry::Incremental_object_entry): Don't check
5608 (Incremental_object_entry::do_type): Likewise.
5609 (class Incremental_dynobj_entry): New class.
5610 (Incremental_input_entry_reader::as_needed): New function.
5611 (Incremental_input_entry_reader::get_soname): New function.
5612 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5613 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5614 size of shared library info entry.
5615 * layout.cc (Layout::finish_dynamic_section): Don't test for
5616 incremental link when adding DT_NEEDED entries.
5617 * object.h (Object::Object): Initialize new data member.
5618 (Object::dynobj): New function.
5619 (Object::set_as_needed): New function.
5620 (Object::as_needed): New function.
5621 (Object::do_dynobj): New function.
5622 (Object::as_needed_): New data member.
5624 2011-05-24 Cary Coutant <ccoutant@google.com>
5626 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5627 info; adjust display of GOT entries.
5628 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5629 vector of input objects; remove file_status_.
5630 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5631 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5632 got_plt reader; call target hooks to reserve GOT entries.
5633 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5634 of input file info header and GOT info entry.
5635 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5637 (Got_plt_view_info::got_descriptor): Remove.
5638 (Got_plt_view_info::sym_index): New data member.
5639 (Got_plt_view_info::input_index): New data member.
5640 (Local_got_offset_visitor::visit): Write input file index.
5641 (Global_got_offset_visitor::visit): Write 0 for input file index.
5642 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5643 with sym_index and input_index.
5644 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5645 incremental info GOT entry; replace got_descriptor with input_index.
5646 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5647 map from input file index to object.
5648 (Sized_relobj_incr::do_layout): Replace direct data member reference
5649 with accessor function.
5650 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5651 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5652 Adjust size of input file info header.
5653 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5654 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5655 (Incremental_input_entry_reader::get_input_section): Adjust size of
5656 input file info header.
5657 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5658 of incremental info GOT entry.
5659 (Incremental_got_plt_reader::get_got_desc): Remove.
5660 (Incremental_got_plt_reader::get_got_symndx): New function.
5661 (Incremental_got_plt_reader::get_got_input_index): New function.
5662 (Sized_incremental_binary::Sized_incremental_binary): Remove
5663 file_status_; add input_objects_.
5664 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5665 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5666 (Sized_incremental_binary::file_is_unchanged): Remove.
5667 (Sized_incremental_binary::set_input_object): New function.
5668 (Sized_incremental_binary::input_object): New function.
5669 (Sized_incremental_binary::file_status_): Remove.
5670 (Sized_incremental_binary::input_objects_): New data member.
5671 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5673 (Sized_relobj_incr::invalid_address): Move to base class.
5674 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5676 (Sized_relobj_incr::do_output_section_offset): Likewise.
5677 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5678 (Sized_relobj_incr::section_offsets_): Likewise.
5679 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5681 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5682 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5683 with accessor function.
5684 (Sized_relobj_file::do_layout): Likewise.
5685 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5686 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5687 (Sized_relobj_file::compute_final_local_value): Replace refs to
5688 section_offsets_ with accessor function.
5689 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5690 * object.h (Relobj::Relobj): Initialize new data members.
5691 (Relobj::add_dyn_reloc): New function.
5692 (Relobj::first_dyn_reloc): New function.
5693 (Relobj::dyn_reloc_count): New function.
5694 (Relobj::first_dyn_reloc_): New data member.
5695 (Relobj::dyn_reloc_count_): New data member.
5696 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5698 (Sized_relobj::Address): New typedef.
5699 (Sized_relobj::invalid_address): Move here from child class.
5700 (Sized_relobj::Sized_relobj): Initialize new data members.
5701 (Sized_relobj::sized_relobj): New function.
5702 (Sized_relobj::is_output_section_offset_invalid): Move here from
5704 (Sized_relobj::get_output_section_offset): Likewise.
5705 (Sized_relobj::local_has_got_offset): Likewise.
5706 (Sized_relobj::local_got_offset): Likewise.
5707 (Sized_relobj::set_local_got_offset): Likewise.
5708 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5709 (Sized_relobj::clear_got_offsets): New function.
5710 (Sized_relobj::section_offsets): Move here from child class.
5711 (Sized_relobj::do_output_section_offset): Likewise.
5712 (Sized_relobj::do_set_section_offset): Likewise.
5713 (Sized_relobj::Local_got_offsets): Likewise.
5714 (Sized_relobj::local_got_offsets_): Likewise.
5715 (Sized_relobj::section_offsets_): Likewise.
5716 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5718 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5720 (Sized_relobj_file::sized_relobj): New function
5721 (Sized_relobj_file::local_has_got_offset): Move to base class.
5722 (Sized_relobj_file::local_got_offset): Likewise.
5723 (Sized_relobj_file::set_local_got_offset): Likewise.
5724 (Sized_relobj_file::get_output_section_offset): Likewise.
5725 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5726 (Sized_relobj_file::do_output_section_offset): Likewise.
5727 (Sized_relobj_file::do_set_section_offset): Likewise.
5728 (Sized_relobj_file::Local_got_offsets): Likewise.
5729 (Sized_relobj_file::local_got_offsets_): Likewise.
5730 (Sized_relobj_file::section_offsets_): Likewise.
5731 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5733 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5734 (Output_reloc::get_symbol_index): Likewise.
5735 (Output_reloc::local_section_offset): Likewise.
5736 (Output_reloc::get_address): Likewise.
5737 (Output_reloc::symbol_value): Likewise.
5738 (Output_data_got::reserve_slot): Move to class definition.
5739 (Output_data_got::reserve_local): New function.
5740 (Output_data_got::reserve_slot_for_global): Remove.
5741 (Output_data_got::reserve_global): New function.
5742 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5743 (all constructors, two instantiations).
5744 (Output_reloc::get_relobj): New function (two instantiations).
5745 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5746 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5747 (Output_data_reloc::add_global): Adjust type of relobj.
5748 (Output_data_reloc::add_global_relative): Likewise.
5749 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5750 (Output_data_reloc::add_local): Likewise.
5751 (Output_data_reloc::add_local_relative): Likewise.
5752 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5753 (Output_data_reloc::add_local_section): Likewise.
5754 (Output_data_reloc::add_output_section): Likewise.
5755 (Output_data_reloc::add_absolute): Likewise.
5756 (Output_data_reloc::add_target_specific): Likewise.
5757 (Output_data_got::reserve_slot): Move definition here.
5758 (Output_data_got::reserve_local): New function.
5759 (Output_data_got::reserve_global): New function.
5760 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5761 section_offsets_ with accessor function.
5762 (Sized_relobj_file::write_sections): Likewise.
5763 (Sized_relobj_file::do_relocate_sections): Likewise.
5764 * target.h (Sized_target::reserve_local_got_entry): New function.
5765 (Sized_target::reserve_global_got_entry): New function.
5766 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5767 (Target_x86_64::reserve_global_got_entry): New function.
5768 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5770 2011-05-23 Cary Coutant <ccoutant@google.com>
5772 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5773 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5774 bit when checking got_type.
5775 * incremental.cc (Sized_incremental_binary::setup_readers):
5776 Store symbol table and string table locations; initialize bit vector
5777 of file status flags.
5778 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5780 (Sized_incremental_binary::do_process_got_plt): New function.
5781 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5782 (Output_section_incremental_inputs::set_final_data_size): Record
5783 file index for each input file.
5784 (Output_section_incremental_inputs::write_got_plt): Store file index
5785 instead of input entry offset for each GOT entry.
5787 (Incremental_input_entry::Incremental_input_entry): Initialize new
5789 (Incremental_input_entry::set_offset): Store file index.
5790 (Incremental_input_entry::get_file_index): New function.
5791 (Incremental_input_entry::file_index_): New data member.
5792 (Incremental_binary::process_got_plt): New function.
5793 (Incremental_binary::do_process_got_plt): New function.
5794 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5796 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5797 (Sized_incremental_binary::set_file_is_unchanged): New function.
5798 (Sized_incremental_binary::file_is_unchanged): New function.
5799 (Sized_incremental_binary::do_process_got_plt): New function.
5800 (Sized_incremental_binary::file_status_): New data member.
5801 (Sized_incremental_binary::main_symtab_loc_): New data member.
5802 (Sized_incremental_binary::main_strtab_loc_): New data member.
5803 * output.cc (Output_data_got::Got_entry::write): Add case
5805 (Output_data_got::add_global): Call add_got_entry.
5806 (Output_data_got::add_global_plt): Likewise.
5807 (Output_data_got::add_global_with_rel): Likewise.
5808 (Output_data_got::add_global_with_rela): Likewise.
5809 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5810 (Output_data_got::add_global_pair_with_rela): Likewise.
5811 (Output_data_got::add_local): Call add_got_entry.
5812 (Output_data_got::add_local_plt): Likewise.
5813 (Output_data_got::add_local_with_rel): Likewise.
5814 (Output_data_got::add_local_with_rela): Likewise.
5815 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5816 (Output_data_got::add_local_pair_with_rela): Likewise.
5817 (Output_data_got::reserve_slot): New function.
5818 (Output_data_got::reserve_slot_for_global): New function.
5819 (Output_data_got::add_got_entry): New function.
5820 (Output_data_got::add_got_entry_pair): New function.
5821 (Output_section::add_output_section_data): Edit FIXME.
5823 (Output_section_data_build::Output_section_data_build): New
5824 constructor with size parameter.
5825 (Output_data_space::Output_data_space): Likewise.
5826 (Output_data_got::Output_data_got): Initialize new data member; new
5827 constructor with size parameter.
5828 (Output_data_got::add_constant): Call add_got_entry.
5829 (Output_data_got::reserve_slot): New function.
5830 (Output_data_got::reserve_slot_for_global): New function.
5831 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5832 (Output_data_got::add_got_entry): New function.
5833 (Output_data_got::add_got_entry_pair): New function.
5834 (Output_data_got::free_list_): New data member.
5835 * target.h (Sized_target::init_got_plt_for_update): New function.
5836 (Sized_target::register_global_plt_entry): New function.
5837 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5838 Initialize new data member; call init; add constructor with PLT count.
5839 (Output_data_plt_x86_64::init): New function.
5840 (Output_data_plt_x86_64::add_relocation): New function.
5841 (Output_data_plt_x86_64::reserve_slot): New function.
5842 (Output_data_plt_x86_64::free_list_): New data member.
5843 (Target_x86_64::init_got_plt_for_update): New function.
5844 (Target_x86_64::register_global_plt_entry): New function.
5845 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5846 incremental updates.
5847 (Output_data_plt_x86_64::add_relocation): New function.
5848 * testsuite/object_unittest.cc (Object_test): Set default options.
5850 2011-05-16 Ian Lance Taylor <iant@google.com>
5852 * options.h (class General_options): Make -i a synonym for -r.
5854 2011-05-16 Ian Lance Taylor <iant@google.com>
5856 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5858 2011-05-10 Cary Coutant <ccoutant@google.com>
5860 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5863 2011-05-06 Ian Lance Taylor <iant@google.com>
5865 * layout.cc (Layout::layout): If the output section flags change,
5866 update the ordering.
5868 2011-04-25 Cary Coutant <ccoutant@google.com>
5870 * incremental-dump.cc (dump_incremental_inputs): Print local
5871 symbol info for each input file.
5873 (Output_section_incremental_inputs::set_final_data_size): Add local
5874 symbol info to input file entries in incremental info.
5875 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5876 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5877 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5878 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5880 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5881 (Sized_incr_relobj::do_relocate): Write the local symbols.
5882 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5883 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5884 Adjust size of input file header.
5885 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5886 (Incremental_inputs_reader::get_local_symbol_count): New function.
5887 (Incremental_inputs_reader::get_input_section): Adjust size of input
5889 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5890 (Sized_incr_relobj::This): New typedef.
5891 (Sized_incr_relobj::sym_size): New const data member.
5892 (Sized_incr_relobj::Local_symbol): New struct.
5893 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5894 (Sized_incr_relobj::do_local_symbol_offset): New function.
5895 (Sized_incr_relobj::local_symbol_count_): New data member.
5896 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5897 (Sized_incr_relobj::local_symbol_index_): New data member.
5898 (Sized_incr_relobj::local_symbol_offset_): New data member.
5899 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5900 (Sized_incr_relobj::local_symbols_): New data member.
5901 * object.h (Relobj::output_local_symbol_count): New function.
5902 (Relobj::local_symbol_offset): New function.
5903 (Relobj::do_output_local_symbol_count): New function.
5904 (Relobj::do_local_symbol_offset): New function.
5905 (Sized_relobj::do_output_local_symbol_count): New function.
5906 (Sized_relobj::do_local_symbol_offset): New function.
5908 2011-04-22 Vladimir Simonov <sv@sw.ru>
5910 * descriptors.cc (set_close_on_exec): New function.
5911 (Descriptors::open): Use set_close_on_exec.
5912 * output.cc (S_ISLNK): Define if not defined.
5914 2011-04-22 Cary Coutant <ccoutant@google.com>
5916 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5918 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5919 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5920 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5922 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5923 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5924 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5926 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5928 (Incremental_binary::apply_incremental_relocs): New function.
5929 (Incremental_binary::do_apply_incremental_relocs): New function.
5930 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5932 (Sized_incremental_binary::add_global_symbol): New function.
5933 (Sized_incremental_binary::global_symbol): New function.
5934 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5935 (Sized_incremental_binary::symbol_map_): New data member.
5936 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5937 * target.h (Sized_target::apply_relocation): New function.
5938 * target-reloc.h (apply_relocation): New function.
5939 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5941 2011-04-22 Doug Kwan <dougkwan@google.com>
5943 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5944 flag of a SHT_ARM_EXIDX section.
5945 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5946 * testsuite/Makefile.in: Regenerate.
5947 * testsuite/arm_exidx_test.s: New file.
5948 * testsuite/arm_exidx_test.sh: Same.
5950 2011-04-20 Cary Coutant <ccoutant@google.com>
5953 * archive.h (Incremental_archive_entry::Archive_member):
5954 Initialize arg_serial_ (second constructor).
5956 2011-04-17 Ian Lance Taylor <iant@google.com>
5958 * object.cc (Relocate_info::location): Simplify location string.
5959 * errors.cc (Errors::error_at_location): Don't print program
5961 (Errors::warning_at_location): Likewise.
5962 (Errors::undefined_symbol): Likewise.
5963 * testsuite/debug_msg.sh: Update accordingly.
5965 2011-04-14 Cary Coutant <ccoutant@google.com>
5967 * gold/layout.cc (Layout::symtab_section_offset): New function.
5968 * gold/layout.h (Layout::symtab_section_offset): New function.
5969 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5971 2011-04-12 Ian Lance Taylor <iant@google.com>
5973 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5974 with MREMAP_MAYMOVE.
5975 * output.h (class Output_file): Add map_is_allocated_ field.
5976 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5977 not available, provide stubs. If mremap is not available, #define
5979 (MREMAP_MAYMOVE): Define if not defined.
5980 (Output_file::Output_file): Initialize map_is_allocated_.
5981 (Output_file::resize): Check map_is_allocated_.
5982 (Output_file::map_anonymous): If mmap fails, use malloc.
5983 (Output_file::unmap): Don't do anything for an anonymous map.
5984 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5985 is not available, provide stubs.
5986 (File_read::View::~View): Use free rather than delete[].
5987 (File_read::make_view): Use malloc rather than new[]. If mmap
5989 (File_read::find_or_make_view): Use malloc rather than new[].
5990 * gold.h: Remove HAVE_REMAP code.
5991 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5992 exists. Rename mremap to gold_mremap. If mmap is not available
5994 * configure, config.in: Rebuild.
5996 2011-04-11 Ian Lance Taylor <iant@google.com>
5998 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5999 initialize local variable v.
6001 2011-04-11 Cary Coutant <ccoutant@google.com>
6003 * archive.cc (Archive::include_member): Adjust call to
6005 (Add_archive_symbols::run): Track argument serial numbers.
6006 (Lib_group::include_member): Likewise.
6007 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6008 * archive.h (Incremental_archive_entry::Archive_member):
6009 Initialize arg_serial_.
6010 (Archive_member::arg_serial_): New data member.
6011 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6012 (Sized_dynobj::do_add_symbols): Track symbols when doing an
6014 (Sized_dynobj::do_for_all_local_got_entries): New function.
6015 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6017 * fileread.cc (get_mtime): New function.
6018 * fileread.h (get_mtime): New function.
6019 * gold.cc (queue_initial_tasks): Check for incremental update.
6020 (process_incremental_input): New function.
6021 (queue_middle_tasks): Don't force valid target for incremental
6023 * incremental-dump.cc (find_input_containing_global): Adjust
6024 size of symbol info entry.
6025 (dump_incremental_inputs): Dump argument serial number and
6026 in_system_directory flag; bias shndx by 1; print symbol names
6027 when dumping per-file symbol lists; use new symbol info readers.
6029 (Output_section_incremental_inputs:update_data_size): New function.
6030 (Sized_incremental_binary::setup_readers): Setup input readers
6031 for each input file; build maps for files added from libraries
6033 (Sized_incremental_binary::check_input_args): New function.
6034 (Sized_incremental_binary::do_check_inputs): Build map of argument
6035 serial numbers to input arguments.
6036 (Sized_incremental_binary::do_file_has_changed): Rename
6037 do_file_is_unchanged to this; compare file modification times.
6038 (Sized_incremental_binary::do_init_layout): New function.
6039 (Sized_incremental_binary::do_reserve_layout): New function.
6040 (Sized_incremental_binary::do_get_input_reader): Remove.
6041 (Sized_incremental_binary::get_symtab_view): New function.
6042 (Incremental_checker::can_incrementally_link_output_file): Remove.
6043 (Incremental_inputs::report_command_line): Exclude --debug options.
6044 (Incremental_inputs::report_archive_begin): Add parameter; track
6045 argument serial numbers; don't put input file entry for archive
6046 before archive members.
6047 (Incremental_inputs::report_archive_end): Put input file entry
6048 for archive after archive members.
6049 (Incremental_inputs::report_object): Add parameter; track argument
6050 serial numbers and in_system_directory flag.
6051 (Incremental_inputs::report_script): Add parameter; track argument
6053 (Output_section_incremental_inputs::set_final_data_size): Adjust
6054 size of symbol info entry; check for forwarding symbols.
6055 (Output_section_incremental_inputs::write_input_files): Write
6056 in_system_directory flag and argument serial number.
6057 (Output_section_incremental_inputs::write_info_blocks): Map section
6058 indices between incremental info and original input file; store
6059 input section index for each symbol.
6060 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6061 change operator() to visit().
6062 (class Global_got_offset_visitor): Likewise.
6063 (class Global_symbol_visitor_got_plt):
6064 (Output_section_incremental_inputs::write_got_plt): Use new visitor
6066 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6067 (Sized_incr_relobj::do_read_symbols): New function.
6068 (Sized_incr_relobj::do_layout): New function.
6069 (Sized_incr_relobj::do_layout_deferred_sections): New function.
6070 (Sized_incr_relobj::do_add_symbols): New function.
6071 (Sized_incr_relobj::do_should_include_member): New function.
6072 (Sized_incr_relobj::do_for_all_global_symbols): New function.
6073 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6074 (Sized_incr_relobj::do_section_size): New function.
6075 (Sized_incr_relobj::do_section_name): New function.
6076 (Sized_incr_relobj::do_section_contents): New function.
6077 (Sized_incr_relobj::do_section_flags): New function.
6078 (Sized_incr_relobj::do_section_entsize): New function.
6079 (Sized_incr_relobj::do_section_address): New function.
6080 (Sized_incr_relobj::do_section_type): New function.
6081 (Sized_incr_relobj::do_section_link): New function.
6082 (Sized_incr_relobj::do_section_info): New function.
6083 (Sized_incr_relobj::do_section_addralign): New function.
6084 (Sized_incr_relobj::do_initialize_xindex): New function.
6085 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6086 (Sized_incr_relobj::do_read_relocs): New function.
6087 (Sized_incr_relobj::do_gc_process_relocs): New function.
6088 (Sized_incr_relobj::do_scan_relocs): New function.
6089 (Sized_incr_relobj::do_count_local_symbols): New function.
6090 (Sized_incr_relobj::do_finalize_local_symbols): New function.
6091 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6092 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6093 (Sized_incr_relobj::do_relocate): New function.
6094 (Sized_incr_relobj::do_set_section_offset): New function.
6095 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6096 (Sized_incr_dynobj::do_read_symbols): New function.
6097 (Sized_incr_dynobj::do_layout): New function.
6098 (Sized_incr_dynobj::do_add_symbols): New function.
6099 (Sized_incr_dynobj::do_should_include_member): New function.
6100 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6101 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6102 (Sized_incr_dynobj::do_section_size): New function.
6103 (Sized_incr_dynobj::do_section_name): New function.
6104 (Sized_incr_dynobj::do_section_contents): New function.
6105 (Sized_incr_dynobj::do_section_flags): New function.
6106 (Sized_incr_dynobj::do_section_entsize): New function.
6107 (Sized_incr_dynobj::do_section_address): New function.
6108 (Sized_incr_dynobj::do_section_type): New function.
6109 (Sized_incr_dynobj::do_section_link): New function.
6110 (Sized_incr_dynobj::do_section_info): New function.
6111 (Sized_incr_dynobj::do_section_addralign): New function.
6112 (Sized_incr_dynobj::do_initialize_xindex): New function.
6113 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6114 (make_sized_incremental_object): New function.
6115 (Incremental_library::copy_unused_symbols): New function.
6116 (Incremental_library::do_for_all_unused_symbols): New function.
6117 * incremental.h (enum Incremental_input_flags): New type.
6118 (class Incremental_checker): Remove.
6119 (Incremental_input_entry::Incremental_input_entry): Add argument
6121 (Incremental_input_entry::arg_serial): New function.
6122 (Incremental_input_entry::set_is_in_system_directory): New function.
6123 (Incremental_input_entry::is_in_system_directory): New function.
6124 (Incremental_input_entry::arg_serial_): New data member.
6125 (Incremental_input_entry::is_in_system_directory_): New data member.
6126 (class Script_info): Move here from script.h.
6127 (Script_info::Script_info): Add filename parameter.
6128 (Script_info::filename): New function.
6129 (Script_info::filename_): New data member.
6130 (Incremental_script_entry::Incremental_script_entry): Add argument
6132 (Incremental_object_entry::Incremental_object_entry): Likewise.
6133 (Incremental_object_entry::add_input_section): Build list of input
6134 sections with map to original shndx.
6135 (Incremental_object_entry::get_input_section_index): New function.
6136 (Incremental_object_entry::shndx_): New data member.
6137 (Incremental_object_entry::name_key_): Rename; adjust all refs.
6138 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6139 (Incremental_archive_entry::Incremental_archive_entry): Add argument
6141 (Incremental_inputs::report_archive_begin): Likewise.
6142 (Incremental_inputs::report_object): Likewise.
6143 (Incremental_inputs::report_script): Likewise.
6144 (class Incremental_global_symbol_reader): New class.
6145 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6146 and store flags and input file type.
6147 (Incremental_input_entry_reader::arg_serial): New function.
6148 (Incremental_input_entry_reader::type): Extract type from flags.
6149 (Incremental_input_entry_reader::is_in_system_directory): New function.
6150 (Incremental_input_entry_reader::get_input_section_count): Call
6151 accessor function for type.
6152 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6153 function for type; adjust size of global symbol entry.
6154 (Incremental_input_entry_reader::get_global_symbol_count): Call
6155 accessor function for type.
6156 (Incremental_input_entry_reader::get_object_count): Likewise.
6157 (Incremental_input_entry_reader::get_object_offset): Likewise.
6158 (Incremental_input_entry_reader::get_member_count): Likewise.
6159 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6160 (Incremental_input_entry_reader::get_member_offset): Likewise.
6161 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6162 (Incremental_input_entry_reader::Global_symbol_info): Remove.
6163 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6164 (Incremental_input_entry_reader::get_global_symbol_reader): New
6166 (Incremental_input_entry_reader::get_output_symbol_index): New
6168 (Incremental_input_entry_reader::type_): Remove.
6169 (Incremental_input_entry_reader::flags_): New data member.
6170 (Incremental_inputs_reader::input_file_offset): New function.
6171 (Incremental_inputs_reader::input_file_index): New function.
6172 (Incremental_inputs_reader::input_file): Call input_file_offset.
6173 (Incremental_inputs_reader::input_file_at_offset): New function.
6174 (Incremental_relocs_reader::get_r_type): Reformat.
6175 (Incremental_relocs_reader::get_r_shndx): Reformat.
6176 (Incremental_relocs_reader::get_r_offset): Reformat.
6177 (Incremental_relocs_reader::data): New function.
6178 (Incremental_binary::Incremental_binary): Initialize new data members.
6179 (Incremental_binary::check_inputs): Add cmdline parameter.
6180 (Incremental_binary::file_is_unchanged): Remove.
6181 (Input_reader::arg_serial): New function.
6182 (Input_reader::get_unused_symbol_count): New function.
6183 (Input_reader::get_unused_symbol): New function.
6184 (Input_reader::do_arg_serial): New function.
6185 (Input_reader::do_get_unused_symbol_count): New function.
6186 (Input_reader::do_get_unused_symbol): New function.
6187 (Incremental_binary::input_file_count): New function.
6188 (Incremental_binary::get_input_reader): Change signature to use
6189 index instead of filename.
6190 (Incremental_binary::file_has_changed): New function.
6191 (Incremental_binary::get_input_argument): New function.
6192 (Incremental_binary::get_library): New function.
6193 (Incremental_binary::get_script_info): New function.
6194 (Incremental_binary::init_layout): New function.
6195 (Incremental_binary::reserve_layout): New function.
6196 (Incremental_binary::output_file): New function.
6197 (Incremental_binary::do_check_inputs): New function.
6198 (Incremental_binary::do_file_is_unchanged): Remove.
6199 (Incremental_binary::do_file_has_changed): New function.
6200 (Incremental_binary::do_init_layout): New function.
6201 (Incremental_binary::do_reserve_layout): New function.
6202 (Incremental_binary::do_input_file_count): New function.
6203 (Incremental_binary::do_get_input_reader): Change signature.
6204 (Incremental_binary::input_args_map_): New data member.
6205 (Incremental_binary::library_map_): New data member.
6206 (Incremental_binary::script_map_): New data member.
6207 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6209 (Sized_incremental_binary::output_section): New function.
6210 (Sized_incremental_binary::inputs_reader): Add const.
6211 (Sized_incremental_binary::symtab_reader): Add const.
6212 (Sized_incremental_binary::relocs_reader): Add const.
6213 (Sized_incremental_binary::got_plt_reader): Add const.
6214 (Sized_incremental_binary::get_symtab_view): New function.
6215 (Sized_incremental_binary::Inputs_reader): New typedef.
6216 (Sized_incremental_binary::Input_entry_reader): New typedef.
6217 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6218 (Sized_incremental_binary::do_file_is_unchanged): Remove.
6219 (Sized_incremental_binary::do_file_has_changed): New function.
6220 (Sized_incremental_binary::do_init_layout): New function.
6221 (Sized_incremental_binary::do_reserve_layout): New function.
6222 (Sized_input_reader::Inputs_reader): Remove.
6223 (Sized_input_reader::Input_entry_reader): Remove.
6224 (Sized_input_reader::do_arg_serial): New function.
6225 (Sized_input_reader::do_get_unused_symbol_count): New function.
6226 (Sized_input_reader::do_get_unused_symbol): New function.
6227 (Sized_incremental_binary::do_input_file_count): New function.
6228 (Sized_incremental_binary::do_get_input_reader): Change signature;
6229 use index instead of filename.
6230 (Sized_incremental_binary::section_map_): New data member.
6231 (Sized_incremental_binary::input_entry_readers_): New data member.
6232 (class Sized_incr_relobj): New class.
6233 (class Sized_incr_dynobj): New class.
6234 (make_sized_incremental_object): New function.
6235 (class Incremental_library): New class.
6236 * layout.cc (Free_list::num_lists): New static data member.
6237 (Free_list::num_nodes): New static data member.
6238 (Free_list::num_removes): New static data member.
6239 (Free_list::num_remove_visits): New static data member.
6240 (Free_list::num_allocates): New static data member.
6241 (Free_list::num_allocate_visits): New static data member.
6242 (Free_list::init): New function.
6243 (Free_list::remove): New function.
6244 (Free_list::allocate): New function.
6245 (Free_list::dump): New function.
6246 (Free_list::print_stats): New function.
6247 (Layout_task_runner::run): Resize output file for incremental updates.
6248 (Layout::Layout): Initialize new data members.
6249 (Layout::set_incremental_base): New function.
6250 (Layout::init_fixed_output_section): New function.
6251 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6252 incremental updates.
6253 (Layout::create_gold_note): Do not create gold note section for
6254 incremental updates.
6255 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6256 for incremental updates.
6257 (Layout::set_section_offsets): For incremental updates, allocate space
6259 (Layout::create_symtab_sections): Layout with offsets relative to
6260 start of section; for incremental updates, allocate space from free
6262 (Layout::create_shdrs): For incremental updates, allocate space from
6264 (Layout::finish_dynamic_section): For incremental updates, do not
6265 check --as-needed (fixed in subsequent patch).
6266 * layout.h (class Free_list): New class.
6267 (Layout::set_incremental_base): New function.
6268 (Layout::incremental_base): New function.
6269 (Layout::init_fixed_output_section): New function.
6270 (Layout::allocate): New function.
6271 (Layout::incremental_base_): New data member.
6272 (Layout::free_list_): New data member.
6273 * main.cc (main): Print Free_list statistics.
6274 * object.cc (Relobj::finalize_incremental_relocs): Add
6275 clear_counts parameter; clear counts only when clear_counts is set.
6276 (Sized_relobj::Sized_relobj): Initialize new base class.
6277 (Sized_relobj::do_layout): Don't report special sections.
6278 (Sized_relobj::do_for_all_local_got_entries): New function.
6279 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6280 symtab_off to all symbol table offsets.
6281 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6282 * object.h (class Got_offset_list): Move to top of file.
6283 (Object::Object): Allow case where input_file == NULL.
6284 (Object::~Object): Likewise.
6285 (Object::input_file): Assert that input_file != NULL.
6286 (Object::lock): Allow case where input_file == NULL.
6287 (Object::unlock): Likewise.
6288 (Object::is_locked): Likewise.
6289 (Object::token): Likewise.
6290 (Object::release): Likewise.
6291 (Object::is_incremental): New function.
6292 (Object::get_mtime): New function.
6293 (Object::for_all_local_got_entries): New function.
6294 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6295 (Object::set_is_in_system_directory): New function.
6296 (Object::is_in_system_directory): New function.
6297 (Object::do_is_incremental): New function.
6298 (Object::do_get_mtime): New function.
6299 (Object::do_for_all_local_got_entries): New function.
6300 (Object::is_in_system_directory_): New data member.
6301 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6302 (class Sized_relobj_base): New class.
6303 (class Sized_relobj): Derive from Sized_relobj_base.
6304 (class Sized_relobj::Symbols): Redeclare from base class.
6305 (class Sized_relobj::local_got_offset_list): Remove.
6306 (class Sized_relobj::Output_sections): Redeclare from base class.
6307 (class Sized_relobj::do_for_all_local_got_entries): New function.
6308 (class Sized_relobj::write_local_symbols): Add offset parameter.
6309 (class Sized_relobj::local_symbol_offset_): Update comment.
6310 (class Sized_relobj::local_dynsym_offset_): Update comment.
6311 * options.cc (Input_arguments::add_file): Remove const.
6312 * options.h (Input_file_argument::Input_file_argument):
6313 Initialize arg_serial_ (all constructors).
6314 (Input_file_argument::set_arg_serial): New function.
6315 (Input_file_argument::arg_serial): New function.
6316 (Input_file_argument::arg_serial_): New data member.
6317 (Input_arguments::Input_arguments): Initialize file_count_.
6318 (Input_arguments::add_file): Remove const.
6319 (Input_arguments::number_of_input_files): New function.
6320 (Input_arguments::file_count_): New data member.
6321 (Command_line::number_of_input_files): Call
6322 Input_arguments::number_of_input_files.
6323 * output.cc (Output_segment_headers::Output_segment_headers):
6325 (Output_section::Input_section::current_data_size): New function.
6326 (Output_section::Output_section): Initialize new data members.
6327 (Output_section::add_input_section): Don't do merge sections for
6328 an incremental link; allocate space from free list for an
6330 (Output_section::add_output_section_data): Allocate space from
6331 free list for an incremental update.
6332 (Output_section::update_data_size): New function.
6333 (Output_section::set_fixed_layout): New function.
6334 (Output_section::reserve): New function.
6335 (Output_segment::set_section_addresses): Remove const.
6336 (Output_segment::set_section_list_addresses): Remove const; allocate
6337 space from free list for an incremental update.
6338 (Output_segment::set_offset): Adjust size of RELRO segment for an
6340 * output.h (Output_data::current_data_size): Move here from
6342 (Output_data::pre_finalize_data_size): New function.
6343 (Output_data::update_data_size): New function.
6344 (Output_section_headers::update_data_size): new function.
6345 (Output_section_data_build::current_data_size): Move to Output_data.
6346 (Output_data_strtab::update_data_size): New function.
6347 (Output_section::current_data_size): Move to Output_data.
6348 (Output_section::set_fixed_layout): New function.
6349 (Output_section::has_fixed_layout): New function.
6350 (Output_section::reserve): New function.
6351 (Output_section::update_data_size): New function.
6352 (Output_section::has_fixed_layout_): New data member.
6353 (Output_section::free_list_): New data member.
6354 (Output_segment::set_section_addresses): Remove const.
6355 (Output_segment::set_section_list_addresses): Remove const.
6356 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6358 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6360 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6361 parameter when calling Add_symbols constructor; store argument
6362 serial number for members of a lib group.
6363 (Add_symbols::locks): Allow case where token == NULL.
6364 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6365 (Read_member::~Read_member): New function.
6366 (Read_member::is_runnable): New function.
6367 (Read_member::locks): New function.
6368 (Read_member::run): New function.
6369 (Check_script::~Check_script): New function.
6370 (Check_script::is_runnable): New function.
6371 (Check_script::locks): New function.
6372 (Check_script::run): New function.
6373 (Check_library::~Check_library): New function.
6374 (Check_library::is_runnable): New function.
6375 (Check_library::locks): New function.
6376 (Check_library::run): New function.
6377 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6378 (Add_symbols::library_): New data member.
6379 (class Read_member): New class.
6380 (class Check_script): New class.
6381 (class Check_library): New class.
6382 * reloc.cc (Read_relocs::is_runnable): Allow case where
6384 (Read_relocs::locks): Likewise.
6385 (Scan_relocs::locks): Likewise.
6386 (Relocate_task::locks): Likewise.
6387 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6389 (Sized_relobj::incremental_relocs_scan): Fix comment.
6390 (Sized_relobj::do_relocate): Pass output file offset to
6391 write_local_symbols.
6392 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6393 from class declaration.
6394 * script.cc (read_input_script): Allocate Script_info; pass
6395 argument serial number to report_script.
6396 * script.h (class Script_info): Move to incremental.h.
6397 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6398 * symtab.h (Symbol_table::add_from_incrobj): New function.
6399 (Symbol_table::set_file_offset): New function.
6401 2011-04-05 Cary Coutant <ccoutant@google.com>
6403 * incremental-dump.cc (dump_incremental_inputs): Change signature
6404 to take a Sized_incremental_binary; change caller. Use readers
6405 in Sized_incremental_binary.
6407 (Sized_incremental_binary::find_incremental_inputs_sections):
6408 Rename do_find_incremental_inputs_sections to this.
6409 (Sized_incremental_binary::setup_readers): New function.
6410 (Sized_incremental_binary::do_check_inputs): Check
6411 has_incremental_info_ flag; move setup code to setup_readers;
6413 (Sized_incremental_binary::do_file_is_unchanged): New function.
6414 (Sized_incremental_binary::do_get_input_reader): New function.
6415 * incremental.h (class Incremental_binary): Move to end of file.
6416 (Incremental_binary::file_is_unchanged): New function.
6417 (Incremental_binary::do_file_is_unchanged): New function.
6418 (Incremental_binary::Input_reader): New class.
6419 (Incremental_binary::get_input_reader): New function.
6420 (class Sized_incremental_binary): Move to end of file.
6421 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6422 input section reader classes.
6423 (Sized_incremental_binary::has_incremental_info): New function.
6424 (Sized_incremental_binary::inputs_reader): New function.
6425 (Sized_incremental_binary::symtab_reader): New function.
6426 (Sized_incremental_binary::relocs_reader): New function.
6427 (Sized_incremental_binary::got_plt_reader): New function.
6428 (Sized_incremental_binary::do_file_is_unchanged): New function.
6429 (Sized_incremental_binary::Sized_input_reader): New class.
6430 (Sized_incremental_binary::get_input_reader): New function.
6431 (Sized_incremental_binary::find_incremental_inputs_sections):
6432 Rename do_find_incremental_inputs_sections to this.
6433 (Sized_incremental_binary::setup_readers): New function.
6434 (Sized_incremental_binary::has_incremental_info_): New data member.
6435 (Sized_incremental_binary::inputs_reader_): New data member.
6436 (Sized_incremental_binary::symtab_reader_): New data member.
6437 (Sized_incremental_binary::relocs_reader_): New data member.
6438 (Sized_incremental_binary::got_plt_reader_): New data member.
6439 (Sized_incremental_binary::current_input_file_): New data member.
6441 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6444 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6447 2011-03-30 Cary Coutant <ccoutant@google.com>
6449 * archive.cc (Archive::include_member): Adjust call to report_object.
6450 (Add_archive_symbols::run): Add script_info to call to
6451 report_archive_begin.
6452 (Lib_group::include_member): Adjust call to report_object.
6453 (Add_lib_group_symbols::run): Adjust call to report_object.
6454 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6455 blocks. Add object count for script input files.
6456 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6457 script_info parameter; change all callers.
6458 (Incremental_inputs::report_object): Add script_info parameter;
6460 (Incremental_inputs::report_script): Store backpointer to
6461 incremental info entry.
6462 (Output_section_incremental_inputs::set_final_data_size): Record
6463 additional information for scripts.
6464 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6465 * incremental.h (Incremental_script_entry::add_object): New function.
6466 (Incremental_script_entry::get_object_count): New function.
6467 (Incremental_script_entry::get_object): New function.
6468 (Incremental_script_entry::objects_): New data member; adjust
6470 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6471 (Incremental_inputs::report_object): Add script_info parameter.
6472 (Incremental_inputs_reader::get_object_count): New function.
6473 (Incremental_inputs_reader::get_object_offset): New function.
6474 * options.cc (Input_arguments::add_file): Return reference to
6476 * options.h (Input_argument::set_script_info): New function.
6477 (Input_argument::script_info): New function.
6478 (Input_argument::script_info_): New data member; adjust all
6480 (Input_file_group::add_file): Return reference to new input argument.
6481 (Input_file_lib::add_file): Likewise.
6482 (Input_arguments::add_file): Likewise.
6483 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6484 * script.cc (Parser_closure::Parser_closure): Add script_info
6485 parameter; adjust all callers.
6486 (Parser_closure::script_info): New function.
6487 (Parser_closure::script_info_): New data member.
6488 (read_input_script): Report scripts earlier to incremental info.
6489 (script_add_file): Set script_info in Input_argument.
6490 (script_add_library): Likewise.
6491 * script.h (Script_options::Script_info): Rewrite class.
6493 2011-03-29 Cary Coutant <ccoutant@google.com>
6495 * archive.cc (Library_base::should_include_member): Move
6496 method here from class Archive.
6497 (Archive::Archive): Initialize base class.
6498 (Archive::should_include_member): Move to base class.
6499 (Archive::do_for_all_unused_symbols): New function.
6500 (Add_archive_symbols::run): Remove redundant access to
6502 (Lib_group::Lib_group): Initialize base class.
6503 (Lib_group::do_filename): New function.
6504 (Lib_group::include_member): Pass pointer to Lib_group to
6506 (Lib_group::do_for_all_unused_symbols): New function.
6507 (Add_lib_group_symbols::run): Report archive information for
6509 * archive.h (class Library_base): New base class.
6510 (class Archive): Derive from Library_base.
6511 (Archive::filename): Move to base class.
6512 (Archive::set_incremental_info): Likewise.
6513 (Archive::incremental_info): Likewise.
6514 (Archive::Should_include): Likewise.
6515 (Archive::should_include_member): Likewise.
6516 (Archive::Armap_entry): Remove.
6517 (Archive::Unused_symbol_iterator): Remove.
6518 (Archive::unused_symbols_begin): Remove.
6519 (Archive::unused_symbols_end): Remove.
6520 (Archive::do_filename): New function.
6521 (Archive::do_get_mtime): New function.
6522 (Archive::do_for_all_unused_symbols): New function.
6523 (Archive::task_): Move to base class.
6524 (Archive::incremental_info_): Likewise.
6525 (class Lib_group): Derive from Library_base.
6526 (Lib_group::do_filename): New function.
6527 (Lib_group::do_get_mtime): New function.
6528 (Lib_group::do_for_all_unused_symbols): New function.
6529 (Lib_group::task_): Move to base class.
6530 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6532 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6534 * incremental.cc (Incremental_inputs::report_archive_begin):
6535 Use Library_base; call library's get_mtime; add incremental inputs
6536 entry before members.
6537 (class Unused_symbol_visitor): New class.
6538 (Incremental_inputs::report_archive_end): Use Library_base; use
6539 visitor class to record unused symbols; don't add incremental inputs
6540 entry after members.
6541 (Incremental_inputs::report_object): Use Library_base.
6543 (Incremental_archive_entry::Incremental_archive_entry): Remove
6544 unused Archive parameter.
6545 (Incremental_inputs::report_archive_begin): Use Library_base.
6546 (Incremental_inputs::report_archive_end): Likewise.
6547 (Incremental_inputs::report_object): Likewise.
6548 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6550 * object.h (Object::for_all_global_symbols): New function.
6551 (Object::do_for_all_global_symbols): New function.
6552 (Sized_relobj::do_for_all_global_symbols): New function.
6553 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6555 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6558 2011-03-27 Ian Lance Taylor <iant@google.com>
6560 * archive.cc (Archive::interpret_header): Return -1 if something
6561 goes wrong. Change callers accordingly.
6563 2011-03-25 Cary Coutant <ccoutant@google.com>
6565 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6566 * testsuite/Makefile.in: Regenerate.
6568 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6570 * plugin.cc (get_view): New.
6571 (Plugin::load): Pass get_view to the plugin.
6572 (Plugin_manager::get_view): New.
6574 2011-03-21 Ian Lance Taylor <iant@google.com>
6576 * testsuite/final_layout.sh: Rewrite to not use dc.
6577 * testsuite/relro_test.sh: Fail if dc is not present.
6579 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6581 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6583 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6584 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6586 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6587 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6589 2011-03-14 Ian Lance Taylor <iant@google.com>
6591 * script-sections.cc (Sort_output_sections::script_compare):
6592 Rename from is_before, change return type.
6593 (Sort_output_sections::operator()): Adjust accordingly.
6595 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6598 * testsuite/odr_violation2.cc: Add comment to make all error line
6599 numbers double digits.
6600 * testsuite/debug_msg.sh: Adjust expected errors.
6602 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6604 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6605 but mark earlier ones as non-canonical
6606 (offset_to_iterator): Update search target and example
6607 (do_addr2line): Return extra lines in a vector*
6608 (format_file_lineno): Extract from do_addr2line
6609 (one_addr2line): Add vector* out-param
6610 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6611 when a lineno entry appeared last for its instruction
6612 (Dwarf_line_info): Add vector* out-param
6613 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6614 * symtab.cc (Odr_violation_compare): Include the lineno in the
6616 (linenos_from_loc): New. Combine the canonical line for an
6617 address with its other lines.
6618 (True_if_intersect): New. Helper functor to make
6619 std::set_intersection a query.
6620 (detect_odr_violations): Compare sets of lines instead of just
6621 one line for each function. This became less deterministic, but
6622 has fewer false positives.
6623 * symtab.h: Declarations.
6624 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6625 mix an optimized and non-optimized object in the same binary
6626 (odr_violation2.so): Same.
6627 * testsuite/Makefile.in: Regenerate from Makefile.am.
6628 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6629 * testsuite/debug_msg.sh: Update line numbers and add
6631 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6632 non-optimized context.
6633 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6634 isn't inlined, and use OdrDerived in an optimized context.
6635 * testsuite/odr_header1.h: Defines OdrDerived, where
6636 optimization will change the
6637 first-instruction-in-the-destructor's file and line number.
6638 * testsuite/odr_header2.h: Defines OdrBase.
6640 2011-03-09 Ian Lance Taylor <iant@google.com>
6642 * fileread.cc (File_read::clear_views): Don't delete the whole
6645 2011-03-08 Ian Lance Taylor <iant@google.com>
6648 * fileread.cc: #include <climits>.
6649 (GOLD_IOV_MAX): Define.
6650 (File_read::read_multiple): Limit number of entries by iov_max.
6651 * fileread.h (class File_read): Always set max_readv_entries to
6654 2011-03-07 Ian Lance Taylor <iant@google.com>
6657 * options.h (class General_options): Add -dy and -dn.
6659 2011-03-02 Cary Coutant <ccoutant@google.com>
6661 * testsuite/script_test_9.t: Add TLS segment.
6663 2011-03-02 Simon Baldwin <simonb@google.com>
6665 * configure.ac: Add check for gnu_indirect_function support in
6666 the toolchain building binutils.
6667 * configure: Rebuild.
6669 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6671 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6672 plugin only symbols.
6673 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6674 in plugin files as not needed in the symbol table.
6676 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6678 * output.cc (Output_section::add_input_section): Delay fill
6679 generation for section ordering.
6681 2011-02-09 Ian Lance Taylor <iant@google.com>
6684 * object.h (class Sized_relobj): Remove clear_local_symbols.
6685 * reloc.cc (Sized_relobj::do_relocate): Don't call
6686 clear_local_symbols.
6688 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6690 * plugin.cc (is_visible_from_outside): Return true for symbols
6693 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6695 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6698 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6700 * icf.h (is_section_foldable_candidate): Change type of parameter
6702 * icf.cc (Icf::find_identical_sections): Change type of local variable
6703 section_name to be std::string.
6704 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6706 2011-01-25 Ian Lance Taylor <iant@google.com>
6708 * script.cc (script_add_extern): Rewrite to use
6709 add_symbol_reference.
6711 2011-01-25 Doug Kwan <dougkwan@google.com>
6713 * icf.cc (get_section_contents): Always lock section's object.
6715 2011-01-24 Ian Lance Taylor <iant@google.com>
6717 * options.h (class General_options): Accept
6718 --no-detect-odr-violations.
6720 2011-01-24 Ian Lance Taylor <iant@google.com>
6722 * version.cc (version_string): Bump to 1.11.
6724 2011-01-24 Ian Lance Taylor <iant@google.com>
6726 * plugin.cc (class Plugin_rescan): Define new class.
6727 (Plugin_manager::claim_file): Set any_claimed_.
6728 (Plugin_manager::save_archive): New function.
6729 (Plugin_manager::save_input_group): New function.
6730 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6732 (Plugin_manager::new_undefined_symbol): New function.
6733 (Plugin_manager::rescan): New function.
6734 (Plugin_manager::rescannable_defines): New function.
6735 (Plugin_manager::add_input_file): Set any_added_.
6736 * plugin.h (class Plugin_manager): define new fields rescannable_,
6737 undefined_symbols_, any_claimed_, and any_added_. Declare
6738 Plugin_rescan as friend. Declare new functions.
6739 (Plugin_manager::Rescannable): Define type.
6740 (Plugin_manager::Rescannable_list): Define type.
6741 (Plugin_manager::Undefined_symbol_list): Define type.
6742 (Plugin_manager::Plugin_manager): Initialize new fields.
6743 * archive.cc (Archive::defines_symbol): New function.
6744 (Add_archive_symbols::run): Pass archive to plugins if any.
6745 * archive.h (class Archive): Declare defines_symbol.
6746 * readsyms.cc (Input_group::~Input_group): New function.
6747 (Finish_group::run): Pass input_group to plugins if any.
6748 * readsyms.h (class Input_group): Declare destructor.
6749 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6752 2011-01-10 Ian Lance Taylor <iant@google.com>
6754 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6756 (Layout::set_segment_offsets): Reset increase_relro before calling
6757 set_section_addresses a second time.
6759 2011-01-04 Cary Coutant <ccoutant@google.com>
6761 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6762 sections before NOBITS sections.
6764 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6766 * version.cc (print_version): Update copyright to 2011.
6768 2010-12-23 Cary Coutant <ccoutant@google.com>
6770 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6771 of OS to this->add. Add OD parameter to second form of the function.
6773 2010-12-20 Ian Lance Taylor <iant@google.com>
6775 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6776 second of two consecutive entries with same offset.
6778 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6780 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6781 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6782 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6783 to avoid unneeded links against $(LDADD).
6784 * testsuite/Makefile.in: Regenerate.
6786 2010-12-15 Ian Lance Taylor <iant@google.com>
6789 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6790 for R_X86_64_32 and R_X86_64_PC32.
6791 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6792 ver_matching_def_pic.o.
6793 (ver_matching_def_pic.o): New target.
6795 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6797 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6798 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6799 Move definition before File_read::View member definitions.
6800 (File_read::View::~View): Initialize and hold lock before
6801 updating current_mapped_bytes.
6803 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6805 * dwarf_reader.cc: Remove outdated comment.
6806 * gold-threads.cc: Fix typo in error message.
6807 * archive.cc: Fix typos in comments.
6808 * archive.h: Likewise.
6809 * arm-reloc-property.cc: Likewise.
6810 * arm-reloc-property.h: Likewise.
6811 * arm-reloc.def: Likewise.
6813 * attributes.h: Likewise.
6814 * cref.cc: Likewise.
6815 * ehframe.cc: Likewise.
6816 * fileread.h: Likewise.
6818 * i386.cc: Likewise.
6820 * incremental.h: Likewise.
6821 * int_encoding.cc: Likewise.
6822 * layout.h: Likewise.
6823 * main.cc: Likewise.
6824 * merge.h: Likewise.
6825 * object.cc: Likewise.
6826 * object.h: Likewise.
6827 * options.cc: Likewise.
6828 * readsyms.cc: Likewise.
6829 * reduced_debug_output.cc: Likewise.
6830 * reloc.cc: Likewise.
6831 * script-sections.cc: Likewise.
6832 * sparc.cc: Likewise.
6833 * symtab.h: Likewise.
6834 * target-reloc.h: Likewise.
6835 * target.cc: Likewise.
6836 * target.h: Likewise.
6837 * timer.cc: Likewise.
6838 * timer.h: Likewise.
6839 * x86_64.cc: Likewise.
6841 2010-12-09 Cary Coutant <ccoutant@google.com>
6843 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6845 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6846 parameter; change all callers.
6847 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6848 * options.h (warn_execstack): New option.
6850 2010-12-07 Doug Kwan <dougkwan@google.com>
6852 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6853 like function call relocations.
6855 2010-12-07 Ian Lance Taylor <iant@google.com>
6857 * archive.cc (Archive::get_elf_object_for_member): Permit
6858 punconfigured to be NULL.
6859 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6860 (Archive::include_member): Pass NULL to get_elf_object_for_member
6861 if we searched for the archive and this is the first included
6864 2010-12-01 Ian Lance Taylor <iant@google.com>
6866 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6867 track_relocs_type_ field.
6868 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6869 Set track_relocs_type_.
6870 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6871 contents when using RELA relocs.
6872 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6874 * reloc.cc (Track_relocs::next_addend): New function.
6875 * reloc.h (class Track_relocs): Declare next_addend.
6877 2010-12-01 Ian Lance Taylor <iant@google.com>
6879 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6882 2010-12-01 Ian Lance Taylor <iant@google.com>
6884 * README: Update compilers known to work and fail.
6886 2010-11-23 Matthias Klose <doko@ubuntu.com>
6888 * configure.in: For --enable-gold, handle value `default' instead of
6889 `both*'. Always install ld as ld.bfd, install as ld if gold is
6891 * configure: Regenerate.
6893 2010-11-18 Doug Kwan <dougkwan@google.com>
6895 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6896 and right_alignment to be zero. Store result alignment only if it is
6897 greater than existing alignment.
6899 2010-11-16 Cary Coutant <ccoutant@google.com>
6902 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6903 Check for ".zdebug_line".
6905 2010-11-16 Doug Kwan <dougkwan@google.com>
6906 Cary Coutant <ccoutant@google.com>
6908 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6909 by reference; adjust all callers.
6910 * output.cc (Output_segment::set_section_addresses): Adjust references
6911 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6913 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6914 end at page boundary.
6916 2010-11-16 Cary Coutant <ccoutant@google.com>
6919 * layout.cc (Layout::choose_output_section): Transform names of
6920 compressed sections even when using a script with a SECTIONS clause.
6921 (Layout::output_section_name): Remove code to transform
6922 compressed debug section names.
6923 * output.cc (Output_section::add_input_section): Use uncompressed
6924 section size when tracking input sections.
6926 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6928 * symtab.h (Symbol::NON_PIC_REF): Remove.
6929 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6930 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6931 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6932 (Symbol::use_plt_offset): Take a flags argument and pass it
6933 directly to needs_dynamic_reloc. Restrict check for undefined
6934 weak symbols to function calls.
6935 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6936 (Target_arm::Scan::global): Use it.
6937 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6938 (Target_arm::Relocate::relocate): Likewise.
6939 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6940 parameter with an r_type parameter. Use get_reference_flags
6942 (Target_arm::Relocate::relocate): Update accordingly.
6943 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6944 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6945 (Target_i386::Scan::global): Likewise.
6946 (Target_i386::Relocate::relocate): Likewise.
6947 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6948 parameter with an r_type parameter. Use get_reference_flags
6950 (Target_i386::Relocate::relocate): Update accordingly.
6951 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6952 (Target_powerpc::Scan::global): Use it.
6953 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6954 (Target_powerpc::Relocate::relocate): Likewise.
6955 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6956 (Target_sparc::Scan::global): Use it.
6957 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6958 (Target_sparc::Relocate::relocate): Likewise.
6959 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6960 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6961 (Target_x86_64::Scan::global): Likewise.
6962 (Target_x86_64::Relocate::relocate): Likewise.
6964 2010-11-08 Doug Kwan <dougkwan@google.com>
6965 Cary Coutant <ccoutant@google.com>
6967 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6968 (Arm_exidx_merge_section::section_contents_): New data member.
6969 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6970 (Arm_input_section::~Arm_input_section): De-allocate memory.
6971 (Arm_input_section::original_contents_): New data member.
6972 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6973 in parameters instead of calling Object::section_contents without
6975 (Arm_output_section::group_section): New parameter TASK. Pass it
6976 to callees that need locking objects.
6977 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6978 to lock EXIDX input sections. Fix a formatting issue. Call
6979 Arm_exidx_merged_section::build_contents to create merged section
6981 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6982 to lock object of stub table owner.
6983 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6984 TEXT_SIZE to initialize data member TEXT_SIZE_.
6985 (Arm_exidx_input_section::addralign): Fix typo in comment.
6986 (Arm_exidx_input_section::text_size): New method.
6987 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6988 that require locking objects. Lock objects before scanning for stubs
6989 and updating local symbols.
6990 (Arm_input_section<big_endian>::init): Copy contents of original
6992 (Arm_input_section<big_endian>::do_write): Use saved contents of
6993 original input section instead of calling Object::section_contents
6995 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6996 size without calling Object::section_size().
6997 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6998 for size. Allocate a buffer for merged EXIDX entries.
6999 (Arm_exidx_merged_section::build_contents): New method.
7000 (Arm_exidx_merged_section::do_write): Move merge section contents
7001 building code to Arm_exidx_merged_section::build_contetns. Write
7002 out contetns in buffer instead of building it on the fly.
7003 (Arm_relobj::make_exidx_input_section): Also pass text section size
7004 to Arm_exidx_input_section constructor.
7005 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
7006 (Arm_dynobj::do_read_symbols): Fix memory leak.
7007 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7008 * target.h: (class Task): Add forward declaration.
7009 (Target::relax): Add new parameter TASK and pass it to
7011 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
7013 2010-11-05 Cary Coutant <ccoutant@google.com>
7016 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7017 object when reading from the file.
7018 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7020 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7021 when reading section contents.
7022 (get_section_contents): Likewise.
7023 (icf::find_identical_sections): Likewise.
7024 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7025 object when reading from the file.
7026 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7027 the object when doing deferred section layout.
7029 2010-11-03 Nick Clifton <nickc@redhat.com>
7032 * script.h (class Symbol_assignment: name): New member. Returns
7033 the name of the symbol.
7034 * scrfipt.cc (Script_options::is_pending_assignment): New member.
7035 Returns true if the given symbol name is on the list of
7036 assignments wating to be processed.
7037 * archive.cc (should_incldue_member): If the symbol is undefined,
7038 check to see if it is on the list of symbols pending assignment.
7040 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
7042 * script-sections.cc (Script_sections::find_memory_region): Check
7043 for a NULL output section pointer.
7045 2010-10-29 Doug Kwan <dougkwan@google.com>
7047 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7048 Output_section::add_relaxed_input_section.
7049 * output.cc (Output_section::add_relaxed_input_section): Add new
7050 arguments LAYOUT and NAME. Set section order index.
7051 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7052 Copy section order index.
7053 * output.h (Output_section::add_relaxed_input_section): Add new
7054 arguments LAYOUT and NAME.
7056 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7058 * testsuite/Makefile.am: Move gcctestdir/ld rule to
7059 NATIVE_OR_CROSS_LINKER.
7060 * testsuite/Makefile.in: Regenerate.
7062 2010-10-20 Doug Kwan <dougkwan@google.com>
7064 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7065 without SHF_LINK_ORDER flags.
7066 * layout.cc (Layout::choose_output_section): Do not filter
7067 SHF_LINK_ORDER flag in a relocatable link.
7069 2010-10-17 Cary Coutant <ccoutant@google.com>
7071 * output.h (Output_segment::set_section_addresses): Change function
7072 signature. Update all callers.
7073 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7075 (Output_segment::set_section_addresses): Align after last TLS
7076 section. Add padding before last relro section instead of after.
7078 2010-10-17 Doug Kwan <dougkwan@google.com>
7080 * gold/arm.cc (Target_arm::got_section): Use correct order and set
7081 GOT output section to be writable.
7083 2010-10-14 Cary Coutant <ccoutant@google.com>
7085 * debug.h (DEBUG_INCREMENTAL): New flag.
7086 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7087 * gold.cc (queue_initial_tasks): Check parameters for incremental link
7089 * incremental.cc (report_command_line): Ignore all forms of
7091 * layout.cc (Layout::Layout): Check parameters for incremental link
7093 * options.cc (General_options::parse_incremental): New function.
7094 (General_options::parse_no_incremental): New function.
7095 (General_options::parse_incremental_full): New function.
7096 (General_options::parse_incremental_update): New function.
7097 (General_options::incremental_mode_): New data member.
7098 (General_options::finalize): Check incremental_mode_.
7099 * options.h (General_options): Update help text for --incremental.
7100 Add --no-incremental, --incremental-full, --incremental-update.
7101 (General_options::Incremental_mode): New enum type.
7102 (General_options::incremental_mode): New function.
7103 (General_options::incremental_mode_): New data member.
7104 * parameters.cc (Parameters::incremental_mode_): New data member.
7105 (Parameters::set_options): Set incremental_mode_.
7106 (Parameters::set_incremental_full): New function.
7107 (Parameters::incremental): New function.
7108 (Parameters::incremental_update): New function.
7109 (set_parameters_incremental_full): New function.
7110 * parameters.h (Parameters::set_incremental_full): New function.
7111 (Parameters::incremental): New function.
7112 (Parameters::incremental_update): New function.
7113 (Parameters::incremental_mode_): New data member.
7114 (set_parameters_incremental_full): New function.
7115 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7116 incremental link mode.
7117 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7118 (Sized_relobj::do_relocate_sections): Likewise.
7119 * testsuite/Makefile.am (incremental_test): Use --incremental-full
7121 * testsuite/Makefile.in: Regenerate.
7122 * testsuite/incremental_test.sh: Filter all forms of --incremental.
7124 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7126 * script-sections.h (class Script_sections): Make
7127 Sections_elements typedef public.
7128 * script-sections.cc (class Sort_output_sections): Add elements_
7129 field. Add constructor which sets it; change all callers.
7130 (Sort_output_sections::is_before): New function.
7131 (Sort_output_sections::operator()): Call is_before.
7132 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7134 * testsuite/script_test_10.sh: New test. Test script section
7136 * testsuite/script_test_10.t: Likewise.
7137 * testsuite/script_test_10.s: Likewise.
7138 * testsuite/Makefile.am: Wrap the cross linker tests and the
7139 common tests into NATIVE_OR_CROSS_LINKER.
7140 (check_SCRIPTS): Add script_test_10.sh.
7141 (check_DATA): Add script_test_10.stdout.
7142 (script_test_10.o, script_test_10): New targets.
7143 (script_test_10.stdout): New target.
7144 * configure, testsuite/Makefile.in: Regenerate.
7146 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7148 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7149 error for the deprecated relocations.
7150 (Target_arm::Scan::global): Likewise.
7151 (Target_arm::Relocate::relocate): Likewise.
7153 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
7155 * fileread.cc (Input_file::find_file): Initialize *found_name
7156 and *namep when using the fallback search for case 4.
7158 2010-10-11 Cary Coutant <ccoutant@google.com>
7160 * options.h (class General_options): Redefine -z lazy as an alias for
7161 the negation of -z now.
7163 2010-10-11 Ian Lance Taylor <iant@google.com>
7165 * resolve.cc (symbol_to_bits): Report the value of the unsupported
7168 2010-10-06 Nick Clifton <nickc@redhat.com>
7170 * script-sections.cc(class Memory_region): Remove
7171 current_lma_offset_ field. Rename current_vma_offset_ to
7172 current_offset_. Add last_section_ field.
7173 (Memory_region::get_current_vma_address): Rename to
7174 get_current_address.
7175 (Memory_region::get_current_lma_address): Delete.
7176 (Memory_region::increment_vma_offset): Rename to
7178 (Memory_region::increment_lma_offset): Delete.
7179 (Memory_region::attributes_compatible): New method. Returns
7180 true if the provided section is compatible with the region.
7181 (Memory_region::get_last_section): New method. Returns the last
7182 section to use the region.
7183 (Memory_region::set_last_section): New method. Stores the last
7184 section to use the region.
7185 (Script_sections::block_in_region): New method. Returns true if
7186 a block of memory is contained within a region.
7187 (Script_sections::find_memory_region): New method. Locates a
7188 memory region to be used to set a VMA or LMA address.
7189 (Output_section_definition::set_section_addresses): Add code to
7190 check for addresses set by memory regions.
7191 (Output_segment::set_section_addresses): Remove memory region
7193 (Script_sections::create_segment): Add a warning if a header
7194 segment is created outside of any region.
7195 * script-sections.h (class Script_sections): Add prototypes for
7196 find_memory_region and block_in_region methods.
7197 * testsuite/memory_test.s: Use .long instead of .word.
7198 * testsuite/memory_test.t: Add some more output sections.
7199 * testsuite/memory_test.sh: Update expected output.
7201 2010-10-02 Doug Kwan <dougkwan@google.com>
7203 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7204 defintion to symtab.h
7205 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7206 declaration to defintion.
7208 2010-10-01 Nick Clifton <nickc@redhat.com>
7210 * expression.cc (eval): Replace dummy argument with NULL.
7211 (eval_maybe_dot): Check for a NULL result section pointer.
7212 (Symbol_expression::value): Likewise.
7213 (Dot_expression::value): Likewise.
7214 (BINARY_EXPRESSION): Likewise.
7215 (Max_expression::value): Likewise.
7216 (Min_expression::value): Likewise.
7217 (Absolute_expression::value): Likewise.
7218 (Addr_expression::value_from_output_section): Likewise.
7219 (Loaddddr_expression::value_from_output_section): Likewise.
7220 (Segment_start_expression::value): Likewise.
7221 * script-sections.cc
7222 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7224 (Sections_elememt_dot_assignment::set_section_addresses):
7226 (Output_data_expression::do_write_to_buffer): Likewise.
7227 (Output_section_definition::finalize_symbols): Likewise.
7228 (Output_section_definition::set_section_addresses): Likewise.
7230 2010-09-30 Doug Kwan <dougkwan@google.com>
7232 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7234 2010-09-28 Sriraman Tallam <tmsriram@google.com>
7236 * target.h (Target::can_icf_inline_merge_sections): New virtual
7238 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7240 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7242 * icf.cc (get_section_contents): Inline merge sections only when
7245 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7247 * configure: Regenerate.
7249 2010-09-17 Ian Lance Taylor <iant@google.com>
7251 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7252 * testsuite/Makefile.am (memory_test.o): New target.
7253 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7255 * testsuite/Makefile.in: Rebuild.
7257 2010-09-17 Doug Kwan <dougkwan@google.com>
7259 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7260 defintion if relocation uses GOT entries of the symbol.
7261 * testsuite/icf_safe_test.sh: Fix test.
7262 * testsuite/icf_safe_so_test.sh: Fix test.
7264 2010-09-16 Cary Coutant <ccoutant@google.com>
7266 * script_sections.cc (class Memory_region): Remove "NULL" from
7267 vector initializations.
7269 2010-09-15 Cary Coutant <ccoutant@google.com>
7271 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7272 Resolve forwarding symbols.
7274 2010-09-15 Doug Kwan <dougkwan@google.com>
7276 * gold/testsuite/script_test_3.t: Add ARM special sections.
7277 * gold/testsuite/script_test_4.t: Same.
7278 * gold/testsuite/script_test_5.t: Same.
7279 * gold/testsuite/script_test_6.t: Same.
7280 * gold/testsuite/script_test_7.t: Same.
7281 * gold/testsuite/script_test_7.t: Same.
7282 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7284 2010-09-14 Cary Coutant <ccoutant@google.com>
7286 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7287 (Target_x86_64::Relocate::relocate_tls): Replace check for
7288 saw_tls_block_reloc_ with test for executable section.
7290 2010-09-12 Cary Coutant <ccoutant@google.com>
7292 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7293 position-independent executables to shared libraries need dynamic
7295 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7296 position-independent executables.
7297 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7298 * testsuite/Makefile.in: Regenerate.
7300 2010-09-10 Nick Clifton <nickc@redhat.com>
7303 * testsuite/memory_test.t: Discard any sections that are not
7306 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7309 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7310 "This::" to work around a bug in gcc 4.2.
7312 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7314 2010-09-09 Rafael Espindola <espindola@google.com>
7316 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7317 sections with different PF_X flags in the same segment.
7318 (Layout::find_first_load_seg): Search all segments to find the first
7320 * options.h (rosegment): New.
7322 2010-09-08 Rafael Espindola <espindola@google.com>
7324 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7326 2010-09-08 Doug Kwan <dougkwan@google.com>
7328 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7329 (Arm_relobj::do_relocate_sections): Add new parameter for output
7330 file to match the parent.
7331 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7332 of local symbols instead of input values. Update code to track
7333 changes in gold::relocate_section.
7334 * object.cc (Sized_relobj::compute_final_local_value): New methods.
7335 (Sized_relobj::compute_final_local_value_internal): New methods.
7336 (Sized_relobj::do_finalize_local_symbols): Move code from loop
7337 body into private version of Sized_relobj::compute_final_local_value.
7338 Call the inline method.
7339 * object.h (Symbol_value::Symbol_value): Define destructor. Free
7340 merged symbol value if there is one.
7341 (Symbol_value::has_output_value): New method defintiion.
7342 (Sized_relobj::Compute_final_local_value_status): New enum type.
7343 (Sized_relobj::compute_final_local_value): New methods.
7344 (Sized_relobj::compute_final_local_value_internal): New methods.
7345 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7346 and arm_cortex_a8.sh.
7347 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7348 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7350 * Makefile.in: Regenerate.
7351 * testsuite/arm_bl_out_of_range.s: Update test.
7352 * testsuite/thumb_bl_out_of_range.s: Ditto.
7353 * testsuite/thumb_blx_out_of_range.s: Ditto.
7354 * testsuite/arm_branch_out_of_range.sh: New file.
7355 * testsuite/arm_cortex_a8.sh: Ditto.
7356 * testsuite/arm_cortex_a8_b.s: Ditto.
7357 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7358 * testsuite/arm_cortex_a8_b_local.s: Ditto.
7359 * testsuite/arm_cortex_a8_bl.s: Ditto.
7360 * testsuite/arm_cortex_a8_blx.s: Ditto.
7361 * testsuite/arm_cortex_a8_local.s: Ditto.
7362 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7363 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7365 2010-09-08 Rafael Espindola <espindola@google.com>
7367 * Makefile.am (memory_test.stdout): Run readelf with -W.
7368 * Makefile.in: Regenerate.
7369 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7372 2010-09-08 Rafael Espindola <espindola@google.com>
7374 * script-sections.cc (Script_sections::add_memory_region): Convert
7375 field precision to int.
7376 * script.cc (script_set_section_region, script_set_section_region):
7377 Convert field precision to int.
7379 2010-09-08 Rafael Espindola <espindola@google.com>
7381 * arm.cc (do_finalize_sections): Create the __exidx_start and
7382 __exdix_end symbols even when the section is missing.
7384 2010-09-08 Nick Clifton <nickc@redhat.com>
7386 * README: Remove claim that MEMORY is not supported.
7387 * expression.cc (script_exp_function_origin)
7388 (script_exp_function_length): Move from here to ...
7389 * script.cc: ... here.
7390 (script_set_section_region, script_add_memory)
7391 (script_parse_memory_attr, script_include_directive): New
7393 * script-sections.cc
7394 (class Memory_region): New class.
7395 (class Output_section_definition): Add set_memory_region,
7396 set_section_vma, set_section_lma and get_section_name methods.
7397 (class Script_Sections): Add add_memory_region,
7398 find_memory_region, find_memory_region_origin,
7399 find_memory_region_length and set_memory_region methods.
7400 Have set_section_addresses method walk the list of set memory
7402 Extend the print methos to display memory regions.
7403 * script-sections.h: Add prototypes for new methods.
7404 Add enum for MEMORY region attributes.
7405 * yyscript.y: Add support for parsing MEMORY regions.
7406 * script-c.h: Add prototypes for new functions.
7407 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7408 * testsuite/Makefile.in: Regenerate.
7409 * testsuite/memory_test.sh: New script.
7410 * testsuite/memory_test.s: New assembler source file.
7411 * testsuite/memory_test.t: New linker script.
7413 2010-08-27 Doug Kwan <dougkwan@google.com>
7415 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7416 reference override an existing dynamic weak reference.
7417 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7418 * testsuite/Makefile.in: Regenerate.
7419 * testsuite/dyn_weak_ref.sh: New file.
7420 * testsuite/dyn_weak_ref_1.c: Ditto.
7421 * testsuite/dyn_weak_ref_2.c: Ditto.
7423 2010-08-27 Ian Lance Taylor <iant@google.com>
7425 * incremental.h (class Incremental_input_entry): Add virtual
7428 2010-08-27 Ian Lance Taylor <iant@google.com>
7430 * testsuite/start_lib_test_3.c: Mark t3 as used.
7432 2010-08-27 Nick Clifton <nickc@redhat.com>
7434 * options.cc (version_script): Fix small typo in previous
7437 2010-08-25 Nick Clifton <nickc@redhat.com>
7439 * archive.cc: Formatting fixes: Remove whitespace between
7440 typename and following asterisk. Remove whitespace between
7441 function name and opening parenthesis.
7442 * archive.h: Likewise.
7444 * attributes.cc: Likewise.
7445 * attributes.h: Likewise.
7446 * common.cc: Likewise.
7447 * copy-relocs.cc: Likewise.
7448 * dirsearch.h: Likewise.
7449 * dynobj.cc: Likewise.
7450 * ehframe.cc: Likewise.
7451 * ehframe.h: Likewise.
7452 * expression.cc: Likewise.
7453 * fileread.cc: Likewise.
7454 * fileread.h: Likewise.
7456 * gold-threads.cc: Likewise.
7457 * gold.cc: Likewise.
7458 * i386.cc: Likewise.
7460 * incremental-dump.cc: Likewise.
7461 * incremental.cc: Likewise.
7462 * layout.cc: Likewise.
7463 * layout.h: Likewise.
7464 * main.cc: Likewise.
7465 * merge.cc: Likewise.
7466 * merge.h: Likewise.
7467 * object.cc: Likewise.
7468 * object.h: Likewise.
7469 * options.cc: Likewise.
7470 * options.h: Likewise.
7471 * output.cc: Likewise.
7472 * output.h: Likewise.
7473 * plugin.cc: Likewise.
7474 * plugin.h: Likewise.
7475 * powerpc.cc: Likewise.
7476 * reloc.cc: Likewise.
7477 * script-c.h: Likewise.
7478 * script-sections.cc: Likewise.
7479 * script.cc: Likewise.
7480 * stringpool.cc: Likewise.
7481 * symtab.cc: Likewise.
7482 * symtab.h: Likewise.
7483 * target.cc: Likewise.
7484 * timer.cc: Likewise.
7485 * timer.h: Likewise.
7486 * version.cc: Likewise.
7487 * x86_64.cc: Likewise.
7489 2010-08-24 Nick Clifton <nickc@redhat.com>
7492 * layout.cc (segment_precedes): Sort segments by their physical
7493 addresses, if they have been set.
7495 2010-08-23 Cary Coutant <ccoutant@google.com>
7497 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7499 (Lib_group::include_member): Unlock object after deleting its
7501 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7504 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7505 Cary Coutant <ccoutant@google.com>
7507 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7508 constructor, and set_blocker.
7509 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7511 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7512 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7513 * testsuite/Makefile.am (start_lib_test): New test case.
7514 * testsuite/Makefile.in: Regenerate.
7515 * testsuite/start_lib_test_main.c: New file.
7516 * testsuite/start_lib_test_1.c: New file.
7517 * testsuite/start_lib_test_2.c: New file.
7518 * testsuite/start_lib_test_3.c: New file.
7520 2010-08-19 Ian Lance Taylor <iant@google.com>
7522 * Makefile.in: Rebuild with automake 1.11.1.
7523 * aclocal.m4: Likewise.
7524 * testsuite/Makefile.in: Likewise.
7526 2010-08-19 Ian Lance Taylor <iant@google.com>
7529 * i386.cc (class Output_data_plt_i386): Update declarations.
7530 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7531 local_ifuncs_ fields.
7532 (Target_i386::do_plt_section_for_global): New function.
7533 (Target_i386::do_plt_section_for_local): New function.
7534 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7535 parameter; change all callers. Initialize global_ifuncs_ and
7536 local_ifuncs_. If doing a static link define __rel_iplt_start and
7538 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7539 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7540 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7542 (Target_i386::make_plt_section): New function, broken out of
7543 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7544 (Target_i386::make_plt_entry): Call make_plt_section.
7545 (Target_i386::make_local_ifunc_plt_entry): New function.
7546 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7547 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7548 R_386_IRELATIVE to switch.
7549 (Target_i386::Scan::global): Likewise.
7550 (Target_i386::Relocate::relocate): Likewise.
7551 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7553 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7554 (Target_x86_64::do_plt_section_for_global): New function.
7555 (Target_x86_64::do_plt_section_for_local): New function.
7556 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7557 parameter; change all callers. If doing a static link define
7558 __rela_iplt_start and __rela_iplt_end.
7559 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7560 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7561 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7563 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7564 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7566 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7567 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7568 R_X86_64_IRELATIVE to switch.
7569 (Target_x86_64::Scan::global): Likewise.
7570 (Target_x86_64::Relocate::relocate): Likewise.
7571 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7573 * target.h (class Target): Add plt_section_for_global and
7574 plt_section_for_local functions. Add do_plt_section_for_global
7575 and do_plt_section_for_local virtual functions.
7576 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7577 clarifying comments.
7578 (Symbol::use_plt_offset): Handle IFUNC symbol.
7579 * object.cc (Sized_relobj::Sized_relobj): Initialize
7581 (Sized_relobj::local_has_plt_offset): New function.
7582 (Sized_relobj::local_plt_offset): New function.
7583 (Sized_relobj::set_local_plt_offset): New function.
7584 (Sized_relobj::do_count): Handle IFUNC symbol.
7585 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7586 a bit away from input_shndx_ field. Add set_is_func_symbol and
7587 is_ifunc_symbol functions.
7588 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7589 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7590 local_plt_offsets_ field.
7591 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7592 * output.h (class Output_section_data): Add non-const
7593 output_section function.
7594 (class Output_data_got): Update declarations.
7595 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7596 Add use_plt_offset parameter to global and local constructors.
7597 Change all callers. Change local_sym_index_ field to 31 bits.
7598 Change GSYM_CODE and CONSTANT_CODE accordingly.
7599 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7600 doing a static link don't set sh_link field.
7601 (Output_data_got::Got_entry::write): Use PLT offset if
7603 (Output_data_got::add_global_plt): New function.
7604 (Output_data_got::add_local_plt): New function.
7605 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7606 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7607 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7608 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7609 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7611 * testsuite/ifunc-sel.h: New file.
7612 * testsuite/ifuncmain1.c: New file.
7613 * testsuite/ifuncmain1vis.c: New file.
7614 * testsuite/ifuncmod1.c: New file.
7615 * testsuite/ifuncdep2.c: New file.
7616 * testsuite/ifuncmain2.c: New file.
7617 * testsuite/ifuncmain3.c: New file.
7618 * testsuite/ifuncmod3.c: New file.
7619 * testsuite/ifuncmain4.c: New file.
7620 * testsuite/ifuncmain5.c: New file.
7621 * testsuite/ifuncmod5.c: New file.
7622 * testsuite/ifuncmain6pie.c: New file.
7623 * testsuite/ifuncmod6.c: New file.
7624 * testsuite/ifuncmain7.c: New file.
7625 * configure, testsuite/Makefile.in: Rebuild.
7627 2010-08-18 Ian Lance Taylor <iant@google.com>
7630 (Output_section_incremental_inputs::write_input_files): Add cast
7631 to avoid signed/unsigned comparison warning.
7632 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7634 2010-08-12 Cary Coutant <ccoutant@google.com>
7636 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7638 2010-08-13 Ian Lance Taylor <iant@google.com>
7640 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7642 2010-08-12 Cary Coutant <ccoutant@google.com>
7643 Doug Kwan <dougkwan@google.com>
7645 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7646 defintion overrides non-weak undef, remember that the original undef
7648 * symtab.cc (Symbol_table::sized_write_global): For undef without
7649 an original weak binding, set binding to global in output.
7650 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7651 * testsuite/Makefile.in: Regenerate.
7652 * testsuite/strong_ref_weak_def.sh: New file.
7653 * testsuite/strong_ref_weak_def_1.c: Ditto.
7654 * testsuite/strong_ref_weak_def_2.c: Ditto.
7656 2010-08-12 Cary Coutant <ccoutant@google.com>
7658 * testsuite/incremental_test.sh: Rewrite.
7659 * testsuite/incremental_test_1.c: Rewrite.
7660 * testsuite/incremental_test_2.c: Rewrite.
7662 2010-08-12 Cary Coutant <ccoutant@google.com>
7664 * arm.cc (Target_arm::got_size): Add const.
7665 (Target_arm::got_entry_count): New function.
7666 (Target_arm::plt_entry_count): New function.
7667 (Target_arm::first_plt_entry_offset): New function.
7668 (Target_arm::plt_entry_size): New function.
7669 (Output_data_plt_arm::entry_count): New function.
7670 (Output_data_plt_arm::first_plt_entry_offset): New function.
7671 (Output_data_plt_arm::get_plt_entry_size): New function.
7672 * i386.cc (Target_i386::got_size): Add const.
7673 (Target_i386::got_entry_count): New function.
7674 (Target_i386::plt_entry_count): New function.
7675 (Target_i386::first_plt_entry_offset): New function.
7676 (Target_i386::plt_entry_size): New function.
7677 (Output_data_plt_i386::entry_count): New function.
7678 (Output_data_plt_i386::first_plt_entry_offset): New function.
7679 (Output_data_plt_i386::get_plt_entry_size): New function.
7680 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7681 find_incremental_inputs_sections. Dump incremental_got_plt section.
7682 * incremental.cc: Include target.h.
7683 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7684 parameter. Adjust all callers. Find incremental_got_plt section.
7685 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7687 (Output_section_incremental_inputs::set_final_data_size): Calculate
7688 size of incremental_got_plt section.
7689 (Output_section_incremental_inputs::do_write): Write the
7690 incremental_got_plt section.
7691 (Got_plt_view_info): New struct.
7692 (Local_got_offset_visitor): New class.
7693 (Global_got_offset_visitor): New class.
7694 (Global_symbol_visitor_got_plt): New class.
7695 (Output_section_incremental_inputs::write_got_plt): New function.
7696 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7697 Add parameter. Adjust all callers.
7698 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7699 (Incremental_inputs::got_plt_section): New function.
7700 (Incremental_inputs::got_plt_section_): New data member.
7701 (Incremental_got_plt_reader): New class.
7702 * layout.cc (Layout::create_incremental_info_sections): Add the
7703 incremental_got_plt section.
7704 * object.h (Got_offset_list::get_list): New function.
7705 (Got offset_list::for_all_got_offsets): New function.
7706 (Sized_relobj::local_got_offset_list): New function.
7707 * powerpc.cc (Target_powerpc::got_size): Add const.
7708 (Target_powerpc::got_entry_count): New function.
7709 (Target_powerpc::plt_entry_count): New function.
7710 (Target_powerpc::first_plt_entry_offset): New function.
7711 (Target_powerpc::plt_entry_size): New function.
7712 (Output_data_plt_powerpc::entry_count): New function.
7713 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7714 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7715 * sparc.cc (Target_sparc::got_size): Add const.
7716 (Target_sparc::got_entry_count): New function.
7717 (Target_sparc::plt_entry_count): New function.
7718 (Target_sparc::first_plt_entry_offset): New function.
7719 (Target_sparc::plt_entry_size): New function.
7720 (Output_data_plt_sparc::entry_count): New function.
7721 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7722 (Output_data_plt_sparc::get_plt_entry_size): New function.
7723 * symtab.h (Symbol::got_offset_list): New function.
7724 (Symbol_table::for_all_symbols): New function.
7725 * target.h (Sized_target::got_entry_count): New function.
7726 (Sized_target::plt_entry_count): New function.
7727 (Sized_target::plt_entry_size): New function.
7728 * x86_64.cc (Target_x86_64::got_size): Add const.
7729 (Target_x86_64::got_entry_count): New function.
7730 (Target_x86_64::plt_entry_count): New function.
7731 (Target_x86_64::first_plt_entry_offset): New function.
7732 (Target_x86_64::plt_entry_size): New function.
7733 (Output_data_plt_x86_64::entry_count): New function.
7734 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7735 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7737 2010-08-12 Cary Coutant <ccoutant@google.com>
7739 * archive.cc: Include incremental.h.
7740 (Archive::Archive): Initialize incremental_info_.
7741 (Archive::include_member): Record archive members in incremental info.
7742 (Add_archive_symbols::run): Record begin and end of an archive in
7744 (Lib_group::include_member): Record objects in incremental info.
7745 * archive.h (Incremental_archive_entry): Forward declaration.
7746 (Archive::set_incremental_info): New member function.
7747 (Archive::incremental_info): New member function.
7748 (Archive::Unused_symbol_iterator): New class.
7749 (Archive::unused_symbols_begin): New member function.
7750 (Archive::unused_symbols_end): New member function.
7751 (Archive::incremental_info_): New data member.
7752 * incremental-dump.cc (find_input_containing_global): New function.
7753 (dump_incremental_inputs): Dump new incremental info sections.
7754 * incremental.cc: Include symtab.h.
7755 (Output_section_incremental_inputs): New class.
7756 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7757 new incremental info sections.
7758 (Sized_incremental_binary::do_check_inputs): Likewise.
7759 (Incremental_inputs::report_archive): Remove.
7760 (Incremental_inputs::report_archive_begin): New function.
7761 (Incremental_inputs::report_archive_end): New function.
7762 (Incremental_inputs::report_object): New function.
7763 (Incremental_inputs::finalize_inputs): Remove.
7764 (Incremental_inputs::report_input_section): New function.
7765 (Incremental_inputs::report_script): Rewrite.
7766 (Incremental_inputs::finalize): Do nothing but finalize string table.
7767 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7768 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7769 (Incremental_inputs::create_data_sections): New function.
7770 (Incremental_inputs::relocs_entsize): New function.
7771 (Output_section_incremental_inputs::set_final_data_size): New function.
7772 (Output_section_incremental_inputs::do_write): New function.
7773 (Output_section_incremental_inputs::write_header): New function.
7774 (Output_section_incremental_inputs::write_input_files): New function.
7775 (Output_section_incremental_inputs::write_info_blocks): New function.
7776 (Output_section_incremental_inputs::write_symtab): New function.
7777 * incremental.h (Incremental_script_entry): Forward declaration.
7778 (Incremental_object_entry): Forward declaration.
7779 (Incremental_archive_entry): Forward declaration.
7780 (Incremental_inputs): Forward declaration.
7781 (Incremental_inputs_header_data): Remove.
7782 (Incremental_inputs_header): Remove.
7783 (Incremental_inputs_header_write): Remove.
7784 (Incremental_inputs_entry_data): Remove.
7785 (Incremental_inputs_entry): Remove.
7786 (Incremental_inputs_entry_write): Remove.
7787 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7788 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7789 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7790 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7792 (Incremental_input_entry): New class.
7793 (Incremental_script_entry): New class.
7794 (Incremental_object_entry): New class.
7795 (Incremental_archive_entry): New class.
7796 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7797 (Incremental_inputs::report_inputs): Remove.
7798 (Incremental_inputs::report_archive): Remove.
7799 (Incremental_inputs::report_archive_begin): New function.
7800 (Incremental_inputs::report_archive_end): New function.
7801 (Incremental_inputs::report_object): Change prototype.
7802 (Incremental_inputs::report_input_section): New function.
7803 (Incremental_inputs::report_script): Change prototype.
7804 (Incremental_inputs::get_reloc_count): New function.
7805 (Incremental_inputs::set_reloc_count): New function.
7806 (Incremental_inputs::create_data_sections): New function.
7807 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7808 (Incremental_inputs::inputs_section): New function.
7809 (Incremental_inputs::symtab_section): New function.
7810 (Incremental_inputs::relocs_section): New function.
7811 (Incremental_inputs::get_stringpool): Add const.
7812 (Incremental_inputs::command_line): Add const.
7813 (Incremental_inputs::inputs): Remove.
7814 (Incremental_inputs::command_line_key): New function.
7815 (Incremental_inputs::input_file_count): New function.
7816 (Incremental_inputs::input_files): New function.
7817 (Incremental_inputs::relocs_entsize): New function.
7818 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7819 (Incremental_inputs::finalize_inputs): Remove.
7820 (Incremental_inputs::Input_info): Remove.
7821 (Incremental_inputs::lock_): Remove.
7822 (Incremental_inputs::inputs_): Change type.
7823 (Incremental_inputs::inputs_map_): Remove.
7824 (Incremental_inputs::current_object_entry_): New data member.
7825 (Incremental_inputs::inputs_section_): New data member.
7826 (Incremental_inputs::symtab_section_): New data member.
7827 (Incremental_inputs::relocs_section_): New data member.
7828 (Incremental_inputs::reloc_count_): New data member.
7829 (Incremental_inputs_reader): New class.
7830 (Incremental_symtab_reader): New class.
7831 (Incremental_relocs_reader): New class.
7832 * layout.cc (Layout::finalize): Move finalization of incremental info
7833 and creation of incremental info sections to follow finalization of
7834 symbol table. Set offsets for postprocessing sections.
7835 (Layout::create_incremental_info_sections): Call
7836 Incremental_inputs::create_data_sections. Add incremental symtab
7837 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7838 sections to layout after input sections.
7839 * layout.h (struct Timespec): Forward declaration.
7840 (Layout::incremental_inputs): Add const.
7841 (Layout::create_incremental_info_sections): Add parameter.
7842 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7843 * object.cc: Include incremental.h.
7844 (Relobj::finalize_incremental_relocs): New function.
7845 (Sized_relobj::do_layout): Record input sections in incremental info.
7846 * object.h (Object::output_section): New function.
7847 (Object::output_section_offset): Moved from Relobj.
7848 (Object::get_incremental_reloc_base): New function.
7849 (Object::get_incremental_reloc_count): New function.
7850 (Object::do_output_section): New function.
7851 (Object::do_output_section_offset): Moved from Relobj.
7852 (Object::do_get_incremental_reloc_base): New function.
7853 (Object::do_get_incremental_reloc_count): New function.
7854 (Object::Object): Initialize new data members.
7855 (Relobj::output_section): Renamed do_output_section and moved to
7857 (Relobj::output_section_offset): Moved to Object.
7858 (Relobj::do_get_incremental_reloc_base): New function.
7859 (Relobj::do_get_incremental_reloc_count): New function.
7860 (Relobj::allocate_incremental_reloc_counts): New function.
7861 (Relobj::count_incremental_reloc): New function.
7862 (Relobj::finalize_incremental_relocs): New function.
7863 (Relobj::next_incremental_reloc_index): New function.
7864 (Relobj::reloc_counts_): New data member.
7865 (Relobj::reloc_bases_): New data member.
7866 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7867 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7868 (Sized_relobj::incremental_relocs_scan): New function.
7869 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7870 (Sized_relobj::incremental_relocs_write): New function.
7871 (Sized_relobj::incremental_relocs_write_reltype): New function.
7872 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7874 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7875 archives and object files elsewhere.
7876 (Add_symbols::run): Report object files here.
7877 (Finish_group::run): Report end of archive at end of group.
7878 * reloc.cc: Include layout.h, incremental.h.
7879 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7880 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7881 (Sized_relobj::incremental_relocs_scan): New function.
7882 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7883 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7884 (Sized_relobj::incremental_relocs_write): New function.
7885 (Sized_relobj::incremental_relocs_write_reltype): New function.
7886 * script.cc (read_input_script): Rewrite test for incremental link.
7887 Change call to Incremental_inputs::report_script.
7888 * symtab.h (Symbol_table::first_global_index): New function.
7889 (Symbol_table::output_count): New function.
7891 2010-08-12 Doug Kwan <dougkwan@google.com>
7893 * arm.cc (Target_arm::merge_object_attributes): Check command line
7894 options --no-wchar-size-warning and --no-enum-size-warning.
7895 * options.h (General_options): Add ld-compatible options
7896 --no-enum-size-warning and --no-wchar-size-warning.
7898 2010-08-04 Ian Lance Taylor <iant@google.com>
7900 * x86_64.cc (Target_x86_64::Scan::local): Use
7901 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7902 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7903 (Target_x86_64::Scan::global): Likewise.
7904 (Target_x86_64::Relocate::relocate): Likewise.
7905 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7908 2010-08-03 Cary Coutant <ccoutant@google.com>
7910 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7911 to reserve space in merged_strings vector. Keep total input size
7913 (Output_merge_string::do_print_merge_stats): Print total input size.
7914 * merge.h (Output_merge_string): Add input_size_ field.
7915 * stringpool.cc (Stringpool_template::string_length): Move
7916 implementations out of Stringpool_template class and place in
7918 * stringpool.h (string_length): Move out of Stringpool_template.
7920 2010-08-03 Ian Lance Taylor <iant@google.com>
7923 * layout.cc (relaxation_loop_body): If address of load segment is
7924 set, adjust address to include headers if possible.
7926 2010-08-03 Ian Lance Taylor <iant@google.com>
7928 * version.cc (version_string): Bump to 1.10.
7930 2010-08-03 Ian Lance Taylor <iant@google.com>
7933 * layout.h (enum Output_section_order): Define.
7934 (class Layout): Update declarations.
7935 * layout.cc (Layout::get_output_section): Add order parameter.
7936 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7937 is_first_non_relro parameters. Change all callers.
7938 (Layout::choose_output_section): Likewise.
7939 (Layout::add_output_section_data): Likewise.
7940 (Layout::make_output_section): Likewise. Set order.
7941 (Layout::default_section_order): New function.
7942 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7943 * output.cc (Output_section::Output_section): Initialize order_.
7944 Don't initialize deleted fields.
7945 (Output_segment::Output_segment): Don't initialize deleted
7947 (Output_segment::add_output_section_to_load): New function
7948 replacing add_output_section. Change all callers to call this or
7949 add_output_section_to_nonload.
7950 (Output_segment::add_output_section_to_nonload): New function.
7951 (Output_segment::remove_output_section): Rewrite.
7952 (Output_segment::add_initial_output_data): Likewise.
7953 (Output_segment::has_any_data_sections): Likewise.
7954 (Output_segment::is_first_section_relro): Likewise.
7955 (Output_segment::maximum_alignment): Likewise.
7956 (Output_segment::has_dynamic_reloc): New function replacing
7957 dynamic_reloc_count. Change all callers.
7958 (Output_segment::has_dynamic_reloc_list): New function replacing
7959 dynamic_reloc_count_list. Change all callers.
7960 (Output_segment::set_section_addresses): Rewrite.
7961 (Output_segment::set_offset): Rewrite.
7962 (Output_segment::find_first_and_last_list): Remove.
7963 (Output_segment::set_tls_offsets): Rewrite.
7964 (Output_segment::first_section_load_address): Likewise.
7965 (Output_segment::output_section_count): Likewise.
7966 (Output_segment::section_with_lowest_load_address): Likewise.
7967 (Output_segment::write_section_headers): Likewise.
7968 (Output_segment::print_sections_to_map): Likewise.
7969 * output.h (class Output_data): Remove dynamic_reloc_count_
7970 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7971 (Output_data::add_dynamic_reloc): Rewrite.
7972 (Output_data::has_dynamic_reloc): New function.
7973 (Output_data::dynamic_reloc_count): Remove.
7974 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7975 is_last_relro_, is_first_non_relro_, is_interp_,
7976 is_dynamic_linker_section_ fields. Add order and set_order
7977 functions. Remove is_relro_local, set_is_relro_local,
7978 is_last_relro, set_is_last_relro, is_first_non_relro,
7979 set_is_first_non_relro functions, is_interp, set_is_interp,
7980 is_dynamic_linker_section, and set_is_dynamic_linker_section
7982 (class Output_segment): Change Output_data_list from std::list to
7983 std:;vector. Add output_lists_ field. Remove output_data_ and
7984 output_bss_ fields. Update declarations.
7986 2010-08-02 Ian Lance Taylor <iant@google.com>
7988 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7989 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7990 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7992 2010-08-02 Ian Lance Taylor <iant@google.com>
7995 * script.cc (Script_options::Script_options): Initialize
7996 symbol_definitions_ and symbol_references_.
7997 (Script_options::add_symbol_assignment): Update
7998 symbol_definitions_ and symbol_references_.
7999 (Script_options::add_symbol_reference): New function.
8000 (script_symbol): New function.
8001 * script.h (class Script_options): Add symbol_definitions_ and
8002 symbol_references_ fields.
8003 (Script_options::referenced_const_iterator): New type.
8004 (Script_options::referenced_begin): New function.
8005 (Script_options::referenced_end): New function.
8006 (Script_options::is_referenced): New function.
8007 (Script_options::any_unreferenced): New function.
8008 * script-c.h (script_symbol): Declare.
8009 * yyscript.y (exp): Call script_symbol.
8010 * symtab.cc: Include "script.h".
8011 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8012 Change all callers. Check symbols referenced by scripts.
8013 (Symbol_table::add_undefined_symbols_from_command_line): Add
8014 layout parameter. Change all callers.
8015 (Symbol_table::do_add_undefined_symbols_from_command_line):
8016 Likewise. Break out loop body. Check symbols referenced by
8018 (Symbol_table::add_undefined_symbol_from_command_line): New
8019 function broken out of
8020 do_add_undefined_symbols_from_command_line.
8021 * symtab.h (class Symbol_table): Update declarations.
8022 * archive.cc: Include "layout.h".
8023 (Archive::should_include_member): Add layout parameter. Change
8024 all callers. Check for symbol mentioned in expression.
8025 * archive.h (class Archive): Update declaration.
8026 * object.cc (Sized_relobj::do_should_include_member): Add layout
8028 * object.h (Object::should_include_member): Add layout parameter.
8030 (Object::do_should_include_member): Add layout parameter.
8031 (class Sized_relobj): Update declaration.
8032 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8034 * dynobj.h (class Sized_dynobj): Update declaration.
8035 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8037 * plugin.h (class Sized_pluginobj): Update declaration.
8039 2010-08-02 Ian Lance Taylor <iant@google.com>
8042 * output.cc (Output_segment::set_offset): Search for the first and
8043 last sections rather than assuming that the list is in order.
8044 (Output_segment::find_first_and_last_list): New function.
8045 * output.h (class Output_segment): Update declarations.
8046 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8047 (relro_strip_test_SOURCES): New variable.
8048 (relro_strip_test_DEPENDENCIES): New variable.
8049 (relro_strip_test_LDFLAGS): New variable.
8050 (relro_strip_test_LDADD): New variable.
8051 (relro_strip_test.so): New target.
8053 2010-08-02 Ian Lance Taylor <iant@google.com>
8055 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8056 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8057 (Target_i386::got_tlsdesc_section): New function.
8058 (Target_i386::got_section): Create space for GOT entries for
8059 TLSDESC relocations.
8060 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8062 (Target_i386::Scan::global): Likewise.
8063 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8065 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8066 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8067 (Target_x86_64::got_tlsdesc_section): New function.
8068 (Target_x86_64::got_section): Create space for GOT entries for
8069 TLSDESC relocations.
8070 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8072 (Target_x86_64::Scan::global): Likewise.
8073 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8076 2010-08-02 Ian Lance Taylor <iant@google.com>
8078 * testsuite/final_layout.sh: Use dc to convert from hex to
8081 2010-07-29 Sriraman Tallam <tmsriram@google.com>
8083 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8084 paramter to the call to gold::gc_process_relocs.
8085 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8086 paramter to the call to gold::gc_process_relocs.
8087 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8088 parameter to the call to gold::gc_process_relocs.
8089 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8090 template parameter to the call to gold::gc_process_relocs.
8091 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8092 paramter to the call to gold::gc_process_relocs.
8093 * gc.h (get_embedded_addend_size): New function.
8094 (gc_process_relocs): Save the size of the reloc for use by ICF.
8095 * icf.cc (get_section_contents): Get the addend from the text section
8096 for SHT_REL relocation sections.
8097 * icf.h (Icf::Reloc_addend_size_info): New typedef.
8098 (Icf::Reloc_info): Add new member reloc_addend_size_info.
8099 * int_encoding.h (read_from_pointer): New overloaded function.
8100 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8101 * testsuite/icf_sht_rel_addend_test.sh: New file.
8102 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8103 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8105 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8107 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8108 * Makefile.in: Regenerate.
8109 * testsuite/Makefile.in: Regenerate.
8111 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
8113 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8114 * gold/testsuite/debug_msg.cc: Likewise.
8115 * gold/testsuite/odr_violation1.cc
8116 * gold/testsuite/odr_violation2.cc
8118 2010-07-21 Cary Coutant <ccoutant@google.com>
8120 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8121 string, and length fields.
8122 (Output_merge_string::Merged_strings_list): New type.
8123 (Output_merge_string::Merged_strings_lists): New typedef.
8124 (Output_merge_string): Replace merged_strings_ with
8125 merged_strings_lists_.
8126 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8127 Merged_strings_list per input object and section. Don't store pointer
8128 to the string. Don't store length with each merged string entry.
8129 (Output_merge_string::finalize_merged_data): Loop over list of merged
8130 strings lists. Recompute length of each merged string.
8132 2010-07-15 Cary Coutant <ccoutant@google.com>
8134 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8137 2010-07-14 Ian Lance Taylor <iant@google.com>
8139 * descriptors.cc (Descriptors::open): Report correct name in error
8142 2010-07-13 Doug Kwan <dougkwan@google.com>
8144 * arm.cc (Arm_input_section::Arm_input_section): For a
8145 SHT_ARM_EXIDX section, always keeps the input sections.
8146 (Arm_input_section::set_exidx_section_link): New method.
8147 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8148 has_errors_ to false.
8149 (Arm_exidx_input_section::has_errors,
8150 Arm_exidx_input_section::set_has_errors): New methods.
8151 (Arm_exidx_input_section::has_errors_): New data member.
8152 (Arm_relobj::get_exidx_shndx_list): New method.
8153 (Arm_output_section::append_text_sections_to_list): Do not skip
8154 section without SHF_EXECINSTR.
8155 (Arm_output_section::fix_exidx_coverage): Skip input sections with
8157 (Arm_relobj::make_exidx_input_section): Add new parameter for text
8158 section header. Make error messages more verbose. Check for
8159 a non-executable section linked to an EXIDX section.
8160 (Arm_relobj::do_read_symbols): Remove error checking, which has been
8161 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
8162 check that there is no deferred EXIDX section if we exit early.
8163 Instead of not making an EXIDX section in case of an error, make one
8164 and set the has_errors flag of it.
8165 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8166 in a relocatable link.
8167 (Target_arm::do_relax): Look for the EXIDX output section instead of
8168 assuming that it is called .ARM.exidx.
8169 (Target_arm::fix_exidx_coverage): Add a new parameter for input
8170 section list. Do not check for SHF_EXECINSTR section flags but
8171 skip any input section with errors.
8172 * output.cc (Output_section::Output_section): Initialize
8173 always_keeps_input_sections_ to false.
8174 (Output_section::add_input_section): Check for
8175 always_keeps_input_sections_.
8176 * output.h (Output_section::always_keeps_input_sections,
8177 Output_section::set_always_keeps_input_sections): New methods.
8178 (Output_section::always_keeps_input_sections): New data member.
8180 2010-07-13 Rafael Espindola <espindola@google.com>
8182 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8183 * fileread.h (Input_file): Add try_extra_search_path and find_file.
8185 2010-07-13 Philip Herron <herron.philip@googlemail.com>
8186 Ian Lance Taylor <iant@google.com>
8188 * output.h (Output_section_lookup_maps::add_merge_section):
8189 Correct check of whether value was inserted.
8190 (Output_section_lookup_maps::add_merge_input_section): Likewise.
8191 (Output_section_lookup_maps::add_relaxed_input_section):
8193 * arm.cc (Target_arm::got_section): Remove used local os.
8194 * i386.cc (Target_i386::got_section): Likewise.
8195 * x86_64.cc (Target_x86_64::got_section): Likewise.
8196 * sparc.cc (Target_sparc::got_section): Likewise.
8197 (Target_sparc::relocate): Remove unused local have_got_offset.
8198 * powerpc.cc (Target_powerpc::relocate): Likewise.
8200 2010-07-13 Ian Lance Taylor <iant@google.com>
8202 * compressed_output.cc (zlib_decompress): Fix signature in
8205 * archive.cc (Archive::include_member): Unlock an external member
8206 of a thin archive. Don't bother to delete an object we know is
8209 2010-07-12 Cary Coutant <ccoutant@google.com>
8211 * compressed_output.cc (zlib_decompress): New function.
8212 (get_uncompressed_size): New function.
8213 (decompress_input_section): New function.
8214 * compressed_output.h (get_uncompressed_size): New function.
8215 (decompress_input_section): New function.
8216 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8217 Handle compressed debug sections.
8218 * layout.cc (is_compressed_debug_section): New function.
8219 (Layout::output_section_name): Map compressed section names to
8221 * layout.h (is_compressed_debug_section): New function.
8222 (is_debug_info_section): Recognize compressed debug sections.
8223 * merge.cc: Include compressed_output.h.
8224 (Output_merge_data::do_add_input_section): Handle compressed
8226 (Output_merge_string::do_add_input_section): Handle compressed
8228 * object.cc: Include compressed_output.h.
8229 (Sized_relobj::Sized_relobj): Initialize new data members.
8230 (build_compressed_section_map): New function.
8231 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8232 * object.h (Object::section_is_compressed): New method.
8233 (Object::do_section_is_compressed): New method.
8234 (Sized_relobj::Compressed_section_map): New type.
8235 (Sized_relobj::do_section_is_compressed): New method.
8236 (Sized_relobj::compressed_sections_): New data member.
8237 * output.cc (Output_section::add_input_section): Handle compressed
8239 * reloc.cc: Include compressed_output.h.
8240 (Sized_relobj::write_sections): Handle compressed debug sections.
8242 2010-07-08 Cary Coutant <ccoutant@google.com>
8244 * resolve.cc (Symbol_table::resolve): Remember whether undef was
8245 weak when resolving to a dynamic def.
8246 (Symbol_table::should_override): Add adjust_dyndef flag; set it
8247 for weak undef/dynamic def cases. Adjust callers.
8248 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8249 undef_binding_weak_.
8250 (Symbol_table::sized_write_globals): Adjust symbol binding.
8251 (Symbol_table::sized_write_symbol): Add binding parameter.
8252 * symtab.h (Symbol::set_undef_binding): New method.
8253 (Symbol::is_undef_binding_weak): New method.
8254 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8255 (Symbol_table::should_override): Add new parameter.
8256 (Symbol_table::sized_write_symbol): Add new parameter.
8258 * testsuite/weak_undef_file1.cc: Add new test case.
8259 * testsuite/weak_undef_file2.cc: Fix header comment.
8260 * testsuite/weak_undef_test.cc: Add new test case.
8262 2010-06-29 Doug Kwan <dougkwan@google.com>
8264 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8265 Initialize USE_SYMBOL_.
8266 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8268 (Arm_reloc_property::uses_symbol_): New data member declaration.
8269 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8270 uses symbol value and symbol is undefined but not weakly undefined.
8272 2010-06-28 Rafael Espindola <espindola@google.com>
8274 * plugin.cc (Plugin::load): Use dlerror.
8276 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8278 * symtab.cc (detect_odr_violations): When reporting an ODR
8279 violation, report an object where the symbol is defined.
8281 2010-06-25 Doug Kwan <dougkwan@google.com>
8283 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8284 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8286 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8287 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8288 target hook to detect function points.
8289 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8290 * icf.h (Icf::check_section_for_function_pointers): Change type of
8291 parameter SECTION_NAME to const reference to std::string. Use
8292 target hook to determine if section may have unsafe pointers.
8293 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8296 2010-06-21 Rafael Espindola <espindola@google.com>
8298 * fileread.cc (Input_file::find_fie): New
8299 (Input_file::open): Use Input_file::find_fie.
8300 * fileread.h (Input_file::find_fie): New
8301 * plugin.cc (set_extra_library_path): New.
8302 (Plugin::load): Add set_extra_library_path to the transfer vector.
8303 (Plugin_manager::set_extra_library_path): New.
8304 (Plugin_manager::add_input_file): Use the extra search path if set.
8305 (set_extra_library_path(): New.
8306 * plugin.h (Plugin_manager): Add set_extra_library_path and
8309 2010-06-19 Cary Coutant <ccoutant@google.com>
8311 * layout.cc (gdb_sections): Add .debug_types.
8312 (lines_only_debug_sections): Likewise.
8314 2010-06-18 Rafael Espindola <espindola@google.com>
8316 * plugin.cc (add_input_file,add_input_library)
8317 (Plugin_manager::add_input_file): Make filename arguments const.
8318 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8321 2010-06-16 Doug Kwan <dougkwan@google.com>
8323 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8324 .ARM.attributes section if we have not merged any input
8325 attributes sections.
8327 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8329 * arm.cc: Allow combining objects with no EABI version
8332 2010-06-15 Rafael Espindola <espindola@google.com>
8334 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8336 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8338 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8339 (struct iovec): Correct !HAVE_READV definition.
8341 2010-06-10 Cary Coutant <ccoutant@google.com>
8343 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8344 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8346 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8349 * symtab.h (Symbol::is_placeholder): New member function.
8350 * target-reloc.h (relocate_section): Check for placeholder symbols.
8352 * testsuite/Makefile.am (plugin_test_8): New test.
8353 (plugin_test_9): New test.
8354 * testsuite/Makefile.in: Regenerate.
8356 2010-06-09 Nick Clifton <nickc@redhat.com>
8358 * yyscript.y (input_list_element): Allow strings prefixed with
8359 the '-' character. Treat these as libraries.
8360 * script.cc (script_add_library): New function. Adds a library
8361 specified by "-l<name>" found in an input script.
8362 * script-c.h: Add prototype for script_add_library.
8364 2010-06-07 Doug Kwan <dougkwan@google.com>
8366 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8367 Restrict stub-group size to be within long conditional branch
8368 range when working around cortex-A8 erratum.
8370 2010-06-07 Damien Diederen <dd@crosstwine.com>
8372 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8375 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8379 (Output_section::Input_section_sort_entry::compare_section_ordering):
8380 Change to return non-zero correctly.
8381 (Output_section::Input_section_sort_section_order_index_compare
8382 ::operator()): Change to fix ambiguity in comparisons.
8384 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8386 * gold.h (is_wildcard_string): New function.
8387 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8388 (Layout::layout_eh_frame): Ditto.
8389 (Layout::find_section_order_index): New method.
8390 (Layout::read_layout_from_file): New method.
8391 * layout.h (Layout::find_section_order_index): New method.
8392 (Layout::read_layout_from_file): New method.
8393 (Layout::input_section_position_): New private member.
8394 (Layout::input_section_glob_): New private member.
8395 * main.cc (main): Call read_layout_from_file here.
8396 * options.h (--section-ordering-file): New option.
8397 * output.cc (Output_section::input_section_order_specified_): New
8399 (Output_section::Output_section): Initialize new member.
8400 (Output_section::add_input_section): Add new parameter.
8401 Keep input sections when --section-ordering-file is used.
8402 (Output_section::set_final_data_size): Sort input sections when
8403 section ordering file is specified.
8404 (Output_section::Input_section_sort_entry): Add new parameter.
8406 (Output_section::Input_section_sort_entry::compare_section_ordering):
8408 (Output_section::Input_section_sort_compare::operator()): Change to
8409 consider section_order_index.
8410 (Output_section::Input_section_sort_init_fini_compare::operator()):
8411 Change to consider section_order_index.
8412 (Output_section::Input_section_sort_section_order_index_compare
8413 ::operator()): New method.
8414 (Output_section::sort_attached_input_sections): Change to sort
8415 according to section order when specified.
8416 (Output_section::add_input_section<32, true>): Add new parameter.
8417 (Output_section::add_input_section<64, true>): Add new parameter.
8418 (Output_section::add_input_section<32, false>): Add new parameter.
8419 (Output_section::add_input_section<64, false>): Add new parameter.
8420 * output.h (Output_section::add_input_section): Add new parameter.
8421 (Output_section::input_section_order_specified): New
8423 (Output_section::set_input_section_order_specified): New method.
8424 (Input_section::Input_section): Initialize section_order_index_.
8425 (Input_section::section_order_index): New method.
8426 (Input_section::set_section_order_index): New method.
8427 (Input_section::section_order_index_): New member.
8428 (Input_section::Input_section_sort_section_order_index_compare): New
8430 (Output_section::input_section_order_specified_): New member.
8431 * script-sections.cc (is_wildcard_string): Delete and move modified
8433 (Output_section_element_input::Output_section_element_input): Modify
8434 call to is_wildcard_string.
8435 (Output_section_element_input::Input_section_pattern
8436 ::Input_section_pattern): Ditto.
8437 (Output_section_element_input::Output_section_element_input): Ditto.
8438 * testsuite/Makefile.am (final_layout): New test case.
8439 * testsuite/Makefile.in: Regenerate.
8440 * testsuite/final_layout.cc: New file.
8441 * testsuite/final_layout.sh: New file.
8443 2010-06-01 Rafael Espindola <espindola@google.com>
8445 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8447 2010-06-01 Rafael Espindola <espindola@google.com>
8449 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8450 visibility of symbols.
8452 2010-05-27 Doug Kwan <dougkwan@google.com>
8454 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8455 from start of output section instead of address for a local symbol
8456 in a merged or relaxed section when doing a relocatable link.
8458 2010-05-26 Rafael Espindola <espindola@google.com>
8461 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8462 adding sections the garbage collector removed.
8463 * gold/testsuite/Makefile.am: Add test.
8464 * gold/testsuite/Makefile.in: Regenerate.
8465 * gold/testsuite/plugin_test_7.sh: New.
8466 * gold/testsuite/plugin_test_7_1.c: New.
8467 * gold/testsuite/plugin_test_7_2.c: New.
8469 2010-05-26 Rafael Espindola <espindola@google.com>
8471 * script-sections.cc (Output_section_definition::set_section_addresses):
8472 Check for --section-start.
8474 2010-05-26 Doug Kwan <dougkwan@google.com>
8476 * arm.cc (Arm_scan_relocatable_relocs): New class.
8477 (Target_arm::relocate_special_relocatable): New method.
8478 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8479 (Arm_relocate_functions::thumb_branch_common): Same.
8480 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8481 instead of Default_scan_relocatable_relocs.
8482 * target-reloc.h (relocate_for_relocatable): Let target handle
8483 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8484 * target.h (Sized_target::relocate_special_relocatable): New method.
8486 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8488 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8490 2010-05-23 Doug Kwan <dougkwan@google.com>
8492 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8494 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8495 with a direct branch, not a conditional branch, to a stub.
8496 * merge.cc (Output_merge_base::record_input_section): New method
8498 (Output_merge_data::do_add_input_section): Record input section if
8499 keeps-input-sections flag is set.
8500 (Output_merge_string::do_add_input_section): Ditto.
8501 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8502 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8504 (Output_merge_base::keeps_input_sections,
8505 Output_merge_base::set_keeps_input_sections,
8506 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8508 (Output_merge_base::Input_sections): New type declaration.
8509 (Output_merge_base::input_sections_begin,
8510 Output_merge_base::input_sections_end,
8511 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8512 (Output_merge_base::bool keeps_input_sections_,
8513 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8514 Output_merge_base::input_sections_): New data members.
8515 (Output_merge_data::do_set_keeps_input_sections): New method
8517 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8518 * output.cc (Output_section::Input_section::relobj): Move method
8519 defintion from class declaration to here and handle merge sections.
8520 (Output_section::Input_section::shndx): Ditto.
8521 (Output_section::Output_section): Remove initializations of removed
8522 data members and initialize new data member LOOKUP_MAPS_.
8523 (Output_section::add_input_section): Set keeps-input-sections flag
8524 for a newly created merge output section as appropriate. Adjust code
8525 to use Output_section_lookup_maps class.
8526 (Output_section::add_relaxed_input_section): Adjst code for lookup
8527 maps code refactoring.
8528 (Output_section::add_merge_input_section): Add a new parameter
8529 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8530 class. If adding input section to a newly created merge output
8531 section fails, remove the new merge section.
8532 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8533 Adjust code for use of the Output_section_lookup_maps class.
8534 (Output_section::find_merge_section): Ditto.
8535 (Output_section::build_lookup_maps): New method defintion.
8536 (Output_section::find_relaxed_input_section): Adjust code to use
8537 Output_section_lookup_maps class.
8538 (Output_section::get_input_sections): Export merge sections. Adjust
8539 code to use Output_section_lookup_maps class.
8540 (Output_section:::add_script_input_section): Adjust code to use
8541 Output_section_lookup_maps class. Update lookup maps for merge
8543 (Output_section::discard_states): Use Output_section_lookup_maps.
8544 (Output_section::restore_states): Same.
8545 * output.h (Merge_section_properties): Move class defintion out of
8547 (Output_section_lookup_maps): New class.
8548 (Output_section::Input_section::is_merge_section): New method
8550 (Output_section::Input_section::relobj): Move defintion out of class
8551 defintion. Declare method only.
8552 (Output_section::Input_section::shndx): Ditto.
8553 (Output_section::Input_section::output_merge_base): New method defintion.
8554 (Output_section::Input_section::u2_.pomb): New union field.
8555 (Output_section::Merge_section_by_properties_map,
8556 Output_section::Output_section_data_by_input_section_map,
8557 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8559 (Output_section::add_merge_input_section): Add new parameter
8560 KEEPS_INPUT_SECTIONS.
8561 (Output_section::build_lookup_maps): New method declaration.
8562 (Output_section::merge_section_map_,
8563 Output_section::merge_section_by_properties_map_,
8564 Output_section::relaxed_input_section_map_,
8565 Output_section::is_relaxed_input_section_map_valid_): Remove data
8567 (Output_section::lookup_maps_): New data member.
8569 2010-05-21 Doug Kwan <dougkwan@google.com>
8572 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8573 avoid a compilation error.
8575 2010-05-19 Rafael Espindola <espindola@google.com>
8577 * script-sections.cc (Output_section_definition::allocate_to_segment):
8578 Update the phdrs_list even when the output section is NULL.
8579 * testsuite/Makefile.am: Add test.
8580 * testsuite/Makefile.in: Regenerate.
8581 * testsuite/script_test_9.cc: New.
8582 * testsuite/script_test_9.sh: New.
8583 * testsuite/script_test_9.t: New.
8585 2010-05-19 Doug Kwan <dougkwan@google.com>
8587 * arm.cc (Arm_input_section::original_size): New method.
8588 (Arm_input_section::do_addralign): Add a cast.
8589 (Arm_input_section::do_output_offset): Remove static cast.
8590 (Arm_input_section::original_addralign,
8591 Arm_input_section::original_size_): Change type to uint32_t.
8592 (Arm_input_section::init): Add safe casts for section alignment
8594 (Arm_input_section::set_final_data_size): Do not set address and
8595 offset of stub table.
8596 (Arm_output_section::fix_exidx_coverage): Change use of of
8597 Output_section::Simple_input_section to that of
8598 Output_section::Input_section.
8599 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8600 except for the first pass.
8601 * output.cc (Output_section::get_input_sections): Change type of
8602 input_sections to std::list<Input_section>.
8603 (Output_section::add_script_input_section): Rename from
8604 Output_section::add_simple_input_section. Change type of SIS
8605 parameter from Simple_input_section to Input_section.
8606 * output.h (Output_section::Simple_input_section): Remove class.
8607 (Output_section::Input_section): Change class visibility to public.
8608 (Output_section::Input_section::addralign): Use stored alignments
8609 for special input sections if set.
8610 (Output_section::Input_section::set_addralign): New method.
8611 (Output_section::get_input_sections): Change parameter type from
8612 list of Simple_input_section to list of Input_section.
8613 (Output_section::add_script_input_section): Rename from
8614 Output_section::add_simple_input_section. Change first parameter's
8615 type from Simple_input_section to Input_section and remove the
8616 second and third parameters.
8617 * script-sections.cc (Input_section::Input_section_list): Change
8618 type to list of Output_section::Input_section/
8619 (Input_section_info::Input_section_info): Change parameter type of
8620 INPUT_SECTION to Output_section::Input_section.
8621 (Input_section_info::input_section): Change return type.
8622 (Input_section_info::input_section_): Change type to
8623 Output_section::Input_section.
8624 (Output_section_element_input::set_section_addresses): Adjust code
8625 to use Output_section::Input_section instead of
8626 Output_section::Simple_input_section. Adjust code for renaming
8627 of Output_section::add_simple_input_section.
8628 (Orphan_output_section::set_section_addresses): Ditto.
8630 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8632 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8633 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8635 2010-05-18 Rafael Espindola <espindola@google.com>
8637 * options.cc (General_options::finalize): Handle -nostdlib.
8638 * options.h (nostdlib): New option.
8639 * script.cc (script_add_search_dir): Handle -nostdlib.
8641 2010-05-12 Doug Kwan <dougkwan@google.com>
8643 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8644 attributes section only if there no attributes section after merging.
8645 (Target_arm::merge_object_attributes): Move value of
8646 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8647 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8648 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8649 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8650 and arm_attr_merge_7.stdout.
8651 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8652 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8653 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8654 arm_attr_merge_7b.o): New rules.
8655 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8657 * testsuite/Makefile.in: Regenerate.
8658 * testsuite/arm_attr_merge.sh: New file.
8659 * testsuite/arm_attr_merge_[67][ab].s: Same.
8661 2010-05-05 Nick Clifton <nickc@redhat.com>
8663 * po/es.po: Updated Spanish translation.
8665 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8667 * Makefile.am (install-exec-local): Properly install gold as
8668 default cross linker.
8669 * Makefile.in: Regenerated.
8671 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8672 Nick Clifton <nickc@redhat.com>
8674 * configure.ac (install_as_default): Define and set to false
8675 unless --enable-gold or --enable-gold=both/gold has been
8677 * configure: Regenerate.
8679 * Makefile.am (install-exec-local): Install the executable as
8680 'ld.gold'. If install_as_default is true then also install it as
8682 * Makefile.in: Regenerated.
8684 2010-04-24 Ian Lance Taylor <iant@google.com>
8686 * layout.cc (Layout::layout_reloc): In relocatable link don't
8687 combine reloc sections for grouped sections.
8689 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8691 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8692 sections that are not ordinary to icf.
8693 * icf.cc (get_section_contents): Handle relocation pointing to section
8694 with no object or shndx information.
8695 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8696 * testsuite/Makefile.in: Regenerate.
8697 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8698 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8700 2010-04-22 Ian Lance Taylor <iant@google.com>
8702 * expression.cc (Expression::Expression_eval_info): Add
8703 result_alignment_pointer field.
8704 (Expression::eval_with_dot): Add result_alignment_pointer
8705 parameter. Change all callers.
8706 (Expression::eval_maybe_dot): Likewise.
8707 (class Binary_expression): Add alignment_pointer parameter to
8708 left_value and right_value. Change all callers.
8709 (BINARY_EXPRESSION): Set result alignment.
8710 (class Trinary_expression): Add alignment_pointer parameter to
8711 arg2_value and arg3_value. Change all callers.
8712 (Trinary_cond::value): Set result alignment.
8713 (Max_expression::value, Min_expression::value): Likewise.
8714 (Align_expression::value): Likewise.
8715 * script-sections.cc (class Sections_element): Add dot_alignment
8716 parameter to set_section_addresses virtual function. Update
8718 (class Output_section_element): Likewise.
8719 (Script_sections::create_segments): Add dot_alignment parameter.
8721 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8722 (Script_sections::set_phdrs_clause_addresses): Likewise.
8723 * script-sections.h: Update declarations.
8724 * script.h: Update declarations.
8725 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8727 * testsuite/script_test_3.t: Set large alignment.
8728 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8729 segment has expected alignment.
8731 2010-04-22 Nick Clifton <nickc@redhat.com>
8733 * po/gold.pot: Updated by the Translation project.
8734 * po/vi.po: Updated Vietnamese translation.
8736 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8738 * testsuite/Makefile.am (check_PROGRAMS): Add
8739 icf_virtual_function_folding_test.
8740 * testsuite/Makefile.in: Regenerated.
8742 2010-04-15 Andrew Haley <aph@redhat.com>
8744 * options.h (merge_exidx_entries): New option.
8745 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8746 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8747 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8748 (Target_arm::merge_exidx_entries): New function.
8749 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8750 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8751 to Arm_exidx_fixup constructor.
8752 Add new arg, merge_exidx_entries.
8753 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8754 Arm_output_section::fix_exidx_coverage.
8756 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8758 * icf.cc (get_section_contents): Check for preemptible functions.
8759 Ignore addend when appropriate.
8760 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8762 (add_from_relobj): Check for section folded.
8763 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8764 * symtab.h (should_add_dynsym_entry): Add new parameter.
8765 * target-reloc.h (scan_relocs): Check for section folded.
8766 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8767 Check reloc types for function pointers in shared objects.
8768 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8770 (icf_preemptible_functions_test): New test case.
8771 (icf_string_merge_test): New test case.
8772 * testsuite.Makefile.in: Regenerate.
8773 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8774 bar_glob. Refactor code.
8775 * testsuite/icf_preemptible_functions_test.cc: New file.
8776 * testsuite/icf_preemptible_functions_test.sh: New file.
8777 * testsuite/icf_string_merge_test.cc: New file.
8778 * testsuite/icf_string_merge_test.sh: New file.
8779 * testsuite/icf_virtual_function_folding_test.cc: New file.
8780 * testsuite/icf_virtual_function_folding_test.sh: New file.
8782 2010-04-14 Doug Kwan <dougkwan@google.com>
8784 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8785 for local symbol recounting if we remove a section due to ICF.
8786 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8787 there are no regular objects in input.
8789 2010-04-13 Doug Kwan <dougkwan@google.com>
8791 * arm.cc (Arm_input_section::set_final_data_size): Compute
8792 accurate final data size instead of using current data size.
8794 2010-04-09 Doug Kwan <dougkwan@google.com>
8796 * layout.cc (Layout::choose_output_section): Handle script section
8798 (Layout::make_output_section_for_script): Add section type parameter.
8799 Handle script section types.
8800 * layout.h (Layout::make_output_section_for_script): Add section
8802 * output.cc (Output_section::Output_section): Initialize data member
8804 (Output_section::do_reset_address_and_file_offset): Do not set address
8805 to 0 if section is a NOLOAD section.
8806 * output.h (Output_section::is_noload): New method.
8807 (Output_section::set_is_noload): Ditto.
8808 (Output_section::is_noload_): New data member.
8809 * script-c.h (Script_section_type): New enum type.
8810 (struct Parser_output_section_header): Add new file section_type.
8811 * script-sections.cc (Sections_element::output_section_name): Add
8812 parameter for returning script section type.
8813 (Output_section_definition::output_section_name): Ditto.
8814 (Output_section_definition::section_type)P; New method.
8815 (Output_section_definiton::script_section_type_name): Ditto.
8816 (Output_section_definition::script_section_type_): New data member.
8817 (Output_section_definition::Output_section_definition): Initialize
8818 data member Output_section_definition::script_section_type_.
8819 (Output_section_definition::create_sections): Pass script section type
8820 to Layout::make_output_section_for_script.
8821 (Output_section_definition::output_section_name): Return script
8822 section type to caller.
8823 (Output_section_definition::set_section_address): Do not advance
8824 dot value and load address if section type is NOLOAD. Set address
8825 of NOLOAD sections regardless of section flags.
8826 (Output_section_definition::print): Print section type if it is
8827 not SCRIPT_SECTION_TYPE_NONE.
8828 (Output_section_definition::section_type): New method.
8829 (Output_section_definition::script_section_type_name): Ditto.
8830 (Script_sections::output_section_name): Add new parameter
8831 PSECTION_TYPE for returning script section type. Pass it to
8832 section elements. Handle discard sections.
8833 (Sort_output_sections::operator()): Handle NOLOAD sections.
8834 * script-sections.h (Script_sections::Section_type): New enum type.
8835 (Script_sections::output_section_name): Add a new parameter for
8836 returning script section type.
8837 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8839 * yyscript.y (union): Add new field SECTION_TYPE.
8840 (COPY, DSECT, INFO, NOLOAD): New tokens.
8841 (opt_address_and_section_type): Change type to output_section_header.
8842 (section_type): New non-terminal
8843 (section_header): Handle section type.
8844 (opt_address_and_section_type): Return section type value.
8846 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8848 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8849 * testsuite/plugin_common_test_2.c (foo): Likewise.
8851 2010-04-08 Doug Kwan <dougkwan@google.com>
8853 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8855 * output.cc (Output_section::add_merge_input_section): Simplify
8856 code and return status of Output_merge_base::add_input_section.
8857 Update merge section map only if Output_merge_base::add_input_section
8860 2010-04-07 Doug Kwan <dougkwan@google.com>
8862 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8863 if section is marked as containing instructions but has no mapping
8865 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8866 correct section index.
8867 (Arm_relobj::find_linked_text_section): Ditto.
8869 2010-04-07 Cary Coutant <ccoutant@google.com>
8871 * archive.cc (include_member): Destroy Read_symbols_data object before
8873 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8874 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8875 (Read_symbols_data::~Read_symbols_data) New destructor.
8876 (Section_relocs::Section_relocs) New constructor.
8877 (Section_relocs::~Section_relocs) New destructor.
8878 (Read_relocs_data::Read_relocs_data) New constructor.
8879 (Read_relocs_data::~Read_relocs_data) New destructor.
8880 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8881 pointers to NULL after deleting.
8883 2010-04-07 Doug Kwan <dougkwan@google.com>
8885 * arm.cc: Replace "endianity" with "endianness" in comments.
8886 (Arm_exidx_cantunwind): Ditto.
8887 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8888 (Arm_relobj::merge_flags_and_attributes): New method.
8889 (Arm_relobj::merge_flags_and_attributes_): New data member.
8890 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8891 (Arm_relobj::scan_sections_for_stubs): Ditto.
8892 (Arm_relobj::do_read_symbols): Check to see if we really want to
8893 merge processor-specific flags and attributes. Exit early if
8894 an object is empty except for section names and the undefined symbol.
8895 (Target_arm::do_finalize_sections): Move check for ELF format to
8896 Arm_relobj::do_read_symbols. Merge processor specific flags and
8897 attributes from a regular object only when we have determined that
8898 it is aapropriate. Do not create an .ARM.attributes section in
8899 output if there is no regular input object.
8900 (Target_arm::merge_processor_specific_flags): Check
8901 --warn-mismatch before printing any error.
8902 (Target_arm::merge_object_attributes): Ditto.
8903 * gold.cc (queue_middle_tasks): Handle the case in which there is
8904 no regular object in input.
8905 * options.cc (General_options::parse_EB): New method.
8906 (General_options::parse_EL): Same.
8907 (General_options::General_options): Initialize endianness_.
8908 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8910 (General_options::Endianness): New enum.
8911 (General_options::endianness): New method.
8912 (General_options::endianness_): New data member.
8913 * parameters.cc (Parameters::set_options): Check target endianness.
8914 (Parameters::set_target_once): Ditto.
8915 (Parameters::check_target_endianness): New method.
8916 (parameters_force_valid_target): If either -EL or -EB is specified,
8917 use it to define endianness of default target.
8918 * parameters.h (Parameters::check_target_endianness): New method
8920 * target.h (class Target): Change "endianity" to "endianness"
8923 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8925 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8926 * configure: Regenerate.
8927 * Makefile.in: Regenerate.
8928 * testsuite/Makefile.in: Regenerate.
8930 2010-04-06 Cary Coutant <ccoutant@google.com>
8933 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8934 prevailing definitions of common symbols.
8935 * testsuite/plugin_test_6.sh: New test case.
8936 * testsuite/plugin_common_test_1.c: New test case.
8937 * testsuite/plugin_common_test_2.c: New test case.
8938 * testsuite/Makefile.am (plugin_test_6): New test case.
8939 * testsuite/Makefile.in: Regenerate.
8941 2010-04-06 Nick Clifton <nickc@redhat.com>
8943 * po/vi.po: New Vietnamese translation.
8945 2010-03-30 Doug Kwan <dougkwan@google.com>
8947 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8949 2010-03-25 Doug Kwan <dougkwan@google.com>
8951 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8952 to avoid a conversion warning on a 32-bit host.
8954 2010-03-24 Ian Lance Taylor <iant@google.com>
8956 * testsuite/script_test_3.t: Add a TLS segment.
8957 * testsuite/Makefile.am (check_PROGRAMS): Add
8958 tls_phdrs_script_test.
8959 (tls_phdrs_script_test_SOURCES): Define.
8960 (tls_phdrs_script_test_DEPENDENCIES): Define.
8961 (tls_phdrs_script_test_LDFLAGS): Define.
8962 (tls_phdrs_script_test_LDADD): Define.
8963 * testsuite/Makefile.in: Rebuild.
8965 2010-03-23 Cary Coutant <ccoutant@google.com>
8967 * fileread.cc (find_or_make_view): Fix comment.
8969 2010-03-23 Ian Lance Taylor <iant@google.com>
8971 * script-sections.cc (class Orphan_section_placement): Define
8972 PLACE_TLS and PLACE_TLS_BSS.
8973 (Orphan_section_placement::Orphan_section_placement): Initialize
8975 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8976 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8977 (tls_script_test_SOURCES): Define.
8978 (tls_script_test_DEPENDENCIES): Define.
8979 (tls_script_test_LDFLAGS): Define.
8980 (tls_script_test_LDADD): Define.
8981 * testsuite/Makefile.in: Rebuild.
8983 2010-03-22 Doug Kwan <dougkwan@google.com>
8985 * arm.cc (Arm_relocate_functions::abs8,
8986 Arm_relocate_functions::abs16): Use correct check for overflow
8987 specified in the ARM ELF specs.
8988 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8989 target of a BLX instruction specially.
8990 (Reloc_stub::stub_type_for_reloc): Ditto.
8991 (Relocate::relocate): Use symbolic names instead of numeric relocation
8992 codes to report error.
8993 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8995 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8996 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8997 thumb2_blx_out_of_range.stdout
8998 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8999 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9000 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9001 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9002 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9003 thumb2_blx_in_range, thumb2_blx_in_range.o,
9004 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9005 thumb2_blx_out_of_range.o): New rules.
9006 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9007 thumb2_blx_in_range and thumb2_blx_out_of_range.
9008 * testsuite/Makefile.in: Regenerate.
9009 * arm_branch_in_range.sh: Add tests for THUMB BLX.
9010 * testsuite/thumb_blx_in_range.s: New file.
9011 * testsuite/thumb_blx_out_of_range.s: New file.
9013 2010-03-22 Rafael Espindola <espindola@google.com>
9015 * archive.cc (Should_include): Move to archive.h.
9016 (should_include_member): Make it a member of Archive.
9018 (Add_lib_group_symbols): New.
9019 * archive.h: Include options.h.
9020 (Archive_member): Moved from Archive.
9021 (Should_include): Moved from archive.cc.
9023 (Add_lib_group_symbols): New.
9024 * dynobj.cc (do_should_include_member): New.
9025 * dynobj.h (do_should_include_member): New.
9026 * gold.cc (queue_initial_tasks): Update call to queue.
9027 * main.cc (main): Print lib group stats.
9028 * object.cc (do_should_include_member): New.
9029 * object.h: Include archive.h.
9030 (Object::should_include_member): New.
9031 (Object::do_should_include_member): New.
9032 (Sized_relobj::do_should_include_member): New.
9033 * options.cc (General_options::parse_start_lib): New.
9034 (General_options::parse_end_lib): New.
9035 (Input_arguments::add_file): Handle lib groups.
9036 (Input_arguments::start_group): Check we are not in a lib.
9037 (Input_arguments::start_lib): New.
9038 (Input_arguments::end_lib): New.
9039 * options.h (General_options): Add start_lib and end_lib.
9040 (Input_argument::lib_): New.
9041 (Input_argument::lib): New.
9042 (Input_argument::is_lib): New.
9043 (Input_file_lib): New.
9044 (Input_arguments::in_lib_): New.
9045 (Input_arguments::in_lib): New.
9046 (Input_arguments::start_lib): New.
9047 (Input_arguments::end_lib_): New.
9048 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9049 in unused members as preempted.
9050 (Sized_pluginobj::do_should_include_member): New.
9051 * plugin.h (Sized_pluginobj::do_should_include_member): New.
9052 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9054 (Read_symbols::do_whole_lib_group): New.
9055 (Read_symbols::do_lib_group): New.
9056 (Read_symbols::do_read_symbols): Handle lib groups.
9057 (Read_symbols::get_name): Handle lib groups.
9058 * readsyms.h (Read_symbols): Add an archive member pointer.
9059 (Read_symbols::do_whole_lib_group): New.
9060 (Read_symbols::do_lib_group): New.
9061 (Read_symbols::member_): New.
9062 * script.cc (read_input_script): Update call to queue_soon.
9064 2010-03-19 Doug Kwan <dougkwan@google.com>
9066 * arm.cc (Stub_table::Stub_table): Initialize new data members
9067 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9068 (Stub_table::add_reloc_stub): Assign stub offset and update
9069 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9070 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9072 (Stub_table::update_data_size_and_addralign): Use
9073 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9074 instead of going over all reloc stubs.
9075 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9076 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9077 Stringpool_template::offset_ to size of Stringpool_char.
9078 (Stringpool_template::new_key_offset): Remove code to initialize
9079 Stringpool_template::offset_.
9080 * stringpool.h (Stringpool_template::set_no_zero_null): Set
9081 Stringpool_template::offset_ to zero.
9083 2010-03-15 Doug Kwan <dougkwan@google.com>
9085 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9087 (Stringpool_template::new_key_offset): New method.
9088 (Stringpool_template::add_string): Assign offsets when adding new
9090 (Stringpool_template::set_string_offsets): Do not set string offsets
9091 when not optimizing.
9092 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9094 (Chunked_vector::clear): Clear size_.
9095 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9096 (Chunked_vector::size): Return size_.
9097 (Chunked_vector::push_back): Use size_ to find insert position.
9098 (Chunked_vector::size_): New data member.
9099 (Stringpool_template::set_no_zero_null): Assert string set is empty.
9100 (Stringpool_template::new_key_offset): New method declaration.
9101 (Stringpool_template::offset_): New data member.
9103 2010-03-15 Rafael Espindola <espindola@google.com>
9105 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9106 Add_symbols' constructor.
9107 * readsyms.h (Add_symbols): Remove the input_group member.
9109 2010-03-10 Ian Lance Taylor <iant@google.com>
9111 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9112 target to ask whether a reference to a symbol requires a stack
9114 * target.h (Target::is_call_to_non_split): New function.
9115 (Target::do_is_call_to_non_split): Declare virtual function.
9116 * target.cc: Include "symtab.h".
9117 (Target::do_is_call_to_non_split): New function.
9118 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9120 2010-03-10 Cary Coutant <ccoutant@google.com>
9122 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9123 (File_read::open[1]): Remove initial mapping of whole_file_view_.
9124 (File_read::open[2]): Add whole_file_view_ to list of views.
9125 (File_read::make_view): Remove test of whole_file_view_.
9126 (File_read::find_or_make_view): Create whole_file_view_ if
9128 (File_read::clear_views): Replace bool parameter with enum;
9129 adjust all callers. Don't delete views with permanent data;
9130 do delete cached views and views from archives if
9131 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
9132 if clearing the corresponding view.
9133 * fileread.h (File_read::Clear_views_mode): New enum.
9134 (File_read::View::is_permanent_view): New method.
9135 (File_read::clear_views): Replace bool parameter
9136 with enum; adjust all callers.
9137 * options.h (General_options): Change keep_files_mapped option;
9138 add map_whole_files.
9139 * readsyms.cc (Add_symbols::run): Delete sd_ object before
9141 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9144 2010-03-10 David S. Miller <davem@davemloft.net>
9146 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9148 2010-03-09 Sriraman Tallam <tmsriram@google.com>
9150 * icf.cc (get_section_contents): Add '@' marker after processing the
9153 2010-03-08 Doug Kwan <dougkwan@google.com>
9155 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9156 due to a conversion warning.
9157 (Arm_relobj::update_output_local_symbol_count): Check for local
9158 symbol with unset output index.
9160 2010-03-05 Ian Lance Taylor <iant@google.com>
9162 * options.h (class General_options): Add --spare-dynamic-tags.
9163 * output.cc (Output_data_dynamic::set_final_data_size): Implement
9164 --spare-dynamic-tags.
9166 2010-03-05 Ian Lance Taylor <iant@google.com>
9168 * incremental.cc: Include "libiberty.h".
9170 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
9172 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9173 function, is_info_ member.
9174 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9175 (Versions::Versions): Update caller.
9176 (Versions::define_base_version): Likewise.
9177 (Versions::add_def): Likewise.
9179 2010-03-03 Sriraman Tallam <tmsriram@google.com>
9181 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9182 (Scan::possible_function_pointer_reloc): New function.
9183 (Scan::local_reloc_may_be_function_pointer): Change to call
9184 possible_function_pointer_reloc.
9185 (Scan::global_reloc_may_be_function_pointer): Ditto.
9186 * icf.h (Icf::check_section_for_function_pointers): Change to reject
9187 relocations in ".data.rel.ro._ZTV" section.
9188 * testsuite/icf_safe_so_test.sh: Change to pass i386.
9189 * testsuite/icf_safe_so_test.cc: Ditto.
9190 * testsuite/icf_safe_test.cc: Ditto.
9191 * testsuite/icf_safe_test.sh: Ditto.
9193 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9194 Ian Lance Taylor <iant@google.com>
9196 * target-reloc.h (relocate_section): Check the symbol table index
9197 for -1U before setting the local symbol index.
9198 (scan_relocatable_relocs): If copying the relocation, record that
9199 the local symbol is required.
9200 * object.h (Symbol_value::is_output_symtab_index_set): New
9202 (Symbol_value::may_be_discarded_from_output_symtab): New
9204 (Symbol_value::has_output_symtab_entry): New function.
9205 (Symbol_value::needs_output_symtab_entry): Remove.
9206 (Symbol_value::output_symtab_index): Make sure the symbol index is
9208 (Symbol_value::set_output_symtab_index): Make sure the symbol
9209 index is not set. Make sure the new index is valid.
9210 (Symbol_value::set_must_have_output_symtab_entry): New function.
9211 (Symbol_value::has_output_dynsym_entry): New function.
9212 (Symbol_value::set_output_dynsym_index): Make sure the new index
9214 (Sized_relobj::set_must_have_output_symtab_entry): New function.
9215 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9216 local symbol if permitted.
9217 (Sized_relobj::do_finalize_local_symbols): Call
9218 is_output_symtab_index_set rather than needs_output_symtab_entry.
9219 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9220 rather than needs_output_symtab_entry. Call
9221 has_output_dynsym_entry rather than needs_output_dynsym_entry.
9222 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9223 is_output_symtab_index_set rather than needs_output_symtab_entry.
9224 * testsuite/discard_locals_relocatable_test.c: New file.
9225 * testsuite/discard_locals_test.sh: Test -r.
9226 * testsuite/Makefile.am (check_DATA): Add
9227 discard_locals_relocatable_test1.syms,
9228 discard_local_relocatable_test2.syms.
9229 (MOSTLYCLEANFILES): Likewise. Also add
9230 discard_locals_relocatable_test1.lout and
9231 discard_locals_relocatable_test2.out.
9232 (discard_locals_relocatable_test1.syms): New target.
9233 (discard_locals_relocatable_test.o): New target.
9234 (discard_locals_relocatable_test1.out): New target.
9235 (discard_locals_relocatable_test2.syms): New target.
9236 (discard_locals_relocatable_test2.out): New target.
9237 (various): Add missing ../ld-new dependencies.
9238 * testsuite/Makefile.in: Rebuild.
9240 2010-03-03 Nick Clifton <nickc@redhat.com>
9242 * po/fi.po: New Finnish translation.
9244 2010-03-01 Doug Kwan <dougkwan@google.com>
9246 * layout.cc (Layout::Layout): Force section types of .init_array*,
9247 .preinit_array* and .fini_array* sections.
9248 * output.cc (Output_section::Input_section_sort_entry::has_priority):
9249 Fix check of return value of std::string::find.().
9250 (Output_section::Input_section_sort_compare::operator()): Remove
9251 comment about .init_array.
9252 (Output_section::Input_section_sort_init_fini_compare::operator()):
9254 (Output_section::sort_attached_input_sections): Handle .init_array
9255 and .fini_array specially.
9256 * output.h (Output_section::Inut_section_sort_compare): Update
9258 (Output_section::Input_section_sort_init_fini_compare): New struct.
9260 2010-02-26 Doug Kwan <dougkwan@google.com>
9262 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9263 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9264 * testsuite/debug_msg.sh: Avoid matching source line number for
9265 use of global variable undef_int.
9267 2010-02-26 Doug Kwan <dougkwan@google.com>
9269 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9270 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9271 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9272 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9273 * options.cc (General_options::General_options): Initialize member
9275 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9276 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9277 and rm_no_fix_v4bx.stdout
9278 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9279 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9280 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9281 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9282 and arm_no_fix_v4bx.
9283 * Makefile.in: Regenerate.
9284 * testsuite/arm_fix_v4bx.s: New file.
9285 * testsuite/arm_fix_v4bx.sh: Ditto.
9287 2010-02-24 Doug Kwan <dougkwan@google.com>
9289 * arm.cc (Target_arm::got_section): Make the .got section the first
9290 non RELRO section in the data segment.
9291 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9292 suffixes of section names.
9294 2010-02-24 Doug Kwan <dougkwan@google.com>
9296 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9297 flags and attributes merging if an input file is a binary file.
9298 * fileread.cc (Input_file::open): Record format of original file.
9299 * fileread.h (Input_file::Format): New enum type.
9300 (Input_file::Input_file): Initialize data member format_.
9301 (Input_file::format): New method definition.
9302 (Input_file::format_):: New data member.
9304 2010-02-24 Doug Kwan <dougkwan@google.com>
9306 * arm.cc (Arm_output_data_got): New class.
9307 (ARM_TCB_SIZE): New constant
9308 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9309 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9310 If user uses a script with a SECTIONS clause, issue only a warning
9311 for a misplaced EXIDX input section. Otherwise, issue an error.
9312 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9314 (Target_arm::got_mode_index_entry): Handle static linking.
9315 (Target_arm::Scan::local): Ditto.
9316 (Target_arm::Scan::global): Ditto.
9317 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
9318 all incorrectly implemented relocations.
9319 (Target_arm::fix_exidx_coverage): Pass layout to
9320 Arm_output_section::fix_exidx_coverage.
9321 * layout.cc (Layout::section_name_mapping): Remove trailing dots
9322 from ".ARM.exidx." and ".ARM.extab.".
9324 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9326 * arm.cc (Target_arm::do_finalize_sections): Create attribute
9327 section if it does not already exist.
9328 * attributes.cc (Attributes_section_data::Attributes_section_data):
9329 Don't crash if size is zero.
9331 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9332 Ian Lance Taylor <iant@google.com>
9334 * gold.cc (queue_middle_tasks): If no input files were opened,
9336 * workqueue.h (Task_function::Task_function): Assert that there is
9339 2010-02-22 Doug Kwan <dougkwan@google.com>
9341 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9342 * icf.cc (get_section_contents): Cast snprintf arguments to long long
9343 types to avoid warnings due to different uint64_t implementations
9346 2010-02-21 Doug Kwan <dougkwan@google.com>
9348 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9349 handling of the maximum backward branch offset.
9350 (Arm_relocate_functions::thumb_branch_common): Ditto.
9351 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9352 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9353 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9354 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9355 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9356 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9357 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9358 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9359 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9360 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9361 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9362 thumb2_bl_out_of_range.o): New rules.
9363 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9364 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9365 thumb2_bl_out_of_range
9366 * testsuite/Makefile.in: Regenerate.
9367 * testsuite/arm_bl_in_range.s: New file.
9368 * testsuite/arm_bl_out_of_range.s: Ditto.
9369 * testsuite/arm_branch_in_range.sh: Ditto.
9370 * testsuite/arm_branch_range.t: Ditto.
9371 * testsuite/thumb2_branch_range.t: Ditto.
9372 * testsuite/thumb_bl_in_range.s: Ditto.
9373 * testsuite/thumb_bl_out_of_range.s: Ditto.
9374 * testsuite/thumb_branch_range.t: Ditto.
9376 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9378 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9379 Add reloc offset information.
9380 * icf.cc (get_section_contents): Change iterators to point to the new
9381 vectors. Add reloc offset information to the contents.
9382 * icf.h (Icf::Sections_reachable_info): New typedef.
9383 (Icf::Sections_reachable_list): New typedef.
9384 (Icf::Offset_info): New typedef.
9385 (Icf::Reloc_info): New struct typedef.
9386 (Icf::Reloc_info_list): New typedef.
9387 (Icf::symbol_reloc_list): Delete method.
9388 (Icf::addend_reloc_list): Delete method.
9389 (Icf::section_reloc_list): Delete method.
9390 (Icf::reloc_info_list): New method.
9391 (Icf::reloc_info_list_): New member.
9393 2010-02-19 Doug Kwan <dougkwan@google.com>
9395 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9396 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9397 * arm.cc (Arm_relocation_functions): New forward declaration.
9398 (Target_arm::Target_arm): Initialize new data members
9399 got_mod_index_offset_ and tls_base_symbol_defined_.
9400 (Target_arm::Relocate::relocate_tls): New method.
9401 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9402 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9404 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9405 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9406 (Target_arm::got_mod_index_offset_,
9407 Target_arm::tls_base_symbol_defined_): New data members.
9408 (Target_arm::Scan::local, Target::Scan::global,
9409 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9412 2010-02-18 Doug Kwan <dougkwan@google.com>
9414 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9415 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9416 text section as a parameter becuase some broken tools may not set
9417 the link in section header.
9418 (Target_arm::has_got_section): New method.
9419 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9420 without any mapping symbol as data only. Remove warning.
9421 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9422 link in its section header, try to discover the link by inspecting the
9423 REL31 relocation at the beginning of the section.
9424 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9426 (Target_arm::Scan::global): Treat any reference to the symbol
9427 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9429 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9431 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9432 (Scan::global_reloc_may_be_function_pointer): New function.
9433 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9434 (Scan::global_reloc_may_be_function_pointer): New function.
9435 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9436 (Scan::global_reloc_may_be_function_pointer): New function.
9437 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9438 (Scan::global_reloc_may_be_function_pointer): New function.
9439 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9440 (Scan::global_reloc_may_be_function_pointer): New function.
9441 (Scan::possible_function_pointer_reloc): New function.
9442 (Target_x86_64::can_check_for_function_pointers): New function.
9443 * gc.h (gc_process_relocs): Scan relocation types to determine if
9444 function pointers were taken for targets that support it.
9445 * icf.cc (Icf::find_identical_sections): Include functions for
9446 folding in safe ICF whose pointer is not taken.
9447 * icf.h (Secn_fptr_taken_set): New typedef.
9448 (fptr_section_id_): New member.
9449 (section_has_function_pointers): New function.
9450 (set_section_has_function_pointers): New function.
9451 (check_section_for_function_pointers): New function.
9452 * options.h: Fix comment for safe ICF option.
9453 * target.h (can_check_for_function_pointers): New function.
9454 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9455 Modify icf_safe_test for X86-64.
9456 * testsuite/Makefile.in: Regenerate.
9457 * testsuite/icf_safe_so_test.cc: New file.
9458 * testsuite/icf_safe_so_test.sh: New file.
9459 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9460 (main): Change to take pointer to function kept_func_3.
9461 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9462 folding is done correctly for X86-64.
9464 2010-02-12 David S. Miller <davem@davemloft.net>
9466 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9467 is_symbolless parameter.
9468 (Output_reloc<SHT_REL>::is_symbolless): New.
9469 (Output_reloc<SHT_REL>::is_symbolless_): New.
9470 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9471 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9472 (Output_reloc<SHT_RELA>::is_symbolless): New.
9473 (Output_data_reloc::add_global): Handle is_symbolless.
9474 (Output_data_reloc::add_global_relative): Likewise.
9475 (Output_data_reloc::add_local): Likewise.
9476 (Output_data_reloc::add_local_relative): Likewise.
9477 (Output_data_reloc::add_symbolless_global_addend): New.
9478 (Output_data_reloc::add_symbolless_local_addend): New.
9479 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9481 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9482 instead of ->is_relative_
9483 (Output_reloc::write): Likewise.
9484 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9485 (Output_reloc::write_rel): Simplify.
9487 * sparc.cc (Target_sparc::Scan::local): Use
9488 ->add_symbolless_local_addend as needed.
9489 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9490 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9491 based upon relocation offset.
9493 2010-02-11 Doug Kwan <dougkwan@google.com>
9495 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9496 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9497 beginning of function.
9498 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9499 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9500 parameter is_32bit in calls to should_apply_static_reloc.
9501 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9502 (check_DATA): Add arm_abs_global.stdout.
9503 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9504 arm_abs_global.stdout): New rules.
9505 (MOSTLLYCLEANFILES): Add arm_abs_global
9506 * Makefile.in: Regenerate.
9507 * testsuite/arm_abs_global.s: New file.
9508 * testsuite/arm_abs_global.sh: Ditto.
9509 * testsuite/arm_abs_lib.s: Ditto.
9511 2010-02-11 Ian Lance Taylor <iant@google.com>
9513 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9515 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9516 Allocate_commons_task first.
9517 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9518 task, rather than symtab_lock_.
9519 (Gc_process_relocs::~Gc_process_relocs): New function.
9520 (Gc_process_relocs::is_runnable): Check this_blocker_.
9521 (Gc_process_relocs::locks): Use next_blocker_ rather than
9523 (Scan_relocs::~Scan_relocs): New function.
9524 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9526 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9528 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9529 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9530 constructor accordingly.
9531 (class Gc_process_relocs): Likewise.
9532 (class Scan_relocs): Likewise.
9533 * common.h (class Allocate_commons_task): Remove symtab_lock_
9534 field, and corresponding constructor parameter.
9535 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9537 (Allocate_commons_task::locks): Likewise.
9539 2010-02-11 Ian Lance Taylor <iant@google.com>
9541 * gold-threads.h (class Once): Define.
9542 (class Initialize_lock): Rewrite as child of Once.
9543 * gold-threads.cc (class Once_initialize): Define.
9544 (once_pointer_control): New static variable.
9545 (once_pointer, once_arg): New static variables.
9546 (c_run_once): New static function.
9547 (Once::Once, Once::run_once, Once::internal_run): New functions.
9548 (class Initialize_lock_once): Remove.
9549 (initialize_lock_control): Remove.
9550 (initialize_lock_pointer): Remove.
9551 (initialize_lock_once): Remove.
9552 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9553 (Initialize_lock::initialize): Rewrite.
9554 (Initialize_lock::do_run_once): New function.
9555 * archive.cc (Archive::interpret_header): Only clear name if it is
9557 * fileread.cc: Include "gold-threads.h"
9558 (file_counts_lock): New static variable.
9559 (file_counts_initialize_lock): Likewise.
9560 (File_read::release): Only increment counts when using --stats.
9561 Use a lock around the increment.
9562 * parameters.cc (class Set_parameters_target_once): Define.
9563 (set_parameters_target_once): New static variable.
9564 (Parameters::Parameters): Move here from parameters.h.
9565 (Parameters::set_target): Rewrite.
9566 (Parameters::set_target_once): New function.
9567 (Parameters::clear_target): Move here and rewrite.
9568 * parameters.h (class Parameters): Update declarations. Add
9569 set_parameters_target_once_ field.
9570 (Parameters::Parameters): Move to parameters.cc.
9571 (Parameters::clear_target): Likewise.
9572 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9574 (Start_group::~Start_group): New function.
9575 (Start_group::is_runnable): New function.
9576 (Start_group::locks, Start_group::run): New functions.
9577 (Finish_group::run): Change saw_undefined to size_t.
9578 * readsyms.h (class Start_group): Define.
9579 (class Finish_group): Change saw_undefined_ field to size_t.
9580 (Finish_group::Finish_group): Remove saw_undefined and
9581 this_blocker parameters. Change all callers.
9582 (Finish_group::set_saw_undefined): New function.
9583 (Finish_group::set_blocker): New function.
9584 * symtab.h (class Symbol_table): Change saw_undefined to return
9585 size_t. Change saw_undefined_ field to size_t.
9586 * target-select.cc (Set_target_once::do_run_once): New function.
9587 (Target_selector::Target_selector): Initialize set_target_once_
9588 field. Don't initialize lock_ and initialize_lock_ fields.
9589 (Target_selector::instantiate_target): Rewrite.
9590 (Target_selector::set_target): New function.
9591 * target-select.h (class Set_target_once): Define.
9592 (class Target_selector): Update declarations. Make
9593 Set_target_once a friend. Remove lock_ and initialize_lock_
9594 fields. Add set_target_once_ field.
9596 2010-02-10 Ian Lance Taylor <iant@google.com>
9598 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9600 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9601 (queue_middle_tasks): Add all blockers before queueing any tasks.
9602 (queue_final_tasks): Likewise.
9603 * token.h (Task_token::add_blockers): New function.
9604 * object.h (Input_objects::number_of_relobjs): New function.
9606 2010-02-10 Ian Lance Taylor <iant@google.com>
9608 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9609 shared, not if not position independent.
9610 * x86_64.cc (Relocate::relocate_tls): Likewise.
9611 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9612 (tls_pie_pic_test): New target.
9613 * testsuite/Makefile.in: Rebuild.
9615 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9616 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9617 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9618 * testsuite/Makefile.in: Rebuild.
9620 2010-02-09 David S. Miller <davem@davemloft.net>
9622 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9623 R_SPARC_RELATIVE using ->add_local_relative().
9624 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9626 * output.h (Output_data_dynamic::add_section_size): New method
9627 that takes two Output_data objects.
9628 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9629 entry param. Handle it in initializers.
9630 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9631 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9632 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9634 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9635 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9636 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9637 for dynrel_includes_plt.
9638 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9639 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9640 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9642 (Target_sparc::do_finalize_sections): Update to pass true for
9643 dynrel_includes_plt.
9644 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9645 output before .rela.plt
9646 (Target_powerpc::do_finalize_sections): Update to pass true for
9647 dynrel_includes_plt when 32-bit.
9649 2010-02-08 Doug Kwan <dougkwan@google.com>
9651 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9653 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9654 Arm_relobj::scan_section_for_cortex_a8_stubs,
9655 Arm_relobj::do_relocation_section): Instead of calling
9656 Output_section::output_address, use faster
9657 Arm_relobj::simple_input_section_output_address.
9659 2010-02-08 David S. Miller <davem@davemloft.net>
9661 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9662 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9663 relocation helper function.
9665 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9666 just like R_SPARC_GOT{10,13,22}.
9667 (Target_sparc::Scan::local): Likewise.
9668 (Target_sparc::Relocate:relocate): Likewise.
9670 2010-02-06 Ian Lance Taylor <iant@google.com>
9672 * configure.ac: Rewrite targetobjs duplicate removal code to use
9673 only shell constructs.
9674 * configure: Rebuild.
9676 2010-02-05 Doug Kwan <dougkwan@google.com>
9679 * arm.cc (Arm_relobj::section_is_scannable): New method.
9680 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9681 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9683 2010-02-04 Doug Kwan <dougkwan@google.com>
9686 * arm-reloc-property.cc (cstdio): Include.
9687 * configure.ac (targetobjs): Remove duplicates.
9688 * configure: Regenerate.
9689 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9690 big and little endian version for a given address size.
9692 2010-02-03 Doug Kwan <dougkwan@google.com>
9694 * arm-reloc-property.cc
9695 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9697 * arm-reloc-property.h
9698 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9699 New method definition.
9700 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9702 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9704 (GOT_PREL): Change implemented to Y.
9705 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9706 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9707 (Arm_relocate_functions::movw_abs_nc): Remove method.
9708 (Arm_relocate_functions::movt_abs): Ditto.
9709 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9710 (Arm_relocate_functions::thm_movt_abs): Ditto.
9711 (Arm_relocate_functions::movw_rel_nc): Ditto.
9712 (Arm_relocate_functions::movw_rel): Ditto.
9713 (Arm_relocate_functions::movt_rel): Ditto.
9714 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9715 (Arm_relocate_functions:thm_movw_rel): Ditto.
9716 (Arm_relocate_functions:thm_movt_rel): Ditto.
9717 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9718 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9719 New method definitions.
9720 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9721 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9722 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9723 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9724 (Target_arm::Relocate::relocate): Check for non-static or
9725 unimplemented relocation code and exit early. Change calls to
9726 Target_arm::reloc_uses_thumb_bit and
9727 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9728 instead. Refactor code to handle similar relocations to increase
9729 code sharing. Remove check for unsupported relocation code in switch
9731 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9732 relocation property table to find out size. Change error message to
9733 print out the name of a relocation code instead of the numeric value.
9734 (Target_arm::scan_reloc_for_stub): Use relocation property table
9735 instead of calling Target_arm::reloc_uses_thumb_bit().
9737 2010-02-02 Doug Kwan <dougkwan@google.com>
9739 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9740 types of relaxed input section.
9742 2010-02-02 Doug Kwan <dougkwan@google.com>
9744 * Makefile.am (HFILES): Add arm-reloc-property.h.
9746 (TARGETSOURCES): Add arm-reloc-property.cc
9747 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9748 (libgold_a_SOURCES): $(DEFFILES)
9749 * Makefile.in: Regenerate.
9750 * arm-reloc-property.cc: New file.
9751 * arm-reloc-property.h: New file.
9752 * arm-reloc.def: New file.
9753 * arm.cc: Update comments.
9754 (arm-reloc-property.h): New included header.
9755 (arm_reloc_property_table): New global variable.
9756 (Target_arm::do_select_as_default_target): New method definition.
9757 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9758 arm-reloc-property to targ_extra_obj.
9759 * parameters.cc (set_parameters_target): Call
9760 Target::select_as_default_target().
9761 * target.h (Target::select_as_default_target): New method definition.
9762 (Target::do_select_as_default_target): Same.
9764 2010-02-01 Doug Kwan <dougkwan@google.com>
9766 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9767 first_output_text_section_.
9768 (Arm_exidx_fixup::first_output_text_section): New method definition.
9769 (Arm_exidx_fixup::first_output_text_section_): New data member.
9770 (Arm_exidx_fixup::process_exidx_section): Record the first text
9771 output section seen.
9772 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9773 and entsize in output section header.
9775 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9777 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9778 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9779 (Arm_relocate_functions::thm_alu11): New Method.
9780 (Arm_relocate_functions::thm_pc8): New Method.
9781 (Arm_relocate_functions::thm_pc12): New Method.
9782 (Target_arm::Scan::local): Handle the relocations.
9783 (Target_arm::Scan::global): Likewise.
9784 (Target_arm::Relocate::relocate): Likewise.
9785 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9787 2010-01-29 Doug Kwan <dougkwan@google.com>
9789 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9790 of relocation types as ld.
9792 2010-01-29 Doug Kwan <dougkwan@google.com>
9794 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9796 (Arm_relocate_functions::thumb_branch_common): Ditto.
9797 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9798 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9799 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9800 Arm_relocate_functions::jump24): Remove.
9801 (Target_arm::Relocate::relocate): Adjust code to call
9802 Arm_relocation_functions::arm_branch_common and
9803 Arm_relocation_functions::thumb_branch_common instead of their removed
9804 wrappers. Merge switch-cases together to reduce source code size.
9806 2010-01-29 Doug Kwan <dougkwan@google.com>
9808 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9809 output_local_symbol_count_needs_update_.
9810 (Arm_relobj::output_local_symbol_count_needs_update,
9811 Arm_relobj::set_output_local_symbol_count_needs_update,
9812 Arm_relobj::update_output_local_symbol_count): New methods.
9813 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9815 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9816 of pointed function as in a R_ARM_PREL31 relocation.
9817 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9818 for output local symbol count updating.
9819 (Target_arm::do_relax): Update output local symbol counts in objects
9821 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9823 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9825 * arm.cc: Added support for the ARM relocations:
9826 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9827 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9828 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9830 (Arm_relocate_functions::movw_rel): New method.
9831 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9832 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9834 (Arm_relocate_functions::thm_movw_rel): New method.
9835 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9837 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9839 (Target_arm::Scan::global): Likewise.
9840 (Target_arm::Relocate::relocate): Likewise.
9841 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9844 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9846 * arm.cc: Added support for ARM group relocations.
9847 (Target_arm::reloc_needs_sym_origin): New method.
9848 (Arm_relocate_functions::calc_grp_kn): New method.
9849 (Arm_relocate_functions::calc_grp_residual): New method.
9850 (Arm_relocate_functions::calc_grp_gn): New method.
9851 (Arm_relocate_functions::arm_grp_alu): New Method.
9852 (Arm_relocate_functions::arm_grp_ldr): New Method.
9853 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9854 (Arm_relocate_functions::arm_grp_ldc): New Method.
9855 (Target_arm::Scan::local): Handle the ARM group relocations.
9856 (Target_arm::Scan::global): Likewise.
9857 (Target_arm::Relocate::relocate): Likewise.
9858 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9861 2010-01-26 Doug Kwan <dougkwan@google.com>
9863 * arm.cc (set): Include.
9864 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9866 (Arm_output_section::Text_section_list): New type.
9867 (Arm_output_section::append_text_sections_to_list): New method.
9868 (Arm_output_section::fix_exidx_coverage): Ditto.
9869 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9870 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9871 Relobj::set_section_offset() instead of
9872 Sized_relobj::invalidate_section_offset().
9873 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9874 parameter for section headers. Ignore relocation sections for
9875 unallocated sections and EXIDX sections.
9876 (Target_arm::fix_exidx_coverage): New method.
9877 (Target_arm::output_section_address_less_than): New type.
9878 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9879 linked text section instead of the EXIDX section.
9880 (Arm_output_section::create_stub_group): Add an assertion to check
9881 that this is not an EXIDX output section.
9882 (Arm_output_section::append_text_sections_to_list): New method.
9883 (Arm_output_section::fix_exidx_coverage): Ditto.
9884 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9885 Arm_relobj::section_needs_reloc_stub_scanning.
9886 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9888 (Target_arm::fix_exidx_coverage): New method.
9889 * object.h (Relobj::set_output_section): New method.
9890 (Sized_relobj::invalidate_section_offset): Remove method.
9891 (Sized_relobj::do_invalidate_section_offset): Remove method.
9892 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9894 2010-01-25 Doug Kwan <dougkwan@google.com>
9896 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9897 Fix warning due to signed and unsigned comparison on a 32-bit host.
9899 2010-01-22 Doug Kwan <dougkwan@google.com>
9901 * arm.cc (Target_arm::do_relax): Record an output section for section
9902 offset adjustment it contains any stub table that has changed.
9903 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9904 offsets in an output section if necessary.
9905 * output.cc (Output_section::Output_section): Initialize
9906 section_offsets_need_adjustments_.
9907 (Output_section::add_input_section_for_script): Renamed to
9908 Output_section::add_simple_input_section.
9909 (Output_section::save_states): Add a comment.
9910 (Output_section::discard_states): New method defintion.
9911 (Output_section::adjust_section_offsets): Same.
9912 * output.h (Output_section::add_input_section_for_script): Renamed to
9913 Output_section::add_simple_input_section.
9914 (Output_section::discard_states): New method declaration.
9915 (Output_section::adjust_section_offsets): Same.
9916 (Output_section::section_offsets_need_adjustment,
9917 Output_section::set_section_offsets_need_adjustment): New method
9919 (Output_section::section_offsets_need_adjustment_): New data member.
9920 * script-sections.cc
9921 (Output_section_element_input::set_section_address): Adjust code for
9922 renaming of Output_section::add_input_section_for_script.
9923 (Orphan_output_section::set_section_address): Same.
9925 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9927 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9928 Fix_v4bx enum values .
9929 * gold/options.h (General_options): New option definitions.
9930 (General_options::fix_v4bx): New method.
9931 (General_options::Fix_v4bx): New enum.
9932 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9933 (General_options::parse_fix_v4bx_interworking): New method.
9935 2010-01-22 Doug Kwan <dougkwan@google.com>
9937 * arm.cc (Arm_exidx_fixup): New class.
9939 2010-01-21 Doug Kwan <dougkwan@google.com>
9941 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9943 (Arm_exidx_section_offset_map): New type.
9945 2010-01-21 Doug Kwan <dougkwan@google.com>
9947 * arm.cc (Arm_exidx_input_section): New class.
9948 (Arm_relobj::exidx_input_section_by_link,
9949 Arm_relobj::exidx_input_section_by_shndx,
9950 Arm_relobj::make_exidx_input_section): New methods.
9951 (read_arm_attributes_section): Remove.
9952 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9953 information about them.
9954 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9957 2010-01-20 Doug Kwan <dougkwan@google.com>
9959 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9960 Input_section_specifier to Section_id.
9961 (Target_arm::new_arm_input_section: Adjust code for change of key
9963 (Target_arm::find_arm_input_section): Ditto.
9964 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9965 (Section_id): Remove.
9966 (Garbage_collection::Section_id_hash): Remove.
9967 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9968 (Section_id): Remove.
9969 (Icf::Section_id_hash): Remove.
9970 * object.h (Section_id, Const_section_id, Section_id_hash,
9971 Const_section_id_hash): New type definitions.
9972 * output.cc (Output_section::add_relaxed_input_section): Change to
9973 use Const_section_id instead of Input_section_specifier as key type.
9974 (Output_section::add_merge_input_section): Ditto.
9975 (Output_section::build_relaxation_map): Change to use Section_id
9976 instead of Input_section_specifier as key type.
9977 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9979 (Output_section::convert_input_sections_to_relaxed_sections): Change
9980 to use Const_section_id instead of Input_section_specifier as key type.
9981 (Output_section::find_merge_section): Ditto.
9982 (Output_section::find_relaxed_input_section): Ditto.
9983 * output.h (Input_section_specifier): Remove class.
9984 (Output_section::Output_section_data_by_input_section_map): Change
9985 key type to Const_section_id.
9986 (Output_section::Output_relaxed_input_section_by_input_section_map):
9988 (Output_section::Relaxation_map): Change key type to Section_id.
9990 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9992 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9993 (class Arm_v4bx_stub): New class.
9994 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9995 (Stub_factory::make_arm_v4bx_stub): New method.
9996 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9997 (Stub_table::empty): Handle v4bx stubs.
9998 (Stub_table::add_arm_v4bx_stub): New method.
9999 (Stub_table::find_arm_v4bx_stub): New method.
10000 (Arm_relocate_functions::v4bx): New method.
10001 (Target_arm::fix_v4bx): New method.
10002 (Target_arm::Target_arm): Handle R_ARM_V4BX.
10003 (Stub_table::relocate_stubs): Likewise.
10004 (Stub_table::do_write): Likewise.
10005 (Stub_table::update_data_size_and_addralign): Likewise.
10006 (Stub_table::finalize_stubs): Likewise.
10007 (Target_arm::Scan::local): Likewise.
10008 (Target_arm::Scan::global): Likewise.
10009 (Target_arm::do_finalize_sections): Likewise.
10010 (Target_arm::Relocate::relocate): Likewise.
10011 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10013 (Target_arm::scan_reloc_for_stub): Likewise.
10014 (Target_arm::scan_reloc_section_for_stubs): Likewise.
10016 2010-01-19 Ian Lance Taylor <iant@google.com>
10018 * output.cc (Output_section_headers::do_sized_write): Write large
10019 segment count to sh_info field.
10020 (Output_file_header::do_sized_write): For large segment count,
10021 write PN_XNUM to e_phnum field.
10023 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10025 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10026 (Arm_relocate_functions::thm_jump8): New function.
10027 (Arm_relocate_functions::thm_jump11): New function.
10028 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10030 (Target_arm::Scan::global): Likewise.
10031 (Target_arm::Relocate::relocate): Likewise.
10032 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10035 2010-01-14 Doug Kwan <dougkwan@google.com>
10037 * arm.cc (map, utility): Include headers.
10038 (Target_arm::apply_cortex_a8_workaround): New method.
10039 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10040 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10041 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10042 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10043 the --[no-]fix-cortex-a8 command line options.
10044 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10045 (Target_arm::relocate_stub): Use addend in instruction template.
10046 * options.h (DEFINE_bool): Set the user-set flag.
10047 (General_options): Add --[no-]-fix-cortex options.
10048 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10049 : Update fast look-up map after conversion.
10051 2010-01-14 Sriraman Tallam <tmsriram@google.com>
10053 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10054 in the first pass of do_layout.
10056 2010-01-13 Doug Kwan <dougkwan@google.com>
10058 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10059 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10060 apparent compiler problem of not folding static constant integral
10061 data members of elfcpp::Elf_sizes<32>.
10063 2010-01-13 Doug Kwan <dougkwan@google.com>
10065 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10066 Arm_relobj::section_needs_cortex_a8_stub_scanning,
10067 Arm_relobj::scan_section_for_cortex_a8_erratum,
10068 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10069 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10070 sections to scan for relocation stubs into a new method
10071 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
10072 relocation and Cortex-A8 stub scanning.
10073 (Target_arm::do_relax): Force stubs to be after stubbed sections
10074 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
10075 the beginning of a new relaxation pass. Update a comment.
10076 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10078 2010-01-12 Ian Lance Taylor <iant@google.com>
10080 * target-reloc.h (visibility_error): New inline function.
10081 (relocate_section): Call visibility_error.
10082 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10083 (MOSTLYCLEANFILES): Likewise.
10084 (protected_4_pic.o, protected_3.err): New targets.
10085 * testsuite/protected_4.cc: New file.
10087 2010-01-12 Doug Kwan <dougkwan@google.com>
10089 * arm.cc (Cortex_a8_reloc): New class.
10090 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10091 and cortex_a8_relocs_info_.
10092 (Target_arm::fix_cortex_a8): New method definition.
10093 (Target_arm::Cortex_a8_relocs_info): New type.
10094 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10095 New data member declarations.
10096 (Target_arm::scan_reloc_for_stub): Record information about
10097 relocations for THUMB branches that might be exempted from the
10098 Cortex-A8 workaround.
10099 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10100 at the beginning of a relaxation pass.
10102 2010-01-12 Doug Kwan <dougkwan@google.com>
10104 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10105 (Arm_relobj::Mapping_symbol_position,
10106 Arm_reloj::Mapping_symbol_position_less,
10107 Arm_relobj::Mapping_symbols_info): New types.
10108 (Target_arm::is_mapping_symbol_name): New method definition.
10109 (Arm_relobj::do_count_local_symbols): Save information about mapping
10112 2010-01-11 Doug Kwan <dougkwan@google.com>
10114 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10115 Arm_relocate_functions::thumb32_branch_upper,
10116 Arm_relocate_functions::thumb32_branch_lower,
10117 Arm_relocate_functions::thumb32_cond_branch_offset,
10118 Arm_relocate_functions::thumb32_cond_branch_upper,
10119 Arm_relocate_functions::thumb32_cond_branch_lower,
10120 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10121 branch offset encoding.
10122 (Arm_relocate_functions::thumb_branch_common): Use new branch
10123 offset encoding methods to avoid code duplication.
10124 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10125 (Stub_addend_reader::operator()): Use new branch encoding method
10126 to avoid code duplication.
10128 2010-01-11 Doug Kwan <dougkwan@google.com>
10130 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10131 (Target_arm::do_finalize_sections): Define special EXIDX section
10132 symbols only if referenced.
10133 * gc.h (Garbage_collection::add_reference): New method.
10134 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10137 2010-01-11 Ian Lance Taylor <iant@google.com>
10139 * script.cc (Version_script_info::build_expression_list_lookup):
10140 Change complaing about duplicate wildcard match from error to
10143 * script.cc (class Lazy_demangler): Recreate--revert part of patch
10145 (Version_script_info::Version_script_info): Initialize globs_,
10146 default_version_, default_is_global_, and exact_. Don't
10147 initialize globals_ or locals_.
10148 (Version_script_info::build_lookup_tables): Build local symbols
10150 (Version_script_info::unquote): New function.
10151 (Version_script_info::add_exact_match): New function.
10152 (Version_script_info::build_expression_list_lookup): Remove lookup
10153 parameter. Add is_global parameter. Change all callers. Handle
10154 wildcard pattern specially. Unquote pattern. Call
10156 (Version_script_info::get_name_to_match): New function.
10157 (Version_script_info::get_symbol_version): New function.
10158 (Version_script_info::get_symbol_version_helper): Remove.
10159 (Version_script_info::check_unmatched_names): Call unquote.
10160 * script.h (class Version_script_info): Change get_symbol_version
10161 to be non-inline and add is_global parameter; change all callers.
10162 Rewrite symbol_is_local. Update declarations. Define struct
10163 Version_tree_match, Exact, Globs. Don't define struct Lookup.
10164 Remove globals_ and locals_ members. Add exact_, globs_,
10165 default_version_, is_global_.
10166 (Version_script_info::Glob): Remove pattern, add expression and
10167 is_global. Update constructor. Change all callers.
10168 * dynobj.cc (Versions::finalize): Mark the version symbol as the
10170 (Versions::symbol_section_contents): If a symbol is undefined, or
10171 defined in a dynamic object, set the version index to
10173 * symtab.cc (Symbol_table::add_from_relobj): Don't call
10175 (Symbol_table::add_from_pluginobj): Likewise.
10176 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10178 2010-01-11 Doug Kwan <dougkwan@google.com>
10180 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10181 (incremental_dump_LDADD): Add linking option for libintl.
10182 * Makefile.in: Regenerate.
10184 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
10187 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10189 * testsuite/Makefile.in: Regenerated.
10191 2010-01-10 Doug Kwan <dougkwan@google.com>
10193 * options.h (DEFINE_var): Use parentheses around argument varname__
10194 in macro body to avoid any unintended subsequent substitutions.
10196 2010-01-10 Ian Lance Taylor <iant@google.com>
10198 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10199 candidates before doing symbol resolution.
10201 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10202 ODR candidates if only one is weak.
10204 2010-01-08 Ian Lance Taylor <iant@google.com>
10206 * script.cc (Version_script_info::build_expression_list_lookup):
10207 Don't warn about ambiguous version, just record the ambiguity.
10208 (Version_script_info::get_symbol_version_helper): Give error if
10209 version is ambiguous.
10211 2010-01-08 Doug Kwan <dougkwan@google.com>
10213 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10214 prev_data_size_ and prev_addralign_. Remove initializer for
10215 deleted data member has_been_changed_.
10216 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10217 to determine if the table is empty.
10218 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10220 (Stub_table::add_reloc_stub): Define method in class definition
10221 instead of just declaring it there.
10222 (Stub_table::add_cortex_a8_stub): New method definition.
10223 (Stub_table::update_data_size_and_addralign): Ditto.
10224 (Stub_table::finalize_stubs): Ditto.
10225 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10226 (Stub_table::do_addralign_): Return address alignment in the
10227 (Stub_table::do_reset_address_and_file_offset): Define method in
10228 class definition instead of declaring it there. Set current data
10229 size to be the data size of the previous pass.
10230 (Stub_table::set_final_data_size): Use current data size as the
10232 (Stub_table::relocate_stub): Change parameter type of stub from
10233 Reloc_stub pointer to Stub pointer.
10234 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10235 (Stub_table::Cortex_a8_stub_list): New typedef.
10236 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10237 Stub_table::prev_addralign_): New data member.
10238 (Arm_relobj::Arm_relobj): Initialize data member
10239 section_has_cortex_a8_workaround_.
10240 (Arm_relobj::section_has_cortex_a8_workaround,
10241 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10243 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10245 (Target_arm::relocate_stub): Change parameter type of stub from
10246 Reloc_stub pointer to Stub pointer.
10247 (Insn_template::size, Insn_template::alignment): Handle
10248 THUMB16_SPECIAL_TYPE.
10249 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10250 Stub_table::update_data_size_and_addralign,
10251 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10253 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10254 (Stub_table::do_write): Ditto.
10255 (Target_arm::do_relax): Adjust code for changes in Stub_table.
10257 2010-01-08 Ian Lance Taylor <iant@google.com>
10260 * symtab.h (class Symbol): Remove fields is_target_special_ and
10261 has_plt_offset_. Add field is_defined_in_discarded_section_.
10262 (Symbol::is_defined_in_discarded_section): New function.
10263 (Symbol::set_is_defined_in_discarded_section): New function.
10264 (Symbol::has_plt_offset): Rewrite.
10265 (Symbol::set_plt_offset): Verify that new offset is not -1U.
10266 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10267 Don't initialize is_target_special_ or has_plt_offset_.
10268 Initialize is_defined_in_discarded_section_.
10269 (Symbol_table::add_from_relobj): If appropriate, set
10270 is_defined_in_discarded_section.
10271 * resolve.cc (Symbol::override_base_with_special): Don't test
10272 is_target_special_. Change has_plt_offset_ to has_plt_offset().
10273 * target-reloc.h (relocate_section): Do special handling for
10274 symbols defined in discarded sections for global symbols as well
10277 2010-01-08 Ian Lance Taylor <iant@google.com>
10279 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10280 the SHT_SYMTAB case.
10282 2010-01-08 Ian Lance Taylor <iant@google.com>
10284 * object.cc (Sized_relobj::do_layout): Don't get confused if
10285 layout_eh_frame returns NULL.
10287 2010-01-08 Ian Lance Taylor <iant@google.com>
10290 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10291 dynamic symbol table, use the normal symbol table.
10292 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10295 2010-01-08 Ian Lance Taylor <iant@google.com>
10298 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10301 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10303 * version.cc (print_version): Change to "Copyright 2010".
10305 2010-01-08 Ian Lance Taylor <iant@google.com>
10309 * i386.cc (class Target_i386): Change return type of plt_section
10311 (class Output_data_plt_i386): Add tls_desc_rel_ field.
10312 (Output_data_plt_i386::Output_data_plt_i386): Initialize
10313 tls_desc_rel_ field.
10314 (Output_data_plt_i386::rel_tls_desc): New function.
10315 (Target_i386::rel_tls_desc_section): New function.
10316 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10317 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10318 R_386_TLS_DESC reloc in rel_tls_desc_section.
10319 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10320 Define struct Tlsdesc_info.
10321 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10322 (Target_x86_64::do_reloc_symbol_index): New function.
10323 (Target_x86_64::add_tlsdesc_info): New function.
10324 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10325 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10326 tlsdesc_rel_ field.
10327 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
10329 (Output_data_plt_x86_64::rela_tlsdesc): New function.
10330 (Target_x86_64::rela_tlsdesc_section): New function.
10331 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10333 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10334 (Target_x86_64::do_reloc_addend): New function.
10335 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10336 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10337 declarations. Define TARGET_CODE. Add arg field to u1_ union.
10338 (Output_reloc::type): New function.
10339 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10340 (Output_reloc::is_target_specific): New function.
10341 (Output_reloc::target_arg): New function.
10342 (class Output_reloc) [SHT_RELA]: Add four new constructors for
10343 absolute relocs and target specific relocs.
10344 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10345 add_target_specific.
10346 (class Output_data_reloc) [SHT_RELA]: Likewise.
10347 * output.cc (Output_reloc::Output_reloc): Add four new versions
10348 for absolute relocs and target specific relocs.
10349 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10350 (Output_reloc::get_symbol_index): Likewise.
10351 (Output_reloc::local_section_offset): Check that local_sym_index_
10352 is not TARGET_CODE or 0.
10353 (Output_reloc::symbol_value): Likewise.
10354 (Output_reloc::write) [SHT_RELA]: Call target for target specific
10356 * target.h (class Target): Add reloc_symbol_index and reloc_addend
10357 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
10359 * layout.cc (add_target_dynamic_tags): Use output section for
10360 DT_PLTRELSZ and DT_JMPREL.
10362 2010-01-07 Ian Lance Taylor <iant@google.com>
10365 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10367 (class Output_data_reloc_generic): Define.
10368 (class Output_data_reloc_base): Change base class to
10369 Output_data_reloc_generic. Change add() method to call
10370 bump_relative_reloc_count for a relative reloc. Remove
10371 sort_relocs_ field.
10372 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10374 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10375 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10377 * layout.h (class Layout): Update declaration.
10379 2010-01-07 Ian Lance Taylor <iant@google.com>
10381 * output.h (class Output_data): Add const version of
10382 output_section and do_output_section.
10383 (class Output_section_data): Add const version of
10385 (class Output_section): Likewise.
10386 * layout.cc (Layout::add_target_dynamic_tags): New function.
10387 * layout.h (class Layout): Update declarations.
10388 * arm.cc (Target_arm::do_finalize_sections): Use
10389 add_target_dynamic_tags.
10390 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10391 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10392 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10393 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10395 2010-01-07 Ian Lance Taylor <iant@google.com>
10398 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10401 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10402 Ian Lance Taylor <iant@google.com>
10405 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10406 Xindex::read_symtab_xindex.
10408 2010-01-07 Doug Kwan <dougkwan@google.com>
10410 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10411 (Insn_template::thumb16_bcond_insn): New method declaration.
10412 (Insn_template): Fix spelling.
10413 (Stub::thumb16_special): New method declaration.
10414 (Stub::do_write): Define virtual method which was previously pure
10416 (Stub::do_thumb16_special): New method declaration.
10417 (Stub::do_fixed_endian_write): New template member.
10418 (Reloc_stub::do_write): Remove.
10419 (Reloc_stub::do_fixed_endian_write): Remove.
10420 (Cortex_a8_stub): New class definition.
10421 (Stub_factory::make_cortex_a8_stub): New method definition.
10422 (Stub_factory::Stub_factory): Add missing static storage class
10423 qualifier for elf32_arm_stub_a8_veneer_blx.
10425 2010-01-07 Ian Lance Taylor <iant@google.com>
10428 * options.h (class General_options): Add --warn-unresolved-symbols
10429 and --error-unresolved-symbols.
10430 * errors.cc (Errors::undefined_symbol): Implement
10431 --warn-unresolved-symbols.
10433 * options.h (class General_options): Add -z text and -z textoff.
10434 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10436 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10438 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10439 (Garbage_collection::cident_sections): New function.
10440 (Garbage_collection::add_cident_section): New function.
10441 (Garbage_collection::cident_sections_): New member.
10442 (gc_process_relocs): Add references to sections whose names are C
10444 * gold.h (cident_section_start_prefix): New constant.
10445 (cident_section_stop_prefix): New constant.
10446 (is_cident): New function.
10447 * layout.cc (Layout::define_section_symbols): Replace string constants
10448 with the newly defined constants.
10449 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10451 * testsuite/Makefile.am: Add gc_orphan_section_test.
10452 * testsuite/Makefile.in: Regenerate.
10453 * testsuite/gc_orphan_section_test.cc: New file.
10454 * testsuite/gc_orphan_section_test.sh: New file.
10456 2010-01-06 Ian Lance Taylor <iant@google.com>
10459 * options.h (class General_options): Add --warn-shared-textrel.
10460 * layout.cc (Layout::finish_dynamic_section): Implement
10461 --warn-shared-textrel.
10464 * options.h (class General_options): Add --warn-multiple-gp.
10466 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10468 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10469 $(THREADSLIB) and $(LIBDL).
10470 * Makefile.in: Rebuild.
10472 2010-01-06 Ian Lance Taylor <iant@google.com>
10475 * options.cc (General_options::parse_section_start): New function.
10476 (General_options::section_start): New function.
10477 (General_options::General_options): Initialize all members.
10478 * options.h: Include <map>
10479 (class General_options): Add --section-start. Add section_starts_
10481 * layout.cc (Layout::attach_allocated_section_to_segment): If
10482 --section-start was used, set the address of the segment. Remove
10483 local sort_sections.
10484 (Layout::relaxation_loop_body): If the address of the load segment
10485 has been set by --section-start, don't use it.
10486 * output.h (Output_segment::update_flags_for_output_section): New
10488 * output.cc (Output_segment::add_output_section): Call
10489 update_flags_for_output_section.
10491 2010-01-05 Ian Lance Taylor <iant@google.com>
10494 * options.h (class General_options): Add --undefined-version.
10495 * script.cc (struct Version_expression): Add was_matched_by_symbol
10497 (Version_script_info::matched_symbol): New function.
10498 (Version_script_info::get_symbol_version_helper): Call
10500 (Version_script_info::check_unmatched_names): New function.
10501 * script.h (class Version_script_info): Update declarations.
10502 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10504 * options.h (class General_options): Use DEFINE_bool_alias for
10505 allow_multiple_definition.
10506 * resolve.cc (Symbol_table::should_override): Don't test
10507 allow_multiple_definition.
10510 * options.h (class General_options): Add --cref.
10511 * main.cc (main): Print cref table if --cref. Don't close mapfile
10512 until after printing cref table.
10513 * cref.cc: Include "symtab.h".
10514 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10515 (Cref_table_compare::operator()): New function.
10516 (Cref_inputs::gather_cref): New function.
10517 (filecol): New static const.
10518 (Cref_inputs::print_cref): New function.
10519 (Cref::print_cref): New function.
10520 * cref.h: Include <cstdio>.
10521 (class Cref): Update declarations.
10522 * mapfile.h (Mapfile::file): New function.
10523 * object.h (class Object): Define Symbols. Declare virtual
10524 do_get_global_symbols.
10525 (Object::get_global_symbols): New function.
10526 * object.cc (Input_objects::add_object): Pass object to cref_ if
10528 (Input_objects::archive_start): Likewise.
10529 (Input_objects::archive_stop): Likewise.
10530 (Input_objects::print_cref): New function.
10531 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10532 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10534 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10536 * plugin.h (class Sized_pluginobj): Update declarations.
10538 2010-01-05 Ian Lance Taylor <iant@google.com>
10540 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10541 to is_default_version. Rename insdef to insdefault.
10542 (Symbol_table::add_from_relobj): Rename def to is_default_version
10543 and local to is_forced_local.
10544 (Symbol_table::add_from_pluginobj): Likewise.
10545 (Symbol_table::add_from_dynobj): Likewise.
10546 (Symbol_table::define_special_symbol): Rename insdef to
10549 2010-01-04 Ian Lance Taylor <iant@google.com>
10552 * options.h (class General_options): Add
10553 --allow-multiple-definition and -z muldefs.
10554 * resolve.cc (Symbol_table::should_override): Don't warn about a
10555 multiple symbol definition if --allow-multiple-definition or -z
10559 * options.h (class General_options): Add --add-needed and
10560 --copy-dt-needed-entries. Tweak --as-needed help entry.
10561 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10562 error if --copy-dt-needed-entries aka --add-needed is used and
10563 would cause a change in behaviour.
10566 * options.h (class General_options): Add -G as a short version of
10567 --shared. Add no-op options -assert, -g, and -i.
10569 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10571 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10572 check for .text or .gnu.linkonce.t sections.
10573 * icf.cc (Icf::find_identical_sections): Ditto.
10574 Change the detection for mangled function name within the section
10576 * icf.h (is_section_foldable_candidate): New function.
10578 2009-12-30 Ian Lance Taylor <iant@google.com>
10581 * options.h (class General_options): Permit two dashes with
10582 --retain-symbols-file.
10584 2009-12-30 Ian Lance Taylor <iant@google.com>
10587 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10588 don't put the file header and segment headers in the text
10592 * common.cc (Sort_commons::operator()): Stabilize sort when both
10594 (Symbol_table::do_allocate_commons_list): When allocating common
10595 symbols, skip a symbol which is no longer common.
10596 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10597 an object before checking its type.
10598 * testsuite/common_test_2.c: New file.
10599 * testsuite/common_test_3.c: New file.
10600 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10601 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10602 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10603 (common_test_2_pic.o, common_test_2.so): New targets.
10604 (common_test_3_pic.o, common_test_3.so): New targets.
10605 * testsuite/Makefile.in: Rebuild.
10608 * script.cc (read_input_script): If we see a new SECTIONS clause,
10609 and we have added an input section, give an error.
10610 * layout.h (class Layout): Add have_added_input_section function.
10611 Add have_added_input_section_ field.
10612 * layout.cc (Layout::Layout): Initialize
10613 have_added_input_section_.
10614 (Layout::layout): Set have_added_input_section_.
10615 (Layout::layout_eh_frame): Likewise.
10617 2009-12-30 Ian Lance Taylor <iant@google.com>
10620 * options.h (class General_options): Add --sort-common option.
10621 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10622 * common.cc (Sort_common): Add sort_order parameter to
10623 constructor. Add sort_order_ field.
10624 (Sort_commons::operator): Check sort_order_.
10625 (Symbol_table::allocate_commons): Determine the sort order.
10626 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10627 Change all callers.
10628 (Symbol_table::do_allocate_commons_list): Likewise.
10630 2009-12-30 Ian Lance Taylor <iant@google.com>
10633 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10634 symbols from this object, don't change the visibility of an
10636 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10638 2009-12-30 Ian Lance Taylor <iant@google.com>
10641 * script.h (class Version_script_info): Define Language enum.
10642 Update declarations. Define Glob, Exact, and Lookup types. Add
10643 new fields globals_, locals_, and is_finalized_.
10644 * script.cc: Various formatting fixes.
10645 (class Parser_closure): Change language_stack_ from a vector of
10646 std::string to one of Version_script_info::Language. Adjust all
10648 (class Lazy_demangler): Remove.
10649 (struct Version_expression): Change language from std::string to
10650 Version_script_info::Language.
10651 (Version_script_info::Version_script_info): New function.
10652 (Version_script_info::~Version_script_info): Don't call clear.
10653 (Version_script_info::finalize): New function.
10654 (Version_script_info::build_lookup_tables): New function.
10655 (Version_script_info::build_expression_list_lookup): New
10657 (Version_script_info::get_symbol_version_helper): Rewrite to use
10659 (Version_script_info::print_expression_list): Adjust to use
10660 Version_script_info::Language.
10661 (script_push_lex_into_version_mode): Check that the version script
10662 has not been finalized.
10663 (version_script_push_lang): Change language string to
10664 Version_script_info::Language.
10665 * options.cc (Command_line::version_script): New function.
10666 * options.h (class General_options): Add finalize_dynamic_list
10667 function. Change version_script from declaration to definition.
10668 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10669 * testsuite/version_script.map: Remove duplicate def of foo.
10670 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10671 version_script.map.
10672 * testsuite/Makefile.in: Rebuild.
10674 2009-12-30 Ian Lance Taylor <iant@google.com>
10677 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10678 if the input symbol index is 0, make the output symbol index 0.
10680 2009-12-30 Ian Lance Taylor <iant@google.com>
10683 * options.h (class General_options): Add -x/--discard-all.
10684 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10685 --discard-all. If the local symbol needs a dynamic entry, check
10686 that before handling --discard-locals.
10688 2009-12-30 Ian Lance Taylor <iant@google.com>
10691 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10693 (Output_segment::add_output_section): Don't change the flags if
10694 the type is PT_TLS.
10697 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10698 GNU hash table if they need a dynamic value. Otherwise, don't add
10699 them if they are defined in a dynamic object or are forced local.
10701 2009-12-29 Ian Lance Taylor <iant@google.com>
10704 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10705 .gnu.hash table for a 32-bit target.
10708 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10709 regular and a dynamic object only needs a dynamic symbol table
10710 entry if it is externally visible.
10713 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10714 constructor. Add global_offset_table_ field.
10715 (Target_i386::got_section): Set global_offset_table_.
10716 (Target_i386::do_finalize_sections): Set global_offset_table_
10718 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10719 in constructor. Add global_offset_table_ field.
10720 (Target_x86_64::got_section): Set global_offset_table_.
10721 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10724 * layout.cc (Layout::Layout): Initialize increase_relro_.
10725 (Layout::get_output_section): Add is_relro, is_last_relro, and
10726 is_first_non_relro parameters. Change all callers.
10727 (Layout::choose_output_section): Likewise.
10728 (Layout::add_output_section_data): Likewise.
10729 (Layout::make_output_section): Likewise.
10730 (Layout::set_segment_offsets): Clear increase_relro when using a
10732 * layout.h (class Layout): Add increase_relro method. Add
10733 increase_relro_ field. Update declarations.
10734 * output.cc (Output_section::Output_section): Initialize
10735 is_last_relro_ and is_first_non_relro_.
10736 (Output_segment::add_output_section): Group relro sections is
10737 do_sort is true. Handle is_last_relro and is_first_non_relro.
10738 (Output_segment::maximum_alignment): Remove relro handling.
10739 (Output_segment::set_section_addresses): Add increase_relro
10740 parameter. Change all callers. Add initial alignment to align
10741 relro sections on separate page. Remove old relro handling.
10742 (Output_segment::set_section_list_addresses): Remove in_relro
10743 parameter. Change all callers.
10744 (Output_segment::set_offset): Add increase parameter. Change all
10745 callers. Remove old relro handling.
10746 * output.h (class Output_section): Add new methods: is_last_relro,
10747 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10748 Add is_last_relro_ and is_first_non_relro_ fields.
10749 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10750 Create separate .got.plt section. Call increase_relro.
10751 * x86_64.cc (Target_x86_64::got_section): Likewise.
10752 * testsuite/relro_script_test.t: Add .got.plt.
10755 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10756 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10757 (Layout::finalize): Call set_dynamic_symbol_size.
10758 (Layout::set_dynamic_symbol_size): New function.
10759 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10760 set_dynamic_symbol_size.
10763 * output.h (class Output_section): Add is_entsize_zero_ field.
10764 * output.cc (Output_section::Output_section): Initialize
10766 (Output_section::set_entsize): If two different entsizes are
10767 requested, force it to zero.
10768 (Output_section::add_input_section): Set flags for .debug_str
10769 before updating section flags. Set entsize.
10770 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10771 and SHF_STRING if all input sections have those flags.
10773 2009-12-29 Rafael Espindola <espindola@google.com>
10775 * main.cc (main): Fix the sys time reporting.
10776 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10779 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10781 * options.cc (General_options::parse_version): Allow -v to exit
10782 without an error if there is nothing to link.
10784 2009-12-29 Ian Lance Taylor <iant@google.com>
10786 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10787 using a version of gcc before 4.1.
10788 * configure: Rebuild.
10790 2009-12-28 Chris Demetriou <cgd@google.com>
10792 * attributes.cc (Output_attributes_section_data::do_write): Use
10793 std::vector::front rather than std::vector::data.
10795 2009-12-28 Ian Lance Taylor <iant@google.com>
10797 * symtab.h (class Symbol_table): Add enum Defined.
10798 * resolve.cc (Symbol_table::should_override): Add defined
10799 parameter. Change all callers. Test whether object is NULL
10800 before calling a method on it.
10801 (Symbol_table::report_resolve_problem): Add defined parameter.
10802 Change all callers.
10803 (Symbol_table::should_override_with_special): Likewise.
10804 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10805 parameter. Change all callers.
10806 (Symbol_table::do_define_in_output_data): Likewise.
10807 (Symbol_table::define_in_output_segment): Likewise.
10808 (Symbol_table::do_define_in_output_segment): Likewise.
10809 (Symbol_table::define_as_constant): Likewise.
10810 (Symbol_table::do_define_as_constant): Likewise.
10811 * script.h (class Symbol_assignment): Add is_defsym parameter to
10812 constructor; change all callers.
10813 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10814 parameter. Change all callers. Add is_defsym_ field.
10815 (class Parser_closure): Add parsing_defsym parameter to
10816 constructor; change all callers. Add parsing_defsym accessor
10817 function. Add parsing_defsym_ field.
10819 2009-12-28 Ian Lance Taylor <iant@google.com>
10821 * gold.cc (queue_middle_tasks): Fix formatting.
10822 * object.cc (Relobj::is_section_name_included): Likewise.
10824 2009-12-23 Ian Lance Taylor <iant@google.com>
10826 * i386.cc (Target_i386::do_calls_non_split): Recognize
10827 -fsplit-stack prologue for a function with a static chain.
10828 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10829 -fsplit-stack prologue when using %r11.
10831 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10833 * options.cc (General_options::parse_version): Make -v continue and do
10834 the link like GNU ld does.
10836 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10838 * Makefile.am (CCFILES): Add timer.cc.
10839 (HFILES): Add timer.h.
10840 * configure.ac: Check for sysconf and times.
10841 * main.cc: include timer.h.
10842 (main): Use Timer instead of get_run_time.
10845 * workqueue.cc: include timer.h.
10846 (Workqueue::find_and_run_task):
10847 Report user, sys and wall time.
10848 * Makefile.in: Regenerate.
10849 * config.in: Regenerate.
10850 * configure: Regenerate.
10852 2009-12-16 Doug Kwan <dougkwan@google.com>
10854 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10856 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10857 relaxed input sections.
10858 * output.cc (Output_section::find_relaxed_input_section): Change
10859 return type to Output_relaxed_input_section pointer. Adjust code
10860 for new type of relaxed_input_section_map_.
10861 * output.h (Output_section::find_relaxed_input_section): Change
10862 return type to Output_relaxed_input_section pointer.
10863 (Output_section::Output_relaxed_input_section_by_input_section_map):
10865 (Output_section::relaxed_input_section_map_): Change type to
10866 Output_section::Output_relaxed_input_section_by_input_section_map.
10867 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10870 2009-12-15 Ian Lance Taylor <iant@google.com>
10872 * layout.cc (Layout::create_shstrtab): Only write out after input
10873 sections if we are compressing debug sections.
10875 2009-12-15 Ian Lance Taylor <iant@google.com>
10877 * archive.cc (Archive::add_symbols): Only look up a symbol without
10878 a version if there is, in fact, a version.
10880 2009-12-14 Ian Lance Taylor <iant@google.com>
10882 Revert -Wshadow changes, all changes from:
10883 2009-12-11 Doug Kwan <dougkwan@google.com>
10884 2009-12-11 Nick Clifton <nickc@redhat.com>
10885 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10887 2009-12-11 Doug Kwan <dougkwan@google.com>
10889 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10891 * attributes.cc (Object_attribute::size): Ditto.
10892 (Attributes_section_data::size): Ditto.
10893 (Attributes_section_data::Attributes_section_data): Ditto.
10894 (Output_attributes_section_data::do_write): Ditto.
10895 * attributes.h (Object_attribute::set_type): Ditto.
10896 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10898 2009-12-11 Nick Clifton <nickc@redhat.com>
10900 * archive.cc: Fix shadowed variable warnings.
10901 * arm.cc: Likewise.
10902 * compressed_output.cc: Likewise.
10903 * compressed_output.h: Likewise.
10904 * configure: Likewise.
10905 * dwarf_reader.cc: Likewise.
10906 * dynobj.cc: Likewise.
10907 * dynobj.h: Likewise.
10908 * ehframe.cc: Likewise.
10909 * ehframe.h: Likewise.
10910 * errors.cc: Likewise.
10911 * expression.cc: Likewise.
10912 * fileread.cc: Likewise.
10913 * fileread.h: Likewise.
10914 * freebsd.h: Likewise.
10915 * i386.cc: Likewise.
10916 * icf.cc: Likewise.
10917 * incremental.h: Likewise.
10918 * layout.cc: Likewise.
10919 * layout.h: Likewise.
10920 * mapfile.cc: Likewise.
10921 * merge.cc: Likewise.
10922 * merge.h: Likewise.
10923 * object.cc: Likewise.
10924 * object.h: Likewise.
10925 * options.h: Likewise.
10926 * output.cc: Likewise.
10927 * output.h: Likewise.
10928 * parameters.cc: Likewise.
10929 * plugin.cc: Likewise.
10930 * powerpc.cc: Likewise.
10931 * reduced_debug_output.cc: Likewise.
10932 * reduced_debug_output.h: Likewise.
10933 * reloc.cc: Likewise.
10934 * reloc.h: Likewise.
10935 * resolve.cc: Likewise.
10936 * script-sections.cc: Likewise.
10937 * script.cc: Likewise.
10938 * script.h: Likewise.
10939 * sparc.cc: Likewise.
10940 * symtab.cc: Likewise.
10941 * symtab.h: Likewise.
10942 * target-select.cc: Likewise.
10943 * target-select.h: Likewise.
10944 * token.h: Likewise.
10945 * workqueue.cc: Likewise.
10946 * workqueue.h: Likewise.
10947 * x86_64.cc: Likewise.
10949 2009-12-10 Doug Kwan <dougkwan@google.com>
10951 * arm.cc (attributes.h): New include.
10952 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10953 (Arm_relobj::~Arm_relobj): Delete object pointed by
10954 attributes_section_data_.
10955 (Arm_relobj::attributes_section_data): New method definition.
10956 (Arm_relobj::attributes_section_data_): New data member declaration.
10957 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10958 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10959 attributes_section_data_.
10960 (Arm_dynobj::attributes_section_data): New method definition.
10961 (Arm_dynobj::attributes_section_data_): New data member declaration.
10962 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10963 initialization value of may_use_blx_ to false.
10964 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10965 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10966 object attributes to compute results instead of hard-coding.
10967 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10968 Target_arm::get_secondary_compatible_arch,
10969 Target_arm::set_secondary_compatible_arch
10970 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10971 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10972 New method declarations.
10973 (Target_arm::get_aeabi_object_attribute): New method definition.
10974 (Target_arm::attributes_section_data_): New data member declaration.
10975 (read_arm_attributes_section): New template definition.
10976 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10977 (Arm_dynobj::do_read_symbols): Ditto.
10978 (Target_arm::do_finalize_sections): Merge attributes sections from
10979 input. Check for BLX use after attributes section merging.
10980 Fix __exidx_start and __exidx_end visibility. Create an
10981 .ARM.attributes section if necessary.
10982 (Target_arm::get_secondary_compatible_arch,
10983 Target_arm::set_secondary_compatible_arch,
10984 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10985 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10986 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10987 New method definitions.
10989 2009-12-09 Ian Lance Taylor <iant@google.com>
10991 * plugin.cc (Plugin::load): Don't cast from void* to a function
10994 2009-12-09 Ian Lance Taylor <iant@google.com>
10996 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10997 information fields.
10999 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
11001 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11002 Replace two_file_shared_1.so with two_file_shared_2.so.
11003 * testsuite/Makefile.in: Regenerated.
11005 2009-12-08 Doug Kwan <dougkwan@google.com>
11007 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11008 (HFILES): Add attributes.h and int_encoding.h.
11009 * Makefile.in: Regenerate.
11010 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11011 function definitions to int_encoding.cc
11012 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11013 prototypes to int_encoding.h
11014 * reduced_debug_output.cc (int_encoding.h): New include.
11015 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11016 function definitions to int_encoding.cc
11017 (insert_into_vector, read_from_pointer): Move template definitions to
11019 * attributes.cc: New file.
11020 * attributes.h: New file.
11021 * int_encoding.cc: New file.
11022 * int_encoding.h: New file.
11024 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
11027 * incremental-dump.cc (dump_incremental_inputs): New.
11028 (main): Use dump_incremental_inputs.
11030 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
11033 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11034 checking elfcpp::STT_FUNC.
11035 (Target_i386::Relocate::relocate): Likewise.
11036 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11038 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11039 symbols from shared libraries into normal FUNC symbols.
11041 * symtab.h (Symbol): Add is_func and use it.
11043 2009-12-05 Doug Kwan <dougkwan@google.com>
11045 * arm.cc (Target_arm::arm_info): Initialize new fields
11046 attributes_section and attributes_vendor.
11047 * i386.cc (Target_i386::i386_info): Same.
11048 * object.cc (Sized_relobj::do_layout): Skip attribute section.
11049 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11050 fields attributes_section and attributes_vendor.
11051 * sparc.cc (Target_sparc::sparc_info): Same.
11052 * target.h (Target::attributes_section, Target::attributes_vendor,
11053 Target::is_attributes_section, Target::attribute_arg_type,
11054 Target::attributes_order): New method definitions.
11055 (Target::Target_info::attributes_section,
11056 Target::Target_info::attributes_vendor): New fields.
11057 (Target::do_attribute_arg_type, Target::do_attributes_order): New
11058 virtual method definitions.
11059 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11060 attributes_section and attributes_vendor.
11061 * testsuite/testfile.cc (Target_test::test_target_info): Same.
11063 2009-12-05 Doug Kwan <dougkwan@google.com>
11065 * arm.cc: Update comments about interworking and stub generation.
11066 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11067 considered as non-PIC.
11068 (Arm_relocate_functions::base_abs): Fix formatting.
11069 (Arm_relocate_functions::got_prel): Fix comment. Change interface
11070 of function to use GOT entry address instead of offset.
11071 (Target_arm::Scan::global): Issue an error if a symbol would need a
11072 PLT does not get one because it is untyped. Remove code to create
11073 dynamic symbols for relative branches.
11074 (Target_arm::Relocate::relocate: Use 0 instead of false since function
11075 takes unsigned integer instead of boolean.
11077 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
11079 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11080 (two_file_test_LDADD): Likewise.
11081 (common_test_1_LDADD): Likewise.
11082 (exception_test_LDADD) Likewise.
11083 (weak_test_LDADD): Likewise.
11084 (many_sections_test_LDADD): Likewise.
11085 (initpri1_LDADD): Likewise.
11086 (script_test_1_LDADD): Likewise.
11087 (script_test_2_LDADD): Likewise.
11088 (justsyms_LDADD): Likewise.
11089 (binary_test_LDADD): Likewise.
11090 (large_LDADD): Likewise.
11091 * testsuite/Makefile.in: Regenerated.
11093 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
11095 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11096 (Symbol_table::override_with_special): Likewise.
11097 (Symbol_table::add_from_object): Likewise.
11099 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11101 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11102 Don't set the data_offset twice.
11104 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11106 * testsuite/Makefile.in: Regenerate.
11108 2009-12-03 Doug Kwan <dougkwan@google.com>
11110 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11111 (Target_arm::do_finalize_sections): Add parameter for symbol table
11112 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
11113 * i386.cc (Target_i386::do_finalize_sections): Add an additional
11114 parameter for symbol table pointer.
11115 * layout.cc (Layout::finalize): Call Target::finalize_sections with
11116 an additional parameter for a pointer to symbol table.
11117 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11118 parameter for a symbol table pointer.
11119 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11120 * target.h (Target::finalize_sections, Target::do_finalize_sections):
11122 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11123 parameter for a symbol table pointer.
11125 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
11127 * incremental.cc (Incremental_inputs_header)
11128 (Incremental_inputs_header_write, Incremental_inputs_entry)
11129 (Incremental_inputs_entry_write): Move ...
11130 * incremental.h (Incremental_inputs_header)
11131 (Incremental_inputs_header_write, Incremental_inputs_entry)
11132 (Incremental_inputs_entry_write): here.
11134 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11136 * incremental.cc (make_sized_incremental_binary): Set the target.
11137 Error if it is incompatible.
11138 * output.h (Output_file): Add filename method.
11140 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11142 * incremental.cc (Incremental_inputs_entry): Remove unused argument
11143 from the get_* methods.
11145 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11147 * incremental-dump.cc (main): Check that the offeset of a script is 0.
11148 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11149 Write 0 for the data_offset of scripts.
11151 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11153 * testsuite/Makefile.am: Add the incremental_test.sh test.
11154 * testsuite/incremental_test.sh: New.
11155 * testsuite/incremental_test_1.c: New.
11156 * testsuite/incremental_test_2.c: New.
11158 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
11160 * incremental-dump.cc (main): Fix typos.
11162 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
11165 * incremental-dump.cc (main): Use llu to print 64 bit values.
11167 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
11168 H.J. Lu <hongjiu.lu@intel.com>
11170 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11172 (incremental_dump_LDADD): Likewise.
11173 * Makefile.in: Regenerated.
11175 2009-11-25 Doug Kwan <dougkwan@google.com>
11179 2009-11-25 Doug Kwan <dougkwan@google.com>
11181 * arm.cc (Target_arm::Target_arm): Move method definition
11182 outside of class definition. Add code to handle
11183 --target1-rel, --target1-abs and --target2= options.
11184 (Target_arm::get_reloc_reloc_type): Change method to be
11185 non-static and const.
11186 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11187 New data member declaration.
11188 (Target_arm::Scan::local, Target_arm::Scan::global,
11189 Target_arm::Relocate::relocate,
11190 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11191 Adjust call to Target_arm::get_real_reloc_type.
11192 (Target_arm::get_real_reloc_type): Use command line options
11193 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11194 * options.h (--target1-rel, --target1-abs, --target2): New
11197 2009-11-25 Doug Kwan <dougkwan@google.com>
11199 * arm.cc (Target_arm::Target_arm): Move method definition outside of
11200 class definition. Add code to handle --target1-rel, --target1-abs
11201 and --target2= options.
11202 (Target_arm::get_reloc_reloc_type): Change method to be non-static
11204 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11205 member declaration.
11206 (Target_arm::Scan::local, Target_arm::Scan::global,
11207 Target_arm::Relocate::relocate,
11208 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11209 call to Target_arm::get_real_reloc_type.
11210 (Target_arm::get_real_reloc_type): Use command line options to
11211 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11212 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11215 2009-11-25 Doug Kwan <dougkwan@google.com>
11217 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11218 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11219 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11221 (Arm_relocate_functions::thm_call): Replace body with a call to
11222 Arm_relocate_functions::thumb_branch_common.
11223 (Arm_relocate_functions::thm_jump24,
11224 Arm_relocate_functions::thm_xpc22): New method definitions.
11225 (Arm_relocate_functions::thumb_branch_common): New method definition.
11226 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11228 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11229 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11231 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11233 * Makefile.am: Build incremental-dump
11234 * Makefile.in: Regenerate.
11235 * incremental-dump.cc: New.
11236 * incremental.cc (Incremental_inputs_header_data,
11237 Incremental_inputs_entry_data): Move to incremental.h
11238 * incremental.h: (Incremental_inputs_header_data,
11239 Incremental_inputs_entry_data): Move from incremental.cc
11241 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11243 * incremental.cc (Incremental_inputs_header,
11244 Incremental_inputs_header_write, Incremental_inputs_entry,
11245 Incremental_inputs_entry_write): Add a typedef with the data type.
11247 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11249 * incremental.cc (Incremental_inputs_header,
11250 Incremental_inputs_header_write, Incremental_inputs_entry,
11251 Incremental_inputs_entry_write): Update comment about which
11252 type has the filed descriptions.
11254 2009-11-15 Doug Kwan <dougkwan@google.com>
11256 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11257 (Arm_relocate_functions::arm_branch_common): Change method defintion
11258 in class definition to a method declaration and update list of formal
11260 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11261 Arm_relocation_functions::jump24): Adjust call to
11262 Arm_relocate_functions::arm_branch_common. Update list of formal
11264 (Arm_relocate_functions::xpc25): New method definition.
11265 (Arm_relocate_functions::arm_branch_common): Move method defintion
11266 out from class definition. Use stubs for mode-switching and extending
11268 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11269 specially. Change code to enable use of stubs in ARM branches.
11271 2009-11-10 Doug Kwan <dougkwan@google.com>
11273 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11274 in method declaration.
11275 (Target_arm::relocate_stub): New method declaration.
11276 (Target_arm::default_target): Change to return a pointer instead of
11278 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11279 Target_arm::default_target.
11280 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11282 (Target_arm::relocate_section): Adjust view.
11283 (Target_arm::relocate_stub): New method definition.
11285 2009-11-10 Doug Kwan <dougkwan@google.com>
11287 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11289 * incremental.cc (open_incremental_binary): Initialized local
11290 variables to avoid warnings.
11291 * object.cc (make_elf_object): Ditto.
11292 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11295 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11298 * testsuite/plugin_test.c: Include "config.h".
11300 2009-11-09 Doug Kwan <dougkwan@google.com>
11302 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11303 (arm_symbol_value): Remove.
11304 (Arm_relocate_functions::arm_branch_common,
11305 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11306 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11307 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11308 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11309 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11310 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11311 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11312 Arm_relocate_functions::thm_mobw_abs_nc,
11313 Arm_relocate_functions::thm_mov_abs,
11314 Arm_relocate_functions::movw_prel_nc,
11315 Arm_relocate_functions::thm_movt_abs,
11316 Arm_relocate_functions::movt_prel,
11317 Arm_relocate_functions::thm_movw_prel_nc,
11318 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11319 (Target_arm::Relocate::relocate): Only decompose address into two
11320 parts if relocation type uses the thumb-bit and pass the actual
11321 bit instead of a flag indicating that the thumb-bit is used. Adjust
11322 calls to methods in Arm_relocate_functions for this change.
11324 2009-11-08 Ian Lance Taylor <iant@google.com>
11327 * reloc.cc: Instantiate
11328 Sized_relobj::initialize_input_to_output_maps and
11329 Sized_relobj:free_input_to_output_maps.
11331 2009-11-06 Ian Lance Taylor <iant@google.com>
11334 * defstd.cc (in_segment): Set only_if_ref true for "end".
11336 2009-11-06 Doug Kwan <dougkwan@google.com>
11338 * arm.cc (class Reloc_stub): Correct a comment.
11339 (Target_arm::Target_arm): Initialize arm_input_section_map_.
11340 (Target_arm::scan_section_for_stubs): New method declaration.
11341 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11342 Change methods from private to protected.
11343 (Target_arm::do_may_relax): New method definition.
11344 (Target_arm::do_relax, Target_arm::group_sections,
11345 Target_arm::scan_reloc_for_stub,
11346 Target_arm::scan_reloc_section_for_stubs): New method declarations.
11347 (Target_arm::arm_input_section_map_): New data member declaration.
11348 (Target_arm::scan_reloc_for_stub,
11349 Target_arm::scan_reloc_section_for_stubs,
11350 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11351 Target_arm::do_relax): New method definitions.
11353 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
11355 * configure.ac: Check for (struct stat)::st_mtim
11356 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11357 * config.in: Regenerate.
11358 * configure: Regenerate.
11360 2009-11-05 Ian Lance Taylor <iant@google.com>
11363 * output.cc (Output_segment::add_output_section): Add missing
11366 2009-11-04 Ian Lance Taylor <iant@google.com>
11369 * object.h (class Object): Add is_needed and set_is_needed
11370 methods. Add is_needed_ field. Make bool fields into bitfields.
11371 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11372 defined in a dynamic object and referenced by a regular object,
11373 set is_needed for the dynamic object.
11374 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11375 if the file is marked with as_needed and it is not needed.
11377 2009-11-04 Ian Lance Taylor <iant@google.com>
11380 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11381 tags if data is discarded by linker script.
11382 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11383 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11384 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11385 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11387 2009-11-04 Ian Lance Taylor <iant@google.com>
11389 * layout.cc (Layout::get_output_section): Add is_interp and
11390 is_dynamic_linker_section parameters. Change all callers.
11391 (Layout::choose_output_section): Likewise.
11392 (Layout::make_output_section): Likewise.
11393 (Layout::add_output_section_data): Add is_dynamic_linker_section
11394 parameter. Change all callers.
11395 * layout.h (class Layout): Update declarations.
11396 * output.h (class Output_section): Add is_interp, set_is_interp,
11397 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11398 Add is_interp_, is_dynamic_linker_section_ fields. Change
11399 generate_code_fills_at_write_ to a bitfield.
11400 * output.cc (Output_section::Output_sections): Initialize new
11402 (Output_segment::add_output_section): Add do_sort parameter.
11403 Change all callers.
11405 2009-11-03 Ian Lance Taylor <iant@google.com>
11408 * options.h (class General_options): Add --warn-common.
11409 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11410 merging two common symbols.
11411 (Symbol_table::should_override): Handle --warn-common when merging
11412 a common symbol with a defined symbol. Use report_resolve_problem
11413 for multiple definitions.
11414 (Symbol_table::report_resolve_problem): New function.
11415 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11417 2009-11-03 Doug Kwan <dougkwan@google.com>
11419 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11421 (Target_arm::stub_factory): New method definition.
11422 (Target_arm::new_arm_input_section,
11423 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11424 Target_arm::reloc_uses_thumb_bit): New method declarations.
11425 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11426 New type definitions.
11427 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11428 member declarations.
11429 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11430 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11431 New method definitions.
11433 2009-11-03 Ian Lance Taylor <iant@google.com>
11435 * options.h (class General_options): Add --warn_constructors.
11437 2009-11-03 Ian Lance Taylor <iant@google.com>
11440 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11441 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11443 2009-11-03 Ian Lance Taylor <iant@google.com>
11446 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11447 --msgid-bugs-address.
11448 (install-pdf): New target.
11449 (install-data_yes): Look up one directory to find mkinstalldirs.
11451 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11453 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11456 2009-10-30 Doug Kwan <dougkwan@google.com>
11458 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11460 2009-10-30 Doug Kwan <dougkwan@google.com>
11462 * arm.cc (Stub_addend_reader): New struct template definition
11463 and partial specializations.
11464 (Stub_addend_reader::operator()): New method definition for a
11465 partially specialized template.
11467 2009-10-30 Doug Kwan <dougkwan@google.com>
11469 * arm.cc (Arm_relobj::processor_specific_flags): New method
11471 (Arm_relobj::do_read_symbols): New method declaration.
11472 (Arm_relobj::processor_specific_flags_): New data member declaration.
11473 (Arm_dynobj): New class definition.
11474 (Target_arm::do_finalize_sections): Add input_objects parameter.
11475 (Target_arm::do_adjust_elf_header): New method declaration.
11476 (Target_arm::are_eabi_versions_compatible,
11477 (Target_arm::merge_processor_specific_flags): New method declaration.
11478 (Target_arm::do_make_elf_object): New overloaded method definitions
11480 (Arm_relobj::do_read_symbols): New method definition.
11481 (Arm_dynobj::do_read_symbols): Ditto.
11482 (Target_arm::do_finalize_sections): Add input_objects parameters.
11483 Merge processor-specific flags from all input objects.
11484 (Target_arm::are_eabi_versions_compatible,
11485 Target_arm::merge_processor_specific_flags,
11486 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11487 New method definitions.
11488 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11489 Input_objects pointer type parameter.
11490 * layout.cc (Layout::finalize): Pass input objects to target's.
11491 finalize_sections function.
11492 * output.cc (Output_file_header::do_sized_write): Set ELF file
11493 header's processor-specific flags.
11494 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11495 Input_objects pointer type parameter.
11496 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11497 * target.h (Input_objects): New forward class declaration.
11498 (Target::processor_specific_flags,
11499 Target::are_processor_specific_flags_sect): New method definitions.
11500 (Target::finalize_sections): Add input_objects parameter.
11501 (Target::Target): Initialize processor_specific_flags_ and
11502 are_processor_specific_flags_set_.
11503 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11505 (Target::set_processor_specific_flags): New method definition.
11506 (Target::processor_specific_flags_,
11507 Target::are_processor_specific_flags_set_): New data member
11509 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11510 Input_objects pointer type parameter.
11512 2009-10-30 Doug Kwan <dougkwan@google.com>
11514 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11516 2009-10-28 Ian Lance Taylor <iant@google.com>
11518 * object.h (class Relobj): Drop options parameter from
11519 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11520 do_scan_relocs, do_relocate. Change all callers.
11521 (class Sized_relobj): Drop options parameters from
11522 do_gc_process_relocs, do_scan_relocs, do_relocate,
11523 do_relocate_sections, relocate_sections, emit_relocs_scan,
11524 emit_relocs_scan_reltype. Change all callers.
11525 (struct Relocate_info): Remove options field and all references to
11527 * reloc.h (class Read_relocs): Remove options constructor
11528 parameter and options_ field. Change all callers.
11529 (class Gc_process_relocs, class Scan_relocs): Likewise.
11530 (class Relocate_task): Likewise.
11531 * target-reloc.h (scan_relocs): Remove options parameter. Change
11533 (scan_relocatable_relocs): Likewise.
11534 * target.h (class Sized_target): Remove options parameter from
11535 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11537 * gc.h (gc_process_relocs): Remove options parameter. Change all
11539 * arm.cc: Update functions to remove options parameters.
11540 * i386.cc: Likewise.
11541 * powerpc.cc: Likewise.
11542 * sparc.cc: Likewise.
11543 * x86_64.cc: Likewise.
11544 * testsuite/testfile.cc: Likewise.
11546 2009-10-28 Doug Kwan <dougkwan@google.com>
11548 * arm.cc (Arm_relobj): New class definition.
11549 (Arm_relobj::scan_sections_for_stubs,
11550 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11551 New method definitions.
11553 2009-10-28 Cary Coutant <ccoutant@google.com>
11555 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11556 (Plugin::cleanup_done_): New member.
11557 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11558 (Plugin_manager::cleanup_done_): Remove.
11559 (Plugin_manager::add_input_file): Edit error message.
11560 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11561 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11563 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11565 * fileread.cc: (File_read::View::~View): Use the new
11566 data_ownership_ filed.
11567 (File_read::~File_read): Dispose the new whole_file_view_.
11568 (File_read::open): Mmap the whole file if needed.
11569 (File_read::open): Use whole_file_view_ instead of contents_.
11570 (File_read::find_view): Use whole_file_view_ if applicable.
11571 (File_read::do_read): Use whole_file_view_ instead of contents_.
11572 (File_read::make_view): Use whole_file_view_ instead of contents_,
11573 update File_read::View::View call.
11574 (File_read::find_or_make_view): Update File_read::View::View
11576 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11578 (File_read::View::Data_ownership): New enum.
11579 (File_read::View::View): Replace bool mapped_ with Data_ownership
11581 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11582 (File_read::View::data_ownership_): New field.
11583 (File_read::contents_): Remove (replaced by whole_file_view_).
11584 (File_read::whole_file_view_): New field.
11585 * options.h (class General_options): Add --keep-files-mapped.
11587 2009-10-27 Cary Coutant <ccoutant@google.com>
11589 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11590 * testsuite/Makefile.am (plugin_test_5): New test case.
11591 * testsuite/Makefile.in: Regenerate.
11593 2009-10-25 Doug Kwan <dougkwan@google.com>
11595 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11596 from private to protected to allow access by child class.
11597 (Sized_relobj::do_relocate_sections): New method declaration.
11598 (Sized_relobj::relocate_sections): Virtualize.
11599 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11600 Sized_relobj::relocate_sections. Instantiate template explicitly
11601 for different target sizes and endianity.
11603 2009-10-24 Doug Kwan <dougkwan@google.com>
11605 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11606 (Arm_input_section::as_arm_input_section): New method.
11607 (Arm_output_section): New class definition.
11608 (Arm_output_section::create_stub_group,
11609 Arm_output_section::group_sections): New method definitions.
11611 2009-10-22 Doug Kwan <dougkwan@google.com>
11613 * arm.cc (Arm_input_section): New class definition.
11614 (Arm_input_section::init, Arm_input_section:do_write,
11615 Arm_input_section::set_final_data_size,
11616 Arm_input_section::do_reset_address_and_file_offset): New method
11619 2009-10-21 Doug Kwan <dougkwan@google.com>
11621 * arm.cc (Stub_table, Arm_input_section): New forward class
11623 (Stub_table): New class defintion.
11624 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11625 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11626 New method definition.
11628 2009-10-21 Doug Kwan <dougkwan@google.com>
11630 * arm.cc: Update copyright comments.
11631 (Target_arm): New forward class template declaration.
11632 (Arm_address): New type.
11633 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11634 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11635 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11637 (Insn_template): Same.
11638 (DEF_STUBS): New macro.
11639 (Stub_type): New enum type.
11640 (Stub_template): New class definition.
11642 (Reloc_stub): Same.
11643 (Stub_factory): Same.
11644 (Target_arm::Target_arm): Initialize may_use_blx_ and
11645 should_force_pic_veneer_.
11646 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11647 Target_arm::should_force_pic_veneer,
11648 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11649 Target_arm::using_thumb_only, Target_arm:;default_target): New
11651 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11652 New data member declarations.
11653 (Insn_template::size, Insn_template::alignment): New method defintions.
11654 (Stub_template::Stub_template): New method definition.
11655 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11656 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11657 (Stub_factory::Stub_factory): New method definition.
11658 * gold.h (string_hash): New template.
11659 * output.h (Input_section_specifier::hash_value): Use
11661 (Input_section_specifier::string_hash): Remove.
11662 * stringpool.cc (Stringpool_template::string_hash): Use
11665 2009-10-20 Doug Kwan <dougkwan@google.com>
11667 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11668 symbols of relaxed input sections.
11669 * output.h (Output_section::find_relaxed_input_section): Make
11672 2009-10-16 Doug Kwan <dougkwan@google.com>
11674 * dynobj.cc (Versions::Versions): Initialize version_script_.
11675 Only insert base version symbol definition for a shared object
11676 if version script defines any version versions.
11677 (Versions::define_base_version): New method definition.
11678 (Versions::add_def): Check that base version is not needed.
11679 (Versions::add_need): Define base version lazily.
11680 * dynobj.h (Versions::define_base_version): New method declaration.
11681 (Versions::needs_base_version_): New data member declaration.
11682 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11683 (check_DATA): Add no_version_test.stdout.
11684 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11686 * testsuite/Makefile.in: Regenerate.
11687 * testsuite/no_version_test.c: New file.
11688 * testsuite/no_version_test.sh: Ditto.
11690 2009-10-16 Doug Kwan <dougkwan@google.com>
11692 * expression.cc (class Segment_start_expression): New class definition.
11693 (Segment_start_expression::value): New method definition.
11694 (script_exp_function_segment_start): Return a new
11695 Segment_start_expression.
11696 * gold/script-c.h (script_saw_segment_start_expression): New function
11698 * script-sections.cc (Script_sections::Script_sections): Initialize
11699 SAW_SEGMENT_START_EXPRESSION_ to false.
11700 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11701 and -Tbbs options to specify section addresses if given in
11702 command line and no SEGMENT_START expression is seen in a script.
11703 * script-sections.h (Script_sections::saw_segment_start_expression,
11704 Script_sections::set_saw_segment_start_expression): New method
11706 (Script_sections::saw_segment_start_expression_): New data member
11708 * script.cc (script_saw_segment_start_expression): New function.
11709 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11710 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11711 script_test_7.sh and script_test_8.sh.
11712 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11713 script_test_8.stdout.
11714 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11715 (script_test_6, script_test_6.stdout, script_test_7,
11716 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11717 * Makefile.in: Regenerate.
11718 * testsuite/script_test_6.sh: New file.
11719 * testsuite/script_test_6.t: Same.
11720 * testsuite/script_test_7.sh: Same.
11721 * testsuite/script_test_7.t: Same.
11722 * testsuite/script_test_8.sh: Same.
11724 2009-10-16 Doug Kwan <dougkwan@google.com>
11726 * output.cc (Output_segment::set_section_list_address): Cast
11727 expressions to unsigned long long type to avoid format warnings.
11729 2009-10-15 Ian Lance Taylor <iant@google.com>
11731 * script.cc (Script_options::add_symbol_assignment): Always add a
11732 dot assignment to script_sections_.
11733 * script-sections.cc (Script_sections::add_dot_assignment):
11734 Initialize if necessary.
11736 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11737 program headers with no load segment if there is a linker script.
11739 * layout.cc (Layout::set_segment_offsets): Align the file offset
11740 to the segment aligment for -N or -n with no load segment.
11741 * output.cc (Output_segment::add_output_section): Don't crash if
11742 the first section is a TLS section.
11743 (Output_segment::set_section_list_addresses): Print an error
11744 message if the address moves backward in a linker script.
11745 * script-sections.cc
11746 (Output_section_element_input::set_section_addresses): Don't
11747 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11748 (Orphan_output_section::set_section_addresses): Likewise.
11750 2009-10-15 Doug Kwan <dougkwan@google.com>
11752 * layout.cc (Layout::finish_dynamic_section): Generate tags
11753 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11754 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11755 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11757 2009-10-14 Ian Lance Taylor <iant@google.com>
11759 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11761 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11762 data_shdr fields of relinfo.
11763 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11764 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11765 R_386_TLS_LDO_32, adjust based on section flags.
11766 (Target_i386::Relocate::fix_up_ldo): Remove.
11768 2009-10-13 Ian Lance Taylor <iant@google.com>
11770 Add support for -pie.
11771 * options.h (class General_options): Add -pie and
11773 (General_options::output_is_position_independent): Test -pie.
11774 (General_options::output_is_executable): Return true if not shared
11775 and not relocatable.
11776 (General_options::output_is_pie): Remove.
11777 * options.cc (General_options::finalize): Reject incompatible uses
11779 * gold.cc (queue_middle_tasks): A -pie link is not static.
11780 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11781 * symtab.cc (Symbol::final_value_is_known): Return false if
11782 output_is_position_independent.
11783 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11784 output_is_position_independent.
11785 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11786 output_is_position_independent.
11787 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11788 output_is_position_independent.
11789 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11791 (basic_pie_test.o, basic_pie_test): New targets.
11792 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11793 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11794 (two_file_pie_test): New target.
11795 * testsuite/Makefile.in: Rebuild.
11796 * README: Remove note saying that -pie is not supported.
11798 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11800 * options.h (class General_options): Add -init and -fini.
11801 * layout.cc (Layout::finish_dynamic_section): Emit
11802 given init and fini functions.
11804 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11806 * gc.h (gc_process_relocs): Check if icf is enabled using new
11808 * gold.cc (queue_initial_tasks): Likewise.
11809 (queue_middle_tasks): Likewise.
11810 * object.cc (do_layout): Likewise.
11811 * symtab.cc (is_section_folded): Likewise.
11812 * main.cc (main): Likewise.
11813 * reloc.cc (Read_relocs::run): Likewise.
11814 (Sized_relobj::do_scan_relocs): Likewise.
11815 * icf.cc (is_function_ctor_or_dtor): New function.
11816 (Icf::find_identical_sections): Check if function is ctor or dtor when
11817 safe icf is chosen.
11818 * options.h (General_options::icf): Change option to be an enum.
11819 (Icf_status): New enum.
11820 (icf_enabled): New method.
11821 (icf_safe_folding): New method.
11822 (set_icf_status): New method.
11823 (icf_status_): New variable.
11824 * (options.cc) (General_options::finalize): Set icf_status_.
11825 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11826 icf_test and icf_keep_unique_test to use the --icf enum flag.
11827 * testsuite/icf_safe_test.sh: New file.
11828 * testsuite/icf_safe_test.cc: New file.
11830 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11832 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11833 includes to gc.h and icf.h.
11834 * arm.cc: Include gc.h.
11835 * gold.cc: Likewise.
11836 * i386.cc: Likewise.
11837 * powerpc.cc: Likewise.
11838 * sparc.cc: Likewise.
11839 * x86_64.cc: Likewise.
11840 * gc.h: Include icf.h.
11842 2009-10-11 Ian Lance Taylor <iant@google.com>
11844 * plugin.cc: Include "gold.h" before other header files.
11846 2009-10-10 Chris Demetriou <cgd@google.com>
11848 * options.h (Input_file_argument::Input_file_type): New enum.
11849 (Input_file_argument::is_lib_): Replace with...
11850 (Input_file_argument::type_): New member.
11851 (Input_file_argument::Input_file_argument): Take Input_file_type
11852 'type' rather than boolean 'is_lib' as second argument.
11853 (Input_file_argument::is_lib): Use type_.
11854 (Input_file_argument::is_searched_file): New function.
11855 (Input_file_argument::may_need_search): Handle is_searched_file.
11856 * options.cc (General_options::parse_library): Support -l:filename.
11857 (General_options::parse_just_symbols): Update for Input_file_argument
11859 (Command_line::process): Likewise.
11860 * archive.cc (Archive::get_file_and_offset): Likewise.
11861 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11862 * script.cc (read_script_file, script_add_file): Likewise.
11863 * fileread.cc (Input_file::Input_file): Likewise.
11864 (Input_file::will_search_for): Handle is_searched_file.
11865 (Input_file::open): Likewise.
11866 * readsyms.cc (Read_symbols::get_name): Likewise.
11867 * testsuite/Makefile.am (searched_file_test): New test.
11868 * testsuite/Makefile.in: Regenerate.
11869 * testsuite/searched_file_test.cc: New file.
11870 * testsuite/searched_file_test_lib.cc: New file.
11872 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11873 Ian Lance Taylor <iant@google.com>
11875 * descriptor.cc: Include <cstdio> and "binary-io.h".
11876 (Descriptors::open): Open the files in binary mode always.
11877 * script.cc (Lex::get_token): Treat \r as whitespace.
11879 2009-10-09 Ian Lance Taylor <iant@google.com>
11881 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11883 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11884 Ian Lance Taylor <iant@google.com>
11886 * configure.ac: Check for readv function also.
11887 * fileread.cc (readv): Define if not HAVE_READV.
11888 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11890 * config.in: Regenerate.
11891 * configure: Regenerate.
11893 2009-10-09 Doug Kwan <dougkwan@google.com>
11895 * layout.cc (Layout::make_output_section): Call target hook to make
11896 ordinary output section.
11897 (Layout::finalize): Adjust parameter list of call the
11898 Target::may_relax().
11899 * layout.h (class Layout::section_list): New method.
11900 * merge.h (Output_merge_base::entsize): Change visibility to public.
11901 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11903 (Output_merge_string::do_is_string): New method.
11904 * object.cc (Sized_relobj::do_setup): renamed from
11905 Sized_relobj::set_up.
11906 * object.h (Sized_relobj::adjust_shndx,
11907 Sized_relobj::initializ_input_to_output_maps,
11908 Sized_relobj::free_input_to_output_maps): Change visibilities to
11910 (Sized_relobj::setup): Virtualize.
11911 (Sized_relobj::do_setup): New method declaration.
11912 (Sized_relobj::invalidate_section_offset,
11913 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11914 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11915 * options.cc (parse_int): New function.
11916 * options.h (parse_int): New declaration.
11917 (DEFINE_int): New macro.
11918 (stub_group_size): New option.
11919 * output.cc (Output_section::Output_section): Initialize memebers
11920 merge_section_map_, merge_section_by_properties_map_,
11921 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11922 (Output_section::add_input_section): Handled deferred code-fill
11923 generation and remove an old comment.
11924 (Output_section::add_relaxed_input_section): New method definition.
11925 (Output_section::add_merge_input_section): Use merge section by
11926 properties map to speed to search. Update merge section maps
11928 (Output_section::build_relaxation_map): New method definition.
11929 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11931 (Output_section::relax_input_section): Renamed to
11932 Output_section::convert_input_sections_to_relaxed_sections and change
11933 interface to take a vector of pointers to relaxed sections.
11934 (Output_section::find_merge_section,
11935 Output_section::find_relaxed_input_section): New method definitions.
11936 (Output_section::is_input_address_mapped,
11937 Output_section::output_offset, Output_section::output_address):
11938 Use output section data maps to speed up searching.
11939 (Output_section::find_starting_output_address): Add comments.
11940 (Output_section::do_write,
11941 Output_section::write_to_postprocessing_buffer): Do code-fill
11942 generation as appropriate.
11943 (Output_section::get_input_sections): Invalidate relaxed input section
11945 (Output_section::restore_states): Adjust type of checkpoint .
11946 Invalidate relaxed input section map.
11947 * output.h (Output_merge_base): New class declaration.
11948 (Input_section_specifier): New class defintion.
11949 (class Output_relaxed_input_section) Change base class to
11950 Output_section_data_build.
11951 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11952 base class initializer.
11953 (Output_section::add_relaxed_input_section): New method declaration.
11954 (Output_section::Input_section): Change visibility to protected.
11955 (Output_section::Input_section::relobj,
11956 Output_section::Input_section::shndx): Handle relaxed input sections.
11957 Output_section::input_sections) Change visibility to protected. Also
11958 define overload to return a non-const pointer.
11959 (Output_section::Merge_section_properties): New class defintion.
11960 (Output_section::Merge_section_by_properties_map,
11961 Output_section::Output_section_data_by_input_section_map,
11962 Output_section::Relaxation_map): New types.
11963 (Output_section::relax_input_section): Rename method to
11964 Output_section::convert_input_sections_to_relaxed_sections and change
11965 interface to take a vector of relaxed section pointers.
11966 (Output_section::find_merge_section,
11967 Output_section::find_relaxed_input_section,
11968 Output_section::build_relaxation_map,
11969 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11970 New method declarations.
11971 (Output_section::merge_section_map_
11972 Output_section::merge_section_by_properties_map_,
11973 Output_section::relaxed_input_section_map_,
11974 Output_section::is_relaxed_input_section_map_valid_,
11975 Output_section::generate_code_fills_at_write_): New data members.
11976 * script-sections.cc
11977 (Output_section_element_input::set_section_addresses): Call
11978 current_data_size and addralign methods of relaxed input sections.
11979 (Orphan_output_section::set_section_addresses): Call current_data_size
11980 and addralign methods of relaxed input sections.
11981 * symtab.cc (Symbol_table::compute_final_value): Extract template
11982 from the body of Symbol_table::sized_finalize_symbol.
11983 (Symbol_table::sized_finalized_symbol): Call
11984 Symbol_table::compute_final_value.
11985 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11986 (Symbol_table::compute_final_value): New templated method declaration.
11987 * target.cc (Target::do_make_output_section): New method defintion.
11988 * target.h (Target::make_output_section): New method declaration.
11989 (Target::relax): Add more parameters for input objects, symbol table
11990 and layout. Adjust call to do_relax.
11991 (Target::do_make_output_section): New method declaration.
11992 (Target::do_relax): Add parameters for input objects, symbol table
11995 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11997 * pread.c: Include stdio.h.
11999 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12001 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12004 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12006 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12007 Change read_shndx type to unsigned int.
12008 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12010 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12011 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12012 Change read_shndx type to unsigned int.
12013 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12015 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12016 * layout.cc (Layout::create_symtab_sections): Cast the result of
12017 local_symcount * symsize to off_t in the gold_assert.
12019 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12021 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12022 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12024 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12025 (Arm_relocate_functions::thm_abs5): New function.
12026 (Arm_relocate_functions::abs12): New function.
12027 (Arm_relocate_functions::abs16): New function.
12028 (Arm_relocate_functions::base_abs): New function.
12029 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12030 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
12031 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12033 (Scan::global): Likewise.
12034 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12035 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12036 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12037 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12040 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12042 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12043 (Arm_relocate_functions::movt_prel): New function.
12044 (Arm_relocate_functions::thm_movw_prel_nc): New function.
12045 (Arm_relocate_functions::thm_movt_prel): New function.
12046 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12047 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12048 (Scan::global, Relocate::relocate): Likewise.
12049 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12051 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12053 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12054 Incremental_checker.
12055 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12057 (class Incremental_inputs_header): New class.
12058 (Incremental_inputs_header_writer): Edit comment.
12059 (Incremental_inputs_entry): New class.
12060 (Incremental_inputs_entry_writer): Edit comment.
12061 (Sized_incremental_binary::do_find_incremental_inputs_section):
12062 Add *strtab_shndx parameter, fill it.
12063 (Sized_incremental_binary::do_check_inputs): New method.
12064 (Incremental_checker::can_incrementally_link_output_file): Use
12065 Sized_incremental_binary::check_inputs.
12066 (Incremental_inputs::report_command_line): Save command line in
12069 (Incremental_binary::find_incremental_inputs_section): New
12071 (Incremental_binary::do_find_incremental_inputs_section): Add
12072 strtab_shndx parameter.
12073 (Incremental_binary::do_check_inputs): New pure virtual method.
12074 (Sized_incremental_binary::do_check_inputs): Declare.
12075 (Incremental_checker::Incremental_checker): Add incremental_inputs
12076 parameter, use it to initialize incremental_inputs_.
12077 (Incremental_checker::incremental_inputs_): New field.
12078 (Incremental_checker::command_line): New method.
12079 (Incremental_checker::inputs): New method.
12080 (Incremental_checker::command_line_): New field.
12082 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12084 * incremental.cc: Include <cstdarg> and "target-select.h".
12085 (vexplain_no_incremental): New function.
12086 (explain_no_incremental): New function.
12087 (Incremental_binary::error): New method.
12088 (Sized_incremental_binary::do_find_incremental_inputs_section): New
12090 (make_sized_incremental_binary): New function.
12091 (open_incremental_binary): New function.
12092 (can_incrementally_link_file): Add checks if output is ELF and has
12094 * incremental.h: Include "elfcpp_file.h" and "output.h".
12095 (Incremental_binary): New class.
12096 (Sized_incremental_binary): New class.
12097 (open_incremental_binary): Declare.
12098 * object.cc (is_elf_object): Use
12099 elfcpp::Elf_recognizer::is_elf_file.
12100 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12101 * output.h (Output_file::filesize): New method.
12103 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12105 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12107 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12108 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12110 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12112 (Arm_relocate_functions::movw_abs_nc): New function.
12113 (Arm_relocate_functions::movt_abs): New function.
12114 (Arm_relocate_functions::thm_movw_abs_nc): New function.
12115 (Arm_relocate_functions::thm_movt_abs): New function.
12116 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12117 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12118 (Scan::global): Likewise.
12119 (Relocate::relocate): Likewise.
12120 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12122 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12124 * arm.cc (Arm_relocate_functions::got_prel) New function.
12125 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12126 (Relocate::relocate): Likewise.
12127 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12129 2009-10-06 Ian Lance Taylor <iant@google.com>
12131 * options.h (class General_options): Define
12132 split_stack_adjust_size parameter.
12133 * object.h (class Object): Add uses_split_stack_ and
12134 has_no_split_stack_ fields. Add uses_split_stack and
12135 has_no_split_stack accessor functions. Declare
12136 handle_split_stack_section.
12137 (class Reloc_symbol_changes): Define.
12138 (class Sized_relobj): Define Function_offsets. Declare
12139 split_stack_adjust, split_stack_adjust_reltype, and
12141 * object.cc (Object::handle_split_stack_section): New function.
12142 (Sized_relobj::do_layout): Call handle_split_stack_section.
12143 * dynobj.cc (Sized_dynobj::do_layout): Call
12144 handle_split_stack_section.
12145 * reloc.cc (Sized_relobj::relocate_sections): Call
12146 split_stack_adjust for executable sections in split_stack
12147 objects. Pass reloc_map to relocate_section.
12148 (Sized_relobj::split_stack_adjust): New function.
12149 (Sized_relobj::split_stack_adjust_reltype): New function.
12150 (Sized_relobj::find_functions): New function.
12151 * target-reloc.h: Include "object.h".
12152 (relocate_section): Add reloc_symbol_changes parameter. Change
12154 * target.h (class Target): Add calls_non_split method. Declare
12155 do_calls_non_split virtual method. Declare match_view and
12157 * target.cc: Include "elfcpp.h".
12158 (Target::do_calls_non_split): New function.
12159 (Target::match_view): New function.
12160 (Target::set_view_to_nop): New function.
12161 * gold.cc (queue_middle_tasks): Give an error if mixing
12162 split-stack and non-split-stack objects with -r.
12163 * i386.cc (Target_i386::relocate_section): Add
12164 reloc_symbol_changes parameter.
12165 (Target_i386::do_calls_non_split): New function.
12166 * x86_64.cc (Target_x86_64::relocate_section): Add
12167 reloc_symbol_changes parameter.
12168 (Target_x86_64::do_calls_non_split): New function.
12169 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12171 * powerpc.cc (Target_powerpc::relocate_section): Add
12172 reloc_symbol_changes parameter.
12173 * sparc.cc (Target_sparc::relocate_section): Add
12174 reloc_symbol_changes parameter.
12175 * configure.ac: Call AM_CONDITIONAL for the default target.
12176 * configure: Rebuild.
12177 * testsuite/Makefile.am (TEST_AS): New variable.
12178 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12179 (check_DATA): Add split_i386 and split_x86_64 files.
12180 (SPLIT_DEFSYMS): Define.
12181 (split_i386_[1234n].o): New targets.
12182 (split_i386_[124]): New targets.
12183 (split_i386_[1234r].stdout): New targets.
12184 (split_x86_64_[1234n].o): New targets.
12185 (split_x86_64_[124]): New targets.
12186 (split_x86_64_[1234r].stdout): New targets.
12187 (MOSTLYCLEANFILES): Add new executables.
12188 * testsuite/split_i386.sh: New file.
12189 * testsuite/split_x86_64.sh: New file.
12190 * testsuite/split_i386_1.s: New file.
12191 * testsuite/split_i386_2.s: New file.
12192 * testsuite/split_i386_3.s: New file.
12193 * testsuite/split_i386_4.s: New file.
12194 * testsuite/split_i386_n.s: New file.
12195 * testsuite/split_x86_64_1.s: New file.
12196 * testsuite/split_x86_64_2.s: New file.
12197 * testsuite/split_x86_64_3.s: New file.
12198 * testsuite/split_x86_64_4.s: New file.
12199 * testsuite/split_x86_64_n.s: New file.
12200 * testsuite/testfile.cc (Target_test): Update relocation_section
12202 * testsuite/Makefile.in: Rebuild.
12204 2009-10-06 Ian Lance Taylor <iant@google.com>
12206 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12207 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12208 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
12209 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12210 the address on ldo_addrs_.
12211 (Target_i386::Relocate::fix_up_ldo): New function.
12213 2009-10-06 Rafael Espindola <espindola@google.com>
12215 * plugin.cc (add_input_library): New.
12216 (Plugin::load): Add add_input_library to tv.
12217 (Plugin_manager::add_input_file): Add the is_lib argument.
12218 (add_input_file): Update call to Plugin_manager::add_input_file.
12219 (add_input_library): New.
12220 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12222 2009-09-30 Doug Kwan <dougkwan@google.com>
12224 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12225 symbol and call Symbol::may_need_copy_reloc to determine if
12226 a copy reloc is needed.
12227 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12228 nocopyreloc is given in command line.
12229 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12230 given in command line.
12231 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12232 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12233 of the removed Target_i386::may_need_copy_reloc.
12234 * options.h (copyreloc): New option with default value false.
12235 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12236 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12237 instead of the removed Target_powerpc::may_need_copy_reloc.
12238 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12239 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12240 instead of the removed Target_sparc::may_need_copy_reloc.
12241 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12242 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12243 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12244 instead of the removed Target_x86_64::may_need_copy_reloc.
12246 2009-09-30 Ian Lance Taylor <iant@google.com>
12248 * object.h (class Object): Remove target_ field, and target,
12249 sized_target, and set_target methods.
12250 (Object::sized_target): Remove.
12251 (class Sized_relobj): Update declarations. Remove sized_target.
12252 * object.cc (Sized_relobj::setup): Remove target parameter.
12253 Change all callers.
12254 (Input_objects::add_object): Don't do anything with the target.
12255 (make_elf_sized_object): Add punconfigured parameter. Change all
12256 callers. Set or test parameter target.
12257 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12258 Change all callers.
12259 * parameters.cc (Parameters::set_target): Change parameter type to
12261 (Parameters::default_target): Remove.
12262 (set_parameters_target): Change parameter type to be non-const.
12263 (parameters_force_valid_target): New function.
12264 (parameters_clear_target): New function.
12265 * parameters.h (class Parameters): Update declarations. Remove
12266 default_target method. Add sized_target and clear_target
12267 methods. Change target_ to be non-const.
12268 (set_parameters_target): Update declaration.
12269 (parameters_force_valid_target): Declare.
12270 (parameters_clear_target): Declare.
12271 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12272 as NULL if we aren't searching.
12273 (Add_symbols::run): Don't check for compatible target.
12274 * fileread.cc (Input_file::open_binary): Call
12275 parameters_force_valid_target.
12276 * gold.cc (queue_middle_tasks): Likewise.
12277 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12278 set_target on object.
12279 * dynobj.h (class Sized_dynobj): Update declarations.
12280 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12281 make_elf_object returns NULL.
12282 (Archive::include_member): Don't check whether object target is
12284 * output.cc (Output_section::add_input_section): Get target from
12286 (Output_section::relax_input_section): Likewise.
12287 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12289 (Sized_relobj::do_scan_relocs): Likewise.
12290 (Sized_relobj::relocate_sections): Likewise.
12291 * resolve.cc (Symbol_table::resolve): Likewise.
12292 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12293 parameter. Change all callers.
12294 (Symbol_table::add_from_object): Get target from parameters.
12295 (Symbol_table::add_from_relobj): Don't check object target.
12296 (Symbol_table::add_from_dynobj): Likewise.
12297 (Symbol_table::define_special_symbol): Get target from
12299 * symtab.h (class Symbol_table): Update declaration.
12300 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12301 parameter. Change all callers. Clear parameter target.
12302 (Binary_test): Test target here.
12303 * testsuite/object_unittest.cc (gold_testsuite): Remove
12304 target_test_pointer parameter. Change all callers.
12305 (Object_test): Test target here.
12307 2009-09-26 Ian Lance Taylor <iant@google.com>
12309 * testsuite/initpri1.c: Don't try to use constructor priorities if
12310 compiling with gcc before 4.3.
12312 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
12314 * testsuite/retain_symbols_file_test.sh (check_present): Change
12315 output file name to retain_symbols_file_test.stdout.
12316 (check_absent): Likewise.
12318 2009-09-18 Craig Silverstein <csilvers@google.com>
12320 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12321 * options.cc: Include <cerrno> and <fstream>.
12322 (General_options::finalize): Parse -retain-symbols-file tag.
12323 * options.h: New flag.
12324 (General_options): New method should_retain_symbol, new
12325 variable symbols_to_retain.
12326 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12327 should_retain_symbol map.
12328 * testsuite/Makefile.am (retain_symbols_file_test): New test.
12329 * testsuite/Makefile.in: Regenerate.
12330 * testsuite/retain_symbols_file_test.sh: New file.
12332 2009-09-18 Nick Clifton <nickc@redhat.com>
12334 * po/es.po: Updated Spanish translation.
12336 2009-09-17 Doug Kwan <dougkwan@google.com>
12338 * debug.h (DEBUG_RELAXATION): New constant.
12339 (DEBUG_ALL): Add DEBUG_RELAXATION.
12340 (debug_string_to_enum): Add relaxation debug option.
12342 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12343 Layout::Relaxation_debug_check::read_sections,
12344 Layout::Relaxation_debug_check::read_sections): New method definitions.
12345 (Layout::Layout): Initialize data members
12346 record_output_section_data_from_scrips_,
12347 script_output_section_data_list_ and relaxation_debug_check_.
12348 (Layout::save_segments, Layout::restore_segments,
12349 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12350 Layout::relaxation_loop_body): New method definitions.
12351 (Layout::finalize): Support relaxation. Move section layout code to
12352 Layout::relaxation_loop_body.
12353 (Layout::set_asection_address_from_script): Move code for orphan
12354 section placement out.
12355 (Layout::place_orphan_sections_in_script): New method definition.
12356 * layout.h (Output_segment_headers, Output_file_header):
12357 New forward class declarations.
12358 (Layout::~Layout): Define.
12359 (Layout::new_output_section_data_from_script): New method definition.
12360 (Layout::place_orphan_sections_in_script): New method declaration.
12361 (Layout::Segment_states): New type declaration.
12362 (Layout::save_segments, Layout::restore_segments,
12363 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12364 Layout::relaxation_loop_body): New method declarations.
12365 (Layout::Output_section_data_list): New type declaration.
12366 (Layout::Relaxation_debug_check): New class definition.
12367 (Layout::record_output_section_data_from_script_,
12368 Layout::script_output_section_data_list_, Layout::segment_states_,
12369 Layout::relaxation_debug_check_): New data members.
12370 * output.cc: (Output_section_headers::do_size): New method definition.
12371 (Output_section_headers::Output_section_headers): Move size
12372 computation to Output_section_headers::do_size.
12373 (Output_segment_headers::do_size): New method definition.
12374 (Output_file_header::Output_file_header): Move size computation to
12375 Output_file_header::do_size and call it.
12376 (Output_file_header::do_size): New method definition.
12377 (Output_data_group::Output_data_group): Adjust call to
12378 Output_section_data.
12379 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12380 (Output_symtab_xindex::do_write): Add array bound check.
12381 (Output_section::Input_section::print_to_mapfile): Handle
12382 RELAXED_INPUT_SECTION_CODE.
12383 (Output_section::Output_section): Initialize data member checkpoint_.
12384 (Output_section::~Output_section): Delete checkpoint object pointed
12386 (Output_section::add_input_section): Always add an Input_section if
12388 (Output_section::add_merge_input_section): Add assert.
12389 (Output_section::relax_input_section): New method definition.
12390 (Output_section::set_final_data_size): Set load address to zero for
12391 an unallocated section.
12392 (Output_section::do_address_and_file_offset_have_reset_values):
12393 New method definition.
12394 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12395 Handle relaxed input section.
12396 (Output_section::sort_attached_input_sections): Checkpoint input
12397 section list lazily.
12398 (Output_section::get_input_sections): Change type of input_sections to
12399 list of Simple_input_section pointers. Checkpoint input section list
12400 lazily. Also handle relaxed input sections.
12401 (Output_section::add_input_section_for_script): Take a reference to
12402 a Simple_input_section object instead of Relobj pointer and section
12403 index as parameter. Handle relaxed input sections.
12404 (Output_section::save_states, Output_section::restore_states): New
12405 method definitions.
12406 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12407 (Output_data::is_data_size_fixed): New method definition.
12408 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12410 (Output_data::address_and_file_offset_have_reset_values): New method
12412 (Output_data::do_address_and_file_offset_have_reset_values): New method
12414 (Output_data::set_data_size): Check that data size is not fixed.
12415 (Output_data::fix_data_size): New method definition.
12416 (Output_data::is_data_size_fixed_): New data member.
12417 (Output_section_headers::set_final_data_size): New method definition.
12418 (Output_section_headers::do_size): New method declaration.
12419 (Output_segment_headers::set_final_data_size): New method definition.
12420 (Output_segment_headers::do_size): New method declaration.
12421 (Output_file_header::set_final_data_size)::New method definition.
12422 (Output_file_header::do_size)::New method declaration.
12423 (Output_section_data::Output_section_data): Add new parameter
12424 is_data_size_fixed and use it to fix data size.
12425 (Output_data_const::Output_data_const): Adjust call to base class
12426 constructor and fix data size.
12427 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12428 base class constructor and fix data size.
12429 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12430 base class constructor and fix data size.
12431 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12432 class constructor and fix data size.
12433 (Output_data_group::set_final_data_size): New method definition.
12434 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12435 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12436 class constructor and fix data size.
12437 (Output_relaxed_input_section): New class definition.
12438 (Output_section::Simple_input_section): New class definition.
12439 (Output_section::get_input_sections): Adjust parameter list.
12440 (Output_section::add_input_section_for_script): Same.
12441 (Output_section::save_states, Output_section::restore_states,
12442 Output_section::do_address_and_file_offset_have_reset_values,
12443 (Output_section::Input_section::Input_section): Handle
12444 RELAXED_INPUT_SECTION_CODE. Add new overload for
12445 Output_relaxed_input_section.
12446 (Output_section::Input_section::is_input_section,
12447 Output_section::Input_section::set_output_section): Handle relaxed
12449 (Output_section::Input_section::is_relaxed_input_section,
12450 Output_section::Input_section::output_section_data,
12451 Output_section::Input_section::relaxed_input_section): New method
12453 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12455 (Output_section::Input_section::u1_): Update comments.
12456 (Output_section::Input_section::u2_): Add new union member poris.
12457 (Output_section::Checkpoint_output_section): New classs definition.
12458 (Output_section::relax_input_section): New method declaration.
12459 (Output_section::checkpoint_): New data member.
12460 (Output_segment): Update comments.
12461 (Output_segment::Output_segment): Un-privatize copy constructor.
12462 (Output_segment::operator=): Un-privatize.
12463 * script-sections.cc (Output_section_element::Input_section_list):
12464 Change element type to Output_section::Simple_input_section.
12465 (Output_section_element_dot_assignment::set_section_addresses):
12466 Register output section data for relaxation clean up.
12467 (Output_data_exression::Output_data_expression): Adjust call to base
12468 constructor to fix data size.
12469 (Output_section_element_data::set_section_addresses): Register
12470 Output_data_expression object for relaxation clean up.
12471 (struct Input_section_info): Replace Relobj pointer and section index
12472 pair with Output_section::Simple_input_section and Convert struct to a
12474 (Input_section_sorter::operator()): Adjust access to
12475 Input_section_info data member to use accessors.
12476 (Output_section_element_input::set_section_addresses): Use layout
12477 parameter. Adjust code to use Output_section::Simple_input_section
12478 and Input_secction_info classes. Register filler for relaxation
12480 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12481 and section index pair with Output_section::Simple_input_section
12482 class. Adjust code accordingly.
12483 (Phdrs_element::release_segment): New method definition.
12484 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12486 (Script_sections::release_segments): New method definition.
12487 * gold/script-sections.h (Script_sections::release_segments): New
12488 method declaration.
12489 * gold/target.h (Target::may_relax, Target::relax,
12490 Target::do_may_relax, Target::do_relax): New method definitions.
12492 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12494 * arm.cc (has_signed_unsigned_overflow): New function.
12495 (Arm_relocate_functions::abs8): New function.
12496 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12497 (Target_arm::Scan::global): Likewise.
12498 (Target_arm::relocate::relocate): Likewise.
12499 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12502 2009-09-16 Cary Coutant <ccoutant@google.com>
12504 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12505 * testsuite/Makefile.in: Regenerate.
12507 2009-09-11 Nick Clifton <nickc@redhat.com>
12509 * po/gold.pot: Updated by the Translation project.
12511 2009-09-08 Cary Coutant <ccoutant@google.com>
12513 * output.cc (Output_file::open): Add execute permission to empty file.
12514 * testsuite/Makefile.am (permission_test): New test.
12515 * testsuite/Makefile.in: Regenerate.
12517 2009-09-02 Ian Lance Taylor <iant@google.com>
12519 * output.cc (Output_file::resize): Call map_no_anonymous rather
12522 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12524 * gold.cc: Include "incremental.h".
12525 (queue_initial_tasks): Call Incremental_checker methods.
12526 * incremental.cc: Include "output.h".
12527 (Incremental_checker::can_incrementally_link_output_file): New
12529 * incremental.h (Incremental_checker): New class.
12531 * output.cc (Output_file::open_for_modification): New method.
12532 (Output_file::map_anonymous): Changed return type to bool. Record
12533 map in base_ field.
12534 (Output_file::map_no_anonymous): New method, broken out of map.
12535 (Output_file::map): Use map_no_anonymous and map_anonymous.
12536 * output.h (class Output_file): Update declarations.
12538 2009-08-24 Cary Coutant <ccoutant@google.com>
12540 * options.h (Command_line::Pre_options): New class.
12541 (Command_line::pre_options): New member.
12542 * options.cc (gold::options::ready_to_register): New variable.
12543 (One_option::register_option): Do nothing if not registering options.
12544 Assert if same short option registered twice.
12545 (General_options::General_options): Turn off option registration when
12547 (Command_line::Pre_options::Pre_options): New constructor.
12549 2009-08-24 Cary Coutant <ccoutant@google.com>
12551 * options.h (General_options::no_keep_memory): Remove incorrect
12554 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12556 * Makefile.am (am__skiplex, am__skipyacc): New.
12557 * Makefile.in: Regenerate.
12559 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12561 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12562 (INCLUDES): ... this.
12563 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12564 (AM_CPPFLAGS): Renamed from ...
12565 (INCLUDE): ... this.
12566 * Makefile.in, testsuite/Makefile.in: Regenerate.
12568 * Makefile.in: Regenerate.
12569 * aclocal.m4: Likewise.
12570 * config.in: Likewise.
12571 * configure: Likewise.
12572 * testsuite/Makefile.in: Likewise.
12574 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12575 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12576 * Makefile.in: Regenerate.
12577 * testsuite/Makefile.in: Regenerate.
12579 2009-08-19 Cary Coutant <ccoutant@google.com>
12581 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12582 symbols in shared libraries overridden by hidden or internal symbols
12583 in the main program.
12585 2009-08-19 Chris Demetriou <cgd@google.com>
12587 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12588 checking source file names in error messages.
12590 2009-08-18 Doug Kwan <dougkwan@google.com>
12592 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12593 an elcpp::Ehdr as parameter. Adjust call to set_target.
12594 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12595 an elfcpp::Ehdr as parameter.
12596 * object.cc (Object::set_target): Remove the version that looks up
12597 a target and sets it.
12598 (Sized_relobj::setup): Take a Target object instead of
12599 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12600 (make_elf_sized_object): Find target and ask target to
12601 make an ELF object.
12602 * object.h: (Object::set_target): Remove the version that looks up
12603 a target and sets it.
12604 (Sized_relobj::setup): Take a Target object instead of
12605 an elfcpp:Ehdr as parameter.
12606 * target.cc: Include dynobj.h.
12607 (Target::do_make_elf_object_implementation): New.
12608 (Target::do_make_elf_object): New.
12609 * target.h (Target::make_elf_object): New template declaration.
12610 (Target::do_make_elf_object): New method declarations.
12611 (Target::do_make_elf_object_implementation): New template declaration.
12613 2009-08-14 Ian Lance Taylor <iant@google.com>
12615 * gold.h (FUNCTION_NAME): Define.
12616 (gold_unreachable): Use FUNCTION_NAME.
12618 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12620 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12621 symbol in the --keep-unique list is not found.
12623 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12625 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12626 been maked as --keep-unique.
12627 (Icf::unfold_section): New function.
12628 * icf.h (Icf::unfold_section): New function.
12629 * options.h (General_options::keep_unique): New option.
12630 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12631 * testsuite/Makefile.in: Regenerate.
12632 * testsuite/icf_keep_unique_test.sh: New file.
12633 * testsuite/icf_keep_unique_test.cc: New file.
12635 2009-08-12 Cary Coutant <ccoutant@google.com>
12638 * resolve.cc (Symbol_table::resolve): Check for references from
12639 dynamic objects to hidden and internal symbols.
12640 * testsuite/Makefile.am (hidden_test.sh): New test.
12641 * testsuite/Makefile.in: Regenerate.
12642 * testsuite/hidden_test.sh: New script.
12643 * testsuite/hidden_test_1.c: New test source.
12644 * testsuite/hidden_test_main.c: New test source.
12646 2009-08-11 Doug Kwan <dougkwan@google.com>
12648 * arm.cc: Update comments.
12649 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12650 segment to locate the .ARM.exidx section if present.
12652 2009-08-09 Doug Kwan <dougkwan@google.com>
12654 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12657 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12658 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12661 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12663 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12664 valid tls_segment only for non-debug-section relocations.
12665 * testsuite/Makefile.am: Add gc_tls_test.
12666 * testsuite/Makefile.in: Regenerate.
12667 * testsuite/gc_tls_test.cc: New file.
12668 * testsuite/gc_tls_test.sh: New file.
12670 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12672 * icf.cc: New file.
12674 * Makefile.am (CCFILES): Add icf.cc.
12675 (HFILES): Add icf.h
12676 * Makefile.in: Regenerate.
12677 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12678 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12679 section, symbol and addend information for the relocs.
12680 * gold.cc (queue_middle_tasks): Call identical code folding.
12681 * gold.h: Add defines for multimap.
12682 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12683 to the call of finalize_local_symbols.
12684 * main.cc (main): Create object of class Icf.
12685 * object.cc (Sized_relobj::do_layout): Allow this function to be
12686 called twice during icf.
12687 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12688 to sections marked as identical by icf.
12689 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12691 (Sized_relobj::do_section_entsize): New function.
12692 * object.h (Object::section_entsize): New function.
12693 (Object::do_section_entsize): New pure virtual function.
12694 (Relobj::finalize_local_symbols): Add new parameter.
12695 (Relobj::do_section_entsize): New function.
12696 * options.h (General_options::icf): New option.
12697 (General_options::icf_iterations): New option.
12698 (General_options::print_icf_sections): New option.
12699 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12700 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12701 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12703 * symtab.cc (Symbol_table::is_section_folded): New function.
12704 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12705 to sections marked as identical by icf.
12706 * symtab.h (Symbol_table::set_icf): New function.
12707 (Symbol_table::icf): New function.
12708 (Symbol_table::is_section_folded): New function.
12709 (Symbol_table::icf_): New data member.
12710 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12711 * testsuite/Makefile.am: Add commands to build icf_test.
12712 * testsuite/Makefile.in: Regenerate.
12713 * testsuite/icf_test.sh: New file.
12714 * testsuite/icf_test.cc: New file.
12716 2009-07-24 Chris Demetriou <cgd@google.com>
12718 * layout.cc (is_compressible_debug_section): Fix incorrect
12719 comment about compressed section names.
12721 2009-07-20 Ian Lance Taylor <ian@airs.com>
12724 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12726 2009-07-16 Ian Lance Taylor <iant@google.com>
12729 * layout.h: #include <map>.
12730 (class Kept_section): Change from struct to class. Add accessors
12731 and setters. Add section size to Comdat_group mapping. Change
12732 Comdat_group to std::map. Add is_comdat_ field. Add
12733 linkonce_size field in union.
12734 (class Layout): Update declaration of find_or_add_kept_section.
12735 Don't declare find_kept_object.
12736 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12737 parameter. Add object, shndx, is_comdat, and is_group_name
12738 parameters. Change all callers. Adjust for new Kept_section.
12739 (Layout::find_kept_object): Remove.
12740 * object.cc (Sized_relobj::include_section_group): Update use of
12741 Kept_section. Rename secnum to shndx. Only record
12742 Kept_comdat_section if sections are the same size.
12743 (Sized_relobj::include_linkonce_section): Update use of
12744 Kept_section. Only record Kept_comdat_section if sections are the
12745 same size. Set size of linkonce section.
12746 (Sized_relobj::map_to_kept_section): Update call to
12747 get_kept_comdat_section.
12748 * object.h (class Sized_relobj): Rename fields in
12749 Kept_comdat_section to drop trailing underscores; change object
12750 field to Relobj*. Change Kept_comdat_section_table to store
12751 struct rather than pointer.
12752 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12753 Add kept_object and kept_shndx parameters. Change all callers.
12754 (Sized_relobj::get_kept_comdat_section): Change return type to
12755 bool. Add kept_object and kept_shndx parameters. Change all
12757 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12758 Layout::find_or_add_kept_section.
12760 2009-07-09 Ian Lance Taylor <iant@google.com>
12762 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12763 Reserve space in the hash table.
12765 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12767 * fileread.cc (File_read::get_mtime): New method.
12768 * fileread.h (Timespec): New structure.
12769 (File_read::get_mtime): New method.
12770 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12771 Renamed from timestamp_nsec.
12772 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12774 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12776 (Incremental_inputs::report_archive): Save mtime; style fix.
12777 (Incremental_inputs::report_obejct): Save mtime; style fix.
12778 (Incremental_inputs::report_script): Save mtime; style fix.
12779 (Incremental_inputs::finalize_inputs): Style fix.
12780 (Incremental_inputs::finalize): Style fix.
12781 (Incremental_inputs::create_input_section_data): Store inputs
12783 * incremental.h (Incremental_inputs::report_script): Add mtime
12785 (Incremental_inputs::Input_info::Input_info): Intialize only one
12787 (Incremental_inputs::Input_info::archive): Move to nameless
12789 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12790 (Incremental_inputs::Input_info::script): Move to nameless union.
12791 (Incremental_inputs::mtime): New field.
12792 * script.cc (read_input_script): Pass file mtime to
12794 * script.h (Script_info::inputs): Style fix.
12796 2009-07-01 Ian Lance Taylor <ian@airs.com>
12798 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12801 2009-06-24 Ian Lance Taylor <iant@google.com>
12804 * layout.cc (Layout::choose_output_section): If we find an
12805 existing section, update the flags.
12806 (Layout::create_notes): New function, broken out of
12808 (Layout::finalize): Don't create note sections.
12809 (Layout::create_note): Don't crash if linker script discards
12811 (Layout::create_gold_note): Likewise.
12812 (Layout::create_build_id): Likewise. Don't set
12813 after_input_sections on the section.
12814 (Layout::create_executable_stack_info): Remove target parameter.
12816 * layout.h (class Layout): Declare create_notes. Update
12817 declaration of create_executable_stack_info.
12818 * gold.cc (queue_middle_tasks): Call create_notes.
12819 * output.cc (Output_section::update_flags_for_input_section): Move
12820 here from output.h. If SHF_ALLOC flag is newly set, mark address
12822 * output.h (Output_data::mark_address_invalid): New function.
12823 (class Output_section): Only declare, not define,
12824 update_flags_for_input_section. Remove set_flags.
12826 2009-06-24 Ian Lance Taylor <iant@google.com>
12828 * script-sections.cc (Output_section_definition::
12829 set_section_addresses): Rename shadowing local load_address to
12832 2009-06-24 Ian Lance Taylor <iant@google.com>
12835 * reloc.cc (relocate_sections): Skip empty relocation sections.
12837 2009-06-23 Ian Lance Taylor <iant@google.com>
12840 * layout.cc (Layout::create_note): Use choose_output_section
12841 rather than make_output_section.
12843 2009-06-23 Ian Lance Taylor <iant@google.com>
12846 * options.cc (General_options::parse_V): Set printed_version_.
12847 (General_options::General_options): Initialize printed_version_.
12848 * options.h (class General_options): Add printed_version_ field.
12849 * gold.cc (queue_initial_tasks): If there are no input files,
12850 don't give a fatal error if we printed the version information.
12851 (queue_middle_tasks): If using -r with a shared object, give a
12852 fatal error rather than an ordinary error.
12854 2009-06-23 Ian Lance Taylor <iant@google.com>
12857 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12858 (Layout::make_output_section): Set have_stabstr_section_ if we see
12859 a .stab*str section.
12860 (Layout::finalize): Call link_stabs_sections.
12861 (Layout::link_stabs_sections): New file.
12862 * layout.h (class Layout): Add have_stabstr_section_ field.
12863 Declare link_stabs_sections.
12865 2009-06-23 Doug Kwan <dougkwan@google.com>
12867 * Makefile.am (libgold_a_LIBADD): New.
12868 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12869 * Makefile.in: Regenerate.
12870 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12871 * configure: Regenerate.
12872 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12873 * fileread.cc: Include sys/state.h
12874 * gold.h: Declare memmem and strndup if found missing.
12875 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12877 2009-06-23 Ian Lance Taylor <iant@google.com>
12879 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12880 * configure: Rebuild.
12882 2009-06-23 Ian Lance Taylor <iant@google.com>
12885 * object.cc (Object::section_contents): Don't try to get a view if
12886 the section has length zero.
12887 (Object::handle_gnu_warning_section): If the section is empty, use
12888 the name of the section as the warning.
12890 2009-06-23 Ian Lance Taylor <iant@google.com>
12893 * stringpool.h (class Stringpool_template): Add optimize_ field.
12894 (Stringpool_template::set_optimize): New function.
12895 * stringpool.cc (Stringpool_template::Stringpool_template):
12896 Initialize optimize_ field.
12897 (Stringpool_template::set_string_offsets): Test local optimize
12898 fild rather than parameter.
12899 * layout.cc (Layout::Layout): Call set_optimize on the section
12902 2009-06-22 Ian Lance Taylor <iant@google.com>
12905 * yyscript.y: Parse TARGET.
12906 * script.cc (script_set_target): New function.
12907 * script-c.h (script_set_target): Declare.
12908 * options.cc (General_options::string_to_object_format): Rename
12909 from string_to_object_format in anonymous namespace. Change
12911 * options.h (class General_options): Declare
12912 string_to_object_format.
12914 2009-06-22 Ian Lance Taylor <iant@google.com>
12916 * script-sections.cc (Script_sections::create_segments): Don't put
12917 program headers in a PT_LOAD segment if -n or -N.
12919 2009-06-22 Ian Lance Taylor <iant@google.com>
12922 * options.h (class General_options): Add -z lazy and -z now. Sort
12923 -z options into alphabetical order.
12924 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12926 2009-06-21 Ian Lance Taylor <iant@google.com>
12928 * layout.cc (Layout::make_output_section): Call
12929 Target::new_output_section.
12930 (Layout::attach_allocated_section_to_segment): Put large section
12931 sections in a separate load segment with the large segment flag
12933 (Layout::segment_precedes): Sort large data segments after other
12935 (align_file_offset): New static function.
12936 (Layout::set_segment_offsets): Use align_file_offset.
12937 * output.h (class Output_section): Add is_small_section_ and
12938 is_large_section_ fields.
12939 (Output_section::is_small_section): New function.
12940 (Output_section::set_is_small_section): New function.
12941 (Output_section::is_large_section): New function.
12942 (Output_section::set_is_large_section): New function.
12943 (Output_section::is_large_data_section): New function.
12944 (class Output_segment): Add is_large_data_segment_ field.
12945 (Output_segment::is_large_data_segment): New function.
12946 (Output_segment::set_is_large_data_segment): New function.
12947 * output.cc (Output_section::Output_section): Initialize new
12949 (Output_segment::Output_segment): Likewise.
12950 (Output_segment::add_output_section): Add assertion that large
12951 data sections always go in large data segments. Force small data
12952 sections to the end of the list of data sections. Force small BSS
12953 sections to the start of the list of BSS sections. For large BSS
12954 sections to the end of the list of BSS sections.
12955 * symtab.h (class Symbol): Declare is_common_shndx.
12956 (Symbol::is_defined): Check Symbol::is_common_shndx.
12957 (Symbol::is_common): Likewise.
12958 (class Symbol_table): Define enum Commons_section_type. Update
12959 declarations. Add small_commons_ and large_commons_ fields.
12960 * symtab.cc (Symbol::is_common_shndx): New function.
12961 (Symbol_table::Symbol_table): Initialize new fields.
12962 (Symbol_table::add_from_object): Put small and large common
12963 symbols in the right list.
12964 (Symbol_table::sized_finalized_symbol): Check
12965 Symbol::is_common_shndx.
12966 (Symbol_table::sized_write_globals): Likewise.
12967 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12968 common symbol lists. Don't call do_allocate_commons_list if the
12970 (Symbol_table::do_allocate_commons_list): Remove is_tls
12971 parameter. Add comons_section_type parameter. Change all
12972 callers. Handle small and large common symbols.
12973 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12974 Symbol::is_common_shndx.
12975 * resolve.cc (symbol_to_bits): Likewise.
12976 * target.h (Target::small_common_shndx): New function.
12977 (Target::small_common_section_flags): New function.
12978 (Target::large_common_shndx): New function.
12979 (Target::large_common_section_flags): New function.
12980 (Target::new_output_section): New function.
12981 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12982 small_common_section_flags, and large_common_section_flags
12984 (Target::do_new_output_section): New virtual function.
12985 * arm.cc (Target_arm::arm_info): Initialize new fields.
12986 * i386.cc (Target_i386::i386_info): Likewise.
12987 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12989 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12990 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12991 (Target_x86_64::do_new_output_section): New function.
12992 * configure.ac: Define conditional MCMODEL_MEDIUM.
12993 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12994 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12995 (large_LDFLAGS): Define.
12996 * testsuite/large.c: New file.
12997 * testsuite/testfile.cc (Target_test::test_target_info):
12998 Initialize new fields.
12999 * configure, testsuite/Makefile.in: Rebuild.
13001 2009-06-05 Doug Kwan <dougkwan@google.com>
13003 * Makefile.am (CCFILES): Add target.cc.
13004 * Makefile.in: Regenerate.
13005 * i386.cc (class Target_i386): Define new virtual method to
13006 override do_is_local_label_name in parent.
13007 * object.cc (Sized_relobj::do_count_local_symbols): Discard
13008 local symbols if --discard-locals or -X is given.
13009 * options.h (class General_options): Declare new options
13010 '--discard-locals' and '-X' for discarding locals.
13011 * target.h (class Target): Define new methods is_local_label_name.
13012 Declare new virtual method do_is_local_label_name.
13013 * target.cc: New file.
13014 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13015 (check_SCRIPTS): Add discard_locals_test.sh.
13016 (check_DATA): Add discard_local_tests.syms.
13017 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13018 (discard_local_tests.syms, discard_locals_test.o): New make rules.
13019 * testsuite/Makefile.in: Regenerate.
13020 * testsuite/discard_locals_test.c: New file.
13021 * testsuite/discard_locals_test.sh: Same.
13023 2009-06-05 Doug Kwan <dougkwan@google.com>
13025 * object.cc (Sized_relobj::Sized_relobj): Initialize
13026 discarded_eh_frame_shndx_ to -1U.
13027 (Sized_relobj::do_layout): Record index of a discard .eh_frame
13029 (Sized_relobj::do_count_local_symbols): Skip local symbols in
13030 a discarded .eh_frame section.
13031 (Sized_relobj::do_finalize_local_symbols): Ditto.
13032 * object.h (class Sized_relobj): Declare new member
13033 discarded_eh_frame_shndx_.
13034 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13035 (local_labels_test.o, local_labels_test): New rules.
13036 * testsuite/Makefile.in: Regenerate.
13038 2009-06-04 Doug Kwan <dougkwan@google.com>
13040 * layout.cc (Layout::section_name_mapping): Add mapping for
13041 special ARM sections.
13043 2009-06-03 Doug Kwan <dougkwan@google.com>
13045 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13046 (utils::has_overflow): Same.
13048 2009-06-03 Ian Lance Taylor <iant@google.com>
13050 * layout.cc (Layout::section_name_mapping): New array, replacing
13051 Layout::linkonce_mapping.
13052 (Layout::section_name_mapping_count): New variable, replacing
13053 Layout::linkonce_mapping_count.
13054 (Layout::linkonce_output_name): Remove.
13055 (Layout::output_section_name): Rewrite.
13056 * layout.h (class Layout): Rename Linkonce_mapping to
13057 Section_name_mapping, linkonce_mapping to section_name_mapping,
13058 linkonce_mapping_count to section_name_mapping_count. Don't
13059 declare linkonce_output_name.
13061 2009-06-03 Doug Kwan <dougkwan@google.com>
13063 * gold/arm.cc (namespace utils): New.
13064 (Target_arm::reloc_is_non_pic): Define new method.
13065 (class Arm_relocate_functions): New.
13066 (Target_arm::Relocate::relocate): Handle relocation types used by
13069 2009-06-03 Ian Lance Taylor <iant@google.com>
13071 * arm.cc (Target_arm::scan::global): Use || instead of |.
13073 2009-06-02 Doug Kwan <dougkwan@google.com>
13075 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
13076 issued_non_pic_error_.
13077 (class Target_arm::Scan): Declare new method check_non_pic.
13078 Define new method symbol_needs_plt_entry.
13079 Declare new data member issued_non_pic_error_.
13080 (class Target_arm::Relocate): Declare new method
13081 should_apply_static_reloc.
13082 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13083 (Target_arm::Scan::check_non_pic): Define new method.
13084 (Target_arm::Scan::local): Handle a small subset of reloc types used
13086 (Target_arm::Scan::local): Same.
13087 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13089 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
13091 * incremental.cc (Incremental_inputs::report_command_line): Filter
13092 out --incremental-* options.
13094 2009-05-29 Doug Kwan <dougkwan@google.com>
13096 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13098 (class Target_arm): Update comment.
13099 (Target_arm::Target_arm): Initialize new data members GOT_,
13100 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13101 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13102 and Target_arm::rel_dyn_section.
13103 Declare new_enum Target_arm::Got_type.
13104 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13106 Update commments for member do_dynsym_value.
13107 (Target_arm::got_size, Target_arm::plt_section,
13108 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13109 new methods inside class defintion.
13110 (Target_arm::got_section): Define new method.
13111 (Target_arm::rel_dyn_section): Same.
13112 (Output_data_plt_arm): New template class.
13113 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13114 (Output_data_plt_arm:do_adjust_output_section): Define new method.
13115 (Output_data_plt_arm::add_entry): Same.
13116 (Output_data_plt_arm::first_plt_entry): Define new
13117 static data member for PLT instruction template.
13118 (Output_data_plt_arm::plt_entry): Same.
13119 (Output_data_plt_arm::do_write): Define new method.
13120 (Target_arm::make_plt_entry): Same.
13121 (Target_arm::do_finalize_sections): Same.
13122 (Target_arm::do_dynsym_value): Same.
13124 2009-05-28 Doug Kwan <dougkwan@google.com>
13126 * Makefile.am (TARGETSOURCES): Add arm.cc.
13127 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13128 * Makefile.in: Regenerate.
13129 * arm.cc: New file.
13130 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13132 2009-05-26 Doug Kwan <dougkwan@google.com>
13134 * options.cc (General_options::parse_exclude_libs). Fix a comment.
13135 (General_options::check_excluded_libs): Strip off directories in
13136 archive name before matching like GNU ld does.
13137 * testsuite/Makefile.am (MOSTLYCLEANFILES,
13138 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13139 (exclude_libs_test_LDFLAGS): Add linker option
13140 -Wl,--exclude-libs,libexclude_libs_test_3
13141 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13142 an explicit archive without using -l.
13143 (alt/libexclude_libs_test_3.a): New make rule.
13144 * testsuite/Makefile.in: Regenerate.
13145 * testsuite/exclude_libs_test.c : Declare lib3_default().
13147 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13148 * exclude_libs_test_3.c: New file.
13150 2009-05-26 Nick Clifton <nickc@redhat.com>
13152 * po/id.po: New Indonesian translation.
13153 * po/gold.pot: Updated template file.
13155 2009-05-22 Sriraman Tallam <tmsriram@google.com>
13157 * testsuite/Makefile.am: Add -ffunction-sections to compile
13158 gc_comdat_test files. Add -Wl,--gc-sections to build
13160 * testsuite/Makefile.in: Regenerate.
13161 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13163 2009-05-21 Sriraman Tallam <tmsriram@google.com>
13165 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13166 kept comdat section was garbage collected.
13167 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13168 * testsuite/Makefile.in: Regenerate.
13169 * testsuite/gc_comdat_test.sh: New file.
13170 * testsuite/gc_comdat_test_1.cc: New file.
13171 * testsuite/gc_comdat_test_2.cc: New file.
13173 2009-05-19 Doug Kwan <dougkwan@google.com>
13175 * archive.cc (Archive::Archive): Move constructor from archive.h
13176 to here. Initialize no_export_.
13177 (Archive::get_elf_object_for_member): Set no_export flag of object.
13178 * archive.h (Archive::Archive): Move constructor body to
13180 (Archive::no_export): New method.
13181 (Archive::no_export_): New field.
13182 * object.h (Object::Object): Initialize no_export_ to false.
13183 (Object::no_export, Object::set_no_export): New methods.
13184 (Object::no_export_): New field.
13185 * options.cc (General_options::parse_exclude_libs): New method.
13186 (General_options::check_excluded_libs) Same.
13187 * options.h (exclude_libs): New option.
13188 (General_options::check_excluded_libs): New method declaration.
13189 (General_options::excluded_libs_): New field.
13190 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13191 default or protected visibility if an object has no-export flag set.
13192 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13193 (check_SCRIPTS): Add exclude_libs_test.sh.
13194 (check_DATA): Add exclude_libs_test.syms.
13195 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13196 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13197 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13198 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13199 (exclude_libs_test.syms, libexclude_libs_test_1.a,
13200 libexclude_libs_test_2.a): New rules.
13201 * testsuite/Makefile.in: Regenerate.
13202 * testsuite/exclude_libs_test.c: New file.
13203 * testsuite/exclude_libs_test.sh: Ditto.
13204 * testsuite/exclude_libs_test_1.c: Ditto.
13205 * testsuite/exclude_libs_test_2.c: Ditto.
13207 2009-05-15 Ian Lance Taylor <iant@google.com>
13209 * configure.ac: Check for declarations for cases where libiberty.h
13210 checks HAVE_DECL_xxx.
13211 * configure, config.in: Rebuild.
13213 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
13215 * gold.h (Incremental_argument_list): Remove (invalid) forward
13217 * incremental.cc (Incremental_inputs::report_achive): New method.
13218 (Incremental_inputs::report_object): New method.
13219 (Incremental_inputs::report_script): New method.
13220 (Incremental_inputs::finalize_inputs): New method.
13221 (Incremental_inputs::finalize): Call finalize_inputs().
13222 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13223 Create inputs entries.
13224 * incremental.h (Incremental_input_type): New enum.
13225 (Incremental_inputs::Incremental_input): Initialize new fields.
13226 (Incremental_inputs::report_inputs): New method.
13227 (Incremental_inputs::report_achive): New method.
13228 (Incremental_inputs::report_object): New method.
13229 (Incremental_inputs::report_script): New method.
13230 (Incremental_inputs::finalize_inputs): New method.
13231 (Incremental_inputs::Input_info): New struct.
13232 (Incremental_inputs::Input_info_map): New typedef.
13233 (Incremental_inputs::lock_): New field.
13234 (Incremental_inputs::Inputs_): New field.
13235 (Incremental_inputs::Inputs_map): New field.
13236 * main.cc (main): Call Incremental_input::report_inputs.
13237 * options.h (Input_argument_list): Typedef moved from
13239 (Input_file_group::Files): Remove, use ::Input_argument_list.
13240 (Input_file_group::Input_argument_list): Remove, use
13241 ::Input_argument_list.
13242 * plugin.cc (Plugin_manager::add_input_file): Add error in
13244 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13246 * script.cc (read_input_script): Call
13247 Incremental_input::report_script.
13248 * script.h (Script_info): New class.
13250 2009-04-27 Ian Lance Taylor <iant@google.com>
13252 * x86_64.cc (do_adjust_output_section): Set entsize to
13255 2009-04-23 Elliott Hughes <enh@google.com>
13257 * output.cc (Output_file::close): After short writes, continue
13258 writing from the correct offset in the buffer being written.
13260 2009-04-23 Chris Demetriou <cgd@google.com>
13262 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13263 * configure: Regenerate.
13264 * config.in: Regenerate.
13265 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13266 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13268 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
13270 * incremental.cc (Incremental_inputs_header_data): Renamed from
13271 Incremental_input_header_data.
13272 (Incremental_inputs_header_data::data_size): New field.
13273 (Incremental_inputs_header_data::put_input_file_count): Renamed
13274 from input_file_count.
13275 (Incremental_inputs_header_data::put_command_line_offset): Renamed
13276 from command_line_offset.
13277 (Incremental_inputs_header_data::put_reserved): Renamed from
13279 (Incremental_inputs_entry_data): Renamed from
13280 Incremental_input_entry_data.
13281 (Incremental_inputs_entry_data::data_size): New field.
13282 (Incremental_inputs::report_command_line): New method.
13283 (Incremental_inputs::finalize): New method.
13284 (Incremental_inputs::create_incremental_inputs_data): New method.
13285 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13286 * incremental.h: New file.
13287 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13288 (Layout::finalize): Create incremental inputs section in
13289 incremental builds.
13290 (Layout::create_incremental_info_sections): New method.
13291 * layout.h (Layout::incremental_inputs): New method.
13292 (Layout::create_incremental_info_sections): New method.
13293 (Layout::incremental_inputs_): New field.
13294 * main.cc (main): Notify Incremental_input of the command line.
13296 2009-04-01 Ian Lance Taylor <iant@google.com>
13297 Mikolaj Zalewski <mikolajz@google.com>
13299 * gold.h (reserve_unordered_map): Define, three versions, one for
13300 each version of Unordered_map.
13301 * layout.cc (Layout::Layout): Remove options parameter. Add
13302 number_of_input_files parameter. Don't initialize options_.
13303 Initialize number_of_input_files_ and resized_signatures_. Move
13304 sections_are_attached_.
13305 (Layout::layout_group): Reserve space for group_signatures_.
13306 (Layout::find_or_add_kept_section): Change name parameter to be a
13307 reference. Resize signatures_ map when it gets large enough.
13308 (Layout::layout_eh_frame): Use parameters->options() instead of
13310 (Layout::make_output_section): Likewise.
13311 (Layout::attach_allocated_section_to_segment): Likewise.
13312 (Layout::finalize, Layout::create_executable_stack): Likewise.
13313 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13314 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13315 * layout.h (class Layout): Update declarations. Remove options_
13316 field. Add number_of_input_files_ and resized_signatures_
13317 fields. Move sections_are_attached_ field.
13318 * main.cc (main): Pass number of input files to Layout
13319 constructor. Don't pass options.
13321 2009-03-30 Ian Lance Taylor <iant@google.com>
13323 * ffsll.c (ffsll): Correct implementation.
13325 2009-03-27 Ian Lance Taylor <iant@google.com>
13327 * ffsll.c: New file.
13328 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13329 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13330 * ftruncate.c (ftruncate): Declare before definition.
13331 * mremap.c (mremap): Likewise.
13332 * pread.c (pread): Likewise.
13333 * configure, Makefile.in, config.in: Rebuild.
13335 * mremap.c: New file.
13336 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13337 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13338 (mremap): Declare if HAVE_MREMAP is not defined.
13339 * configure, Makefile.in, config.in: Rebuild.
13341 2009-03-27 Cary Coutant <ccoutant@google.com>
13343 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13344 position independent.
13345 * sparc.cc (Target_sparc::check_non_pic): Likewise.
13346 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13348 2009-03-24 Cary Coutant <ccoutant@google.com>
13350 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13352 (needs_dynamic_reloc): Likewise.
13354 2009-03-24 Ian Lance Taylor <iant@google.com>
13356 * yyscript.y (file_cmd): Recognize EXTERN.
13357 (extern_name_list, extern_name_list_body): New nonterminals.
13358 * script.cc (script_add_extern): Define.
13359 * script-c.h (script_add_extern): Declare.
13361 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13363 * object.cc (is_elf_object): Define.
13364 * object.h (is_elf_object): Declare.
13365 * archive.cc (Archive::get_elf_object_for_member): Call
13367 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13369 2009-03-24 Elliott Hughes <enh@google.com>
13371 * output.cc (Output_file::map_anonymous): Define.
13372 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13373 try an anonymous one. Report the size if the mmap fails.
13374 * output.h (class Output_file): Declare map_anonymous.
13376 2009-03-24 Ian Lance Taylor <iant@google.com>
13378 * target-select.cc (instantiate_target): Don't acquire the lock if
13379 the instantiated_target_ field has already been set.
13381 2009-03-23 Ian Lance Taylor <iant@google.com>
13383 * gold-threads.h (class Initialize_lock): Define.
13384 * gold-threads.cc (class Initialize_lock_once): Define.
13385 (initialize_lock_control): New static variable.
13386 (initialize_lock_pointer): New static variable.
13387 (initialize_lock_once): New static function.
13388 (Initialize_lock::Initialize_lock): Define.
13389 (Initialize_lock::initialize): Define.
13390 * target-select.h: Include "gold-threads.h".
13391 (class Target_selector): Add lock_ and initialize_lock_ fields.
13392 Don't define instantiate_target, just declare it.
13393 * target-select.cc (Target_selector::Target_selector): Initialize
13395 (Target_selector::instantiate_target): Define.
13396 * descriptors.h: Include "gold-threads.h".
13397 (class Descriptors): Add initialize_lock_ field.
13398 * descriptors.cc (Descriptors::Descriptors): Initialize new
13400 (Descriptors::open): Use initialize_lock_ field
13401 * errors.h (class Errors): Add initialize_lock_ field.
13402 * errors.cc (Errors::Errors): Initialize new field.
13403 (Errors::initialize_lock): Use initialize_lock_ field.
13404 * powerpc.cc (class Target_selector_powerpc): Remove
13405 instantiated_target_ field. In do_recognize call
13406 instantiate_target rather than do_instantiate_target. In
13407 do_instantiate_target just allocate a new target.
13408 * sparc.cc (class Target_selector_sparc): Likewise.
13410 * freebsd.h: New file.
13411 * i386.cc: Include "freebsd.h".
13412 (Target_i386): Derive from Target_freebsd rather than
13414 (Target_selector_i386): Derive from Target_selector_freebsd rather
13415 than Target_selector.
13416 * x86_64.cc: Include "freebsd.h".
13417 (Target_x86_64): Derive from Target_freebsd rather than
13419 (Target_selector_x86_64): Derive from Target_selector_freebsd
13420 rather than Target_selector.
13421 * target.h (class Target): Add adjust_elf_header and
13422 do_adjust_elf_header.
13423 * output.cc (Output_file_header:: do_sized_write): Call target
13424 adjust_elf_header routine.
13425 * configure.tgt: Set targ_osabi.
13426 * configure.ac: Define GOLD_DEFAULT_OSABI.
13427 * parameters.cc (Parameters::default_target): Pass
13428 GOLD_DEFAULT_OSABI to select_target.
13429 * target-select.h (class Target_selector): Make instantiate_target
13430 protected rather than private.
13431 * Makefile.am (HFILES): Add freebsd.h.
13432 * configure, Makefile.in, config.in: Rebuild.
13434 * merge.cc (do_add_input_section): Correct pend value. Change
13435 message about last entry not being null terminated from error to
13438 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13440 * incremental.cc: New file.
13441 * Makefile.am (CCFILES): Add incremental.cc.
13442 * Makefile.in: Rebuild.
13444 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13446 * layout.cc (Layout::output_section_name): Preserve names
13447 of '.note.' sections.
13449 2009-03-19 Ian Lance Taylor <iant@google.com>
13451 * descriptors.cc (Descriptors::open): Check that the options are
13452 valid before using them.
13454 2009-03-18 Ian Lance Taylor <iant@google.com>
13456 * script-sections.h: Include <list>.
13457 (class Script_sections): Change Sections_elements from std::vector
13458 to std::list. Typedef public Elements_iterator. Add
13459 orphan_section_placement_, data_segment_align_start_, and
13460 saw_data_segment_align_ fields. Remove data_segment_align_index_
13462 * script-sections.cc (class Orphan_section_placement): New class.
13463 (class Sections_element): Add virtual functions is_relro and
13464 orphan_section_init. Remove virtual function place_orphan_here.
13465 (class Output_section_definition): Add is_relro and
13466 orphan_section_init. Remove place_orphan_here.
13467 (class Orphan_output_section): Likewise.
13468 (Script_sections::Script_sections): Update for field changes.
13469 (Script_sections::data_segment_align): Set saw_data_segment_align_
13470 and data_segment_align_start_, not data_segment_align_index.
13471 (Script_sections::data_segment_relro_end): Check
13472 saw_data_segment_align_. Use data_segment_align_start_ rather
13473 than data_segment_align_index_.
13474 (Script_sections::place_orphan): Rewrite to use
13475 Orphan_section_placement.
13477 2009-03-17 Ian Lance Taylor <iant@google.com>
13479 * archive.cc (Archive::add_symbols): Check for a version attached
13480 to the symbol name in the archive map.
13481 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13482 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13483 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13484 (ver_test_11.a): New target.
13485 * testsuite/Makefile.in: Rebuild.
13487 * configure.ac: Check for chsize and posix_fallocate. Replace
13489 * ftruncate.c: New file, from gnulib.
13490 * output.cc (posix_fallocate): Define dummy version if not
13491 HAVE_POSIX_FALLOCATE.
13492 (Output_file::map): Call posix_fallocate rather than lseek and
13494 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13495 * configure, Makefile.in, config.in: Rebuild.
13497 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13499 * layout.h (Layout::create_note): Add section_name parameter.
13500 * layout.cc (Layout::create_note): Likewise.
13501 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13503 2009-03-17 Ian Lance Taylor <iant@google.com>
13505 * descriptors.cc: Include "options.h".
13506 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13507 (Descriptors::open): Always use O_CLOEXEC when opening a new
13508 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13509 then set FD_CLOEXEC.
13511 * sparc.cc (class Target_sparc): Add has_got_section.
13512 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13513 make sure we have a GOT section.
13515 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13516 (Target_sparc::Scan::local): Likewise.
13517 (Target_sparc::Scan::global): Likewise.
13518 (Target_sparc::Relocate::relocate): Likewise.
13519 (Target_sparc::Relocate::relocate_tls): Likewise.
13521 * symtab.cc (Symbol_table::define_default_version): New function,
13522 broken out of add_from_object.
13523 (Symbol_table::add_from_object): Call define_default_version.
13524 (Symbol_table::define_special_symbol): Add resolve_oldsym
13525 parameter. Change all callers. If the version for a symbol comes
13526 from a version script, resolve it with the symbol with the same
13527 name with no version. Also add the symbol without a version if
13529 (do_define_in_output_data): If resolving with oldsym, don't delete
13531 (do_define_in_output_segment): Likewise.
13532 (do_define_as_constant): Likewise.
13533 * symtab.h (class Symbol_table): Update declarations.
13535 2009-03-13 Ian Lance Taylor <iant@google.com>
13537 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13538 (Read_symbols::requeue): New function.
13539 (Read_symbols::do_read_symbols): If make_elf_object fails because
13540 the target type is not configured, and the file was searched for,
13541 issue a warning and retry with the next directory.
13542 (Add_symbols::run): If the file has an incompatible format, and
13543 it was searched for, requeue the Read_symbols task. On error,
13544 release the object.
13545 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13546 dirindex parameter to constructor. Change all callers. Declare
13547 incompatible_warning and requeue.
13548 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13549 input_argument_ and input_group_ fields. Add them to
13550 constructor. Change all callers.
13551 (class Read_script): Add dirindex_ field. Add it to constructor.
13552 Change all callers.
13553 * archive.cc (Archive::setup): Remove input_objects parameter.
13554 Change all callers.
13555 (Archive::get_file_and_offset): Likewise.
13556 (Archive::read_all_symbols): Likewise.
13557 (Archive::read_symbols): Likewise.
13558 (Archive::get_elf_object_for_member): Remove input_objects
13559 parameter. Add punconfigured parameter. Change all callers.
13560 (Archive::add_symbols): Change return type to bool. Check return
13561 value of include_member.
13562 (Archive::include_all_members): Likewise.
13563 (Archive::include_member): Change return type to bool. Return
13564 false if first included object has incompatible target. Set
13565 included_member_ field.
13566 (Add_archive_symbols::run): If add_symbols returns false, requeue
13568 * archive.h (class Archive): Add included_member_ field.
13569 Initialize it in constructor. Add input_file and searched_for
13570 methods. Update declarations.
13571 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13572 input_argument_ fields. Add them to constructor. Change all
13574 * script.cc: Include "target-select.h".
13575 (class Parser_closure): Add skip_on_incompatible_target_ and
13576 found_incompatible_target_ fields. Add
13577 skip_on_incompatible_target parameter to constructor. Change all
13578 callers. Add methods skip_on_incompatible_target,
13579 clear_skip_on_incompatible_target, found_incompatible_target, and
13580 set_found_incompatible_target.
13581 (read_input_script): Add dirindex parameter. Change all callers.
13582 If parser finds an incompatible target, requeue Read_symbols
13584 (script_set_symbol): Clear skip_on_incompatible_target in
13586 (script_add_assertion, script_parse_option): Likewise.
13587 (script_start_sections, script_add_phdr): Likewise.
13588 (script_check_output_format): New function.
13589 * script.h (read_input_script): Update declaration.
13590 * script-c.h (script_check_output_format): Declare.
13591 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13592 (ignore_cmd): Remove OUTPUT_FORMAT.
13593 * fileread.cc (Input_file::Input_file): Add explicit this.
13594 (Input_file::will_search_for): New function.
13595 (Input_file::open): Add pindex parameter. Change all callers.
13596 * fileread.h (class Input_file): Add input_file_argument method.
13597 Declare will_search_for. Update declarations.
13598 * object.cc (make_elf_object): Add punconfigured parameter.
13599 Change all callers.
13600 * object.h (class Object): Make input_file public. Add
13601 searched_for method.
13602 (make_elf_object): Update declaration.
13603 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13605 * dirsearch.h (class Dirsearch): Update declaration.
13606 * options.h (class General_options): Add --warn-search-mismatch.
13607 * parameters.cc (Parameters::is_compatible_target): New function.
13608 * parameters.h (class Parameters): Declare is_compatible_target.
13609 * workqueue.cc (Workqueue::add_blocker): New function.
13610 * workqueue.h (class Workqueue): Declare add_blocker.
13612 * fileread.cc (Input_file::open): Remove options parameter.
13613 Change all callers.
13614 (Input_file::open_binary): Likewise.
13615 * script.cc (read_input_script): Likewise.
13616 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13617 options parameter from constructor. Change all callers.
13618 (class Read_script): Likewise.
13619 * fileread.h (class Input_file): Update declarations.
13620 * script.h (read_input_script): Update declaration.
13622 2009-03-10 Nick Clifton <nickc@redhat.com>
13624 * po/es.po: New Spanish translation.
13626 2009-03-06 Cary Coutant <ccoutant@google.com>
13628 * options.cc (parse_short_option): Keep dash_z from registering itself.
13630 2009-03-03 Ian Lance Taylor <iant@google.com>
13633 * target-reloc.h (relocate_section): Pass output_section to
13635 * i386.cc (Target_i386::should_apply_static_reloc): Add
13636 output_section parameter. Change all callers.
13637 (Target_i386::Relocate::relocate): Add output_section parameter.
13638 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13639 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13640 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13641 * testsuite/two_file_shared.sh: New script.
13642 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13643 (check_DATA): Add two_file_shared.dbg.
13644 (two_file_shared.dbg): New target.
13645 * testsuite/Makefile.in: Rebuild.
13647 2009-03-01 Ian Lance Taylor <iant@google.com>
13649 * configure.ac: Check for byteswap.h.
13650 * configure: Rebuild.
13651 * config.in: Rebuild.
13653 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13655 * layout.cc (Layout::find_or_add_kept_section): New function.
13656 (Layout::add_comdat): Removed.
13657 * layout.h (struct Kept_section): Move out of class Layout.
13658 Remove trailing underscores from field names. Add group_sections
13659 field. Rename group_ field to is_group. Change all uses.
13660 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13661 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13662 comdat_groups_ field.
13663 (Sized_relobj::include_section_group): Use
13664 find_or_add_kept_section and Kept_section::group_sections.
13665 (Sized_relobj::include_linkonce_section): Likewise.
13666 * object.cc (class Sized_relobj): Don't define Comdat_group or
13667 Comdat_group_table. Remove find_comdat_group and
13668 add_comdat_group. Remove comdat_groups_ field.
13669 * plugin.cc (include_comdat_group): Use
13670 Layout::find_or_add_kept_section.
13672 2009-02-28 Ian Lance Taylor <iant@google.com>
13674 * README: --gc-sections and map files are now supported. Document
13675 some build requirements.
13678 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13679 relocatable link set the value of the section symbol to zero.
13680 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13681 relocatable link don't include the section address in the local
13684 2009-02-27 Ian Lance Taylor <iant@google.com>
13687 * options.h (class Search_directory): Add is_system_directory.
13688 (class General_options): Declare is_in_system_directory.
13689 * options.cc (get_relative_sysroot): Make static.
13690 (get_default_sysroot): Make static.
13691 (General_optoins::is_in_system_directory): New function.
13692 * fileread.cc (Input_file::is_in_system_directory): New function.
13693 * fileread.h (class Input_file): Declare is_in_system_directory.
13694 * object.h (class Object): Add is_in_system_directory.
13695 (class Input_objects): Remove system_library_directory_ field.
13696 * object.cc (Input_objects::add_object): Don't set
13697 system_library_directory_.
13698 (input_objects::found_in_system_library_directory): Remove.
13699 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13700 parameter. Change all callers.
13701 (Symbol_table::sized_write_globals): Likewise.
13702 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13703 Call Object::is_in_system_directory.
13704 * symtab.h (class Symbol_table): Update declarations.
13707 * descriptors.h (Open_descriptor): Add is_on_stack field.
13708 * descriptors.cc (Descriptors::open): If the descriptor is on the
13709 top of the stack, remove it. Initialize is_on_stack field.
13710 (Descriptors::release): Only add pod to stack if it is not on the
13712 (Descriptors::close_some_descriptor): Clear stack_next and
13713 is_on_stack fields.
13716 * output.cc (Output_section::find_starting_output_address): Rename
13717 from starting_output_address; add PADDR parameter; change return
13719 * output.h (class Output_section): Declare
13720 find_starting_output_address instead of starting_output_address.
13721 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13722 section symbol for which we can't find a merge section.
13725 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13726 hidden or internal, force the symbol to be local.
13727 * resolve.cc (Symbol::override_visibility): Define.
13728 (Symbol::override_base): Use override_visibility.
13729 (Symbol_table::resolve): Likewise.
13730 (Symbol::override_base_with_special): Likewise.
13731 (Symbol_table::override_with_special): If the visibility is hidden
13732 or internal, force the symbol to be local.
13733 * symtab.h (class Symbol): Add set_visibility and
13734 override_visibility.
13735 * testsuite/ver_test_1.sh: New file.
13736 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13737 (check_DATA): Add ver_test_1.syms.
13738 (ver_test_1.syms): New target.
13739 * testsuite/Makefile.in: Rebuild.
13741 2009-02-25 Cary Coutant <ccoutant@google.com>
13743 * layout.cc (Layout::choose_output_section): Don't rename sections
13744 when using a linker script that has a SECTIONS clause.
13745 * Makefile.in: Regenerate.
13747 * testsuite/Makefile.am (script_test_5.sh): New test case.
13748 * testsuite/Makefile.in: Regenerate.
13749 * testsuite/script_test_5.cc: New file.
13750 * testsuite/script_test_5.sh: New file.
13751 * testsuite/script_test_5.t: New file.
13753 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13755 * archive.cc (Archive::include_member): Update calls to add_symbols.
13756 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13757 the Layout argument.
13758 * dynobj.h (do_add_symbols): Add the Layout argument.
13759 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13761 * object.h (Object::add_symbols): Add the Layout argument.
13762 (Object::do_add_symbols): Add the Layout argument.
13763 (Sized_relobj::do_add_symbols): Add the Layout argument.
13764 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13765 Unify the two versions.
13766 (Add_plugin_symbols): Remove.
13767 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13768 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13769 (Add_plugin_symbols): Remove.
13770 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13771 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13772 (Add_symbols::run): Make it work with Pulginobj.
13774 2009-02-06 Ian Lance Taylor <iant@google.com>
13776 * object.cc (Sized_relobj::do_layout): Make info message start
13777 with lower case letter.
13779 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13781 * binary.cc: Fix file comment.
13783 * options.h (enum Incremental_disposition): Define.
13784 (class General_options): Add new options: --incremental,
13785 --incremental_changed, --incremental_unchanged,
13786 --incremental_unknown. Add incremental_disposition_ and
13787 implicit_incremental_ fields.
13788 (General_options::incremental_disposition): New function.
13789 (class Position_dependent_options): Add incremental_disposition
13791 (Position_dependent_options::copy_from_options): Set incremental
13793 * options.cc (General_options::parse_incremental_changed): New
13795 (General_options::parse_incremental_unchanged): New function.
13796 (General_options::parse_incremental_unknown): New function.
13797 (General_options::General_options): Initialize new fields
13798 incremental_disposition_ and implicit_incremental_.
13799 (General_options::finalize): Check for uasge of --incremental-*
13800 without --incremental.
13802 2009-02-06 Chris Demetriou <cgd@google.com>
13804 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13805 pointer and to report location as the file name associated with
13807 (gold_undefined_symbol_at_location): New function to replace the
13808 old gold_undefined_symbol functionality.
13809 * target-reloc.h (relocate_section): Update to use
13810 gold_undefined_symbol_at_location.
13811 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13812 Call gold_undefined_symbol function rather than gold_error.
13813 * errors.h (Errors::undefined_symbol): Take location as a
13814 string, rather than calculating it from a relocation.
13815 * errors.cc (Errors::fatal): Print "fatal error:" before the
13817 (Errors::error, Errors::error_at_location): Print "error: "
13818 before the formatted message.
13819 (Errors::undefined_symbol): Take location as a string, rather
13820 than calculating it from a relocation.
13821 (gold_undefined_symbol_at_location): New function akin to
13822 old gold_undefined_symbol, calculates location from relocation.
13823 (gold_undefined_symbol): Change to take only a Symbol pointer
13824 and to report location as the file name associated with the symbol.
13825 * testsuite/debug_msg.sh: Update for changed error messages.
13826 * testsuite/undef_symbol.sh: Likewise.
13828 2009-02-04 Duncan Sands <baldrick@free.fr>
13831 * reduced_debug_output.h
13832 (Output_reduced_debug_abbrev_section::failed): Use format for
13834 (Output_reduced_debug_info_section::faild): Likewise.
13836 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13838 * script.cc (Lazy_demangler): New class.
13839 (Version_script_info::get_symbol_version_helper): Demangle a
13842 2009-01-29 Cary Coutant <ccoutant@google.com>
13844 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13846 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13848 2009-01-28 Ian Lance Taylor <iant@google.com>
13850 * version.cc (version_string): Bump to 1.9.
13852 * gold.h: Include <cstring> and <stdint.h>.
13853 * version.cc: Include <cstdio>.
13854 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13856 * reduced_debug_output.cc (insert_into_vector): Rename from
13857 Insert_into_vector; change all callers. Use Swap_unaligned to
13858 avoid aliasing issue; remove union since it is unnecessary.
13860 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13862 * Makefile.am (CCFILES): Add gc.cc.
13863 (HFILES): Add gc.h.
13864 * Makefile.in: Regenerate.
13865 * gold.cc (Gc_runner): New class.
13866 (queue_initial_tasks): Call garbage collection related tasks
13867 when corresponding options are invoked.
13868 (queue_middle_gc_tasks): New function.
13869 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13870 processed early before laying out sections during garbage collection.
13871 * gold.h (queue_middle_gc_tasks): New function.
13872 (is_prefix_of): Move from "layout.cc".
13873 * i386.cc (Target_i386::gc_process_relocs): New function.
13874 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13875 * main.cc (main): Create object of class "Garbage_collection".
13876 * object.cc (Relobj::copy_symbols_data): New function.
13877 (Relobj::is_section_name_included): New function.
13878 (Sized_relobj::do_layout): Allow this function to be called twice
13879 during garbage collection and defer layout of section during the
13881 * object.h (Relobj::get_symbols_data): New function.
13882 (Relobj::is_section_name_included): New function.
13883 (Relobj::copy_symbols_data): New function.
13884 (Relobj::set_symbols_data): New function.
13885 (Relobj::get_relocs_data): New function.
13886 (Relobj::set_relocs_data): New function.
13887 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13888 (Relobj::gc_process_relocs): New function.
13889 (Relobj::do_gc_process_relocs): New pure virtual function.
13890 (Relobj::sd_): New data member.
13891 (Sized_relobj::is_output_section_offset_invalid): New function.
13892 (Sized_relobj::do_gc_process_relocs): New function.
13893 * options.h (General_options::gc_sections): Modify to not be a no-op.
13894 (General_options::print_gc_sections): New option.
13895 * plugin.cc (Plugin_finish::run): Remove function call to
13896 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13897 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13898 * reloc.cc (Read_relocs::run): Add task to process relocs and
13899 determine unreferenced sections when doing garbage collection.
13900 (Gc_process_relocs): New class.
13901 (Sized_relobj::do_gc_process_relocs): New function.
13902 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13903 sections that are garbage collected.
13904 * reloc.h (Gc_process_relocs): New class.
13905 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13906 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13907 symbols whose corresponding sections are garbage collected.
13908 (Symbol_table::Symbol_table): Add new parameter for the garbage
13910 (Symbol_table::gc_mark_undef_symbols): New function.
13911 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13912 (Symbol_table::gc_mark_dyn_syms): New function.
13913 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13915 (Symbol_table::add_from_object): Likewise.
13916 (Symbol_table::add_from_relobj): When building shared objects, do not
13917 treat externally visible symbols as garbage.
13918 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13919 table information for static and relocatable links.
13920 * symtab.h (Symbol_table::set_gc): New function.
13921 (Symbol_table::gc): New function.
13922 (Symbol_table::gc_mark_undef_symbols): New function.
13923 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13924 (Symbol_table::gc_mark_dyn_syms): New function.
13925 (Symbol_table::gc_): New data member.
13926 * target.h (Sized_target::gc_process_relocs): New pure virtual
13928 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13929 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13931 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13933 * options.h (General_options::gc_sections): Define as a no-op for now.
13934 (General_options::no_keep_memory): Ditto.
13935 (General_options::Bshareable): Define.
13936 * options.cc (General_options::finalize): Honor -Bshareable.
13938 2009-01-20 Andreas Schwab <schwab@suse.de>
13940 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13941 read the value in the contents, since we don't use it. Use the
13942 template endianness when writing.
13943 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13945 2009-01-19 Andreas Schwab <schwab@suse.de>
13947 * configure.tgt (powerpc64-*): Fix targ_obj.
13949 2009-01-15 Ian Lance Taylor <iant@google.com>
13951 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13952 local symbols when stripping all symbols.
13954 2009-01-14 Cary Coutant <ccoutant@google.com>
13956 * output.cc (Output_reloc): Add explicit instantiations.
13958 2009-01-14 Cary Coutant <ccoutant@google.com>
13960 * archive.cc (Archive::get_elf_object_for_member): Remove call
13961 to File_read::claim_for_plugin.
13962 * descriptors.cc (Descriptors::open): Remove reference to
13964 (Descriptors::claim_for_plugin): Remove.
13965 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13966 (Descriptors::is_claimed): Remove.
13967 (claim_descriptor_for_plugin): Remove.
13968 * fileread.cc (File_read::claim_for_plugin): Remove.
13969 * fileread.h (File_read::claim_for_plugin): Remove.
13970 (File_read::descriptor): Reopen descriptor if necessary.
13971 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13972 (Plugin_manager::all_symbols_read): Add task parameter. Change
13974 (Plugin_manager::get_input_file): New function.
13975 (Plugin_manager::release_input_file): New function.
13976 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13977 corresponding data member.
13978 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13979 and pass to base constructor. Change all callers.
13980 (get_input_file, release_input_file): New functions.
13981 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13982 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13983 (Plugin_manager::all_symbols_read): Add task parameter.
13984 (Plugin_manager::get_input_file): New function.
13985 (Plugin_manager::release_input_file): New function.
13986 (Plugin_manager::task_): New data member.
13987 (Pluginobj::Pluginobj): Add filesize parameter.
13988 (Pluginobj::filename): New function.
13989 (Pluginobj::descriptor): New function.
13990 (Pluginobj::filesize): New function.
13991 (Pluginobj::filesize_): New data member.
13992 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13993 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13994 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13996 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13997 with archive libraries.
13998 * testsuite/Makefile.in: Regenerate.
13999 * testsuite/plugin_test.c (struct sym_info): New type.
14000 (get_input_file, release_input_file): New static variables.
14001 (onload): Capture new transfer vector entries.
14002 (claim_file_hook): Stop reading at end of file according to filesize.
14003 Factor out parsing of readelf output into separate function.
14004 (all_symbols_read_hook): Exercise get_input_file and release_input_file
14005 APIs and get the source file name from the symbol table. Convert
14006 source file name to corresponding object file name. Print info
14007 message when adding new input files.
14008 (parse_readelf_line): New function.
14009 * testsuite/plugin_test_1.sh: Add checks for new info messages.
14010 * testsuite/plugin_test_2.sh: Likewise.
14011 * testsuite/plugin_test_3.sh: Likewise.
14012 * testsuite/plugin_test_4.sh: New test case.
14014 2009-01-07 Ian Lance Taylor <iant@google.com>
14016 * version.cc (version_string): Bump to 1.8.
14018 2008-12-23 Cary Coutant <ccoutant@google.com>
14020 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14021 * plugin.cc (Plugin_manager::finish): Rename as
14022 layout_deferred_objects. Move cleanup to separate function.
14023 (Plugin_manager::cleanup): New function.
14024 (Plugin_finish::run): Call layout_deferred_objects and cleanup
14026 * plugin.h (Plugin_manager::finish): Rename as
14027 layout_deferred_objects.
14028 (Plugin_manager::cleanup): New function.
14029 (Plugin_manager::cleanup_done): New field.
14031 2008-12-23 Cary Coutant <ccoutant@google.com>
14033 * plugin.cc (is_visible_from_outside): New function.
14034 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14035 so we don't return "IR only" status for exported symbols or -r links.
14037 * testsuite/Makefile.am (plugin_test_3): New test case.
14038 * testsuite/Makefile.in: Regenerate.
14039 * testsuite/plugin_test_3.sh: New file.
14041 2008-12-22 Cary Coutant <ccoutant@google.com>
14043 * object.cc (Sized_relobj::layout_section): New function.
14044 (Sized_relobj::do_layout): Defer layout of input sections until after
14045 plugin has provided replacement files.
14046 (Sized_relobj::do_layout_deferred_sections): New function.
14047 * object.h (Relobj::set_section_offset): Remove virtual keyword.
14048 (Relobj::layout_deferred_sections): New function.
14049 (Relobj::do_layout_deferred_sections): New function.
14050 (Sized_relobj::do_layout_deferred_sections): New function.
14051 (Sized_relobj::layout_section): New function.
14052 (Sized_relobj::Deferred_layout): New structure.
14053 (Sized_relobj::deferred_layout_): New field.
14054 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14055 Change all callers. Layout deferred sections.
14056 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
14058 (Plugin_hook::run): Move code from do_plugin_hook inline.
14059 (Plugin_hook::do_plugin_hook): Remove.
14060 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14061 (Plugin_manager::finish): Renamed, was cleanup.
14062 (Plugin_manager::should_defer_layout): New function.
14063 (Plugin_manager::add_deferred_layout_object): New function.
14064 (Plugin_manager::Deferred_layout_list): New type.
14065 (Plugin_manager::deferred_layout_objects_): New field.
14066 (Plugin_hook::do_plugin_hook): Remove.
14068 2008-12-17 Ian Lance Taylor <iant@google.com>
14070 * options.h (class General_options): Add --no case for
14073 2008-12-16 Cary Coutant <ccoutant@google.com>
14075 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14077 (Plugin_manager::claim_file): Create plugin object even if
14078 plugin did not call the add_symbols callback.
14079 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14080 asking for more symbols than were added.
14081 * testsuite/Makefile.am (plugin_test_1): Add test case with
14083 (empty.syms): New target.
14084 * testsuite/Makefile.in: Regenerate.
14085 * testsuite/plugin_test.c (claim_file_hook): Add new debug
14086 message. Don't call add_symbols if no globals.
14087 (all_symbols_read_hook): Don't provide replacement for empty
14090 2008-12-12 Ian Lance Taylor <iant@google.com>
14092 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14093 r_type == 0 for a local symbol with r_sym == 0.
14094 (scan_relocatable_relocs): Pass r_sym to
14095 local_non_section_strategy.
14096 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14099 * configure.ac: Update test for TLS descriptors: they are
14100 supported as of glibc 2.9.
14101 * configure: Rebuild.
14103 2008-12-11 Ian Lance Taylor <iant@google.com>
14106 * target-reloc.h (Default_scan_relocatable_relocs): For each
14107 function, map r_type == 0 to RELOC_DISCARD.
14109 2008-12-10 Cary Coutant <ccoutant@google.com>
14111 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14112 object to override a kept COMDAT group from a plugin object.
14114 2008-12-09 Ian Lance Taylor <iant@google.com>
14117 * yyscript.y (file_cmd): Handle INPUT.
14119 * testsuite/initpri1.c: Change all declarations to be full
14120 prototypes by adding void, to avoid compiler warnings.
14122 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
14124 * options.cc (General_options::parse_plugin_opt): New.
14125 (General_options::add_plugin): The argument now is just the filename.
14126 (General_options::add_plugin_option): New.
14127 * options.h (plugin_opt): New.
14128 (add_plugin): Change argument name.
14129 (add_plugin_option): New.
14130 * plugin.cc (Plugin::load): Don't parse the plugin option.
14131 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14132 (Plugin::add_option): New.
14133 (Plugin::args_): Change type.
14134 (Plugin::filename_): New.
14135 (Plugin_manager::add_plugin_option): New.
14136 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14137 * testsuite/Makefile.in: Regenerate.
14139 2008-12-05 Cary Coutant <ccoutant@google.com>
14141 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14142 Handle --strip-lto-sections option.
14143 * options.h (strip_lto_sections): New option.
14145 2008-12-01 Cary Coutant <ccoutant@google.com>
14147 * plugin.cc (ld_plugin_message): Change format parameter to const.
14148 Fix mismatch between new[] and delete.
14150 2008-11-14 Cary Coutant <ccoutant@google.com>
14152 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14155 2008-11-05 Craig Silverstein <csilvers@google.com>
14157 * options.cc (General_options::parse_dynamic_list): New function.
14158 * options.h (General_options): New flags dynamic_list,
14159 dynamic_list_data, dynamic_list_cpp_new, and
14160 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
14161 (General_options::in_dynamic_list): New function.
14162 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14163 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14164 (Lex::can_continue_name): Likewise.
14166 (read_script_file): New parameter script_options.
14167 (read_dynamic_list): New function.
14168 (Script_options::define_dynamic_list): New function.
14169 (dynamic_list_keyword_parsecodes): New variable.
14170 (dynamic_list_keywords): New variable.
14171 * script.h (Script_options::define_dynamic_list): New function
14173 (read_dynamic_list): New function prototype.
14174 * symtab.cc (strprefix): New macro.
14175 (Symbol::should_add_dynsym_entry): Support dynamic_list,
14176 dynamic_list_data, dynamic_list_cpp_new, and
14177 dynamic_list_cpp_typeinfo.
14178 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14179 (dynamic_list_expr): New rule.
14180 (dynamic_list_nodes): Likewise.
14181 (dynamic_list_node): Likewise.
14182 * testsuite/Makefile.am (dynamic_list): New test.
14183 * testsuite/Makefile.in: Regenerated.
14184 * testsuite/dynamic_list.t: New file.
14185 * testsuite/dynamic_list.sh: New file.
14187 2008-11-05 Craig Silverstein <csilvers@google.com>
14189 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14190 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14191 (t11_last): Likewise.
14192 * testsuite/ver_test_6.c (main): Likewise.
14194 2008-10-07 Cary Coutant <ccoutant@google.com>
14196 * options.c (General_options::finalize): Add check for -static and
14198 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14201 2008-10-02 Cary Coutant <ccoutant@google.com>
14203 * plugin.cc (make_sized_plugin_object): Fix conditional
14204 compilation to work when not all targets are enabled.
14206 2008-09-29 Cary Coutant <ccoutant@google.com>
14208 * archive.cc (Archive::get_file_and_offset): Use filename instead
14209 of name to get library path.
14210 (Archive::include_member): Unlock external member of a thin archive.
14212 * testsuite/Makefile.am (TEST_AR): New variable.
14213 (thin_archive_test_1): New test.
14214 (thin_archive_test_2): New test.
14215 * testsuite/Makefile.in: Regenerate.
14216 * testsuite/thin_archive_main.cc: New file.
14217 * testsuite/thin_archive_test_1.cc: New file.
14218 * testsuite/thin_archive_test_2.cc: New file.
14219 * testsuite/thin_archive_test_3.cc: New file.
14220 * testsuite/thin_archive_test_4.cc: New file.
14222 2008-09-29 Cary Coutant <ccoutant@google.com>
14224 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14225 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14227 (Sized_relobj::do_finalize_local_symbols): Likewise.
14228 (Sized_relobj::map_to_kept_section): Likewise.
14229 * object.h (Sized_relobj::invalid_address): New constant.
14230 (Sized_relobj::do_output_section_offset): Check for invalid_address
14232 * output.cc (Output_reloc::local_section_offset): Use constant
14233 invalid_address instead of -1U.
14234 (Output_reloc::get_address): Likewise.
14235 (Output_section::output_address): Change -1U to -1ULL.
14236 * output.h (Output_reloc::invalid_address): New constant.
14237 * reloc.cc (Sized_relobj::write_sections): Use constant
14238 invalid_address instead of -1U.
14239 (Sized_relobj::relocate_sections): Likewise.
14240 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14241 values for merge sections.
14242 * target-reloc.h (relocate_for_relocatable): Use constant
14243 invalid_address instead of -1U.
14245 2008-09-19 Cary Coutant <ccoutant@google.com>
14247 Add plugin functionality for link-time optimization (LTO).
14248 * configure.ac (plugins): Add --enable-plugins option.
14249 * configure: Regenerate.
14250 * config.in: Regenerate.
14251 * Makefile.am (LIBDL): New variable.
14252 (CCFILES): Add plugin.cc.
14253 (HFILES): Add plugin.h.
14254 (ldadd_var): Add LIBDL.
14255 * Makefile.in: Regenerate.
14257 * archive.cc: Include "plugin.h".
14258 (Archive::setup): Don't preread archive symbols when using a plugin.
14259 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
14260 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14262 (Archive::include_member): Add symbols from plugin objects.
14263 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14264 * descriptors.cc (Descriptors::open): Check for file descriptors
14265 abandoned by plugins.
14266 (Descriptors::claim_for_plugin): New function.
14267 * descriptors.h (Descriptors::claim_for_plugin): New function.
14268 (Open_descriptor::is_claimed): New field.
14269 (claim_descriptor_for_plugin): New function.
14270 * fileread.cc (File_read::claim_for_plugin): New function.
14271 * fileread.h (File_read::claim_for_plugin): New function.
14272 (File_read::descriptor): New function.
14273 * gold.cc: Include "plugin.h".
14274 (queue_initial_tasks): Add task to call plugin hooks for generating
14276 * main.cc: Include "plugin.h".
14277 (main): Load plugin libraries.
14278 * object.h (Pluginobj): Declare.
14279 (Object::pluginobj): New function.
14280 (Object::do_pluginobj): New function.
14281 (Object::set_target): New function.
14282 * options.cc: Include "plugin.h".
14283 (General_options::parse_plugin): New function.
14284 (General_options::General_options): Initialize plugins_ field.
14285 (General_options::add_plugin): New function.
14286 * options.h (Plugin_manager): Declare.
14287 (General_options): Add --plugin option.
14288 (General_options::has_plugins): New function.
14289 (General_options::plugins): New function.
14290 (General_options::add_plugin): New function.
14291 (General_options::plugins_): New field.
14292 * plugin.cc: New file.
14293 * plugin.h: New file.
14294 * readsyms.cc: Include "plugin.h".
14295 (Read_symbols::do_read_symbols): Check for archive before checking
14296 for ELF file. Call plugin hooks to claim files.
14297 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14298 from a real object file; force override when processing replacement
14300 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14301 (Symbol::init_base_object): Likewise.
14302 (Symbol::init_base_output_data): Likewise.
14303 (Symbol::init_base_output_segment): Likewise.
14304 (Symbol::init_base_constant): Likewise.
14305 (Symbol::init_base_undefined): Likewise.
14306 (Symbol::output_section): Assert that object is not a plugin.
14307 (Symbol_table::add_from_pluginobj): New function.
14308 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14310 (Symbol_table::sized_write_globals): Likewise.
14311 (Symbol_table::add_from_pluginobj): Instantiate template.
14312 * symtab.h (Sized_pluginobj): Declare.
14313 (Symbol::in_real_elf): New function.
14314 (Symbol::set_in_real_elf): New function.
14315 (Symbol::in_real_elf_): New field.
14316 (Symbol_table::add_from_pluginobj): New function.
14318 * testsuite/Makefile.am (AM_CFLAGS): New variable.
14319 (LIBDL): New variable.
14320 (LDADD): Add LIBDL.
14321 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14322 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14323 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14324 (MOSTLYCLEANFILES): Likewise.
14325 * testsuite/Makefile.in: Regenerate.
14326 * testsuite/plugin_test.c: New file.
14327 * testsuite/plugin_test_1.sh: New file.
14328 * testsuite/plugin_test_2.sh: New file.
14330 2008-09-16 Ian Lance Taylor <iant@google.com>
14332 * target-reloc.h (relocate_section): Check whether a symbol is
14333 defined by the ABI before reporting an undefined symbol error.
14334 * target.h (Target::is_defined_by_abi): Make parameter const.
14335 (Target::do_is_defined_by_abi): Likewise.
14336 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14337 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14338 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14339 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14340 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14341 * testsuite/Makefile.in: Rebuild.
14343 * fileread.cc (make_view): Add casts to avoid warning.
14345 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14347 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14348 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14350 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14352 * options.h (General_options::output_is_executable): New.
14353 (General_options::output_is_pie): New.
14354 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14355 for shared libraries.
14356 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14358 2008-09-11 Chris Demetriou <cgd@google.com>
14360 * options.h (origin): New -z option.
14361 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14362 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14365 2008-09-05 Cary Coutant <ccoutant@google.com>
14367 * fileread.cc (File_read::make_view): Add check for attempt to map
14368 beyond end of file.
14370 2008-09-05 Cary Coutant <ccoutant@google.com>
14372 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14373 explicit instantiations.
14375 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14378 * options.cc (General_options::finalize): Allow undefined symbols
14379 in shlibs if linking -shared.
14382 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14383 symbols as not needing a dynsym entry.
14385 2008-08-20 Craig Silverstein <csilvers@google.com>
14387 * fileread.cc (File_read::open): Do not lock the file unless it
14388 was successfully opened.
14390 2008-08-14 Cary Coutant <ccoutant@google.com>
14392 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14393 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14394 * testsuite/tls_test.cc (struct int128): 128-bit struct
14395 for testing TLS relocs with non-zero addend.
14396 (v12): New TLS variable.
14398 (t_last): Add check for v12.
14399 * testsuite/tls_test.h (t12): New function.
14400 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14402 2008-08-13 Ian Lance Taylor <iant@google.com>
14404 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14405 set tls_segment_ or relro_segment_.
14406 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14408 * output.h (Output_section::clear_is_relro): New function.
14409 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14410 sections specially even when output_data_ is empty.
14411 (Output_segment::maximum_alignment): When first section is relro,
14412 only force alignment for PT_LOAD segments.
14413 * script.cc (script_data_segment_align): New function.
14414 (script_data_segment_relro_end): New function.
14415 * script-c.h (script_data_segment_align): Declare.
14416 (script_data_segment_relro_end): Declare.
14417 * script-sections.h (class Script_sections): Declare
14418 data_segment_align and data_segment_relro_end. Add fields
14419 segment_align_index_ and saw_relro_end_.
14420 * script-sections.cc (class Sections_element): Add set_is_relro
14421 virtual function. Add new bool* parameter to place_orphan_here.
14422 Add get_output_section virtual function.
14423 (class Output_section_definition): Add set_is_relro. Add new
14424 bool* parameter to place_orphan_here. Add get_output_section.
14425 Add is_relro_ field.
14426 (Output_section_definition::Output_section_definition): Initialize
14427 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14428 and is_relro_ fields.
14429 (Output_section_definition::place_orphan_here): Add is_relro
14431 (Output_section_definition::set_section_addresses): Set relro for
14433 (Output_section_definition::alternate_constraint): Likewise.
14434 (class Orphan_output_section): Add new bool* parameter to
14435 place_orphan_here. Add get_output_section.
14436 (Orphan_output_section::place_orphan_here): Add is_relro
14438 (Script_sections::Script_sections): Initialize
14439 data_segment_align_index_ and saw_relro_end_.
14440 (Script_sections::data_segment_align): New function.
14441 (Script_sections::data_segment_relro_end): New function.
14442 (Script_sections::place_orphan): Set or clear is_relro.
14443 (Script_sections::set_section_addresses): Force alignment of first
14445 * yyscript.y (exp): Call script_data_segment_align and
14446 script_data_segment_relro_end.
14447 * testsuite/relro_script_test.t: New file.
14448 * testsuite/relro_test.cc (using_script): Declare.
14449 (t1, t2): Test using_script.
14450 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14451 (relro_script_test_SOURCES): Define.
14452 (relro_script_test_DEPENDENCIES): Define.
14453 (relro_script_test_LDFLAGS): Define.
14454 (relro_script_test_LDADD): Define.
14455 (relro_script_test.so): New target.
14456 * testsuite/Makefile.in: Rebuild.
14458 2008-08-06 Cary Coutant <ccoutant@google.com>
14460 * archive.cc (Archive::total_archives, Archive::total_members)
14461 (Archive::total_members_loaded): New variables.
14462 (Archive::setup): Add parameter. Add option to preread
14464 (Archive::read_armap): Add counter.
14465 (Archive::get_file_and_offset): New function.
14466 (Archive::get_elf_object_for_member): New function.
14467 (Archive::read_all_symbols): New function.
14468 (Archive::read_symbols): New function.
14469 (Archive::add_symbols): Add counters.
14470 (Archive::include_all_members): Use armap to find members if it's
14472 (Archive::include_member): Skip reading symbols if already read.
14473 Factored code into Archive::get_file_and_offset and
14474 Archive::get_elf_object_for_member. Changed call to
14475 Mapfile::report_include_archive_member.
14476 (Archive::print_stats): New function.
14477 * archive.h: Declare Object and Read_symbols_data classes.
14478 (Archive::Archive): Add initializers for new members.
14479 (Archive::setup): Add parameter.
14480 (Archive::print_stats): New function.
14481 (Archive::total_archives, Archive::total_members)
14482 (Archive::total_members_loaded): New variables.
14483 (Archive::get_file_and_offset): New function.
14484 (Archive::get_elf_object_for_member): New function.
14485 (Archive::read_all_symbols): New function.
14486 (Archive::read_symbols): New function.
14487 (Archive::Archive_member): New class.
14488 (Archive::members_): New member.
14489 (Archive::num_members_): New member.
14490 * main.cc: Include archive.h.
14491 (main): Call Archive::print_stats.
14492 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14493 archive parameter; member_name is now the fully-decorated name.
14494 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14495 * options.h: (General_options): Add --preread-archive-symbols option.
14496 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14499 2008-08-04 Ian Lance Taylor <iant@google.com>
14501 * symtab.h (Symbol::use_plt_offset): New function.
14502 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14503 * powerpc.cc (Relocate::relocate): Likewise.
14504 * sparc.cc (Relocate::relocate): Likewise.
14505 * x86_64.cc (Relocate::relocate): Likewise.
14506 * testsuite/weak_plt.sh: New test.
14507 * testsuite/weak_plt_main.cc: New test.
14508 * testsuite/weak_plt_shared.cc: New test.
14509 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14510 (check_PROGRAMS): Add weak_plt.
14511 (check_DATA): Add weak_plt_shared.so.
14512 (weak_plt_main_pic.o, weak_plt): New targets.
14513 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14514 * testsuite/Makefile.in: Rebuild.
14516 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14518 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14519 * testsuite/Makefile.in: Rebuild.
14521 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14523 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14524 * Makefile.in: Regenerate.
14525 * po/POTFILES.in: Regenerate.
14527 2008-07-29 Ian Lance Taylor <iant@google.com>
14529 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14530 symbols before other symbols.
14531 * testsuite/script_test_2.cc (test_addr): Declare.
14532 (test_addr_alias): Declare.
14533 (main): Check that test_addr and test_addr_alias have the right
14535 * testsuite/script_test_2.t: Define test_addr_alias and
14538 2008-07-24 Ian Lance Taylor <iant@google.com>
14541 * descriptors.cc: New file.
14542 * descriptors.h: New file.
14543 * gold-threads.h (class Hold_optional_lock): New class.
14544 * fileread.cc: Include "descriptors.h".
14545 (File_read::~File_read): Release descriptor rather than closing
14547 (File_read::open) [file]: Call open_descriptor rather than open.
14548 Set is_descriptor_opened_.
14549 (File_read::open) [memory]: Assert that descriptor is not open.
14550 (File_read::reopen_descriptor): New function.
14551 (File_read::release): Release descriptor.
14552 (File_read::do_read): Make non-const. Reopen descriptor.
14553 (File_read::read): Make non-const.
14554 (File_read::make_view): Reopen descriptor.
14555 (File_read::do_readv): Likewise.
14556 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14557 Update declarations.
14558 * layout.cc: Include "descriptors.h".
14559 (Layout::create_build_id): Use open_descriptor rather than open.
14560 * output.cc: Include "descriptors.h".
14561 (Output_file::open): Use open_descriptor rather than open.
14562 * archive.cc (Archive::const_iterator): Change Archive to be
14564 (Archive::begin, Archive::end): Make non-const.
14565 (Archive::count_members): Likewise.
14566 * archive.h (class Archive): Update declarations.
14567 * object.h (Object::read): Make non-const.
14568 * Makefile.am (CCFILES): Add descriptors.cc.
14569 (HFILES): Add descriptors.h.
14570 * Makefile.in: Rebuild.
14573 * gold.h: Always include <clocale>. Add Solaris workarounds
14574 following code in binutils/sysdep.h.
14577 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14578 this->eh_frame_hdr_ is NULL before using it.
14580 * dynobj.cc (Versions::Versions): Update comment.
14582 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14583 the base version name.
14585 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14586 array size plus one.
14587 (Stringpool_template::set_string_offsets): Subtract one from key
14588 before using it as an array index.
14589 (Stringpool_template::get_offset_with_length): Likewise.
14590 (Stringpool_template::write_to_buffer): Likewise.
14591 * stringpool.h (Stringpool_template::get_offset_from_key):
14594 2008-07-23 Ian Lance Taylor <iant@google.com>
14597 * object.h (Merged_symbol_value::value): Do our best to handle a
14601 * script.cc (Version_script_info::get_versions): Don't add empty
14602 version tag to return value.
14603 (Version_script_info::get_symbol_version_helper): Change return
14604 type to bool. Add pversion parameter. Change all callers.
14605 (script_register_vers_node): Don't require a non-NULL tag.
14606 * script.h (class Version_script_info): Update declarations.
14607 (Version_script_info::get_symbol_version): Change return type to
14608 bool. Add version parameter. Change all callers.
14609 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14610 handling. Handle an empty version from a version script.
14611 (Symbol_table::define_special_symbol): Likewise.
14612 * testsuite/ver_test_10.script: New file.
14613 * testsuite/ver_test_10.sh: New file.
14614 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14615 (check_DATA): Add ver_test_10.syms.
14616 (ver_test_10.syms, ver_test_10.so): New target.
14617 * testsuite/Makefile.in: Rebuild.
14619 2008-07-23 Simon Baldwin <simonb@google.com>
14621 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14622 to zero for undefined symbols from dynamic libraries.
14624 2008-07-23 Ian Lance Taylor <iant@google.com>
14626 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14627 Change all callers.
14628 * symtab.h (class Symbol_table): Update declaration.
14629 * testsuite/ver_test_9.cc: New file.
14630 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14631 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14632 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14633 (ver_test_9.so, ver_test_9.o): New targets.
14634 * testsuite/Makefile.in: Rebuild.
14636 2008-07-22 Ian Lance Taylor <iant@google.com>
14638 * options.h (class General_options): Define --check-sections.
14639 * layout.cc (Layout::set_segment_offsets): Handle
14642 * options.h (class General_options): Define -n/--nmagic and
14644 * options.cc (General_options::finalize): For -n/--nmagic or
14645 -N/--omagic, set -static.
14646 * layout.cc (Layout::attach_allocated_section_to_segment): If
14647 -N/--omagic, don't put read-only and read-write sections in
14648 different segments.
14649 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14650 finding a read-only segment.
14651 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14652 don't set the minimum segment alignment to the common page size,
14653 and don't set the file offset to the address modulo the page size.
14654 * script-sections.cc (Script_sections::create_segments): If
14655 -n/--omagic, don't put read-only and read-write sections in
14656 different segments.
14658 * cref.cc: New file.
14659 * cref.h: New file.
14660 * options.h (class General_options): Add --print-symbol-counts.
14661 * main.cc (main): Issue defined symbol report if requested.
14662 * archive.cc (Archive::interpret_header): Make into a const member
14664 (Archive::add_symbols): Call Input_objects::archive_start and
14666 (Archive::const_iterator): Define new class.
14667 (Archive::begin, Archive::end): New functions.
14668 (Archive::include_all_members): Rewrite to use iterator.
14669 (Archive::count_members): New function.
14670 * archive.h (class Archive): Update declarations.
14671 (Archive::filename): New function.
14672 * object.cc: Include "cref.h".
14673 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14674 (Sized_relobj::do_get_global_symbol_counts): New function.
14675 (Input_objects::add_object): Add object to cross-referencer.
14676 (Input_objects::archive_start): New function.
14677 (Input_objects::archive_stop): New function.
14678 (Input_objects::print_symbol_counts): New function.
14679 * object.h: Declare Cref and Archive.
14680 (Object::get_global_symbol_counts): New function.
14681 (Object::do_get_global_symbol_counts): New pure virtual function.
14682 (class Sized_relobj): Add defined_count_ field. Update
14684 (class Input_objects): Add cref_ field. Update constructor.
14685 Update declarations.
14686 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14688 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14690 (Sized_dynobj::do_get_global_symbol_counts): New function.
14691 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14692 defined_count_. Update declarations. Define Symbols typedef.
14693 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14694 parameter. Change all callers.
14695 (Symbol_table::add_from_dynobj): Add sympointers and defined
14696 parameters. Change all callers.
14697 * symtab.h (class Symbol_table): Update declarations.
14698 * Makefile.am (CCFILES): Add cref.cc.
14699 (HFILES): Add cref.h.
14700 * Makefile.in: Rebuild.
14702 2008-07-22 Simon Baldwin <simonb@google.com>
14704 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14705 to zero when writing undefined symbols.
14707 2008-07-22 Ian Lance Taylor <iant@google.com>
14709 * output.cc (Output_section::add_input_section): Don't try to
14710 merge empty merge sections.
14712 2008-07-21 Craig Silverstein <csilvers@google.com>
14714 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14715 Include symbol version in error message.
14717 2008-07-20 Chris Demetriou <cgd@google.com>
14719 * configure.ac (gold_cv_c_random_seed): New configured variable.
14720 (RANDOM_SEED_CFLAGS): New substituted variable.
14721 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14722 * configure: Rebuild.
14723 * Makefile.in: Likewise.
14724 * testsuite/Makefile.in: Likewise.
14726 2008-07-18 Ian Lance Taylor <iant@google.com>
14728 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14729 where we see NAME/NULL and NAME/VERSION as separate symbols.
14730 * testsuite/ver_test_main.cc (main): Call t4.
14731 (t4, t4_2a): Define.
14732 * testsuite/ver_test_2.cc (t4_2): Define.
14733 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14734 * testsuite/ver_test_4.cc (t4_2a): Define.
14735 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14736 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14738 2008-07-17 Ian Lance Taylor <iant@google.com>
14740 * dynobj.cc (Versions::add_def): If we give an error about a
14741 missing version, go ahead and create the version anyhow.
14743 2008-07-10 Ian Lance Taylor <iant@google.com>
14745 Handle output sections with more than 0x7fffffff bytes.
14746 * object.h (class Relobj): Change map_to_output_ to
14747 output_sections_, and just keep a section pointer. Change all
14748 uses. Move comdat group support to Sized_relobj.
14749 (Relobj::is_section_specially_mapped): Remove.
14750 (Relobj::output_section): Remove poff parameter. Change all
14752 (Relobj::output_section_offset): New function.
14753 (Relobj::set_section_offset): Rewrite.
14754 (Relobj::map_to_output): Remove.
14755 (Relobj::output_sections): New function.
14756 (Relobj::do_output_section_offset): New pure virtual function.
14757 (Relobj::do_set_section_offset): Likewise.
14758 (class Sized_relobj): Add section_offsets_ field. Add comdat
14759 group support from Relobj. Update declarations.
14760 (Sized_relobj::get_output_section_offset): New function.
14761 (Sized_relobj::do_output_section_offset): New function.
14762 (Sized_relobj::do_set_section_offset): New function.
14763 * object.cc (Relobj::output_section_address): Remove.
14764 (Sized_relobj::Sized_relobj): Initialize new fields.
14765 (Sized_relobj::include_section_group): Cast find_kept_object to
14767 (Sized_relobj::include_linkonce_section): Likewise.
14768 (Sized_relobj::do_layout): Use separate arrays for output section
14770 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14772 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14773 output_sections and section_offsets.
14774 (Sized_relobj::write_local_symbols): Likewise.
14775 (map_to_kept_section): Compute output address directly.
14776 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14777 output_sections and section_offsets.
14778 (Sized_relobj::write_sections): Likewise.
14779 (Sized_relobj::relocate_sections): Likewise.
14780 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14781 * output.h (class Output_reloc): Update declarations. Change
14782 u2_.relobj to Sized_relobj*.
14783 (class Output_data_reloc): Change add functions to use
14785 * output.cc (Output_reloc::Output_reloc): Change relobj to
14787 (Output_reloc::local_section_offset): Change return type to
14788 Elf_Addr. Use get_output_section_offset.
14789 (Output_reloc::get_address): Likewise.
14790 (Output_section::is_input_address_mapped): Don't call
14791 is_section_specially_mapped.
14792 (Output_section::output_offset): Likewise.
14793 (Output_section::output_address): Likewise.
14794 (Output_section::starting_output_address): Likewise.
14795 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14796 parameter to Sized_relobj*.
14797 (Copy_relocs::need_copy_reloc): Likewise.
14798 (Copy_relocs::save): Likewise.
14799 * copy-relocs.h (class Copy_relocs): Update declarations.
14800 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14801 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14802 * target-reloc.h (relocate_for_relocatable): Change
14803 offset_in_output_section type to Elf_Addr. Change code that uses
14805 * layout.cc (Layout::layout): Always set *off.
14806 * mapfile.cc (Mapfile::print_input_section): Use
14807 output_section_offset.
14808 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14810 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14811 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14812 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14814 2008-07-03 Ian Lance Taylor <iant@google.com>
14816 * layout.cc (Layout::include_section): Do not discard unrecognized
14817 SHT_STRTAB sections.
14819 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14821 * script.cc (Lex::can_continue_name): Make '?' allowable in
14822 version-script names.
14823 * testsuite/version_script.map: Change glob pattern to use '?'
14825 2008-06-30 Manish Singh <yosh@gimp.org>
14828 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14831 2008-06-30 Ian Lance Taylor <iant@google.com>
14835 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14836 versions]: Don't try to read the value in the contents, since we
14837 don't use it. Use the template endianness when writing.
14839 2008-06-25 Cary Coutant <ccoutant@google.com>
14841 * fileread.cc (File_read::make_view): Assert on zero-length view.
14842 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14843 symbol table when there are no symbols to read.
14845 2008-06-23 Craig Silverstein <csilvers@google.com>
14847 * version.cc (version_string): Bump to 1.7
14849 2008-06-18 Craig Silverstein <csilvers@google.com>
14851 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14852 constant 0xFFFF to type Valtype.
14853 (Powerpc_relocate_functions::rel16_ha): Likewise.
14855 2008-06-17 Ian Lance Taylor <iant@google.com>
14857 * output.h (Output_section::Input_section): Initialize p2align_ to
14858 zero for Output_section_data constructors.
14859 (Output_section::Input_section::addralign): If not an input
14860 section, return the alignment of the Output_section_data.
14861 * testsuite/copy_test.cc: New file.
14862 * testsuite/copy_test_1.cc: New file.
14863 * testsuite/copy_test_2.cc: New file.
14864 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14865 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14866 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14867 (copy_test_1_pic.o, copy_test_1.so): New targets.
14868 (copy_test_2_pic.o, copy_test_2.so): New targets.
14869 * testsuite/Makefile.in: Rebuild.
14871 * script-sections.cc (Script_sections::place_orphan): Initialize
14872 local variable exact.
14874 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14876 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14878 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14879 David S. Miller <davem@davemloft.net>
14881 * powerpc.cc: New file.
14882 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14883 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14884 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14885 * Makefile.in: Rebuild.
14887 2008-06-09 Ian Lance Taylor <iant@google.com>
14889 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14891 (throwing, orig_terminate): New static variables.
14892 (terminate_handler): New static function.
14893 (t2): Set terminate handler.
14895 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14898 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14901 2008-05-30 Cary Coutant <ccoutant@google.com>
14903 * archive.cc (Archive::include_all_members) Correct to step
14904 over symbol table and extended name table in thin archives.
14906 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14909 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14912 2008-05-28 Caleb Howe <cshowe@google.com>
14914 * reduced_debug_output.cc: New file.
14915 * reduced_debug_output.h: New file.
14916 * options.h (class General_options): Add --strip-debug-non-line.
14917 * options.cc (General_options::finalize): Add strip_debug_non_line
14918 to the strip heirarchy.
14919 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14921 * layout.cc: Include "reduced_debug_output.h".
14922 (Layout::Layout): Initialize new fields.
14923 (line_only_debug_sections): New static array.
14924 (is_lines_only_debug_sections): New static inline function.
14925 (Layout::include_section): Handle --strip-debug-non-line.
14926 (Layout::make_output_section): If --strip-debug-non-line, build
14927 new output sections for .debug_abbrev and .debug_info.
14928 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14929 gold. Warn about possible overflow.
14930 (read_signed_LEB_128): Likewise.
14931 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14932 (read_signed_LEB_128): Declare.
14933 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14934 (HFILES): Add reduced_debug_output.h.
14935 * Makefile.in: Rebuild.
14937 2008-05-21 Ian Lance Taylor <iant@google.com>
14939 * mapfile.cc: New file.
14940 * mapfile.h: New file.
14941 * options.h (class General_options): Add -M/--print-map and -Map.
14942 * options.cc (General_options::finalize): Make -M equivalent to
14944 * main.cc: Include <cstdio> and "mapfile.h".
14945 (main): Open mapfile if requested.
14946 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14947 constructor. Change caller.
14948 (queue_initial_tasks): Add mapfile parameter. Change caller.
14949 (queue_middle_tasks): Likewise.
14950 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14952 * archive.cc: Include "mapfile.h".
14953 (Archive::add_symbols): Add mapfile parameter. Change all
14954 callers. Pass mapfile, symbol, and reason to include_member.
14955 (Archive::include_all_members): Add mapfile parameter. Change all
14957 (Archive::include_member): Add mapfile, sym, and why parameters.
14958 Change all callers. Report inclusion to map file.
14959 * archive.h: Include "fileread.h".
14960 (class Archive): Update declarations.
14961 (Archive::file): New const method.
14962 (class Add_archive_symbols): Add mapfile_ field. Update
14963 constructor. Change all callers.
14964 * readsyms.h (class Read_symbols): Likewise.
14965 (class Finish_group): Likewise.
14966 (class Read_script): Likewise.
14967 * common.cc: Include "mapfile.h".
14968 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14970 (Symbol_table::do_allocate_commons): Likewise.
14971 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14972 symbol allocation to mapfile.
14973 * common.h (class Allocate_commons_task): Add mapfile_ field.
14974 Update constructor. Change all callers.
14975 * symtab.h (class Symbol_table): Update declarations.
14976 * layout.cc: Include "mapfile.h".
14977 (Layout_task_runner::run): Print information to mapfile.
14978 (Layout::create_gold_note): Change Output_data_fixed_space to
14979 Output_data_zero_fill.
14980 (Layout::create_build_id): Likewise.
14981 (Layout::print_to_mapfile): New function.
14982 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14983 constructor. Change caller.
14984 (class Layout): Declare print_to_mapfile.
14985 * output.cc (Output_section::Input_section::print_to_mapfile): New
14987 (Output_section::add_input_section): If producing a map, always
14988 add to input_sections_ list.
14989 (Output_section::do_print_to_mapfile): New function.
14990 (Output_segment::print_sections_to_mapfile): New function.
14991 (Output_segment::print_section_list_to_mapfile): New function.
14992 * output.h: Include "mapfile.h".
14993 (Output_data::print_to_mapfile): New function.
14994 (Output_data::do_print_to_mapfile): New virtual function.
14995 (Output_segment_headers::do_print_to_mapfile): New function.
14996 (Output_file_header::do_print_to_mapfile): New function.
14997 (Output_data_const::do_print_to_mapfile): New function.
14998 (class Output_data_const_buffer): Add map_name_ field. Update
14999 constructor. Change all callers. Add do_print_to_mapfile
15001 (class Output_data_fixed_space): Likewise.
15002 (class Output_data_space): Likewise.
15003 (class Output_data_zero_fill): New class.
15004 (Output_data_strtab::do_print_to_mapfile): New function.
15005 (Output_data_reloc_base::do_print_to_mapfile): New function.
15006 (Output_relocatable_relocs::do_print_to_mapfile): New function.
15007 (Output_data_group::do_print_to_mapfile): New function.
15008 (Output_data_got::do_print_to_mapfile): New function.
15009 (Output_data_dynamic::do_print_to_mapfile): New function.
15010 (Output_symtab_xindex::do_print_to_mapfile): New function.
15011 (class Output_section): Declare do_print_to_mapflie. Declare
15012 print_to_mapfile in Input_section.
15013 (class Output_segment): Declare new functions.
15014 * object.h (Sized_relobj::symbol_count): New function.
15015 * script-sections.cc
15016 (Output_section_element_dot_assignment::set_section_addresses):
15017 Change Output_data_fixed_space to Output_data_zero_fill.
15018 (Output_data_expression::do_print_to_mapfile): New function.
15019 * script.cc (read_input_script): Add mapfile parameter. Change
15021 * script.h (read_input_script): Update declaration.
15022 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15023 (Eh_frame::do_print_to_mapfile): New function.
15024 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15025 (Output_merge_string::do_print_to_mapfile): New function.
15026 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15028 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15030 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15032 * Makefile.am (CCFILES): Add mapfile.cc.
15033 (HFILES): Add mapfile.h.
15034 * Makefile.in: Rebuild.
15036 2008-05-19 Ian Lance Taylor <iant@google.com>
15038 * options.h (class General_options): Add -z relro.
15039 * layout.cc (Layout::Layout): Initialize relro_segment_.
15040 (Layout::add_output_section_data): Return the output section.
15041 (Layout::make_output_section): Rcognize relro sections and mark
15042 them appropriately.
15043 (Layout::attach_allocated_section_to_segment): Put relro sections
15044 in a PT_GNU_RELRO segment.
15045 (Layout::create_initial_dynamic_sections): Mark the .dynamic
15047 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15049 (Layout::linkonce_mapping): Map d.rel.ro.local to
15050 .data.rel.ro.local.
15051 (Layout::output_section_name): Us .data.rel.ro.local for any
15052 section which begins with that.
15053 * layout.h (class Layout): Update add_output_section_data
15054 declaration. Add relro_segment_ field.
15055 * output.cc (Output_section::Output_section): Initialize is_relro_
15056 and is_relro_local_ fields.
15057 (Output_segment::add_output_section): Group relro sections.
15058 (Output_segment::is_first_section_relro): New function.
15059 (Output_segment::maximum_alignment): If there is a relro section,
15060 align the segment to the common page size.
15061 (Output_segment::set_section_addresses): Track whether we are
15062 looking at relro sections. If the last section is a relro
15063 section, align to the common page size.
15064 (Output_segment::set_section_list_addresses): Add in_relro
15065 parameter. Change all callers. Align to the page size when
15066 moving from relro to non-relro section.
15067 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15069 * output.h (class Output_section): Add is_relro_ and
15070 is_relro_local_ fields.
15071 (Output_section::is_relro): New function.
15072 (Output_section::set_is_relro): New function.
15073 (Output_section::is_relro_local): New function.
15074 (Output_section::set_is_relro_local): New function.
15075 (class Output_segment): Update declarations.
15076 * i386.cc (Target_i386::got_section): Mark .got section as relro.
15077 * sparc.cc (Target_sparc::got_section): Likewise.
15078 * x86_64.cc (Target_x86_64::got_section): Likewise.
15079 * testsuite/relro_test_main.cc: New file.
15080 * testsuite/relro_test.cc: New file.
15081 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15082 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15083 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15084 (relro_test.so, relro_test_pic.o): New targets.
15085 * testsuite/Makefile.in: Rebuild.
15087 2008-05-16 Ian Lance Taylor <iant@google.com>
15089 * output.cc (Output_segment::add_output_section): Remove front
15091 * output.h (class Output_segment): Remove
15092 add_initial_output_section and overloaded add_output_section.
15093 Update declaration of remaining add_output_section.
15094 * layout.cc (Layout::create_interp): Call add_output_section
15095 rather than add_initial_output_section.
15096 (Layout::finish_dynamic_section): Likewise.
15098 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15099 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
15100 know the dynamic type.
15101 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15102 field. Initialize it in constructor.
15103 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15104 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15105 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15108 * output.cc (Output_reloc::get_address): Change return type to
15110 * output.h (class Output_reloc): Update get_address declaration.
15111 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15112 for section addresses.
15114 2008-05-09 Ian Lance Taylor <iant@google.com>
15117 * gold.cc (gold_nomem): Use return value of write.
15119 2008-05-08 Ian Lance Taylor <iant@google.com>
15121 * symtab.c (Symbol::init_base_output_data): Add version
15122 parameter. Change all callers.
15123 (Symbol::init_base_output_segment): Likewise.
15124 (Symbol::init_base_constant): Likewise.
15125 (Symbol::init_base_undefined): Likewise.
15126 (Sized_symbol::init_output_data): Likewise.
15127 (Sized_symbol::init_output_segment): Likewise.
15128 (Sized_symbol::init_constant): Likewise.
15129 (Sized_symbol::init_undefined): Likewise.
15130 (Symbol_table::do_define_in_output_data): If the new symbol has a
15131 version, mark it as the default.
15132 (Symbol_table::do_define_in_output_segment): Likewise.
15133 (Symbol_table::do_define_as_constant): Likewise.
15134 * symtab.h (class Symbol): Update declarations.
15135 (class Sized_symbol): Likewise.
15136 * resolve.cc (Symbol::override_version): New function.
15137 (Symbol::override_base): Call override_version.
15138 (Symbol::override_base_with_special): Likewise.
15139 * testsuite/ver_script_8.script: New file.
15140 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15141 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15142 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15143 (ver_test_8_1.so, ver_test_8_2.so): New targets.
15145 2008-05-06 Ian Lance Taylor <iant@google.com>
15148 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15150 (class General_options): Remove existing --undefined, and add
15151 --no-undefined instead. Add new --undefined as synonym for -u.
15152 * archive.cc (Archive::add_symbols): Check whether symbol was
15154 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15155 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15156 all uses. Add IS_UNDEFINED. Update declarations to split
15157 different versions of init_base. Declare init_base_undefined.
15158 (Symbol::is_defined): Handle IS_UNDEFINED.
15159 (Symbol::is_undefined): Likewise.
15160 (Symbol::is_weak_undefined): Call is_undefined.
15161 (Symbol::is_absolute): Handle IS_CONSTANT.
15162 (class Sized_symbol): Update declarations to split different
15163 versions of init. Declare init_undefined.
15164 (class Symbol_table): Declare new functions.
15165 * symtab.cc (Symbol::init_base_object): Rename from init_base.
15166 Change all callers.
15167 (Symbol::init_base_output_data): Likewise.
15168 (Symbol::init_base_output_segment): Likewise.
15169 (Symbol::init_base_constant): Likewise.
15170 (Symbol::init_base_undefined): New function.
15171 (Sized_symbol::init_object): Rename from init. Change all
15173 (Sized_symbol::init_output_data): Likewise.
15174 (Sized_symbol::init_output_segment): Likewise.
15175 (Sized_symbol::init_constant): Likewise.
15176 (Sized_symbol::init_undefined): New function.
15177 (Symbol_table::add_undefined_symbols_from_command_line): New
15179 (Symbol_table::do_add_undefined_symbols_from_command_line): New
15181 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15182 (Symbol::output_section): Likewise.
15183 (Symbol::set_output_section): Likewise.
15184 (Symbol_table::sized_finalize_symbol): Likewise.
15185 (Symbol_table::sized_write_globals): Likewise.
15186 * resolve.cc (Symbol_table::should_override): Likewise.
15187 (Symbol::override_base_with_special): Likewise.
15189 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15190 symbol, change it to have default visibility.
15191 * testsuite/protected_1.cc: New file.
15192 * testsuite/protected_2.cc: New file.
15193 * testsuite/protected_3.cc: New file.
15194 * testsuite/protected_main_1.cc: New file.
15195 * testsuite/protected_main_2.cc: New file.
15196 * testsuite/protected_main_3.cc: New file.
15197 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15198 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15199 (protected_1_LDFLAGS, protected_1_LDADD): Define.
15200 (protected_1.so): New target.
15201 (protected_1_pic.o, protected_2_pic.o): New targets.
15202 (protected_3_pic.o): New target.
15203 (check_PROGRAMS): Add protected_2.
15204 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15205 (protected_2_LDFLAGS, protected_2_LDADD): Define.
15206 * testsuite/Makefile.in: Rebuild.
15208 * options.h (DEFINE_var): Add set_user_set_##varname__.
15209 (DEFINE_bool_alias): New macro.
15210 (class General_options): Define -Bstatic using DEFINE_bool_alias
15211 rather than DEFINE_special. Add --undefined as an alias for -z
15213 * options.cc (General_options::parse_Bstatic): Remove.
15215 * options.h (class General_options): Add --fatal-warnings.
15216 * main.cc (main): Implement --fatal-warnings.
15217 * errors.h (Errors::warning_count): New function.
15219 * options.h (class General_options): Add -Bsymbolic-functions.
15220 * symtab.h (Symbol::is_preemptible): Check for
15221 -Bsymbolic-functions.
15223 2008-05-05 Ian Lance Taylor <iant@google.com>
15225 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15226 as noVARNAME rather than no-VARNAME.
15227 (class General_options): Add option -z combreloc.
15228 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15230 (Output_reloc::sort_before) [SHT_REL]: New function.
15231 (Output_reloc::sort_before) [SHT_RELA]: New function.
15232 (class Output_data_reloc_base): Add sort_relocs_ field. Define
15233 Sort_relocs_comparison.
15234 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15235 parameter. Change all callers.
15236 (Output_data_reloc::Output_data_reloc) [both versions]: Add
15237 sort_relocs parameter. Change all callers.
15238 * output.cc (Output_reloc::get_address): New function, broken out
15240 (Output_reloc::write_rel): Call it.
15241 (Output_reloc::compare): New function.
15242 (Output_data_reloc_base::do_write): Optionally sort relocs.
15244 * configure.ac: If targ_extra_obj is set, link it in.
15245 * configure.tgt: Initialize all variables.
15246 (x86_64*): Set targ_extra_obj and targ_extra_size.
15247 * configure: Rebuild.
15249 * object.cc (Sized_relobj::include_section_group): Adjust section
15250 indexes read from group data. Build vector to pass to
15252 * layout.cc (Layout::layout_group): Add flags and shndxes
15253 parameters. Remove contents parameter. Change caller. Update
15254 explicit instantiations.
15255 * layout.h (class Layout): Update layout_group declaration.
15256 * output.cc (Output_data_group::Output_data_group): Add flags and
15257 input_shndxes parameters. Remove contents parameter. Change
15259 (Output_data_group::do_write): Change input_sections_ to
15261 * output.h (class Output_data_group): Update constructor
15262 declaration. Rename input_sections_ to input_shndxes_.
15263 * testsuite/many_sections_test.cc: Add template.
15265 2008-04-30 Cary Coutant <ccoutant@google.com>
15267 * target-reloc.h (relocate_section): Fix dead-pointer bug.
15269 * layout.cc (Layout::include_section): Refactored check for debug
15271 (Layout::add_comdat): Add new parameters. Change type
15272 of signature parameter. Add object and shndx to signatures table.
15273 (Layout::find_kept_object): New function.
15274 * layout.h: Include <cstring>.
15275 (Layout::is_debug_info_section): New function.
15276 (Layout::add_comdat): Add new parameters.
15277 (Layout::find_kept_object): New function.
15278 (Layout::Kept_section): New struct.
15279 (Layout::Signatures): Change type of map range.
15280 * object.cc (Relobj::output_section_address): New function.
15281 (Sized_relobj::include_section_group): Add new parameters. Change
15282 calls to Layout::add_comdat. Change to build table of kept comdat
15283 groups and table mapping discarded sections to kept sections.
15284 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15285 (Sized_relobj::do_layout): Change calls to include_section_group and
15286 include_linkonce_section.
15287 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15288 value to zero when section is discarded.
15289 (Sized_relobj::map_to_kept_section): New function.
15290 * object.h (Relobj::output_section_address): New function.
15291 (Relobj::Comdat_group): New type.
15292 (Relobj::find_comdat_group): New function.
15293 (Relobj::Comdat_group_table): New type.
15294 (Relobj::Kept_comdat_section): New type.
15295 (Relobj::Kept_comdat_section_table): New type.
15296 (Relobj::add_comdat_group): New function.
15297 (Relobj::set_kept_comdat_section): New function.
15298 (Relobj::get_kept_comdat_section): New function.
15299 (Relobj::comdat_groups_): New field.
15300 (Relobj::kept_comdat_sections_): New field.
15301 (Symbol_value::input_value): Update comment.
15302 (Sized_relobj::map_to_kept_section) New function.
15303 (Sized_relobj::include_linkonce_section): Add new parameter.
15304 * target-reloc.h (Comdat_behavior): New type.
15305 (get_comdat_behavior): New function.
15306 (relocate_section): Add code to map a discarded section to the
15307 corresponding kept section when applying a relocation.
15309 2008-04-30 Craig Silverstein <csilvers@google.com>
15311 * dwarf_reader.cc (next_generation_count): New static var.
15312 (Addr2line_cache_entry): New struct.
15313 (addr2line_cache): New static var.
15314 (Dwarf_line_info::one_addr2line): Added caching.
15315 (Dwarf_line_info::clear_addr2line_cache): New function.
15316 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15317 cache-size parameter.
15318 (Dwarf_line_info::one_addr2line_cache): New function.
15319 * symtab.cc (Symbol_table::detect_odr_violations): Pass
15320 new cache-size argument to one_addr2line(), and clear cache.
15322 2008-04-28 Cary Coutant <ccoutant@google.com>
15324 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15325 R_386_PC8 relocations.
15327 2008-04-23 Ian Lance Taylor <iant@google.com>
15329 * object.cc (Sized_relobj::include_section_group): Check for
15330 invalid section group.
15332 * object.cc (make_elf_object): Correct test for 64-bit ELF file
15335 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15336 than read for file header.
15337 * archive.cc (Archive::include_member): Likewise.
15339 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
15341 * aclocal.m4: Regenerate.
15342 * configure: Regenerate.
15344 2008-04-19 Ian Lance Taylor <iant@google.com>
15346 * version.cc (version_string): Bump to 1.6.
15348 * testsuite/Makefile.am (many_sections_r_test): New target.
15349 (many_sections_r_test_SOURCES): Remove.
15350 (many_sections_r_test_DEPENDENCIES): Remove.
15351 (many_sections_r_test_LDFLAGS): Remove.
15352 (many_sections_r_test_LDADD): Remove.
15354 * object.cc (Sized_relobj::do_add_symbols): Always pass
15355 local_symbol_count_ to add_from_relobj.
15357 * testsuite/Makefile.am (many_sections_check.h): Only check one in
15358 every thousand variables.
15359 * testsuite/Makefile.in: Rebuild.
15361 * object.cc (Xindex::initialize_symtab_xindex): New function.
15362 (Xindex::read_symtab_xindex): New function.
15363 (Xindex::sym_xindex_to_shndx): New function.
15364 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15366 (Sized_relobj::do_initialize_xindex): New function.
15367 (Sized_relobj::do_read_symbols): Adjust section links.
15368 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15369 parameter. Change all callers.
15370 (Sized_relobj::include_section_group): Adjust section links and
15371 symbol section indexes.
15372 (Sized_relobj::do_layout): Adjust section links.
15373 (Sized_relobj::do_count_local_symbols): Adjust section links and
15374 symbol section indexes.
15375 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15376 ordinary and special symbols.
15377 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15378 dynsym_xindex parameters. Change all callers. Adjust section
15379 links. Use SHN_XINDEX when needed.
15380 (Sized_relobj::get_symbol_location_info): Adjust section links.
15381 Don't get fooled by special symbols.
15382 * object.h (class Xindex): Define.
15383 (class Object): Add xindex_ parameter. Declare virtual functoin
15384 do_initialize_xindex.
15385 (Object::adjust_sym_shndx): New function.
15386 (Object::set_xindex): New protected function.
15387 (class Symbol_value): Add is_ordinary_shndx_ field.
15388 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15389 (Symbol_value::value): Assert ordinary section.
15390 (Symbol_value::initialize_input_to_output_map): Likewise.
15391 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15392 Change all callers.
15393 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15395 (class Sized_relobj): Update declarations.
15396 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15397 parameter. Change all callers.
15398 (Sized_relobj::adjust_shndx): New function.
15399 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15401 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15402 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15403 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15404 (Sized_dynobj::read_dynsym_section): Adjust section links.
15405 (Sized_dynobj::read_dynamic): Likewise.
15406 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15408 (Sized_dynobj::do_initialize_xindex): New function.
15409 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15410 do_initialize_xindex.
15411 (Sized_dynobj::adjust_shndx): New function.
15412 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15413 dynsym_xindex_ fields.
15414 (Layout::finalize): Add a call to set_section_indexes before
15415 creating the symtab sections.
15416 (Layout::set_section_indexes): Don't do anything if the section
15417 already has a section index.
15418 (Layout::create_symtab_sections): Add shnum parameter. Change
15419 caller. Create .symtab_shndx section if needed.
15420 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15422 (Layout::allocated_output_section_count): New function.
15423 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15425 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15426 fields. Update declarations.
15427 (Layout::symtab_xindex): New function.
15428 (Layout::dynsym_xindex): New function.
15429 (class Write_symbols_task): Add layout_ field.
15430 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15432 * output.cc (Output_section_headers::Output_section_headers): Add
15433 shstrtab_section parameter. Change all callers.
15434 (Output_section_headers::do_sized_write): Store overflow values
15435 for section count and section string table section index in
15436 section header zero.
15437 (Output_file_header::do_sized_write): Check for overflow of
15438 section count and section string table section index.
15439 (Output_symtab_xindex::do_write): New function.
15440 (Output_symtab_xindex::endian_do_write): New function.
15441 * output.h (class Output_section_headers): Add shstrtab_section_.
15442 Update declarations.
15443 (class Output_symtab_xindex): Define.
15444 (Output_section::has_out_shndx): New function.
15445 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15447 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15448 Change all callers.
15449 (Sized_symbol::init): Likewise.
15450 (Symbol::output_section): Check for ordinary symbol.
15451 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15452 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15454 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15455 Change all callers. Simplify handling of symbols from sections
15456 not included in the link.
15457 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15459 (Weak_alias_sorter::operator()): Assert that symbols are
15461 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15463 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15464 parameters. Change all callers.
15465 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15466 symbol distinction. Use SHN_XINDEX when needed.
15467 (Symbol_table::write_section_symbol): Add symtab_xindex
15468 parameter. Change all callers.
15469 (Symbol_table::sized_write_section_symbol): Likewise. Use
15470 SHN_XINDEX when needed.
15471 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15473 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15474 (Symbol::is_defined): Check is_ordinary.
15475 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15476 (Symbol::is_absolute, Symbol::is_common): Likewise.
15477 (class Sized_symbol): Update declarations.
15478 (class Symbol_table): Update declarations.
15479 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15480 parameters. Change all callers.
15481 (Sized_symbol::override): Likewise.
15482 (Symbol_table::override): Likewise.
15483 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15484 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15485 is_ordinary, and orig_st_shndx parameters. Change all callers.
15486 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15487 to be in an ordinary section.
15488 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15489 object and is_ordinary parameters. Change all callers.
15490 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15491 Change all callers. Don't add undefined or non-ordinary symbols
15493 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15494 Change all callers.
15495 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15497 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15498 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15499 (Sized_relobj::relocate_sections): Likewise.
15500 * target-reloc.h (scan_relocs): Adjust section symbol index.
15501 (scan_relocatable_relocs): Likewise.
15502 * i386.cc (Scan::local): Check for ordinary symbols.
15503 * sparc.cc (Scan::local): Likewise.
15504 * x86_64.cc (Scan::local): Likewise.
15505 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15506 to symbol_section_and_value.
15507 * testsuite/many_sections_test.cc: New file.
15508 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15509 (check_PROGRAMS): Add many_sections_test.
15510 (many_sections_test_SOURCES): Define.
15511 (many_sections_test_DEPENDENCIES): Define.
15512 (many_sections_test_LDFLAGS): Define.
15513 (BUILT_SOURCES): Add many_sections_define.h.
15514 (many_sections_define.h): New target.
15515 (BUILT_SOURCES): Add many_sections_check.h.
15516 (many_sections_check.h): New target.
15517 (check_PROGRAMS): Add many_sections_r_test.
15518 (many_sections_r_test_SOURCES): Define.
15519 (many_sections_r_test_DEPENDENCIES): Define.
15520 (many_sections_r_test_LDFLAGS): Define.
15521 (many_sections_r_test_LDADD): Define.
15522 (many_sections_r_test.o): New target.
15523 * testsuite/Makefile.in: Rebuild.
15525 2008-04-17 Cary Coutant <ccoutant@google.com>
15527 * errors.cc (Errors::info): New function.
15528 (gold_info): New function.
15529 * errors.h (Errors::info): New function.
15530 * gold.h (gold_info): New function.
15531 * object.cc (Input_objects::add_object): Print trace output.
15532 * options.cc (options::parse_set): New function.
15533 (General_options::parse_wrap): Deleted.
15534 (General_options::General_options): Deleted initializer.
15535 * options.h (options::String_set): New typedef.
15536 (options::parse_set): New function.
15537 (DEFINE_set): New macro.
15538 (General_options::wrap): Changed to use DEFINE_set. Changed
15539 callers of any_wrap_symbols and is_wrap_symbol.
15540 (General_options::trace, General_options::trace_symbol):
15542 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15543 (General_options::wrap_symbols_): Deleted.
15544 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15546 2008-04-17 David S. Miller <davem@davemloft.net>
15548 * options.cc (General_options::parse_V): New function.
15549 * options.h: Add entries for -V and -Qy.
15551 2008-04-17 Ian Lance Taylor <iant@google.com>
15553 * common.cc (Symbol_table::allocate_commons): Remove options
15554 parameter. Change caller.
15555 (Symbol_table::do_allocate_commons): Remove options parameter.
15556 Change caller. Just call do_allocate_commons_list twice.
15557 (Symbol_table::do_allocate_commons_list): New function, broken out
15558 of do_allocate_commons.
15559 * common.h (class Allocate_commons_task): Remove options_ field.
15560 Update constructor.
15561 * symtab.cc (Symbol_table::Symbol_table): Initialize
15563 (Symbol_table::add_from_object): Put TLS common symbols on
15565 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15566 which are IN_OUTPUT_DATA.
15567 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15568 allocate_commons and do_allocate_commons declarations. Declare
15569 do_allocate_commons_list.
15570 * gold.cc (queue_middle_tasks): Update creation of
15571 Allocate_commons_task to not pass options.
15572 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15573 (TLS_TEST_C_FLAGS): New variable.
15574 (tls_test_c_pic.o): New target.
15575 (tls_test_shared.so): Link in tls_test_c_pic.o.
15576 (tls_test_c_pic_ie.o): New target.
15577 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15578 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15579 (tls_test_c.o): New target.
15580 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15581 (tls_pic_test_LDADD): Likewise.
15582 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15583 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15584 (tls_test_c_gnu2.o): New target.
15585 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15587 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15588 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15589 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15590 * testsuite/tls_test.cc: Include "config.h".
15591 (t_last): Call t11_last.
15592 * testsuite/tls_test.h (t11, t11_last): Declare.
15593 * testsuite/tls_test_c.c: New file.
15594 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15595 * configure.ac: Check for OpenMP support.
15596 * configure, config.in, Makefile.in: Rebuild.
15597 * testsuite/Makefile.in: Rebuild.
15599 2008-04-16 Cary Coutant <ccoutant@google.com>
15601 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15602 (Target_i386::tls_base_symbol_defined_): New field.
15603 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15604 (Target_i386::Scan::global): Likewise.
15605 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15606 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15607 (Target_x86_64::tls_base_symbol_defined_): New field.
15608 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15609 (Target_x86_64::Scan::global): Likewise.
15611 2008-04-16 Cary Coutant <ccoutant@google.com>
15613 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15614 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15615 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15616 building shared libraries.
15617 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15618 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15619 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15620 * testsuite/Makefile.in: Rebuild.
15621 * testsuite/weak_undef.h: New file.
15622 * testsuite/weak_undef_file1.cc: Add extra test cases.
15623 * testsuite/weak_undef_file2.cc: Likewise.
15624 * testsuite/weak_undef_test.cc: Likewise.
15626 2008-04-16 David S. Miller <davem@davemloft.net>
15628 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15629 Add issued_non_pic_error_ field. Declare check_non_pic.
15630 (Target_sparc::Scan::check_non_pic): New function.
15631 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15632 (Target_sparc::Scan::global): Likewise.
15634 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15635 * configure: Rebuild.
15637 * options.h (DEFINE_enable): New macro.
15638 (new_dtags): New enable option.
15639 (initfirst, interpose, loadfltr, nodefaultlib,
15640 nodelete, nodlopen, nodump): New -z options.
15641 * layout.cc (Layout:finish_dynamic_section): If new
15642 dtags enabled, emit DT_RUNPATH. Also, emit a
15643 DT_FLAGS_1 containing any specified -z flags.
15645 2008-04-16 Ian Lance Taylor <iant@google.com>
15647 * copy-relocs.cc: New file.
15648 * copy-relocs.h: New file.
15649 * reloc.cc: Remove Copy_relocs code.
15650 * reloc.h: Likewise.
15651 * reloc-types.h (struct Reloc_types) [both versions]: Add
15652 get_reloc_addend_noerror.
15653 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15654 variants of add_global which take an addend which must be zero.
15655 * i386.cc: Include "copy-relocs.h".
15656 (class Target_i386): Change type of copy_relocs_ to variable,
15657 update initializer.
15658 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15659 Change all callers.
15660 (Target_i386::do_finalize_sections): Change handling of
15662 * sparc.cc: Include "copy-relocs.h".
15663 (class Target_sparc): Change type of copy_relocs_ to variable,
15664 update initializer.
15665 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15666 Change all callers.
15667 (Target_sparc::do_finalize_sections): Change handling of
15669 * x86_64.cc: Include "copy-relocs.h".
15670 (class Target_x86_64): Change type of copy_relocs_ to variable,
15671 update initializer.
15672 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15673 class. Change all callers.
15674 (Target_x86_64::do_finalize_sections): Change handling of
15676 * Makefile.am (CCFILES): Add copy-relocs.cc.
15677 (HFILES): Add copy-relocs.h.
15679 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15681 * testsuite/script_test_4.sh: Permit leading zeroes.
15683 2008-04-15 Ian Lance Taylor <iant@google.com>
15685 * script-sections.cc (Script_sections::create_segments): Use
15686 header_size_adjustment even when there is enough room for the
15688 * testsuite/script_test_4.sh: New file.
15689 * testsuite/script_test_4.t: New file.
15690 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15691 (check_DATA): Add script_test_4.stdout.
15692 (MOSTLYCLEANFILES): Likewise.
15693 (script_test_4): New target.
15694 (script_test_4.stdout): New target.
15695 * testsuite/Makefile.in: Rebuild.
15697 * sparc.cc: Add definitions for Output_data_plt_sparc class
15700 2008-04-14 David S. Miller <davem@davemloft.net>
15702 * sparc.cc: New file.
15703 * Makefile.am (TARGETSOURCES): Add sparc.cc
15704 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15705 * configure.tgt: Document targ_extra_size and
15706 targ_extra_big_endian. Add entries for sparc-* and
15708 * configure.ac: Handle targ_extra_size and
15709 targ_extra_big_endian.
15710 * Makefile.in: Rebuild.
15711 * configure: Likewise.
15712 * po/POTFILES.in: Likewise.
15713 * po/gold.pot: Likewise.
15715 2008-04-14 Ian Lance Taylor <iant@google.com>
15717 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15718 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15719 in the name/type/flags to section mapping. Don't call
15720 allocate_output_section.
15721 (Layout::choose_output_section): Change parameter from adjust_name
15722 to is_input_section. Don't permit input sections after sections
15723 are attached to segments. Don't call allocate_output_section.
15724 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15725 not write_enable_output_section.
15726 (Layout::make_output_section): Don't push to
15727 unattached_section_list_ nor call attach_to_segment. Call
15728 attach_section_to_segment if sections are attached.
15729 (Layout::attach_sections_to_segments): New function.
15730 (Layout::attach_section_to_segment): New function.
15731 (Layout::attach_allocated_section_to_segment): Rename from
15732 attach_to_segment. Remove flags parameter.
15733 (Layout::allocate_output_section): Remove function.
15734 (Layout::write_enable_output_section): Remove function.
15735 * layout.h (class Layout): Update for above changes. Add new
15736 field sections_are_attached_.
15737 * output.h (Output_section::update_flags_for_input_section): New
15739 * output.cc (Output_section::add_input_section): Call
15740 update_flags_for_input_section.
15741 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15743 2008-04-11 Cary Coutant <ccoutant@google.com>
15745 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15746 thought unnecessary.
15747 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15749 2008-04-11 Ian Lance Taylor <iant@google.com>
15751 * output.h (class Output_section_data): Remove inline definition
15753 * output.cc (Output_section_data::set_addralign): New function.
15755 2008-04-11 Cary Coutant <ccoutant@google.com>
15757 Add support for TLS descriptors for i386 and x86_64.
15758 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15759 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15760 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15762 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15763 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15764 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15766 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15767 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15768 Fix problem with initial-exec relocations.
15769 (Target_i386::Relocate::relocate_tls): Likewise.
15770 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15772 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15773 support for section-plus-offset dynamic table entries.
15774 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15775 (Output_data_dynamic::Dynamic_entry): Add support for
15776 section-plus-offset dynamic table entries.
15777 (Output_data_dynamic::Classification): Likewise.
15778 (Output_data_dynamic::classification_): Renamed offset_.
15779 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15780 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15781 (Target_x86_64::make_plt_section): New function.
15782 (Target_x86_64::reserve_tlsdesc_entries): New function.
15783 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15784 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15785 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15786 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15787 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15788 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15789 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15790 add extra PLT entry for TLS descriptors.
15791 (Output_data_plt_x86_64::got_): New field.
15792 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15793 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15795 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15797 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15798 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15799 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15800 R_386_TLS_DESC_CALL relocations.
15801 (Target_x86_64::Scan::global): Likewise.
15802 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15803 for TLS descriptors.
15804 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15805 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15806 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15807 GD-to-IE relaxation.
15808 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15809 and TLS_DESCRIPTORS.
15810 * Makefile.in: Rebuild.
15811 * configure: Rebuild.
15812 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15813 (tls_test_shared2.so): New target.
15814 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15815 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15816 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15817 (tls_shared_gd_to_ie_test_LDADD): New variable.
15818 (tls_shared_gnu2_gd_to_ie_test): New target.
15819 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15821 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15822 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15823 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15824 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15825 (tls_shared_gnu2_test): New target.
15826 (tls_test_gnu2_shared.so): New target.
15827 (tls_shared_gnu2_test_SOURCES): New variable.
15828 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15829 (tls_shared_gnu2_test_LDFLAGS): New variable.
15830 (tls_shared_gnu2_test_LDADD): New variable.
15831 * testsuite/Makefile.in: Rebuild.
15832 * testsuite/Makefile.
15834 2008-04-11 Ian Lance Taylor <iant@google.com>
15836 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15838 * testsuite/Makefile.in: Rebuild.
15840 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15842 * testsuite/script_test_2.cc (main): Adjust test.
15844 2008-04-11 David S. Miller <davem@davemloft.net>
15845 Ian Lance Taylor <iant@google.com>
15847 * options.h (General_options): Add entries for '-Y' and
15849 * options.cc (General_options:finalize): If -Y was used, add those
15850 entries to the library path instead of the default "/lib" and
15853 2008-04-11 David S. Miller <davem@davemloft.net>
15855 * testsuite/justsyms.t: Start at 0x100.
15856 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15857 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15859 * testsuite/script_test_2.cc: Adjust string and section length
15862 2008-04-09 Ian Lance Taylor <iant@google.com>
15865 * script-sections.cc (Sections_element::allocate_to_segment): Add
15867 (Output_section_definition::allocate_to_segment): Likewise.
15868 (Orphan_output_section::allocate_to_segment): Likewise.
15869 (Script_sections::attach_sections_using_phdrs_clause): Don't
15870 propagate non-PT_LOAD segments to orphan sections.
15871 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15872 readelf rather than objdump.
15873 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15874 .interp section and PT_INTERP segment are the same size.
15875 * testsuite/Makefile.in: Rebuild.
15877 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15878 aliases for symbols defined in the same object.
15879 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15880 (weak_alias_test_SOURCES): New variable.
15881 (weak_alias_test_DEPENDENCIES): New variable.
15882 (weak_alias_test_LDFLAGS): New variable.
15883 (weak_alias_test_LDADD): New variable.
15884 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15885 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15886 (weak_alias_test_3.o): New target.
15887 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15888 * testsuite/weak_alias_test_main.cc: New file.
15889 * testsuite/weak_alias_test_1.cc: New file.
15890 * testsuite/weak_alias_test_2.cc: New file.
15891 * testsuite/weak_alias_test_3.cc: New file.
15893 2008-04-08 Ian Lance Taylor <iant@google.com>
15895 * options.h (class General_options): Add --noinhibit-exec option.
15896 * main.cc (main): Check --noinhibit-exec.
15898 * options.h (class General_options): Define --wrap as a special
15899 option. Add wrap_symbols_ field.
15900 (General_options::any_wrap_symbols): New function.
15901 (General_options::is_wrap_symbol): New function.
15902 * options.cc (General_options::parse_wrap): New function.
15903 (General_options::General_options): Initialize wrap_symbols_.
15904 * symtab.cc (Symbol_table::wrap_symbol): New function.
15905 (Symbol_table::add_from_object): Handle --wrap.
15906 * symtab.h (class Symbol_table): Declare wrap_symbol.
15907 * target.h (Target::wrap_char): New function.
15908 (Target::Target_info): Add wrap_char field.
15909 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15910 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15911 * testsuite/testfile.cc (Target_test::test_target_info):
15914 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15917 * layout.h (class Layout): Add added_eh_frame_data_ field.
15918 * layout.cc (Layout::Layout): Initialize new field.
15919 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15920 output section until we find a section we merged successfully.
15921 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15922 that the size be non-zero.
15924 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15927 2008-04-08 Craig Silverstein <csilvers@google.com>
15929 * configure.ac: Export new conditional variable HAVE_ZLIB.
15930 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15932 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15933 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15935 2008-04-07 Ian Lance Taylor <iant@google.com>
15937 * version.cc (version_string): Set to "1.5".
15939 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15940 Add issued_non_pic_error_ field. Declare check_non_pic.
15941 (Target_x86_64::Scan::check_non_pic): New function.
15942 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15943 (Target_x86_64::Scan::global): Likewise.
15945 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15946 addend parameter. Change caller. Handle merge sections.
15947 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15948 Address to Addend. Don't add in the result of
15949 local_section_offset, pass down the addend and use the returned
15951 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15952 Update declarations of local_section_offset and symbol_value.
15953 * testsuite/two_file_test_1.cc (t18): New function.
15954 * testsuite/two_file_test_2.cc (f18): New function.
15955 * testsuite/two_file_test_main.cc (main): Call t18.
15956 * testsuite/two_file_test.h (t18, f18): Declare.
15958 * configure.ac: Don't test for objdump, c++filt, or readelf.
15959 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15961 (TEST_READELF): New variable.
15962 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15963 (check_PROGRAMS): Add two_file_strip_test.
15964 (two_file_strip_test): New target.
15965 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15966 (two_file_same_shared_strip_test_SOURCES): New variable.
15967 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15968 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15969 (two_file_same_shared_strip_test_LDADD): New variable.
15970 (two_file_shared_strip.so): New target.
15971 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15972 (ver_test_5.syms, ver_test_7.syms): Likewise.
15973 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15974 (strip_test_3.stdout): Use TEST_OBJDUMP.
15975 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15977 2008-04-04 Cary Coutant <ccoutant@google.com>
15979 * symtab.h (Symbol::is_weak_undefined): New function.
15980 (Symbol::is_strong_undefined): New function.
15981 (Symbol::is_absolute): New function.
15982 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15983 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15985 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15986 (weak_undef_test): New target.
15987 * testsuite/Makefile.in: Rebuild.
15988 * testsuite/weak_undef_file1.cc: New file.
15989 * testsuite/weak_undef_file2.cc: New file.
15990 * testsuite/weak_undef_test.cc: New file.
15992 2008-04-03 Craig Silverstein <csilvers@google.com>
15994 * compressed_output.h (class Output_compressed_section): Use
15996 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15998 (zlib_compressed_suffix): Removed.
15999 (Output_compressed_section::set_final_data_size): Use unsigned
16001 * testsuite/Makefile.am (flagstest_compress_debug_sections):
16002 Fix linker invocation.
16003 (flagstest_o_specialfile_and_compress_debug_sections):
16005 * testsuite/Makefile.in: Regenerated.
16007 2008-04-02 David S. Miller <davem@davemloft.net>
16009 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16010 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16012 2008-04-02 Craig Silverstein <csilvers@google.com>
16016 2008-04-02 Ian Lance Taylor <iant@google.com>
16018 * fileread.cc (File_read::find_view): Add byteshift and vshifted
16019 parameters. Update for new key type to views_. Change all
16021 (File_read::read): Adjust for byteshift in returned view.
16022 (File_read::add_view): New function, broken out of
16023 find_and_make_view.
16024 (File_read::make_view): New function, broken out of
16025 find_and_make_view.
16026 (File_read::find_or_make_view): Add offset and aligned
16027 parameters. Rewrite accordingly. Change all callers.
16028 (File_read::get_view): Add offset and aligned parameters. Adjust
16029 for byteshift in return value.
16030 (File_read::get_lasting_view): Likewise.
16031 * fileread.h (class File_read): Update declarations.
16032 (class File_read::View): Add byteshift_ field. Add byteshift to
16033 constructor. Add byteshift method.
16034 * archive.h (Archive::clear_uncached_views): New function.
16035 (Archive::get_view): Add aligned parameter. Change all callers.
16036 * object.h (Object::get_view): Add aligned parameter. Change all
16038 (Object::get_lasting_view): Likewise.
16040 * fileread.cc (File_read::release): Don't call clear_views if
16041 there are multiple objects.
16042 * fileread.h (File_read::clear_uncached_views): New function.
16043 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16046 2008-03-31 Cary Coutant <ccoutant@google.com>
16048 Add thin archive support.
16049 * archive.cc (Archive::armagt): New const.
16050 (Archive::setup): Remove task parameter and calls to unlock.
16051 (Archive::unlock_nested_archives): New function.
16052 (Archive::read_header): Add nested_off parameter. Change
16054 (Archive::interpret_header): Likewise.
16055 (Archive::include_all_members): Change to handle thin
16057 (Archive::include_member): Likewise.
16058 * archive.h (Archive::Archive): Add new parameters and
16060 (Archive::armagt): New const.
16061 (Archive::setup): Remove task parameter.
16062 (Archive::unlock_nested_archives): New function.
16063 (Archive::read_header): Add nested_off parameter.
16064 (Archive::interpret_header): Likewise.
16065 (Archive::Nested_archive_table): New typedef.
16066 (Archive::is_thin_archive_): New field.
16067 (Archive::nested_archives_): New field.
16068 (Archive::options_): New field.
16069 (Archive::dirpath_): New field.
16070 (Archive::task_): New field.
16071 * readsyms.cc (Read_symbols::do_read_symbols): Add check
16072 for thin archives. Pass additional parameters to
16073 Archive::Archive. Unlock the archive file after calling
16076 2008-03-29 Ian Lance Taylor <iant@google.com>
16078 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16079 version symbol to be local.
16080 * testsuite/ver_test_4.sh: New file.
16081 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16082 (check_DATA): Add ver_test_4.syms.
16083 (ver_test_4.syms): New target.
16084 * testsuite/Makefile.in: Rebuild.
16087 (Output_section::Input_section_sort_entry::has_priority): New
16089 (Output_section::Input_section_sort_entry::match_file_name): New
16091 (Output_section::Input_section_sort_entry::match_section_name):
16093 (Output_section::Input_section_sort_entry::match_section_name_prefix):
16095 (Output_section::Input_section_sort_entry::match_section_file):
16097 (Output_section::Input_section_sort_compare::operator()): Rewrite
16098 using new Input_section_sort_entry functions. Sort crtbegin and
16099 crtend first. Sort sections with no priority before sections with
16101 * testsuite/initpri1.c (d3): Check j != 4.
16102 (cd5): New constructor/destructor function.
16103 (main): Check j != 2.
16105 * symtab.cc (Symbol_table::add_from_object): If we don't use the
16106 new symbol when resolving, don't call set_is_default.
16107 * testsuite/ver_test_7.cc: New file.
16108 * testsuite/ver_test_7.sh: New file.
16109 * testsuite/Makefile.am (ver_test_7.so): New target.
16110 (ver_test_7.o): New target.
16111 (check_SCRIPTS): Add ver_test_7.sh.
16112 (check_DATA): Add ver_test_7.syms.
16113 (ver_test_7.syms): New target.
16115 2008-03-28 Ian Lance Taylor <iant@google.com>
16117 * layout.cc (Layout::layout): If we see an input section with a
16118 name that needs sorting, set the must_sort flag for the output
16120 (Layout::make_output_section): If the name of the output section
16121 indicates that it might require sorting, set the may_sort flag.
16122 * output.h (Output_section::may_sort_attached_input_sections): New
16124 (Output_section::set_may_sort_attached_input_sections): New
16126 (Output_section::must_sort_attached_input_sections): New
16128 (Output_section::set_must_sort_attached_input_sections): New
16130 (class Output_section): Declare Input_section_sort_entry. Define
16131 Input_section_sort_compare. Declare
16132 sort_attached_input_sections. Add new fields:
16133 may_sort_attached_input_sections_,
16134 must_sort_attached_input_sections_,
16135 attached_input_sections_are_sorted_.
16136 * output.cc (Output_section::Output_section): Initialize new
16138 (Output_section::add_input_section): Add an entry to
16139 input_sections_ if may_sort or must_sort are true.
16140 (Output_section::set_final_data_size): Call
16141 sort_attached_input_sections if necessary.
16142 (Output_section::Input_section_sort_entry): Define new class.
16143 (Output_section::Input_section_sort_compare::operator()): New
16145 (Output_section::sort_attached_input_sections): New function.
16146 * configure.ac: Check whether the compiler supports constructor
16147 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
16148 * testsuite/initpri1.c: New file.
16149 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16150 CONSTRUCTOR_PRIORITY.
16151 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16152 (initpri1_LDFLAGS): New variable.
16153 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16155 2008-03-27 Ian Lance Taylor <iant@google.com>
16157 * common.cc (Sort_commons::operator): Correct sorting algorithm.
16158 * testsuite/common_test_1.c: New file.
16159 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16160 (common_test_1_SOURCES): New variable.
16161 (common_test_1_DEPENDENCIES): New variable.
16162 (common_test_1_LDFLAGS): New variable.
16164 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16165 and commons_ correctly when NAME/VERSION does not override
16167 * testsuite/ver_test_6.c: New file.
16168 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16169 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16170 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16172 2008-03-26 Ian Lance Taylor <iant@google.com>
16174 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16175 of an undefined symbol from a version script.
16176 * testsuite/Makefile.am (ver_test_5.so): New target.
16177 (ver_test_5.o): New target.
16178 (check_SCRIPTS): Add ver_test_5.sh.
16179 (check_DATA): Add ver_test_5.syms.
16180 (ver_test_5.syms): New target.
16181 * testsuite/ver_test_5.cc: New file.
16182 * testsuite/ver_test_5.script: New file.
16183 * testsuite/ver_test_5.sh: New file.
16184 * Makefile.in, testsuite/Makefile.in: Rebuild.
16187 Fix problems building gold with gcc 4.3.0.
16188 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16189 (gold_error_at_location, gold_warning_at_location): Use it.
16190 * configure.ac: Check whether we can compile and use a template
16191 function with a printf attribute.
16192 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16193 when jumping over bytes.
16194 * object.cc: Instantiate Object::read_section_data.
16195 * debug.h: Include <cstring>
16196 * dwarf_reader.cc: Include <algorithm>
16197 * main.cc: Include <cstring>.
16198 * options.cc: Include <cstring>.
16199 * output.cc: Include <cstring>.
16200 * script.cc: Include <cstring>.
16201 * script.h: Include <string>.
16202 * symtab.cc: Include <cstring> and <algorithm>.
16203 * target-select.cc: Include <cstring>.
16204 * version.cc: Include <string>.
16205 * testsuite/testmain.cc: Include <cstdlib>.
16206 * configure, config.in: Rebuild.
16208 2008-03-25 Ian Lance Taylor <iant@google.com>
16210 * options.cc: Include "../bfd/bfdver.h".
16211 (options::help): Print bug reporting address.
16213 * version.cc (print_version): Adjust output for current value of
16214 BFD_VERSION_STRING.
16218 * options.cc (options::help): Print list of supported targets.
16219 * target-select.h: Include <vector>.
16220 (class Target_selector): Make machine_, size_, and is_big_endian_
16221 fields const. Add bfd_name_ and instantiated_target_ fields.
16222 (Target_selector::Target_selector): Add bfd_name parameter.
16223 (Target_selector::recognize): Make non-virtual, call
16225 (Target_selector::recognize_by_name): Make non-virtual, call
16226 do_recognize_by_name.
16227 (Target_selector::supported_names): New function.
16228 (Target_selector::bfd_name): New function.
16229 (Target_selector::do_instantiate_target): New pure virtual
16231 (Target_selector::do_recognize): New virtual function.
16232 (Target_selector::do_recognize_by_name): New virtual function.
16233 (Target_selector::instantiate_target): New private function.
16234 (supported_target_names): Declare.
16235 * target-select.cc (Target_selector::Target_selector): Update for
16236 new parameter and fields.
16237 (select_target_by_name): Check that the name matches before
16238 calling recognize_by_name.
16239 (supported_target_names): New function.
16240 * i386.cc (class Target_selector_i386): Update Target_selector
16241 constructor call. Remove recognize and recognize_by_name. Add
16242 do_instantiate_target.
16243 * x86_64.cc (class Target_selector_x86_64): Likewise.
16244 * testsuite/testfile.cc (class Target_selector_test): Update for
16245 changes to Target_selector.
16247 * README: Rewrite, with some notes on unsupported features.
16249 2008-03-24 Cary Coutant <ccoutant@google.com>
16251 * i386.cc (Target_i386::Got_type): New enum declaration.
16252 (Target_i386::Scan::local): Updated callers of Output_data_got
16254 (Target_i386::Scan::global): Likewise.
16255 (Target_i386::Relocate::relocate): Likewise.
16256 (Target_i386::Relocate::relocate_tls): Likewise.
16257 * object.h (Got_offset_list): New class.
16258 (Sized_relobj::local_has_got_offset): Added got_type parameter.
16259 (Sized_relobj::local_got_offset): Likewise.
16260 (Sized_relobj::set_local_got_offset): Likewise.
16261 (Sized_relobj::local_has_tls_got_offset): Removed.
16262 (Sized_relobj::local_tls_got_offset): Removed.
16263 (Sized_relobj::set_local_tls_got_offset): Removed.
16264 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16265 * output.cc (Output_data_got::add_global): Added got_type parameter.
16266 (Output_data_got::add_global_with_rel): Likewise.
16267 (Output_data_got::add_global_with_rela): Likewise.
16268 (Output_data_got::add_global_pair_with_rel): New function.
16269 (Output_data_got::add_global_pair_with_rela): New function.
16270 (Output_data_got::add_local): Added got_type parameter.
16271 (Output_data_got::add_local_with_rel): Likewise.
16272 (Output_data_got::add_local_with_rela): Likewise.
16273 (Output_data_got::add_local_pair_with_rel): New function.
16274 (Output_data_got::add_local_pair_with_rela): New function.
16275 (Output_data_got::add_global_tls): Removed.
16276 (Output_data_got::add_global_tls_with_rel): Removed.
16277 (Output_data_got::add_global_tls_with_rela): Removed.
16278 (Output_data_got::add_local_tls): Removed.
16279 (Output_data_got::add_local_tls_with_rel): Removed.
16280 (Output_data_got::add_local_tls_with_rela): Removed.
16281 * output.h (Output_data_got::add_global): Added got_type parameter.
16282 (Output_data_got::add_global_with_rel): Likewise.
16283 (Output_data_got::add_global_with_rela): Likewise.
16284 (Output_data_got::add_global_pair_with_rel): New function.
16285 (Output_data_got::add_global_pair_with_rela): New function.
16286 (Output_data_got::add_local): Added got_type parameter.
16287 (Output_data_got::add_local_with_rel): Likewise.
16288 (Output_data_got::add_local_with_rela): Likewise.
16289 (Output_data_got::add_local_pair_with_rel): New function.
16290 (Output_data_got::add_local_pair_with_rela): New function.
16291 (Output_data_got::add_global_tls): Removed.
16292 (Output_data_got::add_global_tls_with_rel): Removed.
16293 (Output_data_got::add_global_tls_with_rela): Removed.
16294 (Output_data_got::add_local_tls): Removed.
16295 (Output_data_got::add_local_tls_with_rel): Removed.
16296 (Output_data_got::add_local_tls_with_rela): Removed.
16297 * resolve.cc (Symbol::override_base_with_special): Removed
16298 reference to has_got_offset_ field.
16299 * symtab.cc (Symbol::init_fields): Replaced initialization
16300 of got_offset_ with got_offsets_. Removed initialization
16302 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16303 (Symbol::got_offset): Likewise.
16304 (Symbol::set_got_offset): Likewise.
16305 (Symbol::has_tls_got_offset): Removed.
16306 (Symbol::tls_got_offset): Removed.
16307 (Symbol::set_tls_got_offset): Removed.
16308 (Symbol::got_offset_): Removed.
16309 (Symbol::tls_mod_got_offset_): Removed.
16310 (Symbol::tls_pair_got_offset_): Removed.
16311 (Symbol::got_offsets_): New field.
16312 (Symbol::has_got_offset): Removed.
16313 (Symbol::has_tls_mod_got_offset): Removed.
16314 (Symbol::has_tls_pair_got_offset): Removed.
16315 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16316 (Target_x86_64::Scan::local): Updated callers of Output_data_got
16318 (Target_x86_64::Scan::global): Likewise.
16319 (Target_x86_64::Relocate::relocate): Likewise.
16320 (Target_x86_64::Relocate::relocate_tls): Likewise.
16322 2008-03-25 Ben Elliston <bje@au.ibm.com>
16324 * yyscript.y: Fix spelling error in comment.
16326 2008-03-24 Ian Lance Taylor <iant@google.com>
16328 * options.h (class General_options): Define build_id option.
16329 * layout.h (class Layout): Declare write_build_id, create_note,
16330 create_build_id. Add build_id_note_ member.
16331 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16332 "libiberty.h", "md5.h", "sha1.h".
16333 (Layout::Layout): Initialize eh_frame_data_,
16334 eh_frame_hdr_section_, and build_id_note_.
16335 (Layout::finalize): Call create_build_id.
16336 (Layout::create_note): New function, broken out of
16337 Layout::create_gold_note.
16338 (Layout::create_gold_note): Call create_note.
16339 (Layout::create_build_id): New function.
16340 (Layout::write_build_id): New function.
16341 (Close_task_runner::run): Call write_build_id.
16343 * x86_64.cc: Correct license to GPLv3.
16345 2008-03-23 Ian Lance Taylor <iant@google.com>
16347 * options.cc: Include "demangle.h".
16348 (parse_optional_string): New function.
16349 (parse_long_option): Handle takes_optional_argument.
16350 (parse_short_option): Update dash_z initializer. Handle
16351 takes_optional_argument.
16352 (General_options::General_options): Initialize do_demangle_.
16353 (General_options::finalize): Set do_demangle_. Handle demangling
16355 * options.h (parse_optional_string): Declare.
16356 (struct One_option): Add optional_arg field. Update constructor.
16357 Update call constructor calls. Add takes_optional_argument
16359 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16360 (DEFINE_optional_string): Define.
16361 (General_options::demangle): Change from DEFINE_bool to
16362 DEFINE_optional_string.
16363 (General_options::no_demangle): New function.
16364 (General_options::do_demangle): New function.
16365 (General_options::set_do_demangle): New function.
16366 (General_options::execstack_status_): Move definition to end of
16368 (General_options::static_): Likewise.
16369 (General_options::do_demangle_): New field.
16370 * object.cc (big_endian>::get_symbol_location_info): Call
16371 Options::do_demangle, not Options::demangle.
16372 * symtab.cc (demangle): Likewise.
16374 2008-03-22 Ian Lance Taylor <iant@google.com>
16376 * gold.h: Include <cstddef> and <sys/types.h>
16377 * options.h: Include <cstring>.
16379 2008-03-21 Ian Lance Taylor <iant@google.com>
16381 * Added source code to GNU binutils.
16383 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16385 Copying and distribution of this file, with or without modification,
16386 are permitted in any medium without royalty provided the copyright
16387 notice and this notice are preserved.
16393 version-control: never