1 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
3 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
4 * resolve.cc (Symbol_table::resolve): Don't override common symbols
5 during the replacement phase.
7 2014-09-17 Han Shen <shenhan@google.com>
8 Jing Yu <jingyu@google.com>
10 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
11 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
12 * aarch64.cc (Target_aarch64): Add data members
13 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
14 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
16 (Target_aarch64::do_reloc_symbol_index): New method.
17 (Target_aarch64::do_reloc_addend): New method.
18 (Target_aarch64::add_tlsdesc_info): New method.
19 (Target_aarch64::do_dynsym_value): New method.
20 (Target_aarch64::do_make_data_plt): Add new parameters: got,
21 got_irelative. Pass them to Output_data_plt_aarch64_standard.
22 (Target_aarch64::make_data_plt): Add new parameters: got,
23 got_irelative. Pass them to do_make_data_plt.
24 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
25 (Target_aarch64::Relocate:tls_gd_to_le): New method.
26 (Target_aarch64::Relocate:tls_ie_to_le): New method.
27 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
28 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
29 (Target_aarch64::got_tlsdesc_section): New method.
30 (Target_aarch64::make_local_ifunc_plt_entry): New method.
31 (Target_aarch64::define_tls_base_symbol): New method.
32 (Target_aarch64::reserve_tlsdesc_entries): New method.
33 (Target_aarch64::got_mod_index_entry): New method.
34 (Target_aarch64::rela_tlsdesc_section): New method.
35 (Target_aarch64::rela_irelative_section): New method.
36 (Target_aarch64::Tlsdesc_info): New struct.
37 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
38 relocations and tlsdesc relocations.
39 (Target_aarch64::optimize_tls_reloc): Implement method.
40 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
41 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
43 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
44 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
45 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
46 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
47 (Output_data_plt_aarch64::rela_tlsdesc): New method.
48 (Output_data_plt_aarch64::rela_irelative): New method.
49 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
50 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
51 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
52 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
53 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
54 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
55 (Output_data_plt_aarch64_standard): New member variables:
56 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
57 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
58 New parameter: got, got_irelative.
59 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
60 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
61 (Output_data_plt_aarch64::do_write): Replace got_address with
62 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
63 (AArch64_relocate_functions::update_movnz): New method.
64 (AArch64_relocate_functions): Correct format.
65 (AArch64_relocate_functions::movnz): New method.
66 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
67 before the switch. Add new cases to switch.
68 Check ie_to_le relaxation on tlsie relocations. Add code handling
70 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
71 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
72 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
73 Call reloc_name_in_error_message to print unsupported reloc.
74 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
76 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
77 relocs. Fill in some more dynamic tags.
78 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
79 Skip call tls_get_addr when tlsgd is relaxed.
80 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
81 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
82 tlsdesc->ie relaxation.
84 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
86 * mips.cc (Target_mips_nacl): New class.
87 (Target_selector_mips_nacl): New class.
88 (target_selector_mips32): Rename from target_selector_mips32be and use
89 Target_selector_mips_nacl instead of Target_selector_mips.
90 (target_selector_mips32el): Rename from target_selector_mips32 and use
91 Target_selector_mips_nacl instead of Target_selector_mips.
92 (target_selector_mips64): Rename from target_selector_mips64be and use
93 Target_selector_mips_nacl instead of Target_selector_mips.
94 (target_selector_mips64el): Rename from target_selector_mips64 and use
95 Target_selector_mips_nacl instead of Target_selector_mips.
96 (Target_mips::mips_info): Add const attribute.
98 2014-09-02 Cary Coutant <ccoutant@google.com>
100 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
101 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
102 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
103 (Sized_incr_dynobj::do_section_name): Likewise.
104 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
105 (Sized_incr_dynobj::do_section_name): Likewise.
106 * object.h (Object::section_name): Likewise.
107 (Object::do_section_name): Likewise.
108 (Sized_relobj_file::do_section_name): Likewise.
109 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
110 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
112 2014-09-02 Cary Coutant <ccoutant@google.com>
115 * ehframe.cc (Fde::write): Add output_offset parameter.
116 (Cie::write): Likewise.
117 (Eh_frame::set_final_data_size): Account for offset within output
119 (Eh_frame::do_sized_write): Likewise.
120 * ehframe.h (Fde::write): Add output_offset parameter.
121 (Cie::write): Likewise.
122 * output.cc (Output_section::Input_section_sort_entry): Remove
123 section_has_name_; add output_section_name parameter. Use
124 output section name for non-input sections.
125 (Output_section::Input_section_sort_entry::section_has_name): Remove.
126 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
127 (Output_section::Input_section_sort_compare): Remove logic for
128 sections without names.
129 (Output_section::Input_section_sort_init_fini_compare): Likewise.
130 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
132 (Output_section::Input_section_sort_section_name_compare): Likewise.
134 2014-08-29 Han Shen <shenhan@google.com>
135 Jing Yu <jingyu@google.com>
137 * aarch64-reloc-property.cc
138 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
139 reference reloc property in the table.
140 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
142 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
143 2 new overloaded methods.
144 (Output_data_got_aarch64::do_write): Add code to write out
146 (class Output_data_got_aarch64::Static_reloc): New class to wrap
148 (Output_data_got_aarch64::static_relocs): New vector to
150 (Target_aarch64::TCB_SIZE): New const static memeber.
151 (Target_aarch64::tcb_size): New method.
152 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
153 (Target_aarch64::Relocate::relocate_tls): New method.
154 (Target_aarch64::Scan::local): Add code handling new reloc types.
155 (Target_aarch64::Scan::global): Add code handling new reloc types.
157 2014-08-13 Sriraman Tallam <tmsriram@google.com>
159 * options.h (-no-pie): Add option.
161 2014-08-08 Jing Yu <jingyu@google.com>
162 Han Shen <shenhan@google.com>
164 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
165 (DEFFILES): add aarch64-reloc.def.
166 (TARGETSOURCES): Add aarch64-reloc-property.cc.
167 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
168 * Makefile.in: Regenerate.
169 * aarch64-reloc-property.cc: New file.
170 * aarch64-reloc-property.h: New file.
171 * aarch64-reloc.def: New file.
172 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
173 with tab to make the format consistent.
174 (Output_data_got_aarch64::symbol_table_): New method.
175 (Target_aarch64::do_plt_address_for_global): New method.
176 (Target_aarch64::do_plt_address_for_local): New method.
177 (Target_aarch64::do_select_as_default_target): New method.
178 (Target_aarch64::do_make_data_plt): New method.
179 (Target_aarch64::make_data_plt): New method.
180 (Output_data_plt_aarch64::has_irelative_section): New method.
181 (Output_data_plt_aarch64::address_for_global): New method.
182 (Output_data_plt_aarch64::address_for_local): New method.
183 (Output_data_plt_aarch64::irelative_rel_): New parameter.
184 (Output_data_plt_aarch64::add_entry): Implement contents.
185 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
186 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
187 the got_pov entry to plt0.
188 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
190 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
191 (AArch64_howto): New struct.
192 (aarch64_howto[]): New static const array.
193 (AArch64_relocate_functions): New class.
194 (Target_aarch64::Scan::get_reference_flags): Remove method.
195 (Target_aarch64::Scan::local): Implement to support a few relocations.
196 (Target_aarch64::Scan::global): Implement to support a few relocations.
197 (Target_aarch64::make_plt_section): Implement contents.
198 (Target_aarch64::make_plt_entry): Implement contents.
199 (Target_aarch64::do_finalize_sections): Implement contents.
200 (Target_aarch64::Relocate::relocate): Implement a few relocations.
201 (Target_aarch64::relocate_section): Implement contents.
203 2014-08-06 Alan Modra <amodra@gmail.com>
205 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
207 2014-08-06 Alan Modra <amodra@gmail.com>
210 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
212 2014-07-21 Sriraman Tallam <tmsriram@google.com>
214 * object.cc (Relobj::is_section_name_included): Add
215 ".rodata.nptl_version" to not garbage collect this section.
217 2014-07-08 Cary Coutant <ccoutant@google.com>
219 * expression.cc (struct Expression::Expression_eval_info): Add
220 new fields type_pointer, vis_pointer, and nonvis_pointer.
221 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
222 nonvis_pointer parameters. Adjust all calls.
223 (Symbol_expression::value): Update type, visibility, and nonvis bits
225 * script.cc (Symbol_assignment::sized_finalize): Update type,
226 visibility, and remaining st_other bits for new symbol.
227 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
228 vis_pointer, and nonvis_pointer parameters.
229 * symtab.h (Symbol::set_type): New method.
231 * testsuite/Makefile.am (defsym_test): New test.
232 * testsuite/Makefile.in: Regenerate.
233 * testsuite/defsym_test.c: New file.
234 * testsuite/defsym_test.sh: New file.
236 2014-07-08 Cary Coutant <ccoutant@google.com>
239 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
240 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
241 (Sized_dynobj::base_read_symbols): ...new method.
242 * object.h (Sized_relobj_file::base_read_symbols): New method.
243 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
244 (Sized_relobj_file::base_read_symbols): ...new method.
245 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
246 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
247 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
249 2014-07-04 Alan Modra <amodra@gmail.com>
251 * po/POTFILES.in: Regenerate.
253 2014-07-02 Jing Yu <jingyu@google.com>
255 * aarch64.cc: New file
256 * Makefile.am (TARGETSOURCES): Add aarch64.cc
257 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
258 * Makefile.in: Regenerate.
259 * configure.tgt: Add entries for aarch64*.
260 * configure.ac: Likewise.
261 * configure: Likewise.
263 2014-06-27 Alan Modra <amodra@gmail.com>
265 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
267 2014-06-24 Cary Coutant <ccoutant@google.com>
269 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
271 (Dwo_file::sized_read_unit_index): Likewise.
273 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
276 * Makefile.am (TARGETSOURCES): Add mips.cc
277 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
278 * configure.tgt: Add entries for mips*.
279 * configure.ac: Likewise.
280 * Makefile.in: Regenerate.
281 * configure: Likewise.
283 2014-06-09 Cary Coutant <ccoutant@google.com>
285 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
286 unit_length is within section bounds.
288 2014-06-09 Cary Coutant <ccoutant@google.com>
291 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
294 2014-06-07 Alan Modra <amodra@gmail.com>
296 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
298 2014-06-06 Cary Coutant <ccoutant@google.com>
300 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
301 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
302 (Dwarf_pubnames_table::read_header): Likewise.
303 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
306 2014-06-05 Joel Brobecker <brobecker@adacore.com>
308 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
309 * Makefile.in, configure: Regenerate.
311 2014-06-03 Alan Modra <amodra@gmail.com>
313 * powerpc.cc (addis_12_2): Define.
314 (Stub_table::do_write): Support fusion on ELFv2 stubs.
316 2014-06-03 Alan Modra <amodra@gmail.com>
318 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
321 2014-06-02 Alan Modra <amodra@gmail.com>
323 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
324 Only ignore relocs on ELFv1.
325 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
327 2014-05-30 Cary Coutant <ccoutant@google.com>
329 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
330 * testsuite/Makefile.in: Regenerate.
331 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
333 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
336 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
337 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
339 2014-05-15 Alan Modra <amodra@gmail.com>
341 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
342 Compare FDE contents with DW_CFA_nop rather than 0.
344 2014-05-13 Sriraman Tallam <tmsriram@google.com>
346 * symtab.h (may_need_copy_reloc): Remove check for position independent
348 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
349 position independence before pc absolute may_need_copy_reloc call.
350 Add check for executable output befor pc relative may_need_copy_reloc
356 * powerpc.cc: Add check for no position independence before
357 may_need_copy_reloc calls.
358 * testsuite/pie_copyrelocs_test.cc: New file.
359 * testsuite/pie_copyrelocs_shared_test.cc: New file.
360 * Makefile.am (pie_copyrelocs_test): New test.
361 * Makefile.in: Regenerate.
363 2014-05-08 Martin Liška <mliska@suse.cz>
365 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
367 2014-05-06 Cary Coutant <ccoutant@google.com>
370 * i386.cc (Output_data_got_plt_i386): New class.
371 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
372 parameter. Change all callers.
373 (Output_data_plt_i386::layout_): Remove.
374 (Output_data_plt_i386::got_plt_): Change type.
375 (Target_i386::got_plt_): Change type. Change all references.
376 (Target_i386::got_section): Create instance of new class.
377 (Output_data_got_plt_i386::do_write): New function.
378 * x86_64.cc (Output_data_got_plt_x86_64): New class.
379 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
380 parameter. Change all callers.
381 (Output_data_plt_x86_64::layout_): Remove.
382 (Output_data_plt_x86_64::got_plt_): Change type.
383 (Target_x86_64::got_plt_): Change type. Change all references.
384 (Target_x86_64::got_section): Create instance of new class.
385 (Output_data_got_plt_x86_64::do_write): New function.
386 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
387 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
390 2014-05-05 Cary Coutant <ccoutant@google.com>
392 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
393 if we have pubnames/pubtypes.
395 2014-05-02 Cary Coutant <ccoutant@google.com>
397 * defstd.cc (in_segment): Define __ehdr_start here...
398 * layout.cc (Layout::finalize): ...Instead of here. Set the
399 output segment when known.
400 * resolve.cc (Symbol::override_base_with_special): Remember
401 the original binding.
402 * symtab.cc (Symbol::set_output_segment): New function.
403 (Symbol::set_undefined): New function.
404 * symtab.h (Symbol::is_weak_undefined): Check original undef
406 (Symbol::is_strong_undefined): New function.
407 (Symbol::set_output_segment): New function.
408 (Symbol::set_undefined): New function.
409 * target-reloc.h (is_strong_undefined): Remove.
410 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
411 Check for hidden undefs.
412 (relocate_section): Call Symbol::is_strong_undefined.
414 * testsuite/Makefile.am (ehdr_start_test_1)
415 (ehdr_start_test_2, ehdr_start_test_3)
416 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
417 * testsuite/Makefile.in: Regenerate.
418 * testsuite/ehdr_start_def.cc: New source file.
419 * testsuite/ehdr_start_test.cc: New source file.
420 * testsuite/ehdr_start_test.t: New linker script.
421 * testsuite/ehdr_start_test_4.sh: New shell script.
423 2014-04-23 Cary Coutant <ccoutant@google.com>
426 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
428 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
430 * layout.cc (Layout::include_section): Allow a target to decide
431 whether to include a section.
432 * target.h (Target::should_include_section): New function.
433 (Target::do_should_include_section): New function.
435 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
437 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
439 (Copy_relocs::emit): ... here.
440 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
441 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
442 (Copy_reloc_entry::entries_): Change from private to protected.
444 2014-04-02 Sriraman Tallam <tmsriram@google.com>
446 * icf.cc (get_section_contents): Replace copies of reloc
447 vectors with const references.
449 2014-04-02 Cary Coutant <ccoutant@google.com>
451 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
452 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
453 * configure: Regenerate.
454 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
455 -fno-use-linker-plugin.
456 (LINK1, CXXLINK1): Add it to the link command.
457 * testsuite/Makefile.in: Regenerate.
459 2014-03-12 Alan Modra <amodra@gmail.com>
461 * Makefile.in: Regenerate.
463 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
465 * symtab.h (Symbol::set_nonvis): New function.
467 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
469 * symtab.cc (Sized_symbol<32>::init_output_data):
470 Instantiate the template.
471 (Sized_symbol<64>::init_output_data): Likewise.
473 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
475 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
476 adjust dynamic symbol value.
477 * target.h (Target::adjust_dyn_symbol): New function.
478 (Target::do_adjust_dyn_symbol): New function.
480 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
482 * output.cc (Output_data_dynamic::Dynamic_entry::write):
483 Get the value of DYNAMIC_CUSTOM dynamic entry.
484 * output.h (Output_data_dynamic::add_custom): New function.
485 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
487 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
488 * target.h (Target::dynamic_tag_custom_value): New function.
489 (Target::do_dynamic_tag_custom_value): New function.
491 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
493 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
495 * target.h (Target::has_custom_set_dynsym_indexes): New function.
496 (Target::do_has_custom_set_dynsym_indexes): New function.
497 (Target::set_dynsym_indexes): New function.
498 (Target::do_set_dynsym_indexes): New function.
500 2014-03-07 Alan Modra <amodra@gmail.com>
502 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
503 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
504 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
505 (Powerpc_relocate_functions::has_overflow_bitfield,
506 overflowed): Use the above.
507 (Target_powerpc::Relocate::relocate): Correct overflow checking
508 for a number of relocations. Modify overflow test for 16-bit
509 fields in instructions to signed/unsigned according to whether
510 the field takes a signed or unsigned value.
512 2014-03-05 Alan Modra <amodra@gmail.com>
514 Update copyright years.
516 2014-03-05 Alan Modra <amodra@gmail.com>
518 * powerpc.cc (Target_powerpc::Scan::local, global): Support
519 R_PPC64_ADDR64_LOCAL.
520 (Target_powerpc::Relocate::relocate): Likewise.
522 2014-03-03 Alan Modra <amodra@gmail.com>
524 * dwp.cc (print_version): Update copyright year to current.
526 2014-02-10 Alan Modra <amodra@gmail.com>
528 * po/gold.pot: Regenerate.
530 2014-02-06 Cary Coutant <ccoutant@google.com>
532 Fix problem where -u is ignored when a weak undef is seen.
534 * archive.cc (Library_base::should_include_member): Reorder
535 code to check for -u option if a weak undef has already been seen.
536 * testsuite/Makefile.am (weak_undef_test_2): New test case.
537 * testsuite/Makefile.in: Regenerate.
538 * testsuite/weak_undef_file3.cc: New file.
539 * testsuite/weak_undef_file4.cc: New file.
540 * testsuite/weak_undef_test_2.cc: New file.
542 2014-02-05 Cary Coutant <ccoutant@google.com>
544 Fix issues with gold undefined symbol diagnostics.
547 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
549 * target-reloc.h (is_strong_undefined): New function.
550 (relocate_section): Move undef vtable symbol check from here.
551 Check for is_strong_undefined.
553 2014-02-05 Cary Coutant <ccoutant@google.com>
555 Fix problems with the --dynamic-list option.
558 * options.cc (General_options::parse_dynamic_list):
559 Set have_dynamic_list_.
560 (General_options::General_options): Initialize have_dynamic_list_.
561 (General_options::finalize): Turn off -Bsymbolic and
562 -Bsymbolic-functions if --dynamic-list provided.
563 * options.h (General_options::have_dynamic_list): New function.
564 (General_options::have_dynamic_list_): New data member.
565 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
569 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
570 in --dynamic-list, mark it.
572 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
573 (dynamic_list_2): New test case.
574 * testsuite/Makefile.in: Regenerate.
575 * testsuite/dynamic_list_2.cc: New file.
576 * testsuite/dynamic_list_2.t: New file.
577 * testsuite/dynamic_list_lib1.cc: New file.
578 * testsuite/dynamic_list_lib2.cc: New file.
579 * testsuite/gc_dynamic_list_test.c: New file.
580 * testsuite/gc_dynamic_list_test.sh: New file.
581 * testsuite/gc_dynamic_list_test.t: New file.
583 2014-01-28 Cary Coutant <ccoutant@google.com>
585 Add .gdb_index version 7 support.
587 * gold/dwarf_reader.cc: include <utility> (for make_pair).
588 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
590 (Dwarf_ranges_table::read_ranges_table): Likewise.
591 (Dwarf_pubnames_table::read_section): Check for GNU-style
592 sections, and for compressed debug sections.
593 (Dwarf_pubnames_table::read_header): Compute end address of table.
594 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
595 for end of list by offset, not by offset == 0.
596 (Dwarf_info_reader::do_read_string_table): Check for compressed
598 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
599 Initialize new data members.
600 (Dwarf_pubnames_table::next_name): return flag_byte.
601 (Dwarf_pubnames_table::end_of_table_): New data member.
602 (Dwarf_pubnames_table::is_gnu_style_): New data member.
603 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
604 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
605 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
606 read skeleton type unit DIEs.
607 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
608 (Gdb_index::do_write): Write flag_byte.
609 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
610 (Gdb_index::Cu_vector): Store flags along with cu indexes.
611 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
612 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
614 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
616 * version.cc (print_version): Update copyright year to 2014.
618 2013-12-19 Dimitry Andric <dimitry@andric.com>
620 * stringpool.cc (Stringpool_template::reserve): Add
621 HAVE_UNORDERED_MAP case.
622 * stringpool.cc (Stringpool_template::print_stats): Likewise.
624 2013-12-18 Cary Coutant <ccoutant@google.com>
626 * configure.ac: Check for <unordered_set> and <unordered_map>.
627 * config.in: Regenerate.
628 * configure: Regenerate.
629 * system.h: Use <unordered_set> and <unordered_map> if available.
631 2013-12-10 Roland McGrath <mcgrathr@google.com>
633 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
634 with $(INSTALL_PROGRAM_ENV).
635 * Makefile.in: Regenerate.
637 2013-11-22 Cary Coutant <ccoutant@google.com>
639 * configure.ac: Add check for which library is needed for
641 * configure: Regenerate.
643 2013-11-22 Cary Coutant <ccoutant@google.com>
645 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
647 * testsuite/Makefile.in: Regenerate.
649 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
651 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
652 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
653 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
654 (Target_x86_64<size>::Scan::local): Likewise.
655 (Target_x86_64<size>::Scan::global): Likewise.
656 (Target_x86_64<size>::Relocate::relocate): Likewise.
657 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
659 (Target_x86_64<size>::Scan::check_non_pic(): Handle
662 * testsuite/Makefile.am (check_PROGRAMS): Add
663 exception_x86_64_bnd_test.
664 (exception_x86_64_bnd_test_SOURCES): New macro.
665 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
666 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
667 (exception_x86_64_bnd_test_LDADD): Likewise.
668 (exception_x86_64_bnd_1.o): New rule.
669 (exception_x86_64_bnd_2.o): Likewise.
670 * testsuite/Makefile.in: Regenerated.
672 2013-11-15 Alan Modra <amodra@gmail.com>
674 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
676 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
677 Only call ppc64_local_entry_offset for 64-bit. Restrict
678 symval_for_branch lookup to ELFv1.
679 (Stub_table::add_plt_call_entry): Use unsigned int off.
680 (Output_data_glink::Address, invalid_address): New.
681 (Output_data_glink::add_eh_frame): Move out of line. Add
683 (Output_data_glink::add_global_entry, find_global_entry,
684 global_entry_address): New functions.
685 (Output_data_glink::global_entry_stubs_, end_branch_table_,
686 ge_size): New variables.
687 (Output_data_glink::set_final_data_size): Add global entry
689 (Output_data_glink::do_write): Write global entry stubs.
690 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
691 parameter. Return true for ELFv2. Adjust callers.
692 (Target_powerpc::Scan::local, global): Restrict opd lookup to
693 ELFv1. Similarly for ifunc and dynamic relocation processing
694 specific to ELFv1. Recognize that symbols are defined on
695 their plt entries for ELFv2.
696 (Target_powerpc::symval_for_branch): Assert if called for
698 (Target_powerpc::Relocate::relocate): Use global entry plt
699 stub for symbol value if such exists on ELFv2.
700 (Target_powerpc::Relocate::relocate): Don't call
701 symval_for_branch when ELFv2. Do adjust for local entry
703 (Target_powerpc::do_dynsym_value): Set symbols to global entry
705 (Target_powerpc::do_plt_address_for_global): Similarly.
707 2013-11-14 Cary Coutant <ccoutant@google.com>
709 Revert patch -- this did not fix the problem, and there is
712 2013-11-14 Cary Coutant <ccoutant@google.com>
715 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
716 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
717 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
718 updating fde_offsets_.
719 (Eh_frame_hdr::lock_): New data member.
721 2013-11-14 Cary Coutant <ccoutant@google.com>
723 * dwp.cc (Dwo_file_entry): New type.
724 (File_list): Use Dwo_file_entry.
725 (Dwo_file::verify): New function.
726 (Dwo_file::verify_dwo_list): New function.
727 (Dwo_file::sized_verify_dwo_list): New function.
728 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
730 (Dwp_options): New enum type.
731 (dwp_options): Add --verify-only.
734 * dwp.h (gold_info): Add declaration.
736 2013-11-14 Cary Coutant <ccoutant@google.com>
739 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
740 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
741 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
742 updating fde_offsets_.
743 (Eh_frame_hdr::lock_): New data member.
745 2013-11-06 Cary Coutant <ccoutant@google.com>
748 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
749 before reloc sections.
751 2013-11-04 Alan Modra <amodra@gmail.com>
753 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
754 (Symbol::needs_dynamic_reloc): Test new flag.
755 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
756 (Target_powerpc::Scan::get_reference_flags): Add target param.
757 Return FUNC_DESC_ABI for 64-bit ELFv1.
758 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
760 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
761 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
763 2013-10-31 Cary Coutant <ccoutant@google.com>
765 Restore support for dwp v2 DWARF package file format.
767 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
768 tu_length parameter. Adjust all callers.
769 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
770 * dwp.cc: Include dwarf.h.
771 (Section_bounds): New struct type.
772 (Unit_set): New struct type.
773 (Dwo_file::Dwo_file): Initialize new data member.
774 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
775 Combine and rename to...
776 (Dwo_file::read_unit_index): ...this.
777 (Dwo_file::sized_read_compunit_index)
778 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
779 (Dwo_file::sized_read_unit_index): ...this.
780 (Dwo_file::copy_section): Remove section_name, is_str_offsets
781 parameters; add section_id parameter.
782 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
783 (Dwo_file::add_unit_set): ...this.
784 (Dwo_file::shndx_map_): Remove.
785 (Dwo_file::sect_offsets_): New data member.
786 (Dwp_output_file::Dwp_output_file): Initialize new data members.
787 (Dwp_output_file::add_section): Rename to...
788 (Dwp_output_file::add_contribution): ...this.
789 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
790 (Dwp_output_file::add_tu_set): Likewise.
791 (Dwp_output_file::Contribution): New type.
792 (Dwp_output_file::Section::contributions): New data member.
793 (Dwp_output_file::Cu_or_tu_set): Remove.
794 (Dwp_output_file::Section::Section): New ctor.
795 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
796 (Dwp_output_file::Dwp_index::Section_table): New type.
797 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
798 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
800 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
801 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
802 (Dwp_output_file::Dwp_index::section_table): New member function.
803 (Dwp_output_file::Dwp_index::section_table_end): New member function.
804 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
805 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
806 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
807 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
808 (Dwp_output_file::Dwp_index::section_table_): New data member.
809 (Dwp_output_file::Dwp_index::section_mask_): New data member.
810 (Dwp_output_file::add_output_section): New member function.
811 (Dwp_output_file::write_new_section): New member function.
812 (Dwp_output_file::write_contributions): New member function.
813 (Dwp_output_file::section_id_map_): New data member.
814 (class Dwo_id_info_reader): Remove.
815 (class Unit_reader): New class.
816 (get_dwarf_section_name): New function.
817 (Dwo_file::read_executable): Adjust initializations of class data.
818 (Dwo_file::read): Add support for v2 package file format.
819 (Dwo_file::read_unit_index): Likewise.
820 (Dwo_file::sized_read_unit_index): Likewise.
821 (Dwo_file::copy_section): Likewise.
822 (Dwo_file::add_unit_set): Likewise.
823 (Dwp_output_file::add_output_section): Likewise.
824 (Dwp_output_file::add_contribution): Likewise.
825 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
827 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
829 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
831 (Dwp_output_file::initialize): Remove unused function.
832 (Dwp_output_file::finalize): Add support for v2 package file format.
833 (Dwp_output_file::write_index): Likewise.
834 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
837 2013-10-31 Cary Coutant <ccoutant@google.com>
839 * configure.ac: Fix check for -fmerge-constants.
840 * configure.ac: Regenerate.
842 2013-10-30 Roland McGrath <mcgrathr@google.com>
844 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
845 Correct 9-byte nop sequence to match what the assembler generates.
847 2013-10-30 Alan Modra <amodra@gmail.com>
849 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
850 ppc64_local_entry_offset, ppc64_local_entry_offset,
851 do_read_symbols): New functions.
852 (Powerpc_relobj::e_flags_, st_other_): New vars.
853 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
854 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
855 (Powerpc_relobj::e_flags_): New var.
856 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
857 and adjust for ELFv2.
858 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
859 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
860 (Powerpc_dynobj::do_find_special_sections): Likewise.
861 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
862 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
863 to ELFv2 local entry.
864 (Target_powerpc::do_relax): No thread safe barriers needed for
866 (Output_data_plt_powerpc::initial_plt_entry_size_,
867 plt_entry_size): Delete. Replace all uses with
868 first_plt_entry_offset() and plt_entry_size().
869 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
870 reserved_size parm. Update callers.
871 (Output_data_plt_powerpc::entry_count): Update.
872 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
873 and use Target_powerpc::first_plt_entry_offset().
874 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
875 rename to plt_entry_size.
876 (Output_data_plt_powerpc::add_ifunc_entry,
877 add_local_ifunc_entry): Adjust reloc for ELFv2.
878 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
879 (glink_eh_frame_fde_64v2): New.
880 (Stub_table::plt_call_size): Support ELFv2 sizing.
881 (Output_data_glink::add_eh_frame): Use the new FDE.
882 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
883 (Stub_table::do_write): Write ELFv2 stubs and glink.
884 (Target_powerpc::Relocate::relocate): Replaces nop after call
885 with ld 2,24(1) and adjust local offset destination for ELFv2.
887 2013-10-30 Alan Modra <amodra@gmail.com>
889 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
890 (Target_powerpc::Scan::global, local): Likewise.
891 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
892 on all ppc64 @h and @ha relocs.
894 2013-10-14 Alan Modra <amodra@gmail.com>
896 * output.h (Output_data_got::add_constant): Tidy.
897 (Output_data_got::add_constant_pair): New function.
898 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
899 methods used so as to first call reserve_ent().
901 2013-10-11 Roland McGrath <mcgrathr@google.com>
903 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
904 add_got_entry and add_got_entry_pair.
906 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
907 (HAVE_PUBNAMES): Likewise.
908 * configure: Regenerate.
910 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
911 * testsuite/Makefile.in: Regenerate.
913 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
914 Remove const from declaration.
915 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
916 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
917 * output.h (Output_file_header): Remove const from member target_
918 and corresponding constructor argument.
919 * output.cc (Output_file_header::Output_file_header): Update prototype.
920 (Output_file_header::do_sized_write): Use this->target_ in place
921 of parameters()->target().
923 * testsuite/undef_symbol.cc (Foo::get_a): New method.
925 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
926 * configure: Regenerate.
927 * Makefile.in: Regenerate.
928 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
929 * testsuite/merge_string_literals_2.c: Likewise.
930 * testsuite/Makefile.am
931 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
932 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
933 literal -fmerge-constants.
934 * testsuite/Makefile.in: Regenerate.
936 * i386.cc (Target_i386): Remove unused member dynbss_.
937 * arm.cc (Target_arm): Likewise.
938 * powerpc.cc (Target_powerpc): Likewise.
939 * sparc.cc (Target_sparc): Likewise.
940 * tilegx.cc (Target_tilegx): Likewise.
941 * x86_64.cc (Target_x86_64): Likewise.
942 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
943 type_signature_, type_offset_.
944 * plugin.h (Plugin_hook): Remove unused member layout_.
945 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
947 (Read_member): Remove unused members input_objects_, symtab_,
949 (Check_library): Remove unused member symtab_.
950 * archive.h (Lib_group): Remove unused member lib_.
951 * archive.cc (Lib_group::Lib_group): Update initializer.
952 * incremental.h (Incremental_binary): Remove unused member target_.
953 (Incremental_script_entry): Removed unused member script_.
954 * layout.h (Write_symbols_task): Remove unused member input_objects_.
955 * icf.h (Icf): Remove unused member num_tracked_relocs.
957 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
958 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
960 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
962 * archive.h: Use struct rather than class for forward declaration
963 of Read_symbols_data.
965 2013-10-07 Cary Coutant <ccoutant@google.com>
968 * testsuite/Makefile.am (icf_test): Fix dependencies.
969 (icf_safe_test): Likewise.
970 (icf_safe_so_test): Likewise.
971 (large_symbol_alignment): Add empty _LDADD rule.
972 * testsuite/Makefile.in: Regenerate.
974 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
977 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
978 relocation for R_X86_64_32 on x32.
980 2013-08-27 Roland McGrath <mcgrathr@google.com>
982 * output.cc (Output_segment::set_section_addresses): Take new
983 Target* argument. If target->isolate_execinstr() and the segment
984 is executable and starts at a target->abi_pagesize() boundary,
985 pad its end out to a target->abi_pagesize() boundary with code fill.
986 * output.h (Output_segment::set_section_addresses): Update decl.
987 * layout.h (Layout::check_output_data_for_reset_values): Take new
988 argument RELAX_OUTPUTS.
989 (Layout): New member relax_output_list_.
990 (Layout::add_relax_output): New method.
991 * layout.cc (Layout::Layout): Update constructor.
992 (Layout::reset_relax_output): New method.
993 (Layout::clean_up_after_relaxation): Call it.
994 (Layout::prepare_for_relaxation): Update caller.
995 (Layout::set_segment_offsets): Update callers of set_section_addresses.
996 Call reset_relax_output before re-processing segments for
997 isolate_execinstr case.
998 (Layout::write_data): Handle relax_output_list_.
999 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1000 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1002 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1005 * object.h: Fix typos.
1007 2013-08-16 Roland McGrath <mcgrathr@google.com>
1009 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1010 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1012 2013-08-07 Cary Coutant <ccoutant@google.com>
1014 Revert support for v2 DWP files:
1016 2013-03-01 Cary Coutant <ccoutant@google.com>
1018 Add dwp support for v2 DWARF package file format.
1019 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1020 tu_length parameter. Adjust all callers.
1021 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1022 * dwp.cc: Include dwarf.h.
1023 (Section_bounds): New struct type.
1024 (Unit_set): New struct type.
1025 (Dwo_file::Dwo_file): Initialize new data member.
1026 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1027 Combine and rename to...
1028 (Dwo_file::read_unit_index): ...this.
1029 (Dwo_file::sized_read_compunit_index)
1030 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1031 (Dwo_file::sized_read_unit_index): ...this.
1032 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1033 parameters; add section_id parameter.
1034 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1035 (Dwo_file::add_unit_set): ...this.
1036 (Dwo_file::shndx_map_): Remove.
1037 (Dwo_file::sect_offsets_): New data member.
1038 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1039 (Dwp_output_file::add_section): Rename to...
1040 (Dwp_output_file::add_contribution): ...this.
1041 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1042 (Dwp_output_file::add_tu_set): Likewise.
1043 (Dwp_output_file::Contribution): New type.
1044 (Dwp_output_file::Section::contributions): New data member.
1045 (Dwp_output_file::Cu_or_tu_set): Remove.
1046 (Dwp_output_file::Section::Section): New ctor.
1047 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1048 (Dwp_output_file::Dwp_index::Section_table): New type.
1049 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1050 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1052 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1053 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1054 (Dwp_output_file::Dwp_index::section_table): New member function.
1055 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1056 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1057 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1058 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1059 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1060 (Dwp_output_file::Dwp_index::section_table_): New data member.
1061 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1062 (Dwp_output_file::add_output_section): New member function.
1063 (Dwp_output_file::write_new_section): New member function.
1064 (Dwp_output_file::write_contributions): New member function.
1065 (Dwp_output_file::section_id_map_): New data member.
1066 (class Dwo_id_info_reader): Remove.
1067 (class Unit_reader): New class.
1068 (get_dwarf_section_name): New function.
1069 (Dwo_file::read_executable): Adjust initializations of class data.
1070 (Dwo_file::read): Add support for v2 package file format.
1071 (Dwo_file::read_unit_index): Likewise.
1072 (Dwo_file::sized_read_unit_index): Likewise.
1073 (Dwo_file::copy_section): Likewise.
1074 (Dwo_file::add_unit_set): Likewise.
1075 (Dwp_output_file::add_output_section): Likewise.
1076 (Dwp_output_file::add_contribution): Likewise.
1077 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1079 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1081 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1083 (Dwp_output_file::initialize): Remove unused function.
1084 (Dwp_output_file::finalize): Add support for v2 package file format.
1085 (Dwp_output_file::write_index): Likewise.
1086 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1089 2013-07-31 Cary Coutant <ccoutant@google.com>
1091 * object.cc (Sized_relobj::do_output_section_address): New function.
1092 (Sized_relobj): Instantiate explicitly.
1093 * object.h (Object::output_section_address): New function.
1094 (Object::do_output_section_address): New function.
1095 (Sized_relobj::do_output_section_address): New function.
1096 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1098 2013-07-30 Cary Coutant <ccoutant@google.com>
1099 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1101 * parameters.cc (Parameters::entry): Return target-specific entry
1103 * target.h (Target::entry_symbol_name): New function.
1104 (Target_info::entry_symbol_name): New data member.
1106 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1107 * i386.cc (Target_i386::i386_info): Likewise.
1108 (Target_i386_nacl::i386_nacl_info): Likewise.
1109 * sparc.cc (Target_sparc::sparc_info): Likewise.
1110 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1111 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1112 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1113 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1115 2013-07-22 Sterling Augustine <saugustine@google.com>
1117 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1118 Convert parameter shndx to local variable. Add parameters symtab
1119 and symtab_size. Scan over section names. Find relocation
1120 section corresponding to current section. Create and initialize
1121 reloc_mapper_ and reloc_type_.
1122 (Dwarf_pubnames_table::read_header): Add assertion. Change
1123 unit_length to off_t. Initialize member unit_length_. Fill in field
1125 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1126 Initialize new fields unit_length_ and cu_offset_.
1127 (Dwarf_pubnames_table::read_section): Update prototype.
1128 (Dwarf_pubnames_table::cu_offset): New member function.
1129 (Dwarf_pubnames_table::subsection_size): Likewise.
1130 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1132 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1133 member functions public.
1134 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1135 Update comment. Rework logic. Move repeated parts to...
1136 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1137 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1138 pubtypes_table_, and stmt_list_offset.
1139 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1140 Gdb_index::find_pubtype_offset,
1141 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1142 (Gdb_index::pubnames_read): Update prototype and rework logic.
1143 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1145 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1146 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1147 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1148 Gdb_index::map_pubtable_to_dies):
1150 (Gdb_index::pubnames_read): Update declaration.
1151 (Gdb_index::Pubname_offset_map): New type.
1152 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1153 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1154 Gdb_index::stmt_list_offset): Declare.
1155 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1156 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1157 Gdb_index::pubtypes_offset_): Remove.
1159 2013-07-19 Roland McGrath <mcgrathr@google.com>
1161 * options.h (General_options): Add -Trodata-segment option.
1162 * parameters.cc (Parameters::check_rodata_segment): New function.
1163 (Parameters::set_target_once): Call it.
1164 * parameters.h (Parameters): Declare it (private member function).
1165 * layout.cc (load_seg_unusable_for_headers): New function, broken
1166 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1167 then validate rodata segment rather than text segment.
1168 (relaxation_loop_body): Call that.
1169 (is_text_segment): New function. Don't admit a non-executable
1170 segment if TARGET->isolate_execinstr().
1171 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1173 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1176 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1177 * nacl.h (Sniff_file::View::View): Request aligned view.
1179 2013-07-11 Cary Coutant <ccoutant@google.com>
1181 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1182 correct BRLT entry size.
1184 2013-07-03 Alan Modra <amodra@gmail.com>
1186 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1189 2013-07-01 Cary Coutant <ccoutant@google.com>
1191 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1193 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1194 (Dwarf_ranges_table::lookup_reloc): New function.
1195 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1197 (Dwarf_ranges_table::lookup_reloc): New function.
1198 (Dwarf_ranges_table::reloc_type_): New data member.
1200 2013-06-27 Jing Yu <jingyu@google.com>
1203 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1205 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1206 (Target_powerpc::do_relax): Call the above.
1208 2013-06-27 Cary Coutant <ccoutant@google.com>
1210 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1211 on garbage collected .opd section.
1213 2013-06-27 Alan Modra <amodra@gmail.com>
1215 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1217 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1218 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1220 2013-06-14 Cary Coutant <ccoutant@google.com>
1222 * resolve.cc (Symbol::override_base): Don't override st_type
1223 from plugin placeholder symbols.
1224 (Symbol_table::resolve): Likewise.
1225 (Symbol_table::should_override): Don't complain about TLS mismatch
1226 if the TO symbol is a plugin placeholder.
1227 * testsuite/Makefile.am (plugin_test_tls): New test.
1228 * testsuite/Makefile.in: Regenerate.
1229 * testsuite/plugin_test_tls.sh: New test script.
1230 * testsuite/two_file_test_2_tls.cc: New test source.
1231 * testsuite/two_file_test_tls.cc: New test source.
1233 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1235 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1236 the maximum segment alignment is larger than the page size.
1237 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1238 correctly aligns the symbols with large alignemnt.
1239 * testsuite/Makefile.in: Regenerate.
1240 * testsuite/large_symbol_alignment.cc: New file.
1242 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1243 Sriraman Tallam <tmsriram@google.com>
1245 * options.h (sort_section): New option.
1246 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1247 Rename from Input_section_sort_section_name_special_ordering_compare.
1248 (Input_section_sort_section_name_compare): New struct.
1249 * output.cc (Output_section::Input_section_sort_section_name_compare::
1250 operator()): New function.
1251 (Output_section::sort_attached_input_sections): Use new sort function
1252 for .text if --sort-section=name is specified.
1253 * layout.cc (Layout::make_output_section):
1254 Add sorting by name when --sort-section=name is specified.
1255 * testsuite/Makefile.am (text_section_grouping): Test option
1256 --sort-section=name.
1257 * testsuite/Makefile.in: Regenerate.
1258 * testsuite/section_sorting_name.cc: New file.
1259 * testsuite/section_sorting_name.sh: New file.
1261 2013-05-21 Cary Coutant <ccoutant@google.com>
1263 * symtab.h (Symbol::is_cxx_vtable): New function.
1264 * target-reloc.h (relocate_section): Check for vtable symbol.
1265 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1266 * testsuite/Makefile.in: Regenerate.
1267 * testsuite/missing_key_func.cc: New test source.
1268 * testsuite/missing_key_func.sh: New test script.
1270 2013-05-21 Cary Coutant <ccoutant@google.com>
1272 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1273 type of enclosing symbol.
1274 (Relocate_info::location): Check symbol type when describing symbol.
1275 * object.h (Symbol_location_info): Remove unused line_number;
1276 add enclosing_symbol_type.
1277 * testsuite/debug_msg.sh: Adjust expected output.
1279 2013-05-13 Cary Coutant <ccoutant@google.com>
1281 * configure.ac: Export DEFAULT_TARGET.
1282 * configure: Regenerate.
1283 * Makefile.in: Regenerate.
1284 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1285 * testsuite/Makefile.in: Regenerate.
1286 * testsuite/debug_msg.sh: Delete duplicate tests.
1287 Don't check undef_int error message match for powerpc where the
1288 source file and line number aren't available.
1290 2013-05-10 Roland McGrath <mcgrathr@google.com>
1292 * options.h (General_options): Add --rosegment-gap option.
1293 * options.cc (finalize): --rosegment-gap implies --rosegment.
1294 * layout.cc (set_segment_offsets): Let user option override
1295 target->rosegment_gap().
1297 2013-05-10 Roland McGrath <mcgrathr@google.com>
1299 * options.h (General_options): Remove leading space from help
1300 messages for -nostdlib and --rosegment.
1302 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1305 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1307 2013-05-03 Alan Modra <amodra@gmail.com>
1309 * merge.cc (Output_merge_string::do_add_input_section): Correct
1310 scan for number of strings. Rename vars to avoid shadowing.
1311 Include missing terminator in input_size_.
1313 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1315 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1316 Restore empty string handling.
1318 2013-05-01 Cary Coutant <ccoutant@google.com>
1320 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1321 uninitialized warning.
1323 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1325 * output.cc (Output_section::add_merge_input_section): Allow
1326 to merge sections if the alignment is more than character size.
1327 * merge.h (Output_merge_string::Output_merge_string): Remove
1329 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1330 only not-null strings. Check the alignment of strings.
1332 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1333 alignment as the argument.
1334 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1335 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1336 Align non-zero length strings according to the addralign_.
1337 (Stringpool_template<Stringpool_char>::set_string_offsets):
1338 Updating offsets according to the given alignment.
1339 * testsuite/Makefile.am (text_section_grouping): Test if string
1340 literals are getting merged.
1341 * testsuite/Makefile.in: Regenerate.
1342 * testsuite/merge_string_literals_1.c: New file.
1343 * testsuite/merge_string_literals_2.c: Ditto.
1344 * testsuite/merge_string_literals.sh: Ditto.
1346 2013-04-26 Ian Lance Taylor <iant@google.com>
1348 * target-reloc.h (relocate_section): If the reloc offset is out of
1349 range, pass VIEW as NULL to relocate.relocate.
1350 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1351 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1352 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1353 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1354 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1355 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1357 2013-04-26 Geoff Pike <gpike@chromium.org>
1359 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1360 * layout.cc (Hash_task): New class.
1361 (Layout::queue_build_id_tasks): New function.
1362 (Layout::write_build_id): Handle single-thread portion of build ID
1363 computation. (In some cases, all of it is single-threaded.) Replace
1364 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1365 functionality in fewer lines of code.
1366 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1367 * options.h (General_options): make "--build-id" default to tree
1368 rather than sha1. Add two new options related to --build-id=tree:
1369 --build-id-chunk-size-for-treehash and
1370 --build-id-min-file-size-for-treehash.
1371 * Makefile.am: add testing of --build-id=tree and related new options
1372 (these tests will be invoked by "make check").
1373 * Makefile.in: Regenerate.
1375 2013-04-25 Alan Modra <amodra@gmail.com>
1377 * configure.tgt: Add powerpcle and powerpc64le.
1379 2013-04-22 Alan Modra <amodra@gmail.com>
1382 * layout.cc (Layout::segment_precedes): Allow more than one
1383 segment with the same type and flags.
1385 2013-04-15 Cary Coutant <ccoutant@google.com>
1387 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1388 allocate space in file for BSS sections.
1390 2013-04-15 Cary Coutant <ccoutant@google.com>
1392 * script-sections.cc (Orphan_output_section): Reset address
1393 to zero after each orphaned section for relocatable links.
1395 2013-04-15 Cary Coutant <ccoutant@google.com>
1397 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1398 section starting address for relocatable link.
1399 * testsuite/Makefile.am (script_test_11): New test.
1400 * testsuite/Makefile.in: Regenerate.
1401 * testsuite/script_test_11.c: New source file.
1402 * testsuite/script_test_11.t: New linker script.
1404 2013-04-13 Alan Modra <amodra@gmail.com>
1406 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1407 owner when sections are not adjacent and exceed group size.
1408 (Target_powerpc::group_sections): Handle corner case.
1409 (Target_powerpc::Branch_info::make_stub): Handle case where
1410 stub table doesn't exist due to branches in non-exec sections.
1411 (Target_powerpc::Relocate::relocate): Likewise.
1413 2013-04-11 Alan Modra <amodra@gmail.com>
1416 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1417 .branch_lt to match bfd ld. Adjust comments throughout file.
1419 2013-04-04 Ian Lance Taylor <iant@google.com>
1422 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1423 sections before checking whether they are included in the link.
1425 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1427 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1428 object before calling the plugin claim_file handler. Pass the elf
1429 object of the archive to the plugin. Delete the elf object if the
1430 plugin claims the file.
1432 2013-03-21 Alan Modra <amodra@gmail.com>
1434 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1435 segment when omagic.
1437 2013-03-21 Alan Modra <amodra@gmail.com>
1439 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1441 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1442 uninitialized" warning.
1444 2013-03-20 Alan Modra <amodra@gmail.com>
1446 * symtab.h (Symbol::clear_version): New function.
1447 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1448 is_needed by weak references. Clear version for symbols defined
1449 in as-needed objects that are not needed.
1451 2013-03-15 Alan Modra <amodra@gmail.com>
1453 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1454 static and public. Add report_err param. Return false for data refs.
1455 (Target_powerpc::rela_dyn_section): New overloaded function.
1456 (Target_powerpc::plt_, iplt_): Elucidate.
1457 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1458 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1459 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1460 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1461 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1462 push_branch and make_plt_entry for ifunc syms when
1463 reloc_needs_plt_for_ifunc.
1464 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1465 for ifunc unless reloc_needs_plt_for_ifunc.
1467 2013-03-15 Alan Modra <amodra@gmail.com>
1469 * gc.h (gc_process_relocs): Don't look through function descriptors.
1470 * icf.cc (get_section_contents): Do so here instead.
1472 2013-03-13 Alan Modra <amodra@gmail.com>
1474 * powerpc.cc (is_branch_reloc): Forward declare.
1475 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1476 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1477 false for 64-bit, true for 32-bit non-branch relocs.
1478 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1479 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1481 (icf_safe_test): Generate linker map file as well as nm output.
1482 (icf_safe_so_test): Likewise.
1483 * testsuite/Makefile.in: Regenerate.
1484 * testsuite/icf_test.sh: Parse linker map file to determine
1486 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1487 * testsuite/icf_safe_so_test.sh: Likewise.
1488 (X86_32_or_ARM_specific_safe_fold): Merge into..
1489 (arch_specific_safe_fold): ..this.
1490 (X86_64_specific_safe_fold): Delete unused function.
1492 2013-03-12 Alan Modra <amodra@gmail.com>
1494 * gc.h (gc_process_relocs): Look through function descriptors
1495 to determine shndx, symvalue and addend used by ICF. Tidy
1496 variable duplication.
1498 2013-03-11 Alan Modra <amodra@gmail.com>
1500 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1501 * layout.cc (Layout_task_runner::run): ..to here.
1502 * symtab.h (struct Symbol_location): Extract from..
1503 (class Symbol_table): ..here.
1504 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1505 * target.h (class Target): Add function_location and
1506 do_function_location functions.
1507 (class Sized_target): Add do_function_location.
1508 * object.h (class Sized_relobj_file): Move find_shdr..
1509 (class Object): ..to here.
1510 * object.cc: Likewise. Update to suit. Instantiate.
1511 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1512 * powerpc.cc (class Powerpc_dynobj): New.
1513 (Target_powerpc::do_function_location): New function.
1514 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1515 (Powerpc_dynobj::do_read_symbols): New function.
1516 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1518 2013-03-08 Ian Lance Taylor <iant@google.com>
1520 * options.cc (General_options::string_to_object_format): Accept
1523 2013-03-08 Alan Modra <amodra@gmail.com>
1525 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1526 pointer to Post_fde.
1527 (struct Post_fde): Move definition to here..
1528 * ehframe.cc (struct Post_fde): ..from here.
1529 (Cie::write): Don't alloc Post_fde.
1530 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1532 2013-03-07 Alan Modra <amodra@gmail.com>
1534 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1535 relocation referencing .LC0.
1536 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1538 2013-03-07 Alan Modra <amodra@gmail.com>
1540 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1541 always_inline. Add assembly for powerpc to avoid GOT.
1543 2013-03-07 Alan Modra <amodra@gmail.com>
1545 * testsuite/script_test_10.sh: Don't test .bss section
1548 2013-03-06 Alan Modra <amodra@gmail.com>
1550 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1551 (Target_powerpc::symval_for_branch): Add symtab param. Update
1552 all callers. Handle folded sections.
1553 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1555 (Global_symbol_visitor_opd::operator()): Likewise.
1557 2013-03-04 Alan Modra <amodra@gmail.com>
1559 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1560 * testsuite/Makefile.in: Regenerate.
1562 2013-03-01 Cary Coutant <ccoutant@google.com>
1564 Add dwp support for v2 DWARF package file format.
1565 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1566 tu_length parameter. Adjust all callers.
1567 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1568 * dwp.cc: Include dwarf.h.
1569 (Section_bounds): New struct type.
1570 (Unit_set): New struct type.
1571 (Dwo_file::Dwo_file): Initialize new data member.
1572 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1573 Combine and rename to...
1574 (Dwo_file::read_unit_index): ...this.
1575 (Dwo_file::sized_read_compunit_index)
1576 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1577 (Dwo_file::sized_read_unit_index): ...this.
1578 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1579 parameters; add section_id parameter.
1580 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1581 (Dwo_file::add_unit_set): ...this.
1582 (Dwo_file::shndx_map_): Remove.
1583 (Dwo_file::sect_offsets_): New data member.
1584 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1585 (Dwp_output_file::add_section): Rename to...
1586 (Dwp_output_file::add_contribution): ...this.
1587 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1588 (Dwp_output_file::add_tu_set): Likewise.
1589 (Dwp_output_file::Contribution): New type.
1590 (Dwp_output_file::Section::contributions): New data member.
1591 (Dwp_output_file::Cu_or_tu_set): Remove.
1592 (Dwp_output_file::Section::Section): New ctor.
1593 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1594 (Dwp_output_file::Dwp_index::Section_table): New type.
1595 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1596 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1598 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1599 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1600 (Dwp_output_file::Dwp_index::section_table): New member function.
1601 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1602 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1603 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1604 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1605 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1606 (Dwp_output_file::Dwp_index::section_table_): New data member.
1607 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1608 (Dwp_output_file::add_output_section): New member function.
1609 (Dwp_output_file::write_new_section): New member function.
1610 (Dwp_output_file::write_contributions): New member function.
1611 (Dwp_output_file::section_id_map_): New data member.
1612 (class Dwo_id_info_reader): Remove.
1613 (class Unit_reader): New class.
1614 (get_dwarf_section_name): New function.
1615 (Dwo_file::read_executable): Adjust initializations of class data.
1616 (Dwo_file::read): Add support for v2 package file format.
1617 (Dwo_file::read_unit_index): Likewise.
1618 (Dwo_file::sized_read_unit_index): Likewise.
1619 (Dwo_file::copy_section): Likewise.
1620 (Dwo_file::add_unit_set): Likewise.
1621 (Dwp_output_file::add_output_section): Likewise.
1622 (Dwp_output_file::add_contribution): Likewise.
1623 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1625 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1627 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1629 (Dwp_output_file::initialize): Remove unused function.
1630 (Dwp_output_file::finalize): Add support for v2 package file format.
1631 (Dwp_output_file::write_index): Likewise.
1632 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1635 2013-03-01 Cary Coutant <ccoutant@google.com>
1637 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1638 function into class definition in header file.
1639 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1640 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1642 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1644 2013-02-28 Alan Modra <amodra@gmail.com>
1646 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1647 * target.cc (Target::do_plt_fde_location): New function.
1648 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1649 accessor function, and constructor param.
1650 (struct Post_fde, Post_fdes): Declare.
1651 (Cie::write): Add post_fdes param.
1652 * ehframe.cc (Fde::write): Use plt_fde_location.
1653 (struct Post_fde): Define.
1654 (Cie::write): Stash FDEs added post merge mapping.
1655 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1656 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1657 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1659 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1660 (Target_powerpc::has_glink): New function.
1661 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1662 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1663 glink_eh_frame_fde_32, default_fde): New data.
1664 (Stub_table::eh_frame_added_): New var.
1665 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1667 (Stub_table::add_eh_frame): New function.
1668 (Output_data_glink::add_eh_frame): New function.
1669 (Target_powerpc::make_glink_section): Call add_eh_frame.
1671 2013-02-15 Ian Lance Taylor <iant@google.com>
1673 * options.h (DEFINE_uint64_alias): Define.
1674 (class General_options): Add -Ttext-segment as an alias for
1677 2013-02-15 Alan Modra <amodra@gmail.com>
1679 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1680 (Stub_table::do_write): ..here, two places.
1681 (Stub_table::plt_call_size): Use it here too.
1683 2013-02-11 Ian Lance Taylor <iant@google.com>
1685 * descriptors.cc (Descriptors::close_all): New function.
1686 * descriptors.h (class Descriptors): Declare close_all.
1687 (close_all_descriptors): New inline function.
1688 * plugin.cc: Include "descriptors.h".
1689 (Plugin_manager::cleanup): Call close_all_descriptors.
1691 2013-02-06 Alan Modra <amodra@gmail.com>
1693 * README: Update coding style link.
1695 2013-01-28 Cary Coutant <ccoutant@google.com>
1697 * dwp.cc (File_list): New typedef.
1698 (Dwo_name_info_reader): New class.
1699 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1700 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1701 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1702 (Dwo_file::read_executable): New function.
1703 (Dwo_file::read): Move common setup code to ...
1704 (Dwo_file::make_object): ... here.
1705 (dwp_options): Add --exec/-e.
1709 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1711 * layout.cc (Layout::layout): Check for option text_reorder.
1712 (Layout::make_output_section): Ditto.
1713 * options.h (text_reorder): New option.
1714 * output.cc (Input_section_sort_compare): Remove special ordering
1717 Input_section_sort_section_name_special_ordering_compare::
1718 operator()): New function.
1719 (Output_section::sort_attached_input_sections): Use new sort function
1721 * output.h (Input_section_sort_section_name_special_ordering_compare):
1723 * testsuite/Makefile.am (text_section_grouping): Test option
1725 * testsuite/Makefile.in: Regenerate.
1726 * testsuite/text_section_grouping.sh: Check order of functions without
1727 default text reordering.
1729 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1731 * options.h (General_options): Change default to true for new_dtags.
1733 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1735 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1736 when enable_new_dtags is false. Only add DT_RUNPATH when
1737 enable_new_dtags is true.
1739 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1741 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1742 used in declaration and definition consistent.
1743 (Target_powerpc::symval_for_branch): Ditto.
1745 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1747 * testsuite/plugin_final_layout.cc: Fix comment.
1749 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1751 * layout.cc (Layout::layout): Do not do default sorting for
1752 text sections when section ordering is specified.
1753 (make_output_section): Ditto.
1754 * testsuite/plugin_final_layout.cc: Name the function sections
1755 to catch reordering issues.
1757 2013-01-15 Alan Modra <amodra@gmail.com>
1759 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1762 2013-01-15 Alan Modra <amodra@gmail.com>
1764 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1765 * testsuite/Makefile.in: Regenerate.
1767 2013-01-14 Alan Modra <amodra@gmail.com>
1769 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1770 * testsuite/Makefile.in: Regenerate.
1772 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1775 Fix mingw gold build with plugins enabled
1776 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1777 * configure.ac: Export DLOPEN_LIBS and add headers check.
1778 * plugin.cc: Handle non-dlfcn case.
1779 * Makefile.in: Regenerate.
1780 * config.in: Regenerate.
1781 * configure: Regenerate.
1782 * testsuite/Makefile.in: Regenerate.
1784 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1786 * output.h (sort_attached_input_sections): Change to be public.
1787 * script-sections.cc
1788 (Output_section_definition::set_section_addresses): Sort
1789 attached input sections according to section order before linker
1790 script assigns section addresses.
1791 (Orphan_output_section::set_section_addresses): Sort
1792 attached input sections according to section order before linker
1793 script assigns section addresses.
1794 * Makefile.am (final_layout.sh): Use a simple linker script to
1795 check if section ordering still works.
1796 * Makefile.in: Regenerate.
1798 2013-01-09 Ben Cheng <bccheng@google.com>
1800 * arm.cc (Target_arm::attributes_accept_div): New function.
1801 (Target_arm::attributes_forbid_div): New function.
1802 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1803 attribute using the same new functions as what bfd/elf32_arm.c
1806 2013-01-07 Cary Coutant <ccoutant@google.com>
1809 * output.cc (Output_section::add_input_section): For incremental
1810 updates, don't track input sections that are allocated from patch
1813 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1814 Ian Lance Taylor <iant@google.com>
1817 * configure.ac (--enable-ld): Removed.
1818 (install_as_default): Set to yes only for --enable-gold=default
1820 * configure: Regenerated.
1822 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1824 * options.h (General_options): Add -fuse-ld= for GCC linker
1825 option compatibility.
1827 2013-01-04 Cary Coutant <ccoutant@google.com>
1829 * configure.ac: Fix typo restoring CXXFLAGS.
1830 * configure: Regenerate.
1832 2013-01-04 Cary Coutant <ccoutant@google.com>
1834 * testsuite/Makefile.am (CXXLINK_S): New macro.
1835 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1836 * testsuite/Makefile.in: Regenerate.
1838 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1840 * version.cc (print_version): Update copyright year to 2013.
1842 2012-12-20 Ian Lance Taylor <iant@google.com>
1844 * layout.cc (Layout::special_ordering_of_input_section): New
1846 (Layout::layout): If input section requires special ordering, must
1847 sort input sections.
1848 (Layout::make_output_section): May sort .text input sections.
1849 (Layout::is_section_name_prefix_grouped): Remove.
1850 * layout.h (class Layout): Declare
1851 special_ordering_of_input_section. Don't declare
1852 is_section_name_prefix_grouped.
1853 * output.cc (Output_section::add_input_section): Revert last
1855 (Output_section::Input_section_sort::match_file_name): Don't crash
1856 if called on output section data.
1857 (Output_section::Input_section_sort_compare): Sort based on
1859 (Output_section::Input_section_sort_section_order_index_compare):
1861 (Output_section::sort_attached_input_sections): Likewise.
1863 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1865 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1866 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1867 * output.cc (Output_section::add_input_section): Check if section
1868 name contains special prefix. Keep input sections to sort such
1870 (Output_section::Input_section_sort_section_order_index_compare
1871 ::operator()): Group sections according to prefixes.
1872 (Output_section::sort_attached_input_sections): Add condition to
1873 Input_section_entry constructor call.
1874 * testsuite/Makefile.am (text_section_grouping): New test.
1875 * testsuite/Makefile.in: Regenerate.
1876 * testsuite/text_section_grouping.cc: New file.
1877 * testsuite/text_section_grouping.sh: New file.
1879 2012-12-17 Nick Clifton <nickc@redhat.com>
1881 * Makefile.am: Add copyright notice.
1884 * configure.ac: Likewise.
1885 * ftruncate.c: Likewise.
1886 * Makefile.in: Regenerate.
1888 2012-12-14 Cary Coutant <ccoutant@google.com>
1890 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1891 --no-as-needed flag.
1892 (exception_separate_shared_12_test): Likewise.
1893 (incremental_copy_test): Likewise.
1894 * testsuite/Makefile.in: Regenerate.
1896 2012-12-14 Cary Coutant <ccoutant@google.com>
1898 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1899 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1901 2012-12-12 Alan Modra <amodra@gmail.com>
1903 * powerpc.cc (class Track_tls): New.
1904 (class Relocate, class Scan): Inherit Track_tls.
1905 (Target_powerpc::Scan::local, global): Track tls optimization
1906 and avoid creating plt entry for __tls_get_addr if all uses
1908 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1910 2012-12-12 Alan Modra <amodra@gmail.com>
1912 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1913 Replace no_toc_optimize with toc_optimize.
1914 * output.h (Output_section::input_sections): Provide non-const variant.
1915 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1916 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1918 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1919 (class Sort_toc_sections): New.
1920 (Target_powerpc::do_finalize_sections): Sort toc sections.
1921 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1923 2012-12-10 Roland McGrath <mcgrathr@google.com>
1925 * testsuite/binary_unittest.cc (read_all): New function.
1926 (Sized_binary_test): Use it instead of ::read.
1927 * fileread.cc (do_read): Don't assume pread always reads the whole
1928 amount in a single call.
1930 2012-12-10 Alan Modra <amodra@gmail.com>
1932 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1933 Set EM_PPC64 or EM_PPC here.
1934 (Target_selector_powerpc::do_recognize): Delete.
1936 2012-12-10 Alan Modra <amodra@gmail.com>
1938 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1940 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1942 2012-12-07 Roland McGrath <mcgrathr@google.com>
1944 * testsuite/binary_unittest.cc (Sized_binary_test):
1945 Use open_descriptor rather than ::open.
1947 2012-12-07 Alan Modra <amodra@gmail.com>
1949 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1950 typedef and invalid_address constant.
1951 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1952 instantiate constants.
1954 2012-12-06 Roland McGrath <mcgrathr@google.com>
1956 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1957 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1958 * aclocal.m4: Regenerate.
1959 * configure: Regenerate.
1960 * Makefile.in: Regenerate.
1961 * testsuite/Makefile.in: Regenerate.
1963 2012-12-07 Alan Modra <amodra@gmail.com>
1965 * options.h (General_options): Add no_toc_optimize.
1966 * powerpc.cc (ok_lo_toc_insn): New function.
1967 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1969 2012-12-06 Alan Modra <amodra@gmail.com>
1971 * options.h (General_options): Add plt_align, plt_static_chain,
1972 plt_thread_safe. Update stub_group_size help text.
1973 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1974 for new plt_thread_safe_ var.
1975 (use_plt_offset): Correct comments.
1976 (Target_powerpc::do_relax): Look for thread creation symbols to
1977 determine default plt_thread_safe value. Clear plt call stubs
1978 as well as branch stubs each iteration.
1979 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1981 (l, hi, ha, write_insn): Move earlier.
1982 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1983 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1985 (Stub_table::update_size): Adjust.
1986 (Stub_table::prev_size, set_prev_size): Delete.
1987 (Stub_table::stub_align): Let --plt-align affect result.
1988 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1989 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1990 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1991 (Stub_table::do_write): Support more stub variants.
1993 2012-12-04 Alan Modra <amodra@gmail.com>
1995 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1996 (Target_powerpc::do_define_standard_symbols): New function.
1998 2012-12-03 Alan Modra <amodra@gmail.com>
2000 * output.h: Formatting, whitespace.
2002 2012-12-03 Alan Modra <amodra@gmail.com>
2004 * layout.h (Layout::get_executable_sections): Declare.
2005 * layout.cc (Layout::get_executable_sections): New function.
2006 * arm.cc (Target_arm::group_sections): Use it.
2007 (Arm_output_section::group_sections): Delete now redundant test.
2008 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2009 param to handle relative relocs.
2010 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2011 (Output_data_reloc::add_absolute): Adjust.
2012 (Output_data_reloc::add_relative): New function.
2013 (Output_data::reset_data_size): New function.
2014 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2015 (Output_section::set_addralign): New function.
2016 (Output_section::checkpoint_set_addralign): New function.
2017 (Output_section::clear_section_offsets_need_adjustment): New function.
2018 (Output_section::input_sections): Make public.
2019 * powerpc.cc (class Output_data_brlt_powerpc): New.
2020 (class Stub_table, class Stub_control): New.
2021 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2022 stub_table_, set_stub_table, stub_table): New vectors and accessor
2024 (Target_powerpc::do_may_relax, do_relax, push_branch,
2025 new_stub_table, stub_tables, brlt_section, group_sections,
2026 add_branch_lookup_table, find_branch_lookup_table,
2027 write_branch_lookup_table, make_brlt_section): New functions.
2028 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2029 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2030 branch_info_): New vars.
2031 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2032 make call stubs here.
2033 (Output_data_glink): Remove all call stub handling from this class.
2034 (Target_powerpc::Scan::local, global): Save interesting branch
2035 relocs and relocs for ifunc. Adjust calls to plt entry functions.
2036 (Target_powerpc::do_finalize_sections): Only make reg save/restore
2037 functions on final link.
2038 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2039 Handle long branch destinations too.
2040 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2041 do_plt_address_for_local): Adjust lookup of plt call stubs.
2043 2012-11-30 Alan Modra <amodra@gmail.com>
2045 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2046 relocs against protected symbols when building 32-bit shared libs.
2048 2012-11-30 Alan Modra <amodra@gmail.com>
2050 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2051 param. Call got_section() to make .got. Update all callers
2052 and their callers and so on.
2054 2012-11-30 Alan Modra <amodra@gmail.com>
2056 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2057 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2058 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2059 value if it already exists.
2061 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
2064 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2066 2012-11-14 Roland McGrath <mcgrathr@google.com>
2068 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2069 than bfc instruction for data sandboxing.
2071 2012-11-08 Alan Modra <amodra@gmail.com>
2073 * po/POTFILES.in: Regenerate.
2075 2012-11-05 Alan Modra <amodra@gmail.com>
2077 * configure.ac: Apply 2012-09-10 change to config.in here.
2078 * configure: Regenerate.
2080 2012-11-05 Alan Modra <amodra@gmail.com>
2082 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2083 (struct Opd_ent): Use "Address" rather than "Offset".
2084 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2085 (Target_powerpc::got_section): Make public.
2086 (Target_powerpc::scan_relocs): Move code setting symbols..
2087 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2088 Create _SDA_BASE_ only when referenced.
2090 2012-11-02 Roland McGrath <mcgrathr@google.com>
2092 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2095 2012-11-01 Roland McGrath <mcgrathr@google.com>
2097 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2098 for offset_in_output_section parameter.
2099 (Sized_target::relocate_special_relocatable): Likewise.
2100 * arm.cc (Target_arm::relocate_relocs): Likewise.
2101 (Target_arm::relocate_special_relocatable): Likewise.
2102 * i386.cc (Target_i386::relocate_relocs): Likewise.
2103 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2104 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2105 * target-reloc.h (relocate_relocs): Likewise.
2106 * testsuite/testfile.cc (Target_test): Likewise.
2107 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2108 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2110 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2111 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2113 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2114 parameter, which is unused in the [!F_SETFD] case.
2116 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2117 SYMNDX to off_t before comparing it to this->data_size().
2118 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2119 * incremental.cc (Output_section_incremental_inputs::do_write):
2120 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2122 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2124 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2126 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2127 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2130 2012-10-29 Cary Coutant <ccoutant@google.com>
2132 * dwp.cc (usage): Add file and exit status parameters;
2133 add --help and --version options.
2134 (print_version): New function.
2135 (main): Add --help and --version options.
2137 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2139 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2140 final_layout_sequence.txt.
2141 * testsuite/Makefile.in: Regenerated.
2143 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2145 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2146 COMPILE generated by automake.
2148 (CXXCOMPILE1): Likewise.
2149 (CXXLINK1): Likewise.
2150 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2152 (CXXCOMPILE): Likewise.
2153 (CXXLINK): Likewise.
2154 * testsuite/Makefile.in: Regenerated.
2156 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2158 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2159 on bad fwrite return.
2161 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2163 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2166 2012-10-23 Cary Coutant <ccoutant@google.com>
2168 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2169 * testsuite/Makefile.in: Regenerate.
2170 * testsuite/dwp_test.h: New source file.
2171 * testsuite/dwp_test_1.cc: New source file.
2172 * testsuite/dwp_test_1.s: New source file.
2173 * testsuite/dwp_test_1.sh: New source file.
2174 * testsuite/dwp_test_1b.cc: New source file.
2175 * testsuite/dwp_test_1b.s: New source file.
2176 * testsuite/dwp_test_2.cc: New source file.
2177 * testsuite/dwp_test_2.s: New source file.
2178 * testsuite/dwp_test_2.sh: New source file.
2179 * testsuite/dwp_test_main.cc: New source file.
2180 * testsuite/dwp_test_main.s: New source file.
2182 2012-10-23 Cary Coutant <ccoutant@google.com>
2184 * dwp.h: New header file.
2185 * dwp.cc: New source file.
2186 * gold.h: Move shared declarations to system.h.
2187 * system.h: New header file.
2188 * Makefile.am: Add dwp.
2189 * Makefile.in: Regenerate.
2191 2012-10-23 Cary Coutant <ccoutant@google.com>
2193 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2194 Dwarf_info_reader::read_from_pointer.
2195 (Dwarf_pubnames_table::read_header): Likewise.
2196 (Dwarf_pubnames_table::next_name): Likewise.
2197 (Dwarf_die::read_attributes): Likewise.
2198 (Dwarf_die::skip_attributes): Likewise.
2199 (Dwarf_info_reader::read_from_pointer): New function template.
2200 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2201 (Dwarf_pubnames_table): Likewise.
2202 (Dwarf_info_reader::read_from_pointer): New function template.
2203 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2204 Dwarf_pubnames_table ctor.
2206 2012-10-23 Cary Coutant <ccoutant@google.com>
2208 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2210 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2212 (Dwarf_info_reader::set_abbrev_shndx): New method.
2213 (Dwarf_info_reader::abbrev_shndx_): New data member.
2215 2012-10-23 Cary Coutant <ccoutant@google.com>
2217 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2218 from object, not parameters.
2219 (Dwarf_info_reader::parse): Likewise.
2220 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2221 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2222 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2225 2012-10-23 Cary Coutant <ccoutant@google.com>
2227 * fileread.cc (Input_file::Input_file): New constructor.
2228 * fileread.h (class Input_file): Add new constructor.
2230 2012-10-18 Alan Modra <amodra@gmail.com>
2233 * object.cc (Relobj::is_section_name_included): Also match
2234 .sdata personality section.
2236 2012-10-18 Alan Modra <amodra@gmail.com>
2238 * target-reloc.h (class Default_comdat_behavior): New, package up..
2239 (get_comdat_behaviour): ..this.
2240 (relocate_section): Add Relocate_comdat_behavior template arg,
2241 adjust code to suit.
2242 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2243 (Target_arm::scan_reloc_section): Likewise.
2244 * i386.cc (Target_i386::relocate_section): Likewise.
2245 * sparc.cc (Target_sparc::relocate_section): Likewise.
2246 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2247 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2248 * powerpc.cc (class Relocate_comdat_behavior): New.
2249 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2250 gold::relocate_section with new template arg.
2252 2012-10-18 Alan Modra <amodra@gmail.com>
2254 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2255 dynamic relocs for GOT_TPREL got entries, without symbol if
2257 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2258 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2259 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2261 2012-10-17 Alan Modra <amodra@gmail.com>
2264 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2266 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2268 * layout.cc (Layout::include_section): Keep sections marked
2269 SHF_EXCLUDE when doing relocatable links.
2271 2012-10-16 Alan Modra <amodra@gmail.com>
2273 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2274 (Target_powerpc::do_finalize_sections): Call it.
2275 (Output_data_save_res): New class and supporting functions.
2276 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2277 normal symbols defined in object files.
2279 2012-10-12 Alan Modra <amodra@gmail.com>
2281 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2282 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2283 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2284 section if scan_opd_relocs not yet called.
2285 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2287 2012-10-12 Alan Modra <amodra@gmail.com>
2289 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2290 add_local_ifunc_entry): Revert last change.
2291 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2293 2012-10-05 Alan Modra <amodra@gmail.com>
2295 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2296 do_plt_address_for_global): New functions.
2297 (Output_data_got_powerpc::do_write): Don't segfault when linking
2299 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2300 add_local_ifunc_entry): Return true on adding entry..
2301 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2302 glink->add_entry call. Remove unused symtab param. Adjust calls.
2303 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2304 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2305 set up symbols here.
2306 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2307 syms here. Do so even when no .iplt. Don't segfault when linking
2309 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2310 new variants without reloc param.
2311 (Glink_sym_ent::Glink_sym_ent): Likewise.
2312 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2313 reloc when refs will resolve to plt call stub.
2314 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2315 R_PPC_PLTREL24 to resolve locally.
2316 (Target_powerpc::Scan::global): Correct ifunc handling.
2317 (Target_powerpc::Relocate::relocate): Correct local sym glink
2318 lookup. Don't destroy "value" when we have a plt call stub,
2319 and when checking plt call validity.
2320 (Target_powerpc::do_dynsym_value): Simplify.
2322 2012-10-05 Alan Modra <amodra@gmail.com>
2324 * i386.cc (Output_data_plt_i386::address_for_global,
2325 address_for_local): Add plt offset to returned value. Adjust uses.
2326 * sparc.cc (Output_data_plt_sparc::address_for_global,
2327 address_for_local): Likewise.
2328 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2329 address_for_local): Likewise.
2330 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2331 address_for_local): Likewise.
2332 * target.h (Target::plt_address_for_global, plt_address_for_local):
2334 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2335 (Output_data_got::Got_entry::write): Nor here.
2336 * output.h: Comment fix.
2338 2012-10-02 Jiong Wang <jiwang@tilera.com>
2340 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2341 global_offset_table_ value for larget got.
2342 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2344 2012-09-29 Alan Modra <amodra@gmail.com>
2346 * powerpc.cc (Target_powerpc::iplt_): New output section.
2347 (Target_powerpc::iplt_section, make_iplt_section,
2348 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2349 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2350 Target_powerpc::plt_entry_count): Count iplt entries too.
2351 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2352 reloc section in constructor. New params.
2353 (Target_powerpc::make_plt_section): Create reloc section here instead.
2354 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2356 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2357 (Output_data_glink::add_entry, find_entry): New functions to
2358 deal with local syms.
2359 (Glink_sym_ent): Add support for local syms.
2360 (Output_data_glink::do_write): Handle ifunc plt entries.
2361 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2362 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2363 (Target_powerpc::Relocate::relocate): Likewise.
2364 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2366 2012-09-25 Alan Modra <amodra@gmail.com>
2368 * object.h (Sized_relobj_file::adjust_local_symbol,
2369 do_adjust_local_symbol): New functions.
2370 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2371 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2372 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2373 and irregular opd entry spacing.
2374 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2375 (Global_symbol_visitor_opd): New functor.
2376 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2377 on deleted opd entries.
2379 2012-09-15 Jiong Wang <jiwang@tilera.com>
2381 * tilegx.cc: New file.
2382 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2383 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2384 * configure.tgt: Add entries for tilegx*.
2385 * configure.ac: Likewise.
2386 * Makefile.in: Rebuild.
2387 * configure: Likewise.
2388 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2391 2012-09-13 Alan Modra <amodra@gmail.com>
2393 * target-reloc.h (scan_relocs): Call scan.local for relocs
2394 against symbols in discarded sections. Pass is_discarded
2396 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2397 Add is_discarded param.
2398 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2399 is_discarded to flag opd entry as discarded. Don't emit dyn
2400 relocs on such entries.
2401 (Target_powerpc::Scan::global): Similarly detect and handle
2403 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2404 opd_ent_. Update all uses.
2405 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2406 (Target_powerpc::relocate_section): Zero out discarded opd
2409 2012-09-12 Ian Lance Taylor <iant@google.com>
2412 * output.cc: Rename Output_data_got template parameter from size
2413 to got_size for all functions. Compile all variants of
2415 (Output_data_got::Got_entry::write): Correct use of size for
2416 symbol value. Use local_is_tls rather than casting to
2418 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2419 (class Sized_relobj_file): Add do_local_is_tls.
2420 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2422 2012-09-11 Alan Modra <amodra@gmail.com>
2425 * layout.cc (Layout::set_segment_offsets): When using
2426 common-page-size alignment, ensure we are on a new max-page-size
2428 * output.cc (Output_segment::set_section_addresses): Use
2429 abi_pagesize, not common_pagesize for relro boundary.
2430 (Output_segment::set_offset): Likewise.
2432 2012-09-11 Alan Modra <amodra@gmail.com>
2434 * output.h (Output_data_got::add_global_tls, add_local_tls,
2435 add_local_tls_pair): New functions.
2436 (Output_data_got::add_local_pair_with_rel): Remove second
2437 reloc param. Expand comment.
2438 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2439 use_plt_or_tls_offset_, similarly for constructor param.
2440 (Output_data_got::Got_entry::write): Add got_index param.
2441 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2442 add_local_tls_pair): New functions.
2443 (Output_data_got::Got_entry::write): Handle tls symbols
2444 with use_plt_or_tls_offset_ set specially.
2445 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2446 (Output_data_got::do_write): Replace iterator with index, pass
2447 index to entry write function.
2448 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2449 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2450 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2452 * i386.cc (Target_i386::Scan::local): Likewise.
2453 * sparc.cc (Target_sparc::Scan::local): Likewise.
2454 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2455 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2456 do_tls_offset_for_global): New functions.
2457 (Target_powerpc::Scan::local): Correct TLS relocations and got
2459 (Target_powerpc::Scan::global): Don't emit unnecessary
2460 dynamic relocations on TLS GOT entries.
2462 2012-09-10 Matthias Klose <doko@ubuntu.com>
2464 * config.in: Disable sanity check for kfreebsd.
2466 2012-09-10 Sterling Augustine <saugustine@google.com>
2468 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2469 (Gdb_index::pubtypes_read): New parameter.
2470 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2472 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2475 2012-09-09 Alan Modra <amodra@gmail.com>
2477 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2478 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2479 * gc.h (gc_process_relocs): Call target gc_add_reference.
2480 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2481 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2482 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2484 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2485 to cater for when we don't need code offset. Update use.
2486 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2487 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2488 set_opd_valid): New functions.
2489 (Target_powerpc::do_gc_add_reference): New function.
2490 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2492 (Target_powerpc::do_gc_mark_symbol): New function.
2494 2012-09-06 Cary Coutant <ccoutant@google.com>
2496 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2497 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2498 (Dwarf_die::skip_attributes): Likewise.
2499 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2500 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2502 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2504 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2506 * testsuite/script_test_3.t: Add .got.plt output section
2508 * testsuite/script_test_4.t: Likewise.
2510 2012-09-05 Alan Modra <amodra@gmail.com>
2512 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2513 update all uses and lose "enum" when using type.
2515 2012-09-05 Alan Modra <amodra@gmail.com>
2517 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2518 * configure: Regenerate.
2519 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2520 (plugin_final_layout.stdout): Likewise.
2521 (memory_test): Set page sizes to 0x1000.
2522 * testsuite/Makefile.in: Regenerate.
2523 * testsuite/discard_locals_test.sh: Add FIXME comment.
2524 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2525 * testsuite/pr14265.t: Add .got output section statement.
2526 * testsuite/script_test_2.t: Likewise.
2527 * testsuite/script_test_3.t: Likewise.
2528 * testsuite/script_test_4.t: Likewise.
2529 * testsuite/script_test_5.t: Likewise.
2530 * testsuite/script_test_6.t: Likewise.
2531 * testsuite/script_test_7.t: Likewise.
2532 * testsuite/script_test_9.t: Likewise.
2534 2012-09-05 Alan Modra <amodra@gmail.com>
2536 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2537 (Powerpc_relocate_functions::Status): New typedef.
2538 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2539 (Target_powerpc::Scan::local): Handle REL64.
2540 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2541 for REL32 and REL64.
2542 (Target_powerpc::symval_for_branch): New function, extracted from..
2543 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2544 checks. Report overflow errors.
2546 2012-09-05 Alan Modra <amodra@gmail.com>
2548 * object.h (Sized_relobj_file::emit_relocs): Delete.
2549 (Sized_relobj_file::emit_relocs_reltype): Delete.
2550 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2551 relocate_relocs for --emit-relocs.
2552 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2553 * output.h: Update comment.
2554 (Output_segment::first_section): New function.
2555 (Output_segment::first_section_load_address): Use first_section.
2556 * output.cc (Output_segment::first_section): New function extracted..
2557 (Output_segment::first_section_load_address): ..from here. Delete.
2558 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2559 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2560 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2561 adjust call to target.h function.
2562 * i386.cc (Target_i386): Likewise.
2563 * sparc.cc (Target_sparc): Likewise.
2564 * x86_64.cc (Target_x86_64): Likewise.
2565 * powerpc.cc (Target_powerpc): Likewise.
2566 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2567 first tls section has section symbol for optimised local dynamic
2569 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2570 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2572 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2573 Rename to relocate_relocs. Update error message.
2575 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2577 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2580 2012-08-31 Alan Modra <amodra@gmail.com>
2582 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2583 (Powerpc_relobj::toc_base_offset): New stub function.
2584 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2585 got_mod_index_offset to tlsld_got_offset. Update all refs.
2586 (Target_powerpc::Relocate::enum skip_tls): New.
2587 (Target_powerpc::call_tls_get_addr_): New var.
2588 (Target_powerpc::is_branch_reloc): Move to file scope.
2589 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2590 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2592 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2593 (powerpc_info): Correct common_pagesize for ppc64.
2594 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2595 (Powerpc_relocate_functions): Add overflow check enums and functions.
2596 Add non-shift version of rela, rela_ua. Delete all rel public
2597 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2598 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2599 addr16_ha3, addr14 functions.
2600 (Output_data_got_powerpc::add_constant_pair): New function.
2601 (Output_data_got_powerpc::got_base_offset): Likewise.
2602 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2603 (instruction constants): Sort, add some more.
2604 (Output_data_glink::do_write): Add and use Address typedef. Use
2605 object->toc_base_offset() stub for 64-bit.
2606 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2607 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2608 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2609 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2610 Always treat .opd relocs as against locally defined symbol.
2611 Correct condition for RELATIVE relocs.
2612 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2613 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2614 for 32-bit syms with a plt entry. Correct ppc64 toc base
2615 calculations. Handle TLS relocs, and more. Add overflow
2616 checking and adjust for Powerpc_relocate_functions changes.
2617 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2618 Reinstate --emit-relocs code with FIXME.
2620 2012-08-30 Alan Modra <amodra@gmail.com>
2622 * layout.cc (Layout::set_segment_offsets): Set p_align to
2623 abi_pagesize, not common_pagesize.
2624 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2625 to determine whether file header can go in segment.
2627 2012-08-30 Alan Modra <amodra@gmail.com>
2629 * output.h (Output_reloc::Output_reloc <output section>): Add
2630 is_relative param. Adjust calls.
2631 (Output_reloc::add_output_section_relative): New functions.
2632 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2634 (Output_reloc::symbol_value): Handle SECTION_CODE.
2636 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2638 * gold.cc (queue_middle_tasks): Call layout again when unique
2639 segments for sections is desired.
2640 * layout.cc (Layout::Layout): Initialize new members.
2641 (Layout::get_output_section_flags): New function.
2642 (Layout::choose_output_section): Call get_output_section_flags.
2643 (Layout::layout): Make output section for mapping to a unique segment.
2644 (Layout::insert_section_segment_map): New function.
2645 (Layout::attach_allocated_section_to_segment): Make unique segment for
2646 output sections marked so.
2647 (Layout::segment_precedes): Check for unique segments when sorting.
2648 * layout.h (Layout::Unique_segment_info): New struct.
2649 (Layout::Section_segment_map): New typedef.
2650 (Layout::insert_section_segment_map): New function.
2651 (Layout::get_output_section_flags): New function.
2652 (Layout::is_unique_segment_for_sections_specified): New function.
2653 (Layout::set_unique_segment_for_sections_specified): New function.
2654 (Layout::unique_segment_for_sections_specified_): New member.
2655 (Layout::section_segment_map_): New member.
2656 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2657 Rename is_gc_pass_one to is_pass_one.
2658 Rename is_gc_pass_two to is_pass_two.
2659 Rename is_gc_or_icf to is_two_pass.
2660 Check for which pass based on whether symbols data is present.
2661 Make it two pass when unique segments for sections is desired.
2662 * output.cc (Output_section::Output_section): Initialize new
2664 * output.h (Output_section::is_unique_segment): New function.
2665 (Output_section::set_is_unique_segment): New function.
2666 (Output_section::is_unique_segment_): New member.
2667 (Output_section::extra_segment_flags): New function.
2668 (Output_section::set_extra_segment_flags): New function.
2669 (Output_section::extra_segment_flags_): New member.
2670 (Output_section::segment_alignment): New function.
2671 (Output_section::set_segment_alignment): New function.
2672 (Output_section::segment_alignment_): New member.
2673 (Output_segment::Output_segment): Initialize is_unique_segment_.
2674 (Output_segment::is_unique_segment): New function.
2675 (Output_segment::set_is_unique_segment): New function.
2676 (Output_segment::is_unique_segment_): New member.
2677 * plugin.cc (allow_unique_segment_for_sections): New function.
2678 (unique_segment_for_sections): New function.
2679 (Plugin::load): Add new functions to transfer vector.
2680 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2681 * Makefile.in: Regenerate.
2682 * testsuite/plugin_final_layout.sh: Check if unique segment
2683 functionality works.
2684 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2686 (allow_unique_segment_for_sections): New global.
2687 (unique_segment_for_sections): New global.
2688 (claim_file_hook): Call allow_unique_segment_for_sections.
2689 (all_symbols_read_hook): Call unique_segment_for_sections.
2691 2012-08-22 Cary Coutant <ccoutant@google.com>
2693 * layout.cc (Layout::include_section): Don't assert on GROUP
2694 sections with --emit-relocs.
2696 2012-08-21 Cary Coutant <ccoutant@google.com>
2698 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2699 if --export-dynamic-symbol names an undef symbol.
2701 2012-08-18 Alan Modra <amodra@gmail.com>
2703 * powerpc.cc: Formatting and white space.
2704 (Powerpc_relobj): Rename got2_section_ to special_.
2705 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2706 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2707 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2708 (Target_powerpc): Add Address typedef and invalid_address. Use
2710 (Target_powerpc::is_branch_reloc): New function.
2711 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2712 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2713 for dst_mask, value and addend.
2714 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2715 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2716 (Output_data_glink::do_write): Correct toc base. Don't try to use
2717 uint16_t for 24-bit offset. Use get_output_section_offset and
2719 (Target_powerpc::Scan::local): Handle more relocs.
2720 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2721 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2722 Plug in toc restoring insn after plt calls. Translate branches
2723 to function descriptor symbols to corresponding entry point.
2724 (Target_powerpc::relocate_for_relocatable): Check return from
2725 get_output_section_offset.
2726 * symtab.h: Comment typo.
2728 2012-08-14 Ian Lance Taylor <iant@google.com>
2730 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2731 unsupported_relocal_local to call unsupported_reloc_global.
2733 2012-08-14 Nick Clifton <nickc@redhat.com>
2736 * script-sections.cc (Sections_element::output_section_name): Add
2737 keep return parameter.
2738 (Output_section_element::match_name): Add keep return parameter.
2739 Return the value of the keep_ member.
2740 * script-sections.h (class Output_section): Update
2741 output_section_name prototype.
2742 * layout.cc (Layout::keep_input_section): New public member
2744 (Layout::choose_output_section): Pass keep parameter to
2745 output_section_name.
2746 * layout.h (class Layout): Add keep_input_section.
2747 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2749 * testsuite/Makefile.am: Add a test.
2750 * testsuite/Makefile.in: Regenerate.
2751 * testsuite/pr14265.c: Source file for the test.
2752 * testsuite/pr14265.t: Linker script for the test.
2753 * testsuite/pr14265.sh: Shell script for the test.
2755 2012-08-14 Alan Modra <amodra@gmail.com>
2757 * target.h (Target::output_section_name): New function.
2758 (Target::do_output_section_name): New function.
2759 * layout.cc (Layout::choose_output_section): Call the above.
2760 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2762 2012-08-14 Alan Modra <amodra@gmail.com>
2764 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2765 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2766 for replace_constant call.
2767 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2768 (Output_data_glink::do_print_to_mapfile): New function.
2769 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2770 (Target_powerpc::Relocate::relocate): Likewise.
2772 2012-08-14 Alan Modra <amodra@gmail.com>
2774 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2775 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2776 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2777 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2778 all references to shndx_. Handle special case for R_PPC_PLTREL24
2780 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2781 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2782 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2784 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2785 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2787 2012-08-12 Alan Modra <amodra@gmail.com>
2789 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2790 (glink insn constants): Use uint32_t.
2791 (Output_data_glink::add_entry): Use insert, not [] operator.
2793 2012-08-11 Alan Modra <amodra@gmail.com>
2795 * object.h (Sized_relobj_file::find_shdr): New function.
2796 (Sized_relobj_file::find_special_sections): New function.
2797 * object.cc (Sized_relobj_file::find_shdr): New function.
2798 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2799 (Sized_relobj_file::find_special_sections): New function, split out..
2800 (Sized_relobj_file::do_read_symbols): ..from here.
2801 * output.h (Output_data_got::replace_constant): New function.
2802 (Output_data_got::num_entries): New function.
2803 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2804 (Output_data_got::got_offset): Protected rather than private.
2805 (Output_data_got::replace_got_entry): New function.
2806 * output.cc (Output_data_got::replace_got_entry): New function.
2807 * powerpc.cc (class Powerpc_relobj): New.
2808 (class Powerpc_relocate_functions): Delete all psymval variants or
2809 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2810 Implement _ha functions using corresponding _hi function.
2811 (Powerpc_relobj::find_special_sections): New function.
2812 (Target_powerpc::do_make_elf_object): New function.
2813 (class Output_data_got_powerpc): New.
2814 (class Output_data_glink): New.
2815 (class Powerpc_scan_relocatable_reloc): New.
2816 Many more changes througout file.
2818 2012-08-09 Nick Clifton <nickc@redhat.com>
2820 * po/vi.po: Updated Vietnamese translation.
2822 2012-08-07 Ian Lance Taylor <iant@google.com>
2824 * layout.cc (Layout::add_target_dynamic_tags): If
2825 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2828 2012-07-30 Nick Clifton <nickc@redhat.com>
2830 * po/gold.pot: Updated template.
2831 * po/es.po: Updated Spanish translation.
2833 2012-07-18 Cary Coutant <ccoutant@google.com>
2836 * configure.ac: Add check for -gpubnames support.
2837 * configure: Regenerate.
2838 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2839 support; force -gno-pubnames.
2840 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2842 (gdb_index_test_4): New test.
2843 * testsuite/Makefile.in: Regenerate.
2844 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2845 * testsuite/gdb_index_test_2.sh: Likewise.
2846 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2847 * testsuite/gdb_index_test_4.sh: New script.
2848 * testsuite/gdb_index_test_comm.sh: New script with common code;
2849 don't look for space after colon.
2851 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2853 * gold.cc (queue_middle_tasks): Update function order only after
2854 deferred objects due to plugins are processed.
2856 2012-07-11 Ian Lance Taylor <iant@google.com>
2858 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2859 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2860 (Target_arm::scan_reloc_for_stub): Likewise.
2861 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2862 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2863 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2864 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2865 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2867 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2868 Ian Lance Taylor <iant@google.com>
2871 * configure.ac: Test whether std::tr1::hash<off_t> works.
2872 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2874 * output.h (class Output_fill): Add virtual destructor.
2875 * configure, config.in: Rebuild.
2877 2012-06-22 Roland McGrath <mcgrathr@google.com>
2879 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2881 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2883 * plugin.cc (Plugin::load): Handle position independent executables.
2885 2012-06-06 Cary Coutant <ccoutant@google.com>
2887 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2889 (lines_only_debug_sections): Likewise.
2890 (gdb_fast_lookup_sections): New static array.
2891 (is_gdb_debug_section): Rename formal parameter.
2892 (is_lines_only_debug_section): Likewise.
2893 (is_gdb_fast_lookup_section): New function.
2894 (Layout::include_section): Check for ".zdebug_" prefix; pass
2895 section name suffix to is_gdb_debug_section, et al.; check for
2896 fast-lookup sections when building .gdb_index.
2897 * options.h (--strip-debug-gdb): Update GDB version number.
2899 2012-06-06 Cary Coutant <ccoutant@google.com>
2901 * configure.ac: Add check for fallocate.
2902 * configure: Regenerate.
2903 * config.in: Regenerate.
2905 * options.h (class General_options): Add --mmap-output-file and
2906 --posix-fallocate options.
2907 * output.cc: (posix_fallocate): Remove; replace with...
2908 (gold_fallocate): New function.
2909 (Output_file::map_no_anonymous): Call gold_fallocate.
2910 (Output_file::map): Check --mmap-output-file option.
2912 2012-06-05 Jing Yu <jingyu@google.com>
2914 * gold.h (textdomain): Add do {} to empty while(0).
2915 (bindtextdomain): Likewise.
2917 2012-06-04 Cary Coutant <ccoutant@google.com>
2919 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2922 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2924 * symtab.cc (Symbol_table::define_special_symbol):
2925 Initialize *poldsym to prevent uninitialized variable errors.
2927 2012-05-23 Cary Coutant <ccoutant@google.com>
2929 * layout.cc (Layout::section_name_mapping): Add rules to handle
2930 exact match on .data.rel.ro.local or .data.rel.ro.
2931 (Layout::output_section_name): Check for exact matches.
2933 2012-05-23 Cary Coutant <ccoutant@google.com>
2935 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2938 2012-05-22 Cary Coutant <ccoutant@google.com>
2940 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2941 object before exporting symbol.
2943 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2945 * testsuite/tls_test.cc: Include "config.h" first.
2946 * testsuite/tls_test_c.c: Likewise.
2948 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2949 Nick Clifton <nickc@redhat.com>
2952 * configure.in: Add check that sysdep.h has been included before
2953 any system header files.
2954 * configure: Regenerate.
2955 * config.in: Regenerate.
2957 2012-05-14 Cary Coutant <ccoutant@google.com>
2959 * layout.cc (Layout::make_output_section): Mark .tdata section
2961 * testsuite/relro_test.cc: Add a TLS variable.
2963 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2966 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2967 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2970 2012-05-08 Cary Coutant <ccoutant@google.com>
2972 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2973 (lines_only_debug_sections): Likewise.
2975 2012-05-02 Roland McGrath <mcgrathr@google.com>
2977 * nacl.cc: New file.
2979 * Makefile.am (CCFILES, HFILES): Add them.
2980 * Makefile.in: Regenerate.
2981 * i386.cc (Output_data_plt_i386_nacl): New class.
2982 (Output_data_plt_i386_nacl_exec): New class.
2983 (Output_data_plt_i386_nacl_dyn): New class.
2984 (Target_i386_nacl): New class.
2985 (Target_selector_i386_nacl): New class.
2986 (target_selector_i386): Use it instead of Target_selector_i386.
2987 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2988 (Target_x86_64_nacl): New class.
2989 (Target_selector_x86_64_nacl): New class.
2990 (target_selector_x86_64, target_selector_x32): Use it instead of
2991 Target_selector_x86_64.
2992 * arm.cc (Output_data_plt_arm_nacl): New class.
2993 (Target_arm_nacl): New class.
2994 (Target_selector_arm_nacl): New class.
2995 (target_selector_arm, target_selector_armbe): Use it instead of
2996 Target_selector_arm.
2998 * target-select.cc (select_target): Take new Input_file* and off_t
2999 arguments, pass them on to recognize method of selector.
3000 * object.cc (make_elf_sized_object): Update caller.
3001 * parameters.cc (parameters_force_valid_target): Likewise.
3002 * incremental.cc (make_sized_incremental_binary): Likewise.
3003 * target-select.h: Update decl.
3004 (Target_selector::recognize): Take new Input_file* argument,
3005 pass it on to do_recognize.
3006 (Target_selector::do_recognize): Take new Input_file* argument.
3007 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3008 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3009 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3010 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3012 * target.h (Target::Target_info): New members isolate_execinstr
3014 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3015 * arm.cc (Target_arm::arm_info): Update initializer.
3016 * i386.cc (Target_i386::i386_info): Likewise.
3017 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3018 * sparc.cc (Target_sparc::sparc_info): Likewise.
3019 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3020 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3021 * layout.cc (Layout::attach_allocated_section_to_segment):
3022 Take new const Target* argument. If target->isolate_execinstr(), act
3024 (Layout::find_first_load_seg): Take new const Target* argument;
3025 if target->isolate_execinstr(), reject PF_X segments.
3026 (Layout::relaxation_loop_body): Update caller.
3027 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3028 reset file offset to zero when we hit LOAD_SEG, and then do a second
3029 loop over the segments before LOAD_SEG to reassign offsets after
3030 addresses have been determined. Handle target->rosegment_gap().
3031 (Layout::attach_section_to_segment): Take new const Target* argument;
3032 pass it to attach_allocated_section_to_segment.
3033 (Layout::make_output_section): Update caller.
3034 (Layout::attach_sections_to_segments): Take new const Target* argument;
3035 pass it to attach_section_to_segment.
3036 * gold.cc (queue_middle_tasks): Update caller.
3037 * layout.h (Layout): Update method decls with new arguments.
3039 * arm.cc (Target_arm::Target_arm): Take optional argument for the
3040 Target_info pointer to use.
3041 (Target_arm::do_make_data_plt): New virtual method.
3042 (Target_arm::make_data_plt): New method that calls it.
3043 (Target_arm::make_plt_entry): Use it.
3044 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3045 for the section alignment.
3046 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3048 (Output_data_plt_arm::first_plt_entry_offset): Call it.
3049 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3051 (Output_data_plt_arm::get_plt_entry_size): Call it.
3052 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3053 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3054 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3056 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3057 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3058 method instead of sizeof(plt_entry).
3059 (Output_data_plt_arm::add_entry): Likewise.
3060 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3061 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3063 (Target_arm::plt_entry_size): Likewise.
3064 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3066 (Output_data_plt_arm_standard): ... here, new class.
3067 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3068 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3069 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3071 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3072 Take additional argument for the PLT entry size.
3073 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3074 Use get_plt_entry_size method rather than plt_entry_size variable.
3075 (Output_data_plt_x86_64::reserve_slot): Likewise.
3076 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3077 (Output_data_plt_x86_64::add_entry): Likewise.
3078 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3079 (Output_data_plt_x86_64::address_for_global): Likewise.
3080 (Output_data_plt_x86_64::address_for_local): Likewise.
3081 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3082 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3083 Make method non-static.
3084 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3086 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3087 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3088 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3089 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3091 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3092 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3094 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3095 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3097 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3098 (Output_data_plt_x86_64::plt_entry_size)
3099 (Output_data_plt_x86_64::first_plt_entry)
3100 (Output_data_plt_x86_64::plt_entry)
3101 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3102 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3103 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3104 (Output_data_plt_x86_64_standard): ... here, new class.
3105 (Target_x86_64::Target_x86_64): Take optional argument for the
3106 Target_info pointer to use.
3107 (Target_x86_64::do_make_data_plt): New virtual method.
3108 (Target_x86_64::make_data_plt): New method to call it.
3109 (Target_x86_64::init_got_plt_for_update): Use that.
3110 Call this->plt_->add_eh_frame method here.
3111 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3112 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3113 rather than static method.
3114 (Target_x86_64::plt_entry_size): Likewise.
3115 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3116 rather than plt_entry_size variable. Move guts of PLT filling to...
3117 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3118 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3119 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3121 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3122 additional argument for the section alignment.
3123 Don't do add_eh_frame_for_plt here.
3124 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3125 non-static. Use get_plt_entry_size method rather than plt_entry_size
3127 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3129 (Output_data_plt_i386::get_plt_entry_size): Call it.
3130 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3131 (Output_data_plt_i386::add_eh_frame): New method to call it.
3132 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3134 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3135 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3137 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3138 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3139 method instead of plt_entry_size.
3140 (Output_data_plt_i386::plt_entry_size)
3141 (Output_data_plt_i386::plt_eh_frame_fde_size)
3142 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3143 (Output_data_plt_i386_standard): ... here, new class.
3144 (Output_data_plt_i386_exec): New class.
3145 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3146 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3147 (Output_data_plt_i386::exec_plt_entry): Move to ...
3148 (Output_data_plt_i386_exec::plt_entry): ... here.
3149 (Output_data_plt_i386_dyn): New class.
3150 (Output_data_plt_i386::first_plt_entry): Move to ...
3151 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3152 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3153 (Output_data_plt_i386_dyn::plt_entry): ... here.
3154 (Target_i386::Target_i386): Take optional argument for the Target_info
3156 (Target_i386::do_make_data_plt): New virtual method.
3157 (Target_i386::make_data_plt): New method to call it.
3158 (Target_i386::make_plt_section): Use that.
3159 Call this->plt_->add_eh_frame method here.
3160 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3161 rather than plt_entry_size variable.
3162 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3163 (Output_data_plt_i386::address_for_local): Likewise.
3164 (Output_data_plt_i386::do_write): Likewise.
3165 Move guts of PLT filling to...
3166 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3167 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3168 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3169 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3171 2012-05-01 Cary Coutant <ccoutant@google.com>
3173 * dwarf_reader.cc (Dwarf_die::read_attributes)
3174 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3175 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3176 * reduced_debug_output.cc
3177 (Output_reduced_debug_info_section::get_die_end): Remove
3178 DW_FORM_GNU_ref_index. Add default case.
3180 2012-04-26 Mark Wielaard <mjw@redhat.com>
3182 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3183 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3184 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3185 DW_AT_high_pc as offset from DW_AT_low_pc.
3187 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3188 * testsuite/Makefile.in: Regenerate.
3189 * testsuite/gdb_index_test_3.c: New test source file.
3190 * testsuite/gdb_index_test_3.sh: New test source file.
3192 2012-04-25 Ian Lance Taylor <iant@google.com>
3194 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3196 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3197 as a class, not a struct.
3198 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3199 (Target_arm::apply_cortex_a8_workaround): Likewise.
3200 * gc.h: Declare Reloc_types as a struct, not a class.
3201 * object.h: Declare Symbols_data as a struct.
3202 * reloc.h: Declare Read_relocs_data as a struct.
3203 * target.h: Declare Relocate_info as a struct.
3205 2012-04-24 David S. Miller <davem@davemloft.net>
3207 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3208 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3211 2012-04-24 Cary Coutant <ccoutant@google.com>
3213 * incremental-dump.cc (find_input_containing_global): Replace
3214 magic number with symbolic constant.
3215 (dump_incremental_inputs): Update version number.
3216 * incremental.cc (Output_section_incremental_inputs): Update version
3217 number; import symbolic constants from Incremental_inputs_reader.
3218 (Incremental_inputs::create_data_sections): Align relocations
3219 section correctly for 64-bit targets.
3220 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3221 constants; add padding.
3222 (Output_section_incremental_inputs::write_header): Add assert for
3224 (Output_section_incremental_inputs::write_input_files): Add assert
3225 for input_entry_size.
3226 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3227 add assert for object_info_size, input_section_entry_size,
3228 global_sym_entry_size.
3229 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3230 for data structure sizes; use them.
3231 (Incremental_input_entry_reader): Import symbolic constants from
3232 Incremental_inputs_reader; use them.
3234 2012-04-23 David S. Miller <davem@davemloft.net>
3236 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3238 (Target_sparc::Target_sparc): Initialize new fields.
3239 (Target_sparc::do_make_elf_object): New function.
3240 (Target_sparc::do_adjust_elf_header): New function.
3242 2012-04-23 Cary Coutant <ccoutant@google.com>
3244 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3245 CU range table of gdb index.
3247 2012-04-20 David S. Miller <davem@davemloft.net>
3249 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3252 2012-04-16 David S. Miller <davem@davemloft.net>
3254 * sparc.cc (Target_sparc::got_address): New function.
3255 (Sparc_relocate_functions::gdop_hix22): New function.
3256 (Sparc_relocate_functions::gdop_lox10): New function.
3257 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3259 (Target_sparc::Scan::local): Likewise if the global symbol is not
3260 preemptible and is not IFUNC.
3261 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3262 transformations for local and non-preemptible non-IFUNC global
3265 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3266 writing out 64-bit part of ranges.
3268 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3269 -fpic and -fpie respectively.
3270 * Makefile.in: Regenerate.
3272 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3273 (Target_sparc::Target_sparc): Initialize new field.
3274 (Target_sparc::do_plt_section_for_global): New function.
3275 (Target_sparc::do_plt_section_for_local): New function.
3276 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3277 (Target_sparc::make_plt_section): New function, broken out of
3278 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3279 (Target_sparc::make_plt_entry): Call make_plt_section.
3280 (Target_sparc::make_local_ifunc_plt_entry): New function.
3281 (Target_sparc::rela_ifunc_section): New function.
3282 (Target_sparc::plt_section): Remove const.
3283 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3284 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3285 and ifunc_count_ fields.
3286 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3287 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3288 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3289 (Output_data_plt_sparc::rela_ifunc): New function.
3290 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3291 (Output_data_plt_sparc::has_ifunc_section): New function.
3292 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3293 (Output_data_plt_sparc::address_for_global): New function.
3294 (Output_data_plt_sparc::address_for_local): New function.
3295 (Output_data_plt_sparc::plt_index_to_offset): New function.
3296 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3298 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3300 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3301 R_SPARC_JMP_IREL to switch.
3302 (Target_sparc::Scan::check_non_pic): Likewise.
3303 (Target_sparc::Scan::local): Handle IFUNC symbols.
3304 (Target_sparc::Scan::local): Likewise.
3305 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3306 and plt_address_for_local.
3307 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3308 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3310 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3311 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3312 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3313 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3315 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3316 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3318 * sparc.cc (Target_sparc::Scan::global): Likewise.
3319 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3321 2012-04-16 Cary Coutant <ccoutant@google.com>
3323 * archive.cc (Library_base::should_include_member): Check for
3324 --export-dynamic-symbol.
3325 * options.h (class General_options): Add --export-dynamic-symbol.
3326 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3327 --export-dynamic-symbol.
3328 (Symbol_table::gc_mark_undef_symbols): Likewise.
3329 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3331 2012-04-12 David S. Miller <davem@davemloft.net>
3333 * sparc.cc (Reloc::wdisp10): New relocation method.
3334 (Reloc::h34): Likewise.
3335 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3336 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3338 (Target_sparc::Scan::local): Likewise.
3339 (Target_sparc::Scan::global): Likewise.
3340 (Target_sparc::Relocate::relocate): Likewise.
3342 2012-04-09 Cary Coutant <ccoutant@google.com>
3344 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3347 2012-04-06 Ian Lance Taylor <iant@google.com>
3349 * timer.cc: #include <unistd.h>.
3351 2012-04-06 Roland McGrath <mcgrathr@google.com>
3353 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3354 * config.in: Regenerate.
3355 * configure: Regenerate.
3357 2012-04-05 Nick Clifton <nickc@redhat.com>
3359 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3360 (AM_LC_MESSAGES): Add.
3361 * aclocal.m4: Regenerate.
3362 * config.in: Regenerate.
3363 * configure: Regenerate.
3365 2012-03-21 Cary Coutant <ccoutant@google.com>
3367 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3368 * Makefile.in: Regenerate.
3369 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3370 (Sized_elf_reloc_mapper::symbol_section): New function.
3371 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3372 (make_elf_reloc_mapper): New function.
3373 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3374 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3375 (Dwarf_abbrev_table::do_get_abbrev): New function.
3376 (Dwarf_ranges_table::read_ranges_table): New function.
3377 (Dwarf_ranges_table::read_range_list): New function.
3378 (Dwarf_pubnames_table::read_section): New function.
3379 (Dwarf_pubnames_table::read_header): New function.
3380 (Dwarf_pubnames_table::next_name): New function.
3381 (Dwarf_die::Dwarf_die): New function.
3382 (Dwarf_die::read_attributes): New function.
3383 (Dwarf_die::skip_attributes): New function.
3384 (Dwarf_die::set_name): New function.
3385 (Dwarf_die::set_linkage_name): New function.
3386 (Dwarf_die::attribute): New function.
3387 (Dwarf_die::string_attribute): New function.
3388 (Dwarf_die::int_attribute): New function.
3389 (Dwarf_die::uint_attribute): New function.
3390 (Dwarf_die::ref_attribute): New function.
3391 (Dwarf_die::child_offset): New function.
3392 (Dwarf_die::sibling_offset): New function.
3393 (Dwarf_info_reader::check_buffer): New function.
3394 (Dwarf_info_reader::parse): New function.
3395 (Dwarf_info_reader::do_parse): New function.
3396 (Dwarf_info_reader::do_read_string_table): New function.
3397 (Dwarf_info_reader::lookup_reloc): New function.
3398 (Dwarf_info_reader::get_string): New function.
3399 (Dwarf_info_reader::visit_compilation_unit): New function.
3400 (Dwarf_info_reader::visit_type_unit): New function.
3401 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3402 Sized_elf_reloc_mapper.
3403 (Sized_dwarf_line_info::symbol_section): Remove function.
3404 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3405 (Sized_dwarf_line_info::read_line_mappings): Remove object
3406 parameter, adjust callers.
3407 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3408 * dwarf_reader.h: Include <sys/types.h>.
3409 (class Track_relocs): Remove forward declaration.
3410 (class Elf_reloc_mapper): New class.
3411 (class Sized_elf_reloc_mapper): New class.
3412 (class Dwarf_abbrev_table): New class.
3413 (class Dwarf_range_list): New class.
3414 (class Dwarf_ranges_table): New class.
3415 (class Dwarf_pubnames_table): New class.
3416 (class Dwarf_die): New class.
3417 (class Dwarf_info_reader): New class.
3418 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3419 (Sized_dwarf_line_info::symbol_section): Remove member function.
3420 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3422 * gdb-index.cc: New source file.
3423 * gdb-index.h: New source file.
3424 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3425 and .debug_types sections, call Layout::add_to_gdb_index.
3426 (Sized_relobj_incr::do_section_name): Implement.
3427 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3428 return type; Implement.
3429 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3431 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3432 parameter list and return type.
3433 (Sized_incr_dynobj::do_section_contents): Likewise.
3434 * layout.cc: Include gdb-index.h.
3435 (Layout::Layout): Initialize gdb_index_data_.
3436 (Layout::init_fixed_output_section): Check for .gdb_index section.
3437 (Layout::add_to_gdb_index): New function. Instantiate.
3438 * layout.h: Add forward declaration for class Gdb_index.
3439 (Layout::add_to_gdb_index): New member function.
3440 (Layout::gdb_index_data_): New data member.
3441 * main.cc: Include gdb-index.h.
3442 (main): Print statistics for gdb index.
3443 * object.cc (Object::section_contents): Move code into
3444 do_section_contents.
3445 (need_decompressed_section): Check for sections needed when building
3447 (build_compressed_section_map): Likewise.
3448 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3450 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3451 sections; call Layout::add_to_gdb_index.
3452 (Sized_relobj_file::do_decompressed_section_contents): Call
3453 do_section_contents directly.
3454 * object.h (Object::do_section_contents): Adjust parameter list and
3456 (Object::do_decompressed_section_contents): Call do_section_contents
3458 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3460 * options.h (class General_options): Add --gdb-index option.
3461 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3462 list and return type.
3463 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3464 * reloc.h (Track_relocs::checkpoint): New function.
3465 (Track_relocs::reset): New function.
3467 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3469 * testsuite/Makefile.in: Regenerate.
3470 * testsuite/gdb_index_test.cc: New test source file.
3471 * testsuite/gdb_index_test_1.sh: New test source file.
3472 * testsuite/gdb_index_test_2.sh: New test source file.
3474 2012-03-19 Doug Kwan <dougkwan@google.com>
3476 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3477 (Target_arm::do_finalize_sections): Remove code which defines
3478 __exidx_start and __exidx_end. Make symbol table parameter
3479 anonymous as it is not used.
3480 * gold.cc (queue_middle_tasks): Call target hook to define any
3481 target-specific symbols.
3482 * target.h (Target::define_standard_symbols): New method.
3483 (Target::do_define_standard_symbols): Same.
3484 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3485 * testsuite/Makefile.in: Regenerate.
3486 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3488 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3489 relocations are generated for __exidx_start and __exidx_end.
3491 2012-03-16 Doug Kwan <dougkwan@google.com>
3493 * testsuite/Makefile.am: Disable test initpri3b.
3494 * testsuite/Makefile.in: Regenerate.
3496 2012-03-15 Doug Kwan <dougkwan@google.com>
3498 * arm.cc (Target_arm::got_section): Make .got section read-only
3501 2012-03-15 Ian Lance Taylor <iant@google.com>
3504 * layout.cc (Layout::make_output_section): Correctly mark
3505 SHT_INIT_ARRAY, et. al., as relro.
3507 2012-03-14 Doug Kwan <dougkwan@google.com>
3509 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3510 dynamic relocations for protected symbols in shared objects.
3512 2012-03-13 Ian Lance Taylor <iant@google.com>
3514 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3515 keep the larger alignment.
3517 2012-03-12 Cary Coutant <ccoutant@google.com>
3519 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3520 handling of DW_LNE_define_file.
3522 2012-03-12 Cary Coutant <ccoutant@google.com>
3524 * reduced_debug_output.cc
3525 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3528 2012-02-29 Cary Coutant <ccoutant@google.com>
3530 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3532 2012-02-29 Cary Coutant <ccoutant@google.com>
3534 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3535 Call Object::decompressed_section_contents.
3536 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3538 (Sized_dwarf_line_info::buffer_start_): New data member.
3539 * merge.cc (Output_merge_data::do_add_input_section): Call
3540 Object::decompressed_section_contents.
3541 (Output_merge_string::do_add_input_section): Likewise.
3542 * object.cc (need_decompressed_section): New function.
3543 (build_compressed_section_map): Decompress sections needed later.
3544 (Sized_relobj_file::do_decompressed_section_contents): New function.
3545 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3546 * object.h (Object::decompressed_section_contents): New function.
3547 (Object::discard_decompressed_sections): New function.
3548 (Object::do_decompressed_section_contents): New function.
3549 (Object::do_discard_decompressed_sections): New function.
3550 (Compressed_section_info): New type.
3551 (Compressed_section_map): Include decompressed section contents.
3552 (Sized_relobj_file::do_decompressed_section_contents): New function.
3553 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3555 2012-02-16 Cary Coutant <ccoutant@google.com>
3557 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3558 * testsuite/Makefile.in: Regenerate.
3560 2012-02-14 Cary Coutant <ccoutant@google.com>
3562 * options.cc (General_options::finalize): Disallow -pie and -static.
3564 2012-02-03 Doug Kwan <dougkwan@google.com>
3566 * arm.cc (Arm_relocate_functions::abs8,
3567 Arm_relocate_functions::abs16): Use
3568 Bits::has_signed_unsigned_overflow32.
3569 (Arm_relocate_functions::thm_abs8): Correct range of
3571 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3574 2012-02-02 Doug Kwan <dougkwan@google.com>
3576 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3577 position independent outputs, not just shared objects.
3579 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3581 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3582 * configure: Regenerated.
3584 2012-01-27 Ian Lance Taylor <iant@google.com>
3586 * reloc.h (Bits): New class with static functions, copied from
3587 namespace utils in arm.cc.
3588 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3591 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3593 * incremental.cc (write_info_blocks): Correct relocation offset.
3595 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3597 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3598 (Relocate::tls_gd_to_le): Likewise.
3600 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3602 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3604 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3606 * configure.ac: Check if -mcmodel=medium works.
3607 * configure: Regenerated.
3609 2012-01-24 Cary Coutant <ccoutant@google.com>
3611 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3613 (read_unsigned_LEB_128_x): ... this new function.
3614 (read_signed_LEB_128): Replaced with inline definition and ...
3615 (read_signed_LEB_128_x): ... this new function.
3616 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3617 (read_unsigned_LEB_128): Add inline definition.
3618 (read_signed_LEB_128_x): New function.
3619 (read_signed_LEB_128): Add inline definition.
3620 * testsuite/Makefile.am (leb128_unittest): New unit test.
3621 * testsuite/Makefile.in: Regenerate.
3622 * testsuite/leb128_unittest.cc: New unit test.
3624 2012-01-23 Ian Lance Taylor <iant@google.com>
3627 * i386.cc (Target_i386::do_code_fill): When using a jmp
3628 instruction, pad with nop instructions.
3629 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3631 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3633 * x86_64.cc (gc_process_relocs): Add typename on types used in
3635 (scan_relocs): Likewise.
3636 (relocate_section): Likewise.
3637 (apply_relocation): Likewise.
3639 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3641 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3642 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3645 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3647 * x86_64.cc: Initial support for x32.
3649 2012-01-03 Cary Coutant <ccoutant@google.com>
3651 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3652 Use abstract base class for GOT.
3653 * gold/output.h (class Output_data_got_base): New abstract base class.
3654 (class Output_data_got): Derive from new base class, adjust ctors.
3655 (Output_data_got::reserve_slot): Make virtual; rename to
3656 do_reserve_slot; Adjust callers.
3657 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3658 pointer to abstract base class.
3659 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3661 2011-12-18 Ian Lance Taylor <iant@google.com>
3663 * object.h (Relobj::local_symbol_value): New function.
3664 (Relobj::local_plt_offset): New function.
3665 (Relobj::local_has_got_offset): New function.
3666 (Relobj::local_got_offset): New function.
3667 (Relobj::set_local_got_offset): New function.
3668 (Relobj::do_local_symbol_value): New pure virtual function.
3669 (Relobj::do_local_plt_offset): Likewise.
3670 (Relobj::do_local_has_got_offset): Likewise.
3671 (Relobj::do_local_got_offset): Likewise.
3672 (Relobj::do_set_local_got_offset): Likewise.
3673 (Sized_relobj::do_local_has_got_offset): Rename from
3674 local_has_got_offset.
3675 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3676 (Sized_relobj::do_set_local_got_offset): Rename from
3677 set_local_got_offset.
3678 (Sized_relobj_file::do_local_plt_offset): Rename from
3680 (Sized_relobj_file::do_local_symbol_value): New function.
3681 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3683 * output.cc (Output_data_got::Got_entry::write): Change object to
3684 Relobj. Use local_symbol_value.
3685 (Output_data_got::add_global_with_rel): Change rel_dyn to
3686 Output_data_reloc_generic*. Use add_global_generic.
3687 (Output_data_got::add_global_with_rela): Remove. Change all
3688 callers to use add_global_with_rel.
3689 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3690 Output_data_reloc_generic*. Use add_global_generic.
3691 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3692 callers to use add_global_pair_with_rel.
3693 (Output_data_got::add_local): Change object to Relobj*.
3694 (Output_data_got::add_local_plt): Likewise.
3695 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3696 change rel_dyn to Output_data_reloc_generic*. Use
3698 (Output_data_got::add_local_with_rela): Remove. Change all
3699 callers to use all_local_with_rel.
3700 (Output_data_got::add_local_pair_with_rel): Change object to
3701 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3702 add_output_section_generic.
3703 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3704 callers to use add_local_pair_with_rel.
3705 (Output_data_got::reserve_local): Change object to Relobj*.
3706 * output.h: (class Output_data_reloc_generic): Add pure virtual
3707 declarations for add_global_generic, add_local_generic,
3708 add_output_section_generic.
3709 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3710 functions for Output_data_reloc_generic. Update declarations for
3711 changes listed in output.cc.
3712 (class Output_data_got): Change template parameter to got_size.
3713 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3714 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3716 (Sized_relobj_incr::do_local_plt_offset): New function.
3717 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3720 2011-12-17 Cary Coutant <ccoutant@google.com>
3722 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3723 * resolve.cc (Symbol_table::resolve): Likewise.
3724 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3726 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3728 2011-12-16 Ian Lance Taylor <iant@google.com>
3730 * output.h (Output_data_reloc_generic::add): Only call
3731 add_dynamic_reloc if this is a dynamic reloc section.
3733 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3736 * target-reloc.h (apply_relocation): Replace <64, false> with
3739 2011-11-25 Nick Clifton <nickc@redhat.com>
3741 * po/it.po: New Italian translation.
3743 2011-11-17 Sterling Augustine <saugustine@google.com>
3745 * script.cc (script_include_directive): Implement.
3746 (read_script_file): New local variables name and search_path. Update
3747 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3748 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3749 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3751 2011-11-11 Sterling Augustine <saugustine@google.com>
3753 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3754 (file_or_sections_cmd): Likewise.
3756 2011-11-11 Doug Kwan <dougkwan@google.com>
3758 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3759 if --just-symbols is given.
3761 2011-11-10 Doug Kwan <dougkwan@google.com>
3764 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3765 when processing data relocs.
3766 * reloc.h (Relocate_functions::rel_unaligned): New method.
3767 (Relocate_functions::pcrel_unaligned): Ditto.
3768 (Relocate_functions::rel32_unaligned): Ditto.
3769 (Relocate_functions::pcrel32_unaligned): Ditto.
3771 2011-11-09 Doug Kwan <dougkwan@google.com>
3774 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3775 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3776 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3777 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3778 (Relocate_functions::rel_unaligned): New.
3779 (Relocate_functions::rel32_unaligned): New.
3780 * target-reloc.h (relocate_for_relocatable): Add code to handle
3781 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3782 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3783 arm_unaligned_reloc_r): New targets.
3784 * testsuite/Makefile.in: Regenerate.
3785 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3788 2011-11-02 Ian Lance Taylor <iant@google.com>
3790 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3792 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3793 * options.cc (General_options::finalize): Use library search path
3794 from configure script if specified. If not native and no sysroot,
3795 only search TOOLLIBDIR.
3796 * options.h (Search_directory::Search_directory): Change name to
3798 (General_options::add_to_library_path_with_sysroot): Change arg to
3800 * configure, Makefile.in, config.in: Rebuild.
3802 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3804 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3805 we are working around the ARM1176 Erratum.
3806 * options.h (General_options::fix_arm1176): Add option.
3807 * testsuite/Makefile.am: Add testcases, and keep current ones
3809 * testsuite/Makefile.in: Regenerate.
3810 * testsuite/arm_fix_1176.s: New file.
3811 * testsuite/arm_fix_1176.sh: Likewise.
3813 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3815 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3817 (Target_arm::may_use_blx): Remove method.
3818 (Target_arm::set_may_use_blx): Likewise.
3819 (Target_arm::may_use_v4t_interworking): New method.
3820 (Target_arm::may_use_v5t_interworking): Likewise.
3821 (Target_arm::may_use_blx_): Remove member variable.
3822 (Arm_relocate_functions::arm_branch_common): Check for v5T
3824 (Arm_relocate_functions::thumb_branch_common): Likewise.
3825 (Reloc_stub::stub_type_for_reloc): Likewise.
3826 (Target_arm::do_finalize_sections): Correct interworking checks.
3827 * testsuite/Makefile.am: Add new tests.
3828 * testsuite/Makefile.in: Regenerate.
3829 * testsuite/arm_farcall_arm_arm.s: New test.
3830 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3831 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3832 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3833 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3834 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3835 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3836 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3838 2011-10-31 Cary Coutant <ccoutant@google.com>
3841 * expression.cc (Expression::eval_with_dot): Add
3842 is_section_dot_assignment parameter.
3843 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3844 absolute and assigning to dot within a section.
3845 * script-sections.cc
3846 (Output_section_element_assignment::set_section_addresses): Pass
3847 dot_section to set_if_absolute.
3848 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3849 as is_section_dot_assignment flag to eval_with_dot.
3850 (Output_section_element_dot_assignment::set_section_addresses):
3852 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3853 parameter. Also set value if relative to dot_section; set the
3854 symbol's output_section.
3855 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3856 parameter. Adjust all callers.
3857 (Expression::eval_maybe_dot): Likewise.
3858 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3860 * testsuite/script_test_2.t: Test assignment of an absolute value
3861 to dot within an output section element.
3863 2011-10-31 Cary Coutant <ccoutant@google.com>
3865 * options.h (class General_options): Add --[no-]gnu-unique options.
3866 * symtab.cc (Symbol_table::sized_write_globals): Convert
3867 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3869 2011-10-31 Cary Coutant <ccoutant@google.com>
3872 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3873 unnecessary assertion.
3874 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3876 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3878 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3880 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3882 Change to just keep the section associated with symbol.
3883 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3884 they are externally visible and --export-dynamic is turned on.
3885 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3887 2011-10-19 Ian Lance Taylor <iant@google.com>
3890 * script-sections.cc
3891 (Output_section_element_dot_assignment::needs_output_section): New
3894 2011-10-19 Ian Lance Taylor <iant@google.com>
3897 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3898 --section-start option was seen.
3899 * options.h (General_options::any_section_start): New function.
3901 2011-10-18 David S. Miller <davem@davemloft.net>
3904 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3905 member to track relocation locations that have moved during TLS
3906 reloc optimizations.
3907 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3908 (Target_sparc::Relocate::relocate): Adjust view down by 4
3909 bytes if it matches reloc_adjust_addr_.
3910 (Target_sparc::Relocate::relocate_tls): Always move the
3911 __tls_get_addr call delay slot instruction forward 4 bytes when
3912 performing relaxation.
3914 2011-10-18 Cary Coutant <ccoutant@google.com>
3916 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3917 (Output_file::map_no_anonymous): Check for non-zero
3918 return code from posix_fallocate.
3920 2011-10-17 Cary Coutant <ccoutant@google.com>
3923 * plugin.cc (is_visible_from_outside): Check for symbols
3924 referenced from dynamic objects.
3925 * resolve.cc (Symbol_table::resolve): Don't count references
3926 from dynamic objects as references from real ELF files.
3927 * testsuite/plugin_test_2.sh: Adjust expected result.
3929 2011-10-17 Cary Coutant <ccoutant@google.com>
3931 * gold.cc: Include timer.h.
3932 (queue_middle_tasks): Stamp time.
3933 (queue_final_tasks): Likewise.
3934 * main.cc (main): Store timer in parameters. Print timers
3936 * parameters.cc (Parameters::Parameters): Initialize timer_.
3937 (Parameters::set_timer): New function.
3938 (set_parameters_timer): New function.
3939 * parameters.h (Parameters::set_timer): New function.
3940 (Parameters::timer): New function.
3941 (Parameters::timer_): New data member.
3942 (set_parameters_timer): New function.
3943 * timer.cc (Timer::stamp): New function.
3944 (Timer::get_pass_time): New function.
3945 * timer.h (Timer::stamp): New function.
3946 (Timer::get_pass_time): New function.
3947 (Timer::pass_times_): New data member.
3949 2011-10-17 Cary Coutant <ccoutant@google.com>
3951 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3952 task for members of lib groups.
3954 2011-10-17 Cary Coutant <ccoutant@google.com>
3957 * fileread.cc (File_read::find_view): Add assert.
3958 (File_read::make_view): Move bounds check (replace with assert)...
3959 (File_read::find_or_make_view): ... to here.
3961 2011-10-12 Cary Coutant <ccoutant@google.com>
3963 * output.cc (Output_file::open_base_file): Handle case where
3964 ::read returns less than requested size.
3966 2011-10-10 Cary Coutant <ccoutant@google.com>
3968 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3969 Initialize defined_count_.
3970 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3971 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3972 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3973 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3974 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3975 * incremental.h (Sized_relobj_incr::defined_count_): New data
3977 (Sized_incr_dynobj::defined_count_): New data member.
3978 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3979 Return zeroes instead of internal error.
3981 2011-10-10 Cary Coutant <ccoutant@google.com>
3984 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3985 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3986 * output.h (class Output_reloc): Add use_plt_offset flag.
3987 (Output_reloc::type_): Adjust size of bit field.
3988 (Output_reloc::use_plt_offset_): New bit field.
3989 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3990 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3991 flag. Adjust all callers.
3992 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3993 creating RELATIVE relocations.
3995 2011-10-10 Nick Clifton <nickc@redhat.com>
3997 * po/es.po: Updated Spanish translation.
3998 * po/fi.po: Updated Finnish translation.
4000 2011-10-03 Diego Novillo <dnovillo@google.com>
4002 * options.cc (parse_uint): Fix dereference of RETVAL.
4004 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4006 * layout.h (section_order_map_): New member.
4007 (get_section_order_map): New member function.
4008 * output.cc (Output_section::add_input_section): Check for patterns
4009 only when --section-ordering-file is specified.
4010 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4011 output_sections have been formed.
4012 * layout.cc (Layout_Layout): Initialize section_order_map_.
4013 * plugin.cc (update_section_order): Store order in order_map. Do not
4015 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4016 * testsuite/Makefile.in: Regenerate.
4017 * testsuite/plugin_section_order.c: New file.
4018 * testsuite/plugin_final_layout.cc: New file.
4019 * testsuite/plugin_final_layout.sh: New file.
4021 2011-09-29 Cary Coutant <ccoutant@google.com>
4023 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4025 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4026 symbols during incremental update.
4027 (Symbol_table::add_from_dynobj): Likewise.
4029 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4030 Ian Lance Taylor <iant@google.com>
4032 * symtab.cc (Symbol_table::define_special_symbol): Always
4033 canonicalize version string.
4035 2011-09-26 Cary Coutant <ccoutant@google.com>
4037 * gold.cc (queue_initial_tasks): Move option checks ...
4038 * options.cc (General_options::finalize): ... to here. Disable
4039 some options; make others fatal.
4041 2011-09-26 Cary Coutant <ccoutant@google.com>
4044 * plugin.cc (get_symbols_v2): New function.
4045 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4046 (is_referenced_from_outside): New function.
4047 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4048 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4049 (get_symbols): Pass version parameter.
4050 (get_symbols_v2): New function.
4051 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4053 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4054 (onload): Add LDPT_GET_SYMBOLS_V2.
4055 (all_symbols_read_hook): Use get_symbols_v2; check for
4056 LDPR_PREVAILING_DEF_IRONLY_EXP.
4057 * testsuite/plugin_test_3.sh: Update expected results.
4059 2011-09-23 Simon Baldwin <simonb@google.com>
4061 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4062 configuration options.
4063 * configure: Regenerate.
4064 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4065 * Makefile.in: Regenerate.
4066 * testsuite/Makefile.in: Regenerate.
4068 2011-09-19 Sriraman Tallam <tmsriram@google.com>
4070 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4072 2011-09-19 Cary Coutant <ccoutant@google.com>
4074 * incremental.cc (can_incremental_update): Fix typo in comment.
4075 * incremental.h (can_incremental_update): Likewise.
4077 2011-09-18 Cary Coutant <ccoutant@google.com>
4079 * incremental.cc (can_incremental_update): New function.
4080 * incremental.h (can_incremental_update): New function.
4081 * layout.cc (Layout::init_fixed_output_section): Call it.
4082 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4083 * object.cc (Sized_relobj_file::do_layout): Call
4084 can_incremental_update.
4086 2011-09-13 Cary Coutant <ccoutant@google.com>
4088 * configure.ac: Check for glibc support for gnu_indirect_function
4089 support with static linking, setting automake conditional
4091 * Makefile.in: Regenerate.
4092 * configure: Regenerate.
4094 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4095 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4097 * testsuite/Makefile.in: Regenerate.
4099 2011-09-13 Cary Coutant <ccoutant@google.com>
4101 * incremental.cc (Sized_relobj_incr::do_layout): Call
4102 report_comdat_group for kept comdat sections.
4103 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4104 * testsuite/Makefile.in: Regenerate.
4105 * testsuite/incr_comdat_test_1.cc: New source file.
4106 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4107 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4108 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4110 2011-09-13 Ian Lance Taylor <iant@google.com>
4112 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4113 variable external_symbols_offset.
4115 2011-09-12 Ian Lance Taylor <iant@google.com>
4117 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4118 triggered if object has no symbols.
4120 2011-09-09 David S. Miller <davem@davemloft.net>
4122 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4123 (Output_fill_debug_line::do_write): Likewise.
4125 2011-08-29 Cary Coutant <ccoutant@google.com>
4127 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4128 casts to match formatting specs.
4129 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4131 2011-08-26 Cary Coutant <ccoutant@google.com>
4133 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4134 remaining hole size when allocating.
4135 (Layout::make_output_section): Set fill methods for debug sections.
4136 * layout.h (Free_list::Free_list_node): Move from private to
4138 (Free_list::set_min_hole_size): New function.
4139 (Free_list::begin, Free_list::end): New functions.
4140 (Free_list::min_hole_): New data member.
4141 * output.cc: Include dwarf.h.
4142 (Output_fill_debug_info::do_minimum_hole_size): New function.
4143 (Output_fill_debug_info::do_write): New function.
4144 (Output_fill_debug_line::do_minimum_hole_size): New function.
4145 (Output_fill_debug_line::do_write): New function.
4146 (Output_section::Output_section): Initialize new data member.
4147 (Output_section::set_final_data_size): Ensure patch space is larger
4148 than minimum hole size.
4149 (Output_section::do_write): Fill holes in debug sections.
4150 * output.h (Output_fill): New class.
4151 (Output_fill_debug_info): New class.
4152 (Output_fill_debug_line): New class.
4153 (Output_section::set_free_space_fill): New function.
4154 (Output_section::free_space_fill_): New data member.
4155 * testsuite/Makefile.am (incremental_test_3): Add
4156 --incremental-patch option.
4157 (incremental_test_4): Likewise.
4158 (incremental_test_5): Likewise.
4159 (incremental_test_6): Likewise.
4160 (incremental_copy_test): Likewise.
4161 (incremental_common_test_1): Likewise.
4162 * testsuite/Makefile.in: Regenerate.
4164 2011-08-26 Nick Clifton <nickc@redhat.com>
4166 * po/es.po: Updated Spanish translation.
4168 2011-08-01 Cary Coutant <ccoutant@google.com>
4170 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4171 * gold/testsuite/Makefile.in: Regenerate.
4172 * gold/testsuite/justsyms_exec.c: New source file.
4173 * gold/testsuite/justsyms_lib.c: New source file.
4175 2011-08-01 Cary Coutant <ccoutant@google.com>
4177 * layout.cc (Layout::set_segment_offsets): Don't realign text
4178 segment if -Ttext was specified.
4179 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4181 * object.h (Sized_relobj_file::e_type): New function.
4182 (Sized_relobj_file::e_type_): New data member.
4183 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4184 base address for ET_EXEC files.
4185 * target.cc (Target::do_make_elf_object_implementation): Allow
4186 ET_EXEC files with --just-symbols option.
4188 2011-07-28 Cary Coutant <ccoutant@google.com>
4190 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4191 Add thread_number parameter.
4192 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4193 * workqueue-threads.cc
4194 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4195 current thread if its thread number is greater than desired thread
4197 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4198 Add thread_number parameter.
4199 (Workqueue::should_cancel_thread): Likewise.
4200 (Workqueue::find_runnable_or_wait): Pass thread_number to
4201 should_cancel_thread.
4202 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4205 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4207 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4208 only after checking if it cannot be forced local.
4209 * symtab.h (is_externally_visible): Check if the symbol is not forced
4212 2011-07-15 Ian Lance Taylor <iant@google.com>
4214 * options.h (class General_options): Add --print-output-format.
4215 Move -EL next to -EB, for better --help output.
4216 * target-select.cc: Include <cstdio>, "options.h", and
4218 (Target_selector::do_target_bfd_name): New function.
4219 (print_output_format): New function.
4220 * target-select.h (class Target_selector): Update declarations.
4221 (Target_selector::target_bfd_name): New function.
4222 (print_output_format): Declare.
4223 * main.cc: Include "target-select.h".
4224 (main): Handle --print-output-format.
4225 * gold.cc: Include "target-select.h".
4226 (queue_initial_tasks): Handle --print-output-format when there are
4228 * parameters.cc (parameters_force_valid_target): Give a better
4229 error message if -EB/-EL does not match target.
4230 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4233 2011-07-15 Ian Lance Taylor <iant@google.com>
4235 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4236 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4237 (Output_data_plt_i386::do_write): Write address of .dynamic
4238 section to first entry in .got.plt section.
4239 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4240 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4242 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4243 section to first entry in .got.plt section.
4244 * layout.h (Layout::dynamic_section): New function.
4246 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4248 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4250 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4251 input_section_position_, and input_section_glob_.
4252 (read_layout_from_file): Call function section_ordering_specified.
4253 * layout.h (is_section_ordering_specified): New function.
4254 (section_ordering_specified): New function.
4255 (section_ordering_specified_): New boolean member.
4256 * main.cc(main): Call load_plugins after layout object is defined.
4257 * output.cc (Output_section::add_input_section): Use
4258 function section_ordering_specified to check if section ordering is
4260 * output.cc (Output_section::add_relaxed_input_section): Use
4261 function section_ordering_specified to check if section ordering is
4263 (Output_section::update_section_layout): New function.
4264 (Output_section::sort_attached_input_sections): Check if input section
4266 * output.h (Output_section::update_section_layout): New function.
4267 * plugin.cc (get_section_count): New function.
4268 (get_section_type): New function.
4269 (get_section_name): New function.
4270 (get_section_contents): New function.
4271 (update_section_order): New function.
4272 (allow_section_ordering): New function.
4273 (Plugin::load): Add the new interfaces to the transfer vector.
4274 (Plugin_manager::load_plugins): New parameter.
4275 (Plugin_manager::all_symbols_read): New parameter.
4276 (Plugin_manager::claim_file): New parameter. Save the elf object for
4278 (Plugin_manager::get_elf_object): New function.
4279 (Plugin_manager::get_view): Change to directly use the bool to check
4280 if get_view is called from claim_file_hook.
4281 * plugin.h (input_objects): New function
4282 (Plugin__manager::load_plugins): New parameter.
4283 (Plugin_manager::claim_file): New parameter.
4284 (Plugin_manager::get_elf_object): New function.
4285 (Plugin_manager::in_claim_file_handler): New function.
4286 (Plugin_manager::in_claim_file_handler_): New member.
4287 (layout): New function.
4288 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4289 handler with an extra parameter. Make the elf object before calling
4291 * testsuite/plugin_test.c (get_section_count): New function pointer.
4292 (get_section_type): New function pointer.
4293 (get_section_name): New function pointer.
4294 (get_section_contents): New function pointer.
4295 (update_section_order): New function pointer.
4296 (allow_section_ordering): New function pointer.
4297 (onload): Check if the new interfaces exist.
4299 2011-07-13 Ian Lance Taylor <iant@google.com>
4301 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4303 * x86_64.cc (Target_x86_64::got_section): Likewise.
4304 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4305 (relro_now_test_SOURCES): New variable.
4306 (relro_now_test_DEPENDENCIES): New variable.
4307 (relro_now_test_LDFLAGS): New variable.
4308 (relro_now_test_LDADD): New variable.
4309 (relro_now_test.so): New target.
4310 * testsuite/Makefile.in: Rebuild.
4312 2011-07-12 Ian Lance Taylor <iant@google.com>
4315 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4316 GLOB_DAT relocation rather than a RELATIVE relocation for a
4317 protected symbol when creating a shared library.
4318 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4319 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4320 * testsuite/protected_main_1.cc (main): Test that protected
4321 function has same address.
4323 2011-07-11 Ian Lance Taylor <iant@google.com>
4326 * options.h (class General_options): Add -Bgroup.
4327 * options.cc (General_options::finalize): If -Bgroup is set,
4328 default to --unresolved-symbols=report-all.
4329 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4330 * target-reloc.h (issue_undefined_symbol_error): Handle
4331 --unresolved-symbols=report-all.
4333 2011-07-08 Ian Lance Taylor <iant@google.com>
4336 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4337 if linker script discards key sections.
4338 (Layout::create_dynamic_symtab): Likewise.
4339 (Layout::assign_local_dynsym_offsets): Likewise.
4340 (Layout::sized_create_version_sections): Likewise.
4341 (Layout::create_interp): Likewise.
4342 (Layout::finish_dynamic_section): Likewise.
4343 (Layout::set_dynamic_symbol_size): Likewise.
4345 2011-07-08 Ian Lance Taylor <iant@google.com>
4348 * options.h (class General_options): Add --unresolved-symbols.
4349 * target-reloc.h (issue_undefined_symbol_error): Check
4350 --unresolved-symbols. Add comments.
4352 2011-07-08 Ian Lance Taylor <iant@google.com>
4354 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4355 expression more complex.
4357 2011-07-08 Ian Lance Taylor <iant@google.com>
4360 * target-reloc.h (issue_undefined_symbol_error): New inline
4361 function, broken out of relocate_section.
4362 (relocate_section): Call issue_undefined_symbol_error.
4363 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4364 there is no TLS segment if we are about to issue an undefined
4366 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4368 2011-07-08 Ian Lance Taylor <iant@google.com>
4371 * resolve.cc (Symbol_table::should_override): Add fromtype
4372 parameter. Change all callers. Give error when linking together
4373 TLS and non-TLS symbol.
4374 (Symbol_table::should_override_with_special): Add fromtype
4375 parameter. Change all callers.
4376 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4377 there is no TLS segment if we have reported some errors.
4378 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4380 2011-07-08 Ian Lance Taylor <iant@google.com>
4383 * target.h (Target::plt_address_for_global): New function.
4384 (Target::plt_address_for_local): New function.
4385 (Target::plt_section_for_global): Remove.
4386 (Target::plt_section_for_local): Remove.
4387 (Target::do_plt_address_for_global): New virtual function.
4388 (Target::do_plt_address_for_local): New virtual function.
4389 (Target::do_plt_section_for_global): Remove.
4390 (Target::do_plt_section_for_local): Remove.
4391 (Target::register_global_plt_entry): Add Symbol_table and Layout
4393 * output.cc (Output_data_got::Got_entry::write): Use
4394 plt_address_for_global and plt_address_for_local.
4395 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4396 address of output section.
4397 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4398 got_irelative_, and irelative_count_ fields. Update
4400 (Output_data_plt_i386::has_irelative_section): New function.
4401 (Output_data_plt_i386::entry_count): Add irelative_count_.
4402 (Output_data_plt_i386::set_final_data_size): Likewise.
4403 (class Target_i386): Add got_irelative_ and rel_irelative_
4404 fields. Update declarations.
4405 (Target_i386::Target_i386): Initialize new fields.
4406 (Target_i386::do_plt_address_for_global): New function replacing
4407 do_plt_section_for_global.
4408 (Target_i386::do_plt_address_for_local): New function replacing
4409 do_plt_section_for_local.
4410 (Target_i386::got_section): Create got_irelative_.
4411 (Target_i386::rel_irelative_section): New function.
4412 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4413 fields. Don't define __rel_iplt_{start,end}.
4414 (Output_data_plt_i386::add_entry): Add symtab and layout
4415 parameters. Change all callers. Use different PLT and GOT for
4417 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4418 layout parameters. Change all callers. Use different PLT and
4420 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4421 (Output_data_plt_i386::rel_irelative): New function.
4422 (Output_data_plt_i386::address_for_global): New function.
4423 (Output_data_plt_i386::address_for_local): New function.
4424 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4425 IRELATIVE GOT when changing IFUNC GOT entries.
4426 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4428 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4429 if we didn't create an IRELATIVE GOT.
4430 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4431 plt_address_for_local.
4432 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4433 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4434 got_irelative_, and irelative_count_ fields. Update
4436 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4437 Initialize new fields. Remove symtab parameter. Change all
4439 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4441 (Output_data_plt_x86_64::has_irelative_section): New function.
4442 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4443 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4444 fields. Update declarations.
4445 (Target_x86_64::Target_x86_64): Initialize new fields.
4446 (Target_x86_64::do_plt_address_for_global): New function replacing
4447 do_plt_section_for_global.
4448 (Target_x86_64::do_plt_address_for_local): New function replacing
4449 do_plt_section_for_local.
4450 (Target_x86_64::got_section): Create got_irelative_.
4451 (Target_x86_64::rela_irelative_section): New function.
4452 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4453 all callers. Don't create __rel_iplt_{start,end}.
4454 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4455 parameters. Change all callers. Use different PLT and GOT for
4457 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4458 layout parameters. Change all callers. Use different PLT and
4460 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4461 parameters. Change all callers. Use different PLT and GOT for
4463 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4464 (Output_data_plt_x86_64::rela_irelative): New function.
4465 (Output_data_plt_x86_64::address_for_global): New function.
4466 (Output_data_plt_x86_64::address_for_local): New function.
4467 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4468 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4469 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4470 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4472 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4474 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4475 symbols if we didn't create an IRELATIVE GOT.
4476 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4477 plt_address_for_local.
4478 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4479 * testsuite/ifuncvar1.c: New test file.
4480 * testsuite/ifuncvar2.c: New test file.
4481 * testsuite/ifuncvar3.c: New test file.
4482 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4483 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4484 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4485 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4486 * testsuite/Makefile.in: Rebuild.
4488 2011-07-07 Cary Coutant <ccoutant@google.com>
4490 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4491 (two_file_test_1_ndebug.o): Likewise.
4492 (two_file_test_1b_ndebug.o): Likewise.
4493 (two_file_test_2_ndebug.o): Likewise.
4494 (two_file_test_main_ndebug.o): Likewise.
4495 (incremental_test_2): Link with no-debug versions.
4497 2011-07-06 Cary Coutant <ccoutant@google.com>
4499 * gold/incremental.cc
4500 (Output_section_incremental_inputs::write_info_blocks): Check for
4501 hidden and internal symbols.
4503 2011-07-06 Cary Coutant <ccoutant@google.com>
4505 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4506 Check disposition for startup file.
4507 (Incremental_inputs::report_command_line): Ignore
4508 --incremental-startup-unchanged option.
4509 * options.cc (General_options::parse_incremental_startup_unchanged):
4511 (General_options::General_options): Initialize new data member.
4512 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4513 (General_options): Add --incremental-startup-unchanged option.
4514 (General_options::incremental_startup_disposition): New function.
4515 (General_options::incremental_startup_disposition_): New data member.
4517 2011-07-06 Cary Coutant <ccoutant@google.com>
4519 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4520 input file index to Script_info ctor.
4521 (Sized_incremental_binary::do_file_has_changed): Find the
4522 command-line argument for files named in scripts.
4523 * incremental.h (Script_info::Script_info): New ctor
4524 with input file index.
4525 (Script_info::input_file_index): New function.
4526 (Script_info::input_file_index_): New data member.
4527 (Incremental_binary::get_library): Add const.
4528 (Incremental_binary::get_script_info): Add const.
4529 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4530 * testsuite/Makefile.am (incremental_test_5): New test case.
4531 (incremental_test_6): New test case.
4532 * testsuite/Makefile.in: Regenerate.
4534 2011-07-06 Cary Coutant <ccoutant@google.com>
4536 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4537 debug output when command lines differ.
4539 2011-07-06 Cary Coutant <ccoutant@google.com>
4541 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4542 --incremental-patch option.
4543 * layout.cc (Free_list::allocate): Extend allocation beyond original
4545 (Layout::make_output_section): Mark sections that should get
4547 * options.cc (parse_percent): New function.
4548 * options.h (parse_percent): New function.
4549 (DEFINE_percent): New macro.
4550 (General_options): Add --incremental-patch option.
4551 * output.cc (Output_section::Output_section): Initialize new data
4553 (Output_section::add_input_section): Print section name when out
4555 (Output_section::add_output_section_data): Likewise.
4556 (Output_section::set_final_data_size): Add patch space when
4557 doing --incremental-full.
4558 (Output_section::do_reset_address_and_file_offset): Remove patch
4560 (Output_segment::set_section_list_addresses): Print debug output
4561 only if --incremental-update.
4562 * output.h (Output_section::set_is_patch_space_allowed): New function.
4563 (Output_section::is_patch_space_allowed_): New data member.
4564 (Output_section::patch_space_): New data member.
4565 * parameters.cc (Parameters::incremental_full): New function.
4566 * parameters.h (Parameters::incremental_full): New function
4567 * testsuite/Makefile.am (incremental_test_2): Add test for
4568 --incremental-patch option.
4569 * testsuite/Makefile.in: Regenerate.
4570 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4571 (t18): Remove function body.
4573 2011-07-05 Doug Kwan <dougkwan@google.com>
4576 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4577 Arm_Address type for relocation result.
4578 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4580 (Arm_relocate_functions::abs32): Use unaligned access.
4581 (Arm_relocate_functions::rel32): Ditto.
4582 (Arm_relocate_functions::prel31): Ditto.
4583 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4584 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4585 static data relocations.
4586 * testsuite/Makefile.in: Regnerate.
4587 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4589 2011-07-05 Ian Lance Taylor <iant@google.com>
4592 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4593 symbols if necessary.
4594 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4596 2011-07-05 Ian Lance Taylor <iant@google.com>
4599 * resolve.cc (Symbol::override_base_with_special): Simply override
4600 version with special symbol version, ignoring previous version.
4602 2011-07-05 Ian Lance Taylor <iant@google.com>
4604 * object.cc (Sized_relobj_file::include_section_group): Add
4605 information to comment about signature location.
4607 2011-07-02 Ian Lance Taylor <iant@google.com>
4610 * options.h (class General_options): Add -f and -F.
4611 * options.cc (General_options::finalize): Fatal error if -f/-F
4612 are used without -shared.
4613 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4615 2011-07-02 Ian Lance Taylor <iant@google.com>
4617 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4619 2011-07-01 Ian Lance Taylor <iant@google.com>
4623 * resolve.cc (Symbol::override_base_with_special): Don't override
4624 the version if the overriding symbol has a different name.
4625 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4626 all callers. If we give an error about an undefined version,
4627 define the base version if necessary.
4628 * dynobj.h (class Versions): Update declaration.
4629 * testsuite/weak_alias_test_5.cc: New file.
4630 * testsuite/weak_alias_test.script: New file.
4631 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4632 and versioned_alias have the right value, and call t2.
4633 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4634 weak_alias_test_5.so.
4635 (weak_alias_test_LDADD): Likewise.
4636 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4637 * testsuite/Makefile.in: Rebuild.
4639 2011-07-01 Ian Lance Taylor <iant@google.com>
4642 * options.h (class General_options): Support -z notext.
4643 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4645 (two_file_shared_nonpic.so): Likewise.
4646 (two_file_shared_mixed.so): Likewise.
4647 (two_file_shared_mixed_1.so): Likewise.
4648 (weak_undef_lib_nonpic.so): Likewise.
4649 (alt/weak_undef_lib_nonpic.so): Likewise.
4650 (tls_test_shared_nonpic.so): Likewise.
4651 * testsuite/Makefile.in: Rebuild.
4653 2011-07-01 Ian Lance Taylor <iant@google.com>
4656 * configure.ac: Test whether static linking works, setting
4657 the automake conditional HAVE_STATIC.
4658 * testsuite/Makefile.am: Disable tests using -static if
4659 HAVE_STATIC is not true.
4660 * configure, testsuite/Makefile.in: Rebuild.
4662 2011-07-01 Ian Lance Taylor <iant@google.com>
4665 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4666 Assert if we see DW_EH_PE_indirect.
4667 * target.h (Target::ehframe_datarel_base): New function.
4668 (Target::do_ehframe_datarel_base): New target function.
4669 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4670 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4673 2011-07-01 Ian Lance Taylor <iant@google.com>
4676 * options.h (class General_options): Add
4677 --ld-generated-unwind-info.
4678 * ehframe.cc (Fde::write): Add address parameter. Change all
4679 callers. If associated with PLT, fill in address and size.
4680 (Cie::set_output_offset): Only add merge mapping if there is an
4682 (Cie::write): Add address parameter. Change all callers.
4683 (Eh_frame::add_ehframe_for_plt): New function.
4684 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4685 input_offset_ fields into union u_, with new plt field.
4686 (Fde::Fde): Adjust for new union field.
4687 (Fde::Fde) [Output_data version]: New constructor.
4688 (Fde::add_mapping): Only add merge mapping if there is an object.
4689 (class Cie): Update declarations.
4690 (class Eh_frame): Declare add_ehframe_for_plt.
4691 * layout.cc (Layout::layout_eh_frame): Break out code into
4692 make_eh_frame_section, and call it.
4693 (Layout::make_eh_frame_section): New function.
4694 (Layout::add_eh_frame_for_plt): New function.
4695 * layout.h (class Layout): Update declarations.
4696 * merge.cc (Merge_map::add_mapping): Add assertion.
4697 * i386.cc: Include "dwarf.h".
4698 (class Output_data_plt_i386): Make first_plt_entry,
4699 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4700 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4701 and plt_eh_frame_fde.
4702 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4703 boundary. Call add_eh_frame_for_plt if appropriate.
4704 * x86_64.cc: Include "dwarf.h".
4705 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4706 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4707 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4708 and plt_eh_frame_fde.
4709 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4712 2011-06-29 Ian Lance Taylor <iant@google.com>
4715 * object.cc (Sized_relobj_file::layout_section): Change shdr
4716 parameter to be const.
4717 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4719 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4720 appropriate. Call layout_eh_frame_section.
4721 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4723 * object.h (class Sized_relobj_file): Update declarations.
4725 2011-06-29 Ian Lance Taylor <iant@google.com>
4728 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4730 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4732 2011-06-29 Ian Lance Taylor <iant@google.com>
4735 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4737 * layout.cc (Layout::layout_eh_frame): Likewise.
4739 2011-06-29 Ian Lance Taylor <iant@google.com>
4742 * layout.cc (Layout::symtab_section_shndx): New function.
4743 * layout.h (class Layout): Declare symtab_section_shndx.
4744 * output.cc (Output_section::write_header): Call it.
4746 2011-06-29 Ian Lance Taylor <iant@google.com>
4749 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4750 symbols which are not used in a relocation.
4752 2011-06-28 Ian Lance Taylor <iant@google.com>
4755 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4756 script create indistinguishable segments.
4757 (Layout::set_segment_offsets): Use stable_sort when sorting
4758 segments. Pass this to Compare_segments constructor.
4759 * layout.h (class Layout): Make segment_precedes non-static.
4760 (class Compare_segments): Change from struct to class. Add
4761 layout_ field. Add constructor.
4762 * script-sections.cc
4763 (Script_sections::attach_sections_using_phdrs_clause): Rename
4764 local orphan to is_orphan. Don't report failure to put empty
4765 section in segment. On attachment failure, report name of
4766 section, and attach to first PT_LOAD segment.
4768 2011-06-28 Ian Lance Taylor <iant@google.com>
4771 * target-select.cc (Target_selector::Target_selector): Add
4772 emulation parameter. Change all callers.
4773 (select_target_by_bfd_name): Rename from select_target_by_name.
4775 (select_target_by_emulation): New function.
4776 (supported_emulation_names): New function.
4777 * target-select.h (class Target_selector): Add emulation_ field.
4778 Update declarations.
4779 (Target_selector::recognize_by_bfd_name): Rename from
4780 recognize_by_name. Change all callers.
4781 (Target_selector::supported_bfd_names): Rename from
4782 supported_names. Change all callers.
4783 (Target_selector::recognize_by_emulation): New function.
4784 (Target_selector::supported_emulations): New function.
4785 (Target_selector::emulation): New function.
4786 (Target_selector::do_recognize_by_bfd_name): Rename from
4787 do_recognize_by_name. Change all callers.
4788 (Target_selector::do_supported_bfd_names): Rename from
4789 do_supported_names. Change all callers.
4790 (Target_selector::do_recognize_by_emulation): New function.
4791 (Target_selector::do_supported_emulations): New function.
4792 (select_target_by_bfd_name): Change name in declaration.
4793 (select_target_by_emulation): Declare.
4794 (supported_emulation_names): Declare.
4795 * parameters.cc (parameters_force_valid_target): Try to find
4796 target based on emulation from -m option.
4797 * options.h (class General_options): Change doc string for -m.
4798 * options.cc (help): Print emulations.
4799 (General_options::parse_V): Likewise.
4800 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4801 Add emulation parameter. Change all callers.
4803 2011-06-28 Ian Lance Taylor <iant@google.com>
4805 * target.h (class Target): Add osabi_ field.
4806 (Target::osabi): New function.
4807 (Target::set_osabi): New function.
4808 (Target::Target): Initialize osabi_.
4809 (Target::do_adjust_elf_header): Make pure virtual.
4810 (Sized_target::do_adjust_elf_header): Declare.
4811 * target.cc (Sized_target::do_adjust_elf_header): New function.
4812 (class Sized_target): Instantiate all versions.
4813 * freebsd.h (class Target_freebsd): Remove.
4814 (Target_selector_freebsd::do_recognize): Call set_osabi on
4816 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4817 (Target_selector_freebsd::set_osabi): Remove.
4818 * i386.cc (class Target_i386): Inherit from Sized_target rather
4819 than Target_freebsd.
4820 * x86_64.cc (class Target_x86_64): Likewise.
4822 2011-06-28 Ian Lance Taylor <iant@google.com>
4824 * target.h (Target::can_check_for_function_pointers): Rewrite.
4826 (Target::can_icf_inline_merge_sections): Likewise.
4827 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4828 (Target::Target_info): Add can_icf_inline_merge_sections field.
4829 (Target::do_can_check_for_function_pointers): New virtual
4831 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4832 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4833 from can_check_for_function_pointers, move in file.
4834 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4835 section_may_have_icf_unsafe_poineters, move in file.
4836 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4837 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4838 Rename from can_check_for_function_pointers, move in file.
4839 (Target_i386::can_icf_inline_merge_sections): Remove.
4840 (Target_i386::i386_info): Initialize
4841 can_icf_inline_merge_sections.
4842 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4843 Initialize can_icf_inline_merge_sections.
4844 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4845 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4846 Rename from can_check_for_function_pointers, move in file.
4847 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4848 (Target_x86_64::x86_64_info): Initialize
4849 can_icf_inline_merge_sections.
4850 * testsuite/testfile.cc (Target_test::test_target_info):
4852 * icf.cc (get_section_contents): Correct formatting.
4854 2011-06-27 Ian Lance Taylor <iant@google.com>
4856 * symtab.cc (Symbol::versioned_name): New function.
4857 (Symbol_table::add_to_final_symtab): Use versioned_name when
4859 (Symbol_table::sized_write_symbol): Likewise.
4860 * symtab.h (class Symbol): Declare versioned_name.
4861 * stringpool.h (class Stringpool_template): Add variant of add
4862 which takes a std::basic_string.
4863 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4864 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4865 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4866 (ver_test_12.o): New target.
4867 * testsuite/Makefile.in: Rebuild.
4869 2011-06-27 Doug Kwan <dougkwan@google.com>
4871 * arm.cc (Arm_relocate_functions::thm_jump8,
4872 Arm_relocate_functions::thm_jump11): Use a wider signed
4873 type to compute offset.
4874 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4876 * testsuite/Makefile.in: Regenerate.
4877 * testsuite/arm_branch_in_range.sh: Check test results of
4878 arm_thm_jump11 and arm_thm_jump8.
4879 * testsuite/arm_thm_jump11.s: New test source file.
4880 * testsuite/arm_thm_jump11.t: New linker script.
4881 * testsuite/arm_thm_jump8.s: New test source file.
4882 * testsuite/arm_thm_jump8.t: New linker script.
4884 2011-06-24 Ian Lance Taylor <iant@google.com>
4886 * layout.cc: Include "object.h".
4887 (ctors_sections_in_init_array): New static variable.
4888 (Layout::is_ctors_in_init_array): New function.
4889 (Layout::layout): Add entry to ctors_sections_in_init_array if
4891 * layout.h (class Layout): Declare is_ctors_in_init_array.
4892 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4893 is_ctors_reverse_view is set.
4894 (Sized_relobj_file::write_sections): Add layout parameter. Change
4895 all callers. Set is_ctors_reverse_view field of View_size.
4896 (Sized_relobj_file::reverse_words): New function.
4897 * object.h (Sized_relobj_file::View_size): Add
4898 is_ctors_reverse_view field.
4899 (class Sized_relobj_file): Update declarations.
4900 * testsuite/initpri3.c: New test.
4901 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4903 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4904 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4905 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4906 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4907 * testsuite/Makefile.in: Rebuild.
4909 2011-06-24 Cary Coutant <ccoutant@google.com>
4911 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4912 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4913 (debug_msg_cdebug.err): New targets.
4914 * testsuite/Makefile.in: Regenerate.
4915 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4916 Fix checks for link with shared library.
4918 2011-06-24 Doug Kwan <dougkwan@google.com>
4920 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4921 skip empty text sections.
4922 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4924 2011-06-22 Ian Lance Taylor <iant@google.com>
4927 * options.h (class General_options): Add --ctors-in-init-array.
4928 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4929 friends as SHT_PROGBITS for merging sections.
4930 (Layout::layout): Remove special handling of .init_array and
4931 friends. Don't sort if doing relocatable link. Sort for .ctors
4932 and .dtors if ctors_in_init_array.
4933 (Layout::make_output_section): Force correct section types for
4934 .init_array and friends. Don't sort if doing relocatable link,
4935 Don't sort .ctors and .dtors if ctors_in_init_array.
4936 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4937 (Layout::output_section_name): Add relobj parameter. Change all
4938 callers. Handle .ctors. and .dtors. in code rather than table.
4939 Handle .ctors and .dtors if ctors_in_init_array.
4940 (Layout::match_file_name): New function, moved from output.cc.
4941 * layout.h (class Layout): Update declarations.
4942 * output.cc: Include "layout.h".
4943 (Input_section_sort_entry::get_priority): New function.
4944 (Input_section_sort_entry::match_file_name): Just call
4945 Layout::match_file_name.
4946 (Output_section::Input_section_sort_init_fini_compare::operator()):
4947 Handle .ctors and .dtors. Sort by explicit priority rather than
4949 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4950 * testsuite/initpri2.c: New test.
4951 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4952 (check_PROGRAMS): Add initpri2.
4953 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4954 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4955 * configure, testsuite/Makefile.in: Rebuild.
4957 2011-06-19 Ian Lance Taylor <iant@google.com>
4960 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4961 .interp section to a PT_INTERP segment even if we have seen a
4962 --dynamic-linker option. Don't do it if we have seen a PHDRS
4963 clause in a linker script.
4964 (Layout::finalize): Don't create a .interp section if we've
4965 already create a PT_INTERP segment.
4966 (Layout::create_interp): Always call choose_output_section (revert
4967 patch of 2011-06-17). Don't create PT_INTERP segment.
4968 * script-sections.cc
4969 (Script_sections::create_note_and_tls_segments): Add a .interp
4970 section to a PT_INTERP segment even if we have seen a
4971 --dynamic-linker option.
4973 2011-06-18 Ian Lance Taylor <iant@google.com>
4975 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4976 merely because a non-PT_LOAD segment has a dynamic reloc.
4978 2011-06-18 Ian Lance Taylor <iant@google.com>
4980 * layout.cc (Layout::finish_dynamic_section): Don't create
4981 DT_FLAGS entry if not needed.
4983 2011-06-18 Ian Lance Taylor <iant@google.com>
4986 * layout.cc (Layout::layout_eh_frame): Correct handling of
4987 writable .eh_frame section.
4989 2011-06-17 Ian Lance Taylor <iant@google.com>
4992 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4993 symbol is redefined with the exact same object and value.
4995 2011-06-17 Ian Lance Taylor <iant@google.com>
4998 * layout.h (class Layout): Add interp_segment_ field.
4999 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5000 (Layout::attach_allocated_section_to_segment): If making shared
5001 library, put .interp section in PT_INTERP segment.
5002 (Layout::finalize): Also call create_interp if -dynamic-linker
5004 (Layout::create_interp): Assert that there is no PT_INTERP
5005 segment. If not using a SECTIONS clause, use make_output_section.
5006 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5007 * script-sections.cc
5008 (Script_sections::create_note_and_tls_segments): If making shared
5009 library, put .interp section in PT_INTERP segment.
5011 2011-06-17 Ian Lance Taylor <iant@google.com>
5013 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5014 when making a shared library.
5016 2011-06-17 Ian Lance Taylor <iant@google.com>
5018 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5019 parameter. Change all callers. Don't issue warning about PC32
5020 against locally defined symbol.
5022 2011-06-16 Ian Lance Taylor <iant@google.com>
5024 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5025 occurs in same object.
5027 2011-06-14 Alan Modra <amodra@gmail.com>
5029 * po/POTFILES.in: Regenerate.
5031 2011-06-09 Ian Lance Taylor <iant@google.com>
5033 * script-sections.cc
5034 (Orphan_output_section::set_section_addresses): For a relocatable
5035 link set address to 0.
5037 2011-06-09 Cary Coutant <ccoutant@google.com>
5040 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5041 used with --compress-debug-sections.
5042 * gold/object.cc (Sized_relobj_file::do_layout): Report
5043 uncompressed size of compressed input sections.
5045 2011-06-08 Cary Coutant <ccoutant@google.com>
5048 * testsuite/two_file_test_2_v1.cc: Change initialization of
5049 v2 to keep it in .data.
5051 2011-06-07 Cary Coutant <ccoutant@google.com>
5053 * common.cc (Symbol_table::do_allocate_commons_list): Call
5055 * errors.cc (Errors::fatal): Adjust call to gold_exit.
5056 (Errors::fallback): New function.
5057 (gold_fallback): New function.
5058 * errors.h (Errors::fallback): New function.
5059 * gold.cc (gold_exit): Change status parameter to enum; adjust
5061 (queue_initial_tasks): Call gold_fallback.
5062 * gold.h: Include cstdlib.
5063 (Exit_status): New enum type.
5064 (gold_exit): Change status parameter to enum.
5065 (gold_fallback): New function.
5066 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5067 (Layout::create_symtab_sections): Likewise.
5068 (Layout::create_shdrs): Likewise.
5069 * main.cc (main): Adjust call to gold_exit.
5070 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5071 (Output_data_got::add_got_entry_pair): Likewise.
5072 (Output_section::add_input_section): Likewise.
5073 (Output_section::add_output_section_data): Likewise.
5074 (Output_segment::set_section_list_addresses): Likewise.
5075 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5077 2011-06-07 Cary Coutant <ccoutant@google.com>
5079 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5080 for incremental links.
5081 * output.cc (Output_segment::set_section_list_addresses): Remove
5082 FIXME and test for TLS or BSS.
5084 2011-06-07 Cary Coutant <ccoutant@google.com>
5086 * testsuite/Makefile.am: Add incremental_copy_test,
5087 incremental_common_test_1.
5088 * testsuite/Makefile.in: Regenerate.
5089 * testsuite/common_test_1_v1.c: New source file.
5090 * testsuite/common_test_1_v2.c: New source file.
5091 * testsuite/copy_test_v1.cc: New source file.
5093 2011-06-07 Cary Coutant <ccoutant@google.com>
5095 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5096 update, allocate common from bss section's free list.
5097 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5098 linker-defined symbols.
5099 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5100 Skip GOT and PLT entries that are no longer referenced.
5101 (Output_section_incremental_inputs::write_info_blocks): Mark
5102 linker-defined symbols.
5103 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5104 * output.cc (Output_section::allocate): New function.
5105 * output.h (Output_section::allocate): New function.
5106 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5107 linker-defined symbols.
5108 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5109 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5110 (Symbol::init_base_output_data): Likewise.
5111 (Symbol::init_base_output_segment): Likewise.
5112 (Symbol::init_base_constant): Likewise.
5113 (Sized_symbol::init_output_data): Likewise.
5114 (Sized_symbol::init_output_segment): Likewise.
5115 (Sized_symbol::init_constant): Likewise.
5116 (Symbol_table::do_define_in_output_data): Likewise.
5117 (Symbol_table::do_define_in_output_segment): Likewise.
5118 (Symbol_table::do_define_as_constant): Likewise.
5119 * symtab.h (Symbol::is_predefined): New function.
5120 (Symbol::init_base_output_data): Add is_predefined parameter.
5121 (Symbol::init_base_output_segment): Likewise.
5122 (Symbol::init_base_constant): Likewise.
5123 (Symbol::is_predefined_): New data member.
5124 (Sized_symbol::init_output_data): Add is_predefined parameter.
5125 (Sized_symbol::init_output_segment): Likewise.
5126 (Sized_symbol::init_constant): Likewise.
5127 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5129 2011-06-07 Cary Coutant <ccoutant@google.com>
5131 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5132 instead of emit_copy_reloc.
5133 (Copy_relocs::emit_copy_reloc): Refactor.
5134 (Copy_relocs::make_copy_reloc): New function.
5135 (Copy_relocs::add_copy_reloc): Remove.
5136 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5138 (Copy_relocs::make_copy_reloc): New function.
5139 (Copy_relocs::add_copy_reloc): Remove.
5140 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5141 unchanged input files.
5142 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5143 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5144 Reserve BSS space for COPY relocations.
5145 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5146 (Output_section_incremental_inputs::write_info_blocks): Record
5147 whether a symbol is copied from a shared object.
5148 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5149 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5150 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5151 (Incremental_input_entry_reader::get_output_symbol_index): Add
5153 (Incremental_binary::emit_copy_relocs): New function.
5154 (Incremental_binary::do_emit_copy_relocs): New function.
5155 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5157 (Sized_incremental_binary::add_copy_reloc): New function.
5158 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5159 (Sized_incremental_binary::Copy_reloc): New struct.
5160 (Sized_incremental_binary::Copy_relocs): New typedef.
5161 (Sized_incremental_binary::copy_relocs_): New data member.
5162 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5163 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5164 * target.h (Sized_target::emit_copy_reloc): New function.
5165 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5167 2011-06-02 Cary Coutant <ccoutant@google.com>
5170 * gold/archive.cc (Archive::Archive): Initialize new data member.
5171 (Archive::include_all_members): Return if archive has already been
5173 * gold/archive.h (Archive::include_all_members_): New data member.
5175 2011-06-02 Nick Clifton <nickc@redhat.com>
5177 * dynobj.h: Fix spelling mistake in comment.
5178 * output.cc: Likewise.
5180 2011-05-31 Doug Kwan <dougkwan@google.com>
5184 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5185 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5186 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5187 redundant arm_exidx_test.so.
5188 * testsuite/Makefile.in: Regenerate.
5189 (check_SCRIPTS): Add pr12826.sh
5190 (check_DATA): Add pr12826.stdout
5191 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5192 * testsuite/pr12826.sh: New file.
5193 * testsuite/pr12826_1.s: Ditto.
5194 * testsuite/pr12826_1.s: Ditto.
5196 2011-05-30 Ian Lance Taylor <iant@google.com>
5198 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5201 2011-05-29 Ian Lance Taylor <iant@google.com>
5204 * testsuite/Makefile.am: Use different file name for two_file_test
5205 temporary file for each incremental test.
5206 * testsuite/Makefile.in: Rebuild.
5208 2011-05-29 Ian Lance Taylor <iant@google.com>
5210 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5211 binary input file is empty.
5213 2011-05-27 Ian Lance Taylor <iant@google.com>
5215 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5216 (ver_test_9.so): Likewise.
5217 * testsuite/Makefile.in: Rebuild.
5219 2011-05-26 Cary Coutant <ccoutant@google.com>
5221 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5222 * incremental.cc (Incremental_inputs::report_input_section): Fix
5223 comment, indentation.
5224 (Incremental_inputs::report_comdat_group): New function.
5225 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5226 of data for incremental input file entry.
5227 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5228 group count, COMDAT group signatures.
5229 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5230 an unchanged input file.
5231 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5232 Initialize new data member.
5233 (Incremental_object_entry::add_comdat_group): New function.
5234 (Incremental_object_entry::get_comdat_group_count): New function.
5235 (Incremental_object_entry::get_comdat_signature_key): New function.
5236 (Incremental_object_entry::groups_): New data member.
5237 (Incremental_inputs::report_comdat_group): New function.
5238 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5239 data for incremental input file entry.
5240 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5241 (Incremental_input_entry_reader::get_input_section): Adjust size of
5242 data for incremental input file entry.
5243 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5244 (Incremental_input_entry_reader::get_comdat_group_signature): New
5246 * object.cc (Sized_relobj::include_section_group): Report kept
5247 COMDAT groups for incremental links.
5249 2011-05-24 David Meyer <pdox@google.com>
5251 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5252 with name parameter. Add found_name parameter.
5253 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5254 * dirsearch.h (class Dirsearch): Update declaration.
5256 2011-05-24 Ian Lance Taylor <iant@google.com>
5258 * archive.cc (Library_base::should_include_member): Pull in object
5259 from archive if it defines the entry symbol.
5260 * parameters.cc (Parameters::entry): New function.
5261 * parameters.h (class Parameters): Declare entry.
5262 * output.h (class Output_file_header): Remove entry_ field.
5263 * output.cc (Output_file_header::Output_file_header): Remove entry
5264 parameter. Change all callers.
5265 (Output_file_header::entry): Use parameters->entry.
5266 * gold.cc (queue_middle_tasks): Likewise.
5267 * plugin.cc (Plugin_hook::run): Likewise.
5269 2011-05-24 Cary Coutant <ccoutant@google.com>
5271 * gold.cc (queue_initial_tasks): Pass incremental base filename
5272 to Output_file::open_base_file; don't print error message.
5273 * incremental-dump.cc (main): Adjust call to
5274 Output_file::open_for_modification.
5275 * incremental-dump.cc (main): Likewise.
5276 * incremental.cc (Incremental_inputs::report_command_line):
5277 Ignore --incremental-base option when comparing command lines.
5278 Ignore parameter when given as separate argument.
5279 * options.h (class General_options): Add --incremental-base.
5280 * output.cc (Output_file::Output_file):
5281 (Output_file::open_base_file): Add base_name and writable parameters;
5282 read base file into new file; print error message here.
5283 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5285 * output.h (Output_file::open_for_modification): Rename to...
5286 (Output_file::open_base_file): ...this; add base_name and
5287 writable parameters; adjust all callers.
5288 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5290 * testsuite/Makefile.am (incremental_test_4): Test
5292 * testsuite/Makefile.in: Regenerate.
5294 2011-05-24 Cary Coutant <ccoutant@google.com>
5296 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5298 * testsuite/Makefile.in: Regenerate.
5299 * testsuite/two_file_test_1_v1.cc: New test source file.
5300 * testsuite/two_file_test_1b_v1.cc: New test source file.
5301 * testsuite/two_file_test_2_v1.cc: New test source file.
5303 2011-05-24 Cary Coutant <ccoutant@google.com>
5305 * dynobj.h (Dynobj::do_dynobj): New function.
5306 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5307 flag and soname for shared objects.
5308 * incremental.cc (Incremental_inputs::report_object): Make
5309 either Incremental_object_entry or Incremental_dynobj_entry; add
5310 soname to string table.
5311 (Incremental_inputs::report_input_section): Add assertion.
5312 (Output_section_incremental_inputs::set_final_data_size): Adjust
5313 type of input file entry for shared libraries; adjust size of
5314 shared library info entry.
5315 (Output_section_incremental_inputs::write_input_files): Write
5316 as_needed flag for shared libraries.
5317 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5318 of input file entry for shared libraries; write soname.
5319 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5320 soname from incremental info.
5321 * incremental.h (enum Incremental_input_flags): Add
5322 INCREMENTAL_INPUT_AS_NEEDED.
5323 (Incremental_input_entry::Incremental_input_entry): Initialize new
5325 (Incremental_input_entry::set_as_needed): New function.
5326 (Incremental_input_entry::as_needed): New function.
5327 (Incremental_input_entry::do_dynobj_entry): New function.
5328 (Incremental_input_entry::as_needed_): New data member.
5329 (Incremental_object_entry::Incremental_object_entry): Don't check
5331 (Incremental_object_entry::do_type): Likewise.
5332 (class Incremental_dynobj_entry): New class.
5333 (Incremental_input_entry_reader::as_needed): New function.
5334 (Incremental_input_entry_reader::get_soname): New function.
5335 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5336 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5337 size of shared library info entry.
5338 * layout.cc (Layout::finish_dynamic_section): Don't test for
5339 incremental link when adding DT_NEEDED entries.
5340 * object.h (Object::Object): Initialize new data member.
5341 (Object::dynobj): New function.
5342 (Object::set_as_needed): New function.
5343 (Object::as_needed): New function.
5344 (Object::do_dynobj): New function.
5345 (Object::as_needed_): New data member.
5347 2011-05-24 Cary Coutant <ccoutant@google.com>
5349 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5350 info; adjust display of GOT entries.
5351 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5352 vector of input objects; remove file_status_.
5353 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5354 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5355 got_plt reader; call target hooks to reserve GOT entries.
5356 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5357 of input file info header and GOT info entry.
5358 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5360 (Got_plt_view_info::got_descriptor): Remove.
5361 (Got_plt_view_info::sym_index): New data member.
5362 (Got_plt_view_info::input_index): New data member.
5363 (Local_got_offset_visitor::visit): Write input file index.
5364 (Global_got_offset_visitor::visit): Write 0 for input file index.
5365 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5366 with sym_index and input_index.
5367 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5368 incremental info GOT entry; replace got_descriptor with input_index.
5369 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5370 map from input file index to object.
5371 (Sized_relobj_incr::do_layout): Replace direct data member reference
5372 with accessor function.
5373 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5374 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5375 Adjust size of input file info header.
5376 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5377 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5378 (Incremental_input_entry_reader::get_input_section): Adjust size of
5379 input file info header.
5380 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5381 of incremental info GOT entry.
5382 (Incremental_got_plt_reader::get_got_desc): Remove.
5383 (Incremental_got_plt_reader::get_got_symndx): New function.
5384 (Incremental_got_plt_reader::get_got_input_index): New function.
5385 (Sized_incremental_binary::Sized_incremental_binary): Remove
5386 file_status_; add input_objects_.
5387 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5388 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5389 (Sized_incremental_binary::file_is_unchanged): Remove.
5390 (Sized_incremental_binary::set_input_object): New function.
5391 (Sized_incremental_binary::input_object): New function.
5392 (Sized_incremental_binary::file_status_): Remove.
5393 (Sized_incremental_binary::input_objects_): New data member.
5394 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5396 (Sized_relobj_incr::invalid_address): Move to base class.
5397 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5399 (Sized_relobj_incr::do_output_section_offset): Likewise.
5400 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5401 (Sized_relobj_incr::section_offsets_): Likewise.
5402 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5404 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5405 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5406 with accessor function.
5407 (Sized_relobj_file::do_layout): Likewise.
5408 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5409 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5410 (Sized_relobj_file::compute_final_local_value): Replace refs to
5411 section_offsets_ with accessor function.
5412 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5413 * object.h (Relobj::Relobj): Initialize new data members.
5414 (Relobj::add_dyn_reloc): New function.
5415 (Relobj::first_dyn_reloc): New function.
5416 (Relobj::dyn_reloc_count): New function.
5417 (Relobj::first_dyn_reloc_): New data member.
5418 (Relobj::dyn_reloc_count_): New data member.
5419 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5421 (Sized_relobj::Address): New typedef.
5422 (Sized_relobj::invalid_address): Move here from child class.
5423 (Sized_relobj::Sized_relobj): Initialize new data members.
5424 (Sized_relobj::sized_relobj): New function.
5425 (Sized_relobj::is_output_section_offset_invalid): Move here from
5427 (Sized_relobj::get_output_section_offset): Likewise.
5428 (Sized_relobj::local_has_got_offset): Likewise.
5429 (Sized_relobj::local_got_offset): Likewise.
5430 (Sized_relobj::set_local_got_offset): Likewise.
5431 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5432 (Sized_relobj::clear_got_offsets): New function.
5433 (Sized_relobj::section_offsets): Move here from child class.
5434 (Sized_relobj::do_output_section_offset): Likewise.
5435 (Sized_relobj::do_set_section_offset): Likewise.
5436 (Sized_relobj::Local_got_offsets): Likewise.
5437 (Sized_relobj::local_got_offsets_): Likewise.
5438 (Sized_relobj::section_offsets_): Likewise.
5439 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5441 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5443 (Sized_relobj_file::sized_relobj): New function
5444 (Sized_relobj_file::local_has_got_offset): Move to base class.
5445 (Sized_relobj_file::local_got_offset): Likewise.
5446 (Sized_relobj_file::set_local_got_offset): Likewise.
5447 (Sized_relobj_file::get_output_section_offset): Likewise.
5448 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5449 (Sized_relobj_file::do_output_section_offset): Likewise.
5450 (Sized_relobj_file::do_set_section_offset): Likewise.
5451 (Sized_relobj_file::Local_got_offsets): Likewise.
5452 (Sized_relobj_file::local_got_offsets_): Likewise.
5453 (Sized_relobj_file::section_offsets_): Likewise.
5454 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5456 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5457 (Output_reloc::get_symbol_index): Likewise.
5458 (Output_reloc::local_section_offset): Likewise.
5459 (Output_reloc::get_address): Likewise.
5460 (Output_reloc::symbol_value): Likewise.
5461 (Output_data_got::reserve_slot): Move to class definition.
5462 (Output_data_got::reserve_local): New function.
5463 (Output_data_got::reserve_slot_for_global): Remove.
5464 (Output_data_got::reserve_global): New function.
5465 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5466 (all constructors, two instantiations).
5467 (Output_reloc::get_relobj): New function (two instantiations).
5468 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5469 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5470 (Output_data_reloc::add_global): Adjust type of relobj.
5471 (Output_data_reloc::add_global_relative): Likewise.
5472 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5473 (Output_data_reloc::add_local): Likewise.
5474 (Output_data_reloc::add_local_relative): Likewise.
5475 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5476 (Output_data_reloc::add_local_section): Likewise.
5477 (Output_data_reloc::add_output_section): Likewise.
5478 (Output_data_reloc::add_absolute): Likewise.
5479 (Output_data_reloc::add_target_specific): Likewise.
5480 (Output_data_got::reserve_slot): Move definition here.
5481 (Output_data_got::reserve_local): New function.
5482 (Output_data_got::reserve_global): New function.
5483 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5484 section_offsets_ with accessor function.
5485 (Sized_relobj_file::write_sections): Likewise.
5486 (Sized_relobj_file::do_relocate_sections): Likewise.
5487 * target.h (Sized_target::reserve_local_got_entry): New function.
5488 (Sized_target::reserve_global_got_entry): New function.
5489 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5490 (Target_x86_64::reserve_global_got_entry): New function.
5491 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5493 2011-05-23 Cary Coutant <ccoutant@google.com>
5495 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5496 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5497 bit when checking got_type.
5498 * incremental.cc (Sized_incremental_binary::setup_readers):
5499 Store symbol table and string table locations; initialize bit vector
5500 of file status flags.
5501 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5503 (Sized_incremental_binary::do_process_got_plt): New function.
5504 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5505 (Output_section_incremental_inputs::set_final_data_size): Record
5506 file index for each input file.
5507 (Output_section_incremental_inputs::write_got_plt): Store file index
5508 instead of input entry offset for each GOT entry.
5510 (Incremental_input_entry::Incremental_input_entry): Initialize new
5512 (Incremental_input_entry::set_offset): Store file index.
5513 (Incremental_input_entry::get_file_index): New function.
5514 (Incremental_input_entry::file_index_): New data member.
5515 (Incremental_binary::process_got_plt): New function.
5516 (Incremental_binary::do_process_got_plt): New function.
5517 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5519 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5520 (Sized_incremental_binary::set_file_is_unchanged): New function.
5521 (Sized_incremental_binary::file_is_unchanged): New function.
5522 (Sized_incremental_binary::do_process_got_plt): New function.
5523 (Sized_incremental_binary::file_status_): New data member.
5524 (Sized_incremental_binary::main_symtab_loc_): New data member.
5525 (Sized_incremental_binary::main_strtab_loc_): New data member.
5526 * output.cc (Output_data_got::Got_entry::write): Add case
5528 (Output_data_got::add_global): Call add_got_entry.
5529 (Output_data_got::add_global_plt): Likewise.
5530 (Output_data_got::add_global_with_rel): Likewise.
5531 (Output_data_got::add_global_with_rela): Likewise.
5532 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5533 (Output_data_got::add_global_pair_with_rela): Likewise.
5534 (Output_data_got::add_local): Call add_got_entry.
5535 (Output_data_got::add_local_plt): Likewise.
5536 (Output_data_got::add_local_with_rel): Likewise.
5537 (Output_data_got::add_local_with_rela): Likewise.
5538 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5539 (Output_data_got::add_local_pair_with_rela): Likewise.
5540 (Output_data_got::reserve_slot): New function.
5541 (Output_data_got::reserve_slot_for_global): New function.
5542 (Output_data_got::add_got_entry): New function.
5543 (Output_data_got::add_got_entry_pair): New function.
5544 (Output_section::add_output_section_data): Edit FIXME.
5546 (Output_section_data_build::Output_section_data_build): New
5547 constructor with size parameter.
5548 (Output_data_space::Output_data_space): Likewise.
5549 (Output_data_got::Output_data_got): Initialize new data member; new
5550 constructor with size parameter.
5551 (Output_data_got::add_constant): Call add_got_entry.
5552 (Output_data_got::reserve_slot): New function.
5553 (Output_data_got::reserve_slot_for_global): New function.
5554 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5555 (Output_data_got::add_got_entry): New function.
5556 (Output_data_got::add_got_entry_pair): New function.
5557 (Output_data_got::free_list_): New data member.
5558 * target.h (Sized_target::init_got_plt_for_update): New function.
5559 (Sized_target::register_global_plt_entry): New function.
5560 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5561 Initialize new data member; call init; add constructor with PLT count.
5562 (Output_data_plt_x86_64::init): New function.
5563 (Output_data_plt_x86_64::add_relocation): New function.
5564 (Output_data_plt_x86_64::reserve_slot): New function.
5565 (Output_data_plt_x86_64::free_list_): New data member.
5566 (Target_x86_64::init_got_plt_for_update): New function.
5567 (Target_x86_64::register_global_plt_entry): New function.
5568 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5569 incremental updates.
5570 (Output_data_plt_x86_64::add_relocation): New function.
5571 * testsuite/object_unittest.cc (Object_test): Set default options.
5573 2011-05-16 Ian Lance Taylor <iant@google.com>
5575 * options.h (class General_options): Make -i a synonym for -r.
5577 2011-05-16 Ian Lance Taylor <iant@google.com>
5579 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5581 2011-05-10 Cary Coutant <ccoutant@google.com>
5583 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5586 2011-05-06 Ian Lance Taylor <iant@google.com>
5588 * layout.cc (Layout::layout): If the output section flags change,
5589 update the ordering.
5591 2011-04-25 Cary Coutant <ccoutant@google.com>
5593 * incremental-dump.cc (dump_incremental_inputs): Print local
5594 symbol info for each input file.
5596 (Output_section_incremental_inputs::set_final_data_size): Add local
5597 symbol info to input file entries in incremental info.
5598 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5599 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5600 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5601 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5603 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5604 (Sized_incr_relobj::do_relocate): Write the local symbols.
5605 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5606 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5607 Adjust size of input file header.
5608 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5609 (Incremental_inputs_reader::get_local_symbol_count): New function.
5610 (Incremental_inputs_reader::get_input_section): Adjust size of input
5612 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5613 (Sized_incr_relobj::This): New typedef.
5614 (Sized_incr_relobj::sym_size): New const data member.
5615 (Sized_incr_relobj::Local_symbol): New struct.
5616 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5617 (Sized_incr_relobj::do_local_symbol_offset): New function.
5618 (Sized_incr_relobj::local_symbol_count_): New data member.
5619 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5620 (Sized_incr_relobj::local_symbol_index_): New data member.
5621 (Sized_incr_relobj::local_symbol_offset_): New data member.
5622 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5623 (Sized_incr_relobj::local_symbols_): New data member.
5624 * object.h (Relobj::output_local_symbol_count): New function.
5625 (Relobj::local_symbol_offset): New function.
5626 (Relobj::do_output_local_symbol_count): New function.
5627 (Relobj::do_local_symbol_offset): New function.
5628 (Sized_relobj::do_output_local_symbol_count): New function.
5629 (Sized_relobj::do_local_symbol_offset): New function.
5631 2011-04-22 Vladimir Simonov <sv@sw.ru>
5633 * descriptors.cc (set_close_on_exec): New function.
5634 (Descriptors::open): Use set_close_on_exec.
5635 * output.cc (S_ISLNK): Define if not defined.
5637 2011-04-22 Cary Coutant <ccoutant@google.com>
5639 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5641 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5642 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5643 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5645 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5646 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5647 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5649 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5651 (Incremental_binary::apply_incremental_relocs): New function.
5652 (Incremental_binary::do_apply_incremental_relocs): New function.
5653 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5655 (Sized_incremental_binary::add_global_symbol): New function.
5656 (Sized_incremental_binary::global_symbol): New function.
5657 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5658 (Sized_incremental_binary::symbol_map_): New data member.
5659 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5660 * target.h (Sized_target::apply_relocation): New function.
5661 * target-reloc.h (apply_relocation): New function.
5662 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5664 2011-04-22 Doug Kwan <dougkwan@google.com>
5666 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5667 flag of a SHT_ARM_EXIDX section.
5668 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5669 * testsuite/Makefile.in: Regenerate.
5670 * testsuite/arm_exidx_test.s: New file.
5671 * testsuite/arm_exidx_test.sh: Same.
5673 2011-04-20 Cary Coutant <ccoutant@google.com>
5676 * archive.h (Incremental_archive_entry::Archive_member):
5677 Initialize arg_serial_ (second constructor).
5679 2011-04-17 Ian Lance Taylor <iant@google.com>
5681 * object.cc (Relocate_info::location): Simplify location string.
5682 * errors.cc (Errors::error_at_location): Don't print program
5684 (Errors::warning_at_location): Likewise.
5685 (Errors::undefined_symbol): Likewise.
5686 * testsuite/debug_msg.sh: Update accordingly.
5688 2011-04-14 Cary Coutant <ccoutant@google.com>
5690 * gold/layout.cc (Layout::symtab_section_offset): New function.
5691 * gold/layout.h (Layout::symtab_section_offset): New function.
5692 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5694 2011-04-12 Ian Lance Taylor <iant@google.com>
5696 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5697 with MREMAP_MAYMOVE.
5698 * output.h (class Output_file): Add map_is_allocated_ field.
5699 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5700 not available, provide stubs. If mremap is not available, #define
5702 (MREMAP_MAYMOVE): Define if not defined.
5703 (Output_file::Output_file): Initialize map_is_allocated_.
5704 (Output_file::resize): Check map_is_allocated_.
5705 (Output_file::map_anonymous): If mmap fails, use malloc.
5706 (Output_file::unmap): Don't do anything for an anonymous map.
5707 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5708 is not available, provide stubs.
5709 (File_read::View::~View): Use free rather than delete[].
5710 (File_read::make_view): Use malloc rather than new[]. If mmap
5712 (File_read::find_or_make_view): Use malloc rather than new[].
5713 * gold.h: Remove HAVE_REMAP code.
5714 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5715 exists. Rename mremap to gold_mremap. If mmap is not available
5717 * configure, config.in: Rebuild.
5719 2011-04-11 Ian Lance Taylor <iant@google.com>
5721 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5722 initialize local variable v.
5724 2011-04-11 Cary Coutant <ccoutant@google.com>
5726 * archive.cc (Archive::include_member): Adjust call to
5728 (Add_archive_symbols::run): Track argument serial numbers.
5729 (Lib_group::include_member): Likewise.
5730 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5731 * archive.h (Incremental_archive_entry::Archive_member):
5732 Initialize arg_serial_.
5733 (Archive_member::arg_serial_): New data member.
5734 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5735 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5737 (Sized_dynobj::do_for_all_local_got_entries): New function.
5738 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5740 * fileread.cc (get_mtime): New function.
5741 * fileread.h (get_mtime): New function.
5742 * gold.cc (queue_initial_tasks): Check for incremental update.
5743 (process_incremental_input): New function.
5744 (queue_middle_tasks): Don't force valid target for incremental
5746 * incremental-dump.cc (find_input_containing_global): Adjust
5747 size of symbol info entry.
5748 (dump_incremental_inputs): Dump argument serial number and
5749 in_system_directory flag; bias shndx by 1; print symbol names
5750 when dumping per-file symbol lists; use new symbol info readers.
5752 (Output_section_incremental_inputs:update_data_size): New function.
5753 (Sized_incremental_binary::setup_readers): Setup input readers
5754 for each input file; build maps for files added from libraries
5756 (Sized_incremental_binary::check_input_args): New function.
5757 (Sized_incremental_binary::do_check_inputs): Build map of argument
5758 serial numbers to input arguments.
5759 (Sized_incremental_binary::do_file_has_changed): Rename
5760 do_file_is_unchanged to this; compare file modification times.
5761 (Sized_incremental_binary::do_init_layout): New function.
5762 (Sized_incremental_binary::do_reserve_layout): New function.
5763 (Sized_incremental_binary::do_get_input_reader): Remove.
5764 (Sized_incremental_binary::get_symtab_view): New function.
5765 (Incremental_checker::can_incrementally_link_output_file): Remove.
5766 (Incremental_inputs::report_command_line): Exclude --debug options.
5767 (Incremental_inputs::report_archive_begin): Add parameter; track
5768 argument serial numbers; don't put input file entry for archive
5769 before archive members.
5770 (Incremental_inputs::report_archive_end): Put input file entry
5771 for archive after archive members.
5772 (Incremental_inputs::report_object): Add parameter; track argument
5773 serial numbers and in_system_directory flag.
5774 (Incremental_inputs::report_script): Add parameter; track argument
5776 (Output_section_incremental_inputs::set_final_data_size): Adjust
5777 size of symbol info entry; check for forwarding symbols.
5778 (Output_section_incremental_inputs::write_input_files): Write
5779 in_system_directory flag and argument serial number.
5780 (Output_section_incremental_inputs::write_info_blocks): Map section
5781 indices between incremental info and original input file; store
5782 input section index for each symbol.
5783 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5784 change operator() to visit().
5785 (class Global_got_offset_visitor): Likewise.
5786 (class Global_symbol_visitor_got_plt):
5787 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5789 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5790 (Sized_incr_relobj::do_read_symbols): New function.
5791 (Sized_incr_relobj::do_layout): New function.
5792 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5793 (Sized_incr_relobj::do_add_symbols): New function.
5794 (Sized_incr_relobj::do_should_include_member): New function.
5795 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5796 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5797 (Sized_incr_relobj::do_section_size): New function.
5798 (Sized_incr_relobj::do_section_name): New function.
5799 (Sized_incr_relobj::do_section_contents): New function.
5800 (Sized_incr_relobj::do_section_flags): New function.
5801 (Sized_incr_relobj::do_section_entsize): New function.
5802 (Sized_incr_relobj::do_section_address): New function.
5803 (Sized_incr_relobj::do_section_type): New function.
5804 (Sized_incr_relobj::do_section_link): New function.
5805 (Sized_incr_relobj::do_section_info): New function.
5806 (Sized_incr_relobj::do_section_addralign): New function.
5807 (Sized_incr_relobj::do_initialize_xindex): New function.
5808 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5809 (Sized_incr_relobj::do_read_relocs): New function.
5810 (Sized_incr_relobj::do_gc_process_relocs): New function.
5811 (Sized_incr_relobj::do_scan_relocs): New function.
5812 (Sized_incr_relobj::do_count_local_symbols): New function.
5813 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5814 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5815 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5816 (Sized_incr_relobj::do_relocate): New function.
5817 (Sized_incr_relobj::do_set_section_offset): New function.
5818 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5819 (Sized_incr_dynobj::do_read_symbols): New function.
5820 (Sized_incr_dynobj::do_layout): New function.
5821 (Sized_incr_dynobj::do_add_symbols): New function.
5822 (Sized_incr_dynobj::do_should_include_member): New function.
5823 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5824 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5825 (Sized_incr_dynobj::do_section_size): New function.
5826 (Sized_incr_dynobj::do_section_name): New function.
5827 (Sized_incr_dynobj::do_section_contents): New function.
5828 (Sized_incr_dynobj::do_section_flags): New function.
5829 (Sized_incr_dynobj::do_section_entsize): New function.
5830 (Sized_incr_dynobj::do_section_address): New function.
5831 (Sized_incr_dynobj::do_section_type): New function.
5832 (Sized_incr_dynobj::do_section_link): New function.
5833 (Sized_incr_dynobj::do_section_info): New function.
5834 (Sized_incr_dynobj::do_section_addralign): New function.
5835 (Sized_incr_dynobj::do_initialize_xindex): New function.
5836 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5837 (make_sized_incremental_object): New function.
5838 (Incremental_library::copy_unused_symbols): New function.
5839 (Incremental_library::do_for_all_unused_symbols): New function.
5840 * incremental.h (enum Incremental_input_flags): New type.
5841 (class Incremental_checker): Remove.
5842 (Incremental_input_entry::Incremental_input_entry): Add argument
5844 (Incremental_input_entry::arg_serial): New function.
5845 (Incremental_input_entry::set_is_in_system_directory): New function.
5846 (Incremental_input_entry::is_in_system_directory): New function.
5847 (Incremental_input_entry::arg_serial_): New data member.
5848 (Incremental_input_entry::is_in_system_directory_): New data member.
5849 (class Script_info): Move here from script.h.
5850 (Script_info::Script_info): Add filename parameter.
5851 (Script_info::filename): New function.
5852 (Script_info::filename_): New data member.
5853 (Incremental_script_entry::Incremental_script_entry): Add argument
5855 (Incremental_object_entry::Incremental_object_entry): Likewise.
5856 (Incremental_object_entry::add_input_section): Build list of input
5857 sections with map to original shndx.
5858 (Incremental_object_entry::get_input_section_index): New function.
5859 (Incremental_object_entry::shndx_): New data member.
5860 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5861 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5862 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5864 (Incremental_inputs::report_archive_begin): Likewise.
5865 (Incremental_inputs::report_object): Likewise.
5866 (Incremental_inputs::report_script): Likewise.
5867 (class Incremental_global_symbol_reader): New class.
5868 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5869 and store flags and input file type.
5870 (Incremental_input_entry_reader::arg_serial): New function.
5871 (Incremental_input_entry_reader::type): Extract type from flags.
5872 (Incremental_input_entry_reader::is_in_system_directory): New function.
5873 (Incremental_input_entry_reader::get_input_section_count): Call
5874 accessor function for type.
5875 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5876 function for type; adjust size of global symbol entry.
5877 (Incremental_input_entry_reader::get_global_symbol_count): Call
5878 accessor function for type.
5879 (Incremental_input_entry_reader::get_object_count): Likewise.
5880 (Incremental_input_entry_reader::get_object_offset): Likewise.
5881 (Incremental_input_entry_reader::get_member_count): Likewise.
5882 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5883 (Incremental_input_entry_reader::get_member_offset): Likewise.
5884 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5885 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5886 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5887 (Incremental_input_entry_reader::get_global_symbol_reader): New
5889 (Incremental_input_entry_reader::get_output_symbol_index): New
5891 (Incremental_input_entry_reader::type_): Remove.
5892 (Incremental_input_entry_reader::flags_): New data member.
5893 (Incremental_inputs_reader::input_file_offset): New function.
5894 (Incremental_inputs_reader::input_file_index): New function.
5895 (Incremental_inputs_reader::input_file): Call input_file_offset.
5896 (Incremental_inputs_reader::input_file_at_offset): New function.
5897 (Incremental_relocs_reader::get_r_type): Reformat.
5898 (Incremental_relocs_reader::get_r_shndx): Reformat.
5899 (Incremental_relocs_reader::get_r_offset): Reformat.
5900 (Incremental_relocs_reader::data): New function.
5901 (Incremental_binary::Incremental_binary): Initialize new data members.
5902 (Incremental_binary::check_inputs): Add cmdline parameter.
5903 (Incremental_binary::file_is_unchanged): Remove.
5904 (Input_reader::arg_serial): New function.
5905 (Input_reader::get_unused_symbol_count): New function.
5906 (Input_reader::get_unused_symbol): New function.
5907 (Input_reader::do_arg_serial): New function.
5908 (Input_reader::do_get_unused_symbol_count): New function.
5909 (Input_reader::do_get_unused_symbol): New function.
5910 (Incremental_binary::input_file_count): New function.
5911 (Incremental_binary::get_input_reader): Change signature to use
5912 index instead of filename.
5913 (Incremental_binary::file_has_changed): New function.
5914 (Incremental_binary::get_input_argument): New function.
5915 (Incremental_binary::get_library): New function.
5916 (Incremental_binary::get_script_info): New function.
5917 (Incremental_binary::init_layout): New function.
5918 (Incremental_binary::reserve_layout): New function.
5919 (Incremental_binary::output_file): New function.
5920 (Incremental_binary::do_check_inputs): New function.
5921 (Incremental_binary::do_file_is_unchanged): Remove.
5922 (Incremental_binary::do_file_has_changed): New function.
5923 (Incremental_binary::do_init_layout): New function.
5924 (Incremental_binary::do_reserve_layout): New function.
5925 (Incremental_binary::do_input_file_count): New function.
5926 (Incremental_binary::do_get_input_reader): Change signature.
5927 (Incremental_binary::input_args_map_): New data member.
5928 (Incremental_binary::library_map_): New data member.
5929 (Incremental_binary::script_map_): New data member.
5930 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5932 (Sized_incremental_binary::output_section): New function.
5933 (Sized_incremental_binary::inputs_reader): Add const.
5934 (Sized_incremental_binary::symtab_reader): Add const.
5935 (Sized_incremental_binary::relocs_reader): Add const.
5936 (Sized_incremental_binary::got_plt_reader): Add const.
5937 (Sized_incremental_binary::get_symtab_view): New function.
5938 (Sized_incremental_binary::Inputs_reader): New typedef.
5939 (Sized_incremental_binary::Input_entry_reader): New typedef.
5940 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5941 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5942 (Sized_incremental_binary::do_file_has_changed): New function.
5943 (Sized_incremental_binary::do_init_layout): New function.
5944 (Sized_incremental_binary::do_reserve_layout): New function.
5945 (Sized_input_reader::Inputs_reader): Remove.
5946 (Sized_input_reader::Input_entry_reader): Remove.
5947 (Sized_input_reader::do_arg_serial): New function.
5948 (Sized_input_reader::do_get_unused_symbol_count): New function.
5949 (Sized_input_reader::do_get_unused_symbol): New function.
5950 (Sized_incremental_binary::do_input_file_count): New function.
5951 (Sized_incremental_binary::do_get_input_reader): Change signature;
5952 use index instead of filename.
5953 (Sized_incremental_binary::section_map_): New data member.
5954 (Sized_incremental_binary::input_entry_readers_): New data member.
5955 (class Sized_incr_relobj): New class.
5956 (class Sized_incr_dynobj): New class.
5957 (make_sized_incremental_object): New function.
5958 (class Incremental_library): New class.
5959 * layout.cc (Free_list::num_lists): New static data member.
5960 (Free_list::num_nodes): New static data member.
5961 (Free_list::num_removes): New static data member.
5962 (Free_list::num_remove_visits): New static data member.
5963 (Free_list::num_allocates): New static data member.
5964 (Free_list::num_allocate_visits): New static data member.
5965 (Free_list::init): New function.
5966 (Free_list::remove): New function.
5967 (Free_list::allocate): New function.
5968 (Free_list::dump): New function.
5969 (Free_list::print_stats): New function.
5970 (Layout_task_runner::run): Resize output file for incremental updates.
5971 (Layout::Layout): Initialize new data members.
5972 (Layout::set_incremental_base): New function.
5973 (Layout::init_fixed_output_section): New function.
5974 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5975 incremental updates.
5976 (Layout::create_gold_note): Do not create gold note section for
5977 incremental updates.
5978 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5979 for incremental updates.
5980 (Layout::set_section_offsets): For incremental updates, allocate space
5982 (Layout::create_symtab_sections): Layout with offsets relative to
5983 start of section; for incremental updates, allocate space from free
5985 (Layout::create_shdrs): For incremental updates, allocate space from
5987 (Layout::finish_dynamic_section): For incremental updates, do not
5988 check --as-needed (fixed in subsequent patch).
5989 * layout.h (class Free_list): New class.
5990 (Layout::set_incremental_base): New function.
5991 (Layout::incremental_base): New function.
5992 (Layout::init_fixed_output_section): New function.
5993 (Layout::allocate): New function.
5994 (Layout::incremental_base_): New data member.
5995 (Layout::free_list_): New data member.
5996 * main.cc (main): Print Free_list statistics.
5997 * object.cc (Relobj::finalize_incremental_relocs): Add
5998 clear_counts parameter; clear counts only when clear_counts is set.
5999 (Sized_relobj::Sized_relobj): Initialize new base class.
6000 (Sized_relobj::do_layout): Don't report special sections.
6001 (Sized_relobj::do_for_all_local_got_entries): New function.
6002 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6003 symtab_off to all symbol table offsets.
6004 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6005 * object.h (class Got_offset_list): Move to top of file.
6006 (Object::Object): Allow case where input_file == NULL.
6007 (Object::~Object): Likewise.
6008 (Object::input_file): Assert that input_file != NULL.
6009 (Object::lock): Allow case where input_file == NULL.
6010 (Object::unlock): Likewise.
6011 (Object::is_locked): Likewise.
6012 (Object::token): Likewise.
6013 (Object::release): Likewise.
6014 (Object::is_incremental): New function.
6015 (Object::get_mtime): New function.
6016 (Object::for_all_local_got_entries): New function.
6017 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6018 (Object::set_is_in_system_directory): New function.
6019 (Object::is_in_system_directory): New function.
6020 (Object::do_is_incremental): New function.
6021 (Object::do_get_mtime): New function.
6022 (Object::do_for_all_local_got_entries): New function.
6023 (Object::is_in_system_directory_): New data member.
6024 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6025 (class Sized_relobj_base): New class.
6026 (class Sized_relobj): Derive from Sized_relobj_base.
6027 (class Sized_relobj::Symbols): Redeclare from base class.
6028 (class Sized_relobj::local_got_offset_list): Remove.
6029 (class Sized_relobj::Output_sections): Redeclare from base class.
6030 (class Sized_relobj::do_for_all_local_got_entries): New function.
6031 (class Sized_relobj::write_local_symbols): Add offset parameter.
6032 (class Sized_relobj::local_symbol_offset_): Update comment.
6033 (class Sized_relobj::local_dynsym_offset_): Update comment.
6034 * options.cc (Input_arguments::add_file): Remove const.
6035 * options.h (Input_file_argument::Input_file_argument):
6036 Initialize arg_serial_ (all constructors).
6037 (Input_file_argument::set_arg_serial): New function.
6038 (Input_file_argument::arg_serial): New function.
6039 (Input_file_argument::arg_serial_): New data member.
6040 (Input_arguments::Input_arguments): Initialize file_count_.
6041 (Input_arguments::add_file): Remove const.
6042 (Input_arguments::number_of_input_files): New function.
6043 (Input_arguments::file_count_): New data member.
6044 (Command_line::number_of_input_files): Call
6045 Input_arguments::number_of_input_files.
6046 * output.cc (Output_segment_headers::Output_segment_headers):
6048 (Output_section::Input_section::current_data_size): New function.
6049 (Output_section::Output_section): Initialize new data members.
6050 (Output_section::add_input_section): Don't do merge sections for
6051 an incremental link; allocate space from free list for an
6053 (Output_section::add_output_section_data): Allocate space from
6054 free list for an incremental update.
6055 (Output_section::update_data_size): New function.
6056 (Output_section::set_fixed_layout): New function.
6057 (Output_section::reserve): New function.
6058 (Output_segment::set_section_addresses): Remove const.
6059 (Output_segment::set_section_list_addresses): Remove const; allocate
6060 space from free list for an incremental update.
6061 (Output_segment::set_offset): Adjust size of RELRO segment for an
6063 * output.h (Output_data::current_data_size): Move here from
6065 (Output_data::pre_finalize_data_size): New function.
6066 (Output_data::update_data_size): New function.
6067 (Output_section_headers::update_data_size): new function.
6068 (Output_section_data_build::current_data_size): Move to Output_data.
6069 (Output_data_strtab::update_data_size): New function.
6070 (Output_section::current_data_size): Move to Output_data.
6071 (Output_section::set_fixed_layout): New function.
6072 (Output_section::has_fixed_layout): New function.
6073 (Output_section::reserve): New function.
6074 (Output_section::update_data_size): New function.
6075 (Output_section::has_fixed_layout_): New data member.
6076 (Output_section::free_list_): New data member.
6077 (Output_segment::set_section_addresses): Remove const.
6078 (Output_segment::set_section_list_addresses): Remove const.
6079 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6081 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6083 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6084 parameter when calling Add_symbols constructor; store argument
6085 serial number for members of a lib group.
6086 (Add_symbols::locks): Allow case where token == NULL.
6087 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6088 (Read_member::~Read_member): New function.
6089 (Read_member::is_runnable): New function.
6090 (Read_member::locks): New function.
6091 (Read_member::run): New function.
6092 (Check_script::~Check_script): New function.
6093 (Check_script::is_runnable): New function.
6094 (Check_script::locks): New function.
6095 (Check_script::run): New function.
6096 (Check_library::~Check_library): New function.
6097 (Check_library::is_runnable): New function.
6098 (Check_library::locks): New function.
6099 (Check_library::run): New function.
6100 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6101 (Add_symbols::library_): New data member.
6102 (class Read_member): New class.
6103 (class Check_script): New class.
6104 (class Check_library): New class.
6105 * reloc.cc (Read_relocs::is_runnable): Allow case where
6107 (Read_relocs::locks): Likewise.
6108 (Scan_relocs::locks): Likewise.
6109 (Relocate_task::locks): Likewise.
6110 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6112 (Sized_relobj::incremental_relocs_scan): Fix comment.
6113 (Sized_relobj::do_relocate): Pass output file offset to
6114 write_local_symbols.
6115 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6116 from class declaration.
6117 * script.cc (read_input_script): Allocate Script_info; pass
6118 argument serial number to report_script.
6119 * script.h (class Script_info): Move to incremental.h.
6120 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6121 * symtab.h (Symbol_table::add_from_incrobj): New function.
6122 (Symbol_table::set_file_offset): New function.
6124 2011-04-05 Cary Coutant <ccoutant@google.com>
6126 * incremental-dump.cc (dump_incremental_inputs): Change signature
6127 to take a Sized_incremental_binary; change caller. Use readers
6128 in Sized_incremental_binary.
6130 (Sized_incremental_binary::find_incremental_inputs_sections):
6131 Rename do_find_incremental_inputs_sections to this.
6132 (Sized_incremental_binary::setup_readers): New function.
6133 (Sized_incremental_binary::do_check_inputs): Check
6134 has_incremental_info_ flag; move setup code to setup_readers;
6136 (Sized_incremental_binary::do_file_is_unchanged): New function.
6137 (Sized_incremental_binary::do_get_input_reader): New function.
6138 * incremental.h (class Incremental_binary): Move to end of file.
6139 (Incremental_binary::file_is_unchanged): New function.
6140 (Incremental_binary::do_file_is_unchanged): New function.
6141 (Incremental_binary::Input_reader): New class.
6142 (Incremental_binary::get_input_reader): New function.
6143 (class Sized_incremental_binary): Move to end of file.
6144 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6145 input section reader classes.
6146 (Sized_incremental_binary::has_incremental_info): New function.
6147 (Sized_incremental_binary::inputs_reader): New function.
6148 (Sized_incremental_binary::symtab_reader): New function.
6149 (Sized_incremental_binary::relocs_reader): New function.
6150 (Sized_incremental_binary::got_plt_reader): New function.
6151 (Sized_incremental_binary::do_file_is_unchanged): New function.
6152 (Sized_incremental_binary::Sized_input_reader): New class.
6153 (Sized_incremental_binary::get_input_reader): New function.
6154 (Sized_incremental_binary::find_incremental_inputs_sections):
6155 Rename do_find_incremental_inputs_sections to this.
6156 (Sized_incremental_binary::setup_readers): New function.
6157 (Sized_incremental_binary::has_incremental_info_): New data member.
6158 (Sized_incremental_binary::inputs_reader_): New data member.
6159 (Sized_incremental_binary::symtab_reader_): New data member.
6160 (Sized_incremental_binary::relocs_reader_): New data member.
6161 (Sized_incremental_binary::got_plt_reader_): New data member.
6162 (Sized_incremental_binary::current_input_file_): New data member.
6164 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6167 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6170 2011-03-30 Cary Coutant <ccoutant@google.com>
6172 * archive.cc (Archive::include_member): Adjust call to report_object.
6173 (Add_archive_symbols::run): Add script_info to call to
6174 report_archive_begin.
6175 (Lib_group::include_member): Adjust call to report_object.
6176 (Add_lib_group_symbols::run): Adjust call to report_object.
6177 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6178 blocks. Add object count for script input files.
6179 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6180 script_info parameter; change all callers.
6181 (Incremental_inputs::report_object): Add script_info parameter;
6183 (Incremental_inputs::report_script): Store backpointer to
6184 incremental info entry.
6185 (Output_section_incremental_inputs::set_final_data_size): Record
6186 additional information for scripts.
6187 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6188 * incremental.h (Incremental_script_entry::add_object): New function.
6189 (Incremental_script_entry::get_object_count): New function.
6190 (Incremental_script_entry::get_object): New function.
6191 (Incremental_script_entry::objects_): New data member; adjust
6193 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6194 (Incremental_inputs::report_object): Add script_info parameter.
6195 (Incremental_inputs_reader::get_object_count): New function.
6196 (Incremental_inputs_reader::get_object_offset): New function.
6197 * options.cc (Input_arguments::add_file): Return reference to
6199 * options.h (Input_argument::set_script_info): New function.
6200 (Input_argument::script_info): New function.
6201 (Input_argument::script_info_): New data member; adjust all
6203 (Input_file_group::add_file): Return reference to new input argument.
6204 (Input_file_lib::add_file): Likewise.
6205 (Input_arguments::add_file): Likewise.
6206 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6207 * script.cc (Parser_closure::Parser_closure): Add script_info
6208 parameter; adjust all callers.
6209 (Parser_closure::script_info): New function.
6210 (Parser_closure::script_info_): New data member.
6211 (read_input_script): Report scripts earlier to incremental info.
6212 (script_add_file): Set script_info in Input_argument.
6213 (script_add_library): Likewise.
6214 * script.h (Script_options::Script_info): Rewrite class.
6216 2011-03-29 Cary Coutant <ccoutant@google.com>
6218 * archive.cc (Library_base::should_include_member): Move
6219 method here from class Archive.
6220 (Archive::Archive): Initialize base class.
6221 (Archive::should_include_member): Move to base class.
6222 (Archive::do_for_all_unused_symbols): New function.
6223 (Add_archive_symbols::run): Remove redundant access to
6225 (Lib_group::Lib_group): Initialize base class.
6226 (Lib_group::do_filename): New function.
6227 (Lib_group::include_member): Pass pointer to Lib_group to
6229 (Lib_group::do_for_all_unused_symbols): New function.
6230 (Add_lib_group_symbols::run): Report archive information for
6232 * archive.h (class Library_base): New base class.
6233 (class Archive): Derive from Library_base.
6234 (Archive::filename): Move to base class.
6235 (Archive::set_incremental_info): Likewise.
6236 (Archive::incremental_info): Likewise.
6237 (Archive::Should_include): Likewise.
6238 (Archive::should_include_member): Likewise.
6239 (Archive::Armap_entry): Remove.
6240 (Archive::Unused_symbol_iterator): Remove.
6241 (Archive::unused_symbols_begin): Remove.
6242 (Archive::unused_symbols_end): Remove.
6243 (Archive::do_filename): New function.
6244 (Archive::do_get_mtime): New function.
6245 (Archive::do_for_all_unused_symbols): New function.
6246 (Archive::task_): Move to base class.
6247 (Archive::incremental_info_): Likewise.
6248 (class Lib_group): Derive from Library_base.
6249 (Lib_group::do_filename): New function.
6250 (Lib_group::do_get_mtime): New function.
6251 (Lib_group::do_for_all_unused_symbols): New function.
6252 (Lib_group::task_): Move to base class.
6253 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6255 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6257 * incremental.cc (Incremental_inputs::report_archive_begin):
6258 Use Library_base; call library's get_mtime; add incremental inputs
6259 entry before members.
6260 (class Unused_symbol_visitor): New class.
6261 (Incremental_inputs::report_archive_end): Use Library_base; use
6262 visitor class to record unused symbols; don't add incremental inputs
6263 entry after members.
6264 (Incremental_inputs::report_object): Use Library_base.
6266 (Incremental_archive_entry::Incremental_archive_entry): Remove
6267 unused Archive parameter.
6268 (Incremental_inputs::report_archive_begin): Use Library_base.
6269 (Incremental_inputs::report_archive_end): Likewise.
6270 (Incremental_inputs::report_object): Likewise.
6271 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6273 * object.h (Object::for_all_global_symbols): New function.
6274 (Object::do_for_all_global_symbols): New function.
6275 (Sized_relobj::do_for_all_global_symbols): New function.
6276 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6278 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6281 2011-03-27 Ian Lance Taylor <iant@google.com>
6283 * archive.cc (Archive::interpret_header): Return -1 if something
6284 goes wrong. Change callers accordingly.
6286 2011-03-25 Cary Coutant <ccoutant@google.com>
6288 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6289 * testsuite/Makefile.in: Regenerate.
6291 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6293 * plugin.cc (get_view): New.
6294 (Plugin::load): Pass get_view to the plugin.
6295 (Plugin_manager::get_view): New.
6297 2011-03-21 Ian Lance Taylor <iant@google.com>
6299 * testsuite/final_layout.sh: Rewrite to not use dc.
6300 * testsuite/relro_test.sh: Fail if dc is not present.
6302 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6304 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6306 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6307 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6309 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6310 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6312 2011-03-14 Ian Lance Taylor <iant@google.com>
6314 * script-sections.cc (Sort_output_sections::script_compare):
6315 Rename from is_before, change return type.
6316 (Sort_output_sections::operator()): Adjust accordingly.
6318 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6321 * testsuite/odr_violation2.cc: Add comment to make all error line
6322 numbers double digits.
6323 * testsuite/debug_msg.sh: Adjust expected errors.
6325 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6327 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6328 but mark earlier ones as non-canonical
6329 (offset_to_iterator): Update search target and example
6330 (do_addr2line): Return extra lines in a vector*
6331 (format_file_lineno): Extract from do_addr2line
6332 (one_addr2line): Add vector* out-param
6333 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6334 when a lineno entry appeared last for its instruction
6335 (Dwarf_line_info): Add vector* out-param
6336 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6337 * symtab.cc (Odr_violation_compare): Include the lineno in the
6339 (linenos_from_loc): New. Combine the canonical line for an
6340 address with its other lines.
6341 (True_if_intersect): New. Helper functor to make
6342 std::set_intersection a query.
6343 (detect_odr_violations): Compare sets of lines instead of just
6344 one line for each function. This became less deterministic, but
6345 has fewer false positives.
6346 * symtab.h: Declarations.
6347 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6348 mix an optimized and non-optimized object in the same binary
6349 (odr_violation2.so): Same.
6350 * testsuite/Makefile.in: Regenerate from Makefile.am.
6351 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6352 * testsuite/debug_msg.sh: Update line numbers and add
6354 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6355 non-optimized context.
6356 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6357 isn't inlined, and use OdrDerived in an optimized context.
6358 * testsuite/odr_header1.h: Defines OdrDerived, where
6359 optimization will change the
6360 first-instruction-in-the-destructor's file and line number.
6361 * testsuite/odr_header2.h: Defines OdrBase.
6363 2011-03-09 Ian Lance Taylor <iant@google.com>
6365 * fileread.cc (File_read::clear_views): Don't delete the whole
6368 2011-03-08 Ian Lance Taylor <iant@google.com>
6371 * fileread.cc: #include <climits>.
6372 (GOLD_IOV_MAX): Define.
6373 (File_read::read_multiple): Limit number of entries by iov_max.
6374 * fileread.h (class File_read): Always set max_readv_entries to
6377 2011-03-07 Ian Lance Taylor <iant@google.com>
6380 * options.h (class General_options): Add -dy and -dn.
6382 2011-03-02 Cary Coutant <ccoutant@google.com>
6384 * testsuite/script_test_9.t: Add TLS segment.
6386 2011-03-02 Simon Baldwin <simonb@google.com>
6388 * configure.ac: Add check for gnu_indirect_function support in
6389 the toolchain building binutils.
6390 * configure: Rebuild.
6392 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6394 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6395 plugin only symbols.
6396 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6397 in plugin files as not needed in the symbol table.
6399 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6401 * output.cc (Output_section::add_input_section): Delay fill
6402 generation for section ordering.
6404 2011-02-09 Ian Lance Taylor <iant@google.com>
6407 * object.h (class Sized_relobj): Remove clear_local_symbols.
6408 * reloc.cc (Sized_relobj::do_relocate): Don't call
6409 clear_local_symbols.
6411 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6413 * plugin.cc (is_visible_from_outside): Return true for symbols
6416 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6418 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6421 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6423 * icf.h (is_section_foldable_candidate): Change type of parameter
6425 * icf.cc (Icf::find_identical_sections): Change type of local variable
6426 section_name to be std::string.
6427 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6429 2011-01-25 Ian Lance Taylor <iant@google.com>
6431 * script.cc (script_add_extern): Rewrite to use
6432 add_symbol_reference.
6434 2011-01-25 Doug Kwan <dougkwan@google.com>
6436 * icf.cc (get_section_contents): Always lock section's object.
6438 2011-01-24 Ian Lance Taylor <iant@google.com>
6440 * options.h (class General_options): Accept
6441 --no-detect-odr-violations.
6443 2011-01-24 Ian Lance Taylor <iant@google.com>
6445 * version.cc (version_string): Bump to 1.11.
6447 2011-01-24 Ian Lance Taylor <iant@google.com>
6449 * plugin.cc (class Plugin_rescan): Define new class.
6450 (Plugin_manager::claim_file): Set any_claimed_.
6451 (Plugin_manager::save_archive): New function.
6452 (Plugin_manager::save_input_group): New function.
6453 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6455 (Plugin_manager::new_undefined_symbol): New function.
6456 (Plugin_manager::rescan): New function.
6457 (Plugin_manager::rescannable_defines): New function.
6458 (Plugin_manager::add_input_file): Set any_added_.
6459 * plugin.h (class Plugin_manager): define new fields rescannable_,
6460 undefined_symbols_, any_claimed_, and any_added_. Declare
6461 Plugin_rescan as friend. Declare new functions.
6462 (Plugin_manager::Rescannable): Define type.
6463 (Plugin_manager::Rescannable_list): Define type.
6464 (Plugin_manager::Undefined_symbol_list): Define type.
6465 (Plugin_manager::Plugin_manager): Initialize new fields.
6466 * archive.cc (Archive::defines_symbol): New function.
6467 (Add_archive_symbols::run): Pass archive to plugins if any.
6468 * archive.h (class Archive): Declare defines_symbol.
6469 * readsyms.cc (Input_group::~Input_group): New function.
6470 (Finish_group::run): Pass input_group to plugins if any.
6471 * readsyms.h (class Input_group): Declare destructor.
6472 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6475 2011-01-10 Ian Lance Taylor <iant@google.com>
6477 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6479 (Layout::set_segment_offsets): Reset increase_relro before calling
6480 set_section_addresses a second time.
6482 2011-01-04 Cary Coutant <ccoutant@google.com>
6484 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6485 sections before NOBITS sections.
6487 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6489 * version.cc (print_version): Update copyright to 2011.
6491 2010-12-23 Cary Coutant <ccoutant@google.com>
6493 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6494 of OS to this->add. Add OD parameter to second form of the function.
6496 2010-12-20 Ian Lance Taylor <iant@google.com>
6498 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6499 second of two consecutive entries with same offset.
6501 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6503 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6504 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6505 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6506 to avoid unneeded links against $(LDADD).
6507 * testsuite/Makefile.in: Regenerate.
6509 2010-12-15 Ian Lance Taylor <iant@google.com>
6512 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6513 for R_X86_64_32 and R_X86_64_PC32.
6514 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6515 ver_matching_def_pic.o.
6516 (ver_matching_def_pic.o): New target.
6518 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6520 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6521 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6522 Move definition before File_read::View member definitions.
6523 (File_read::View::~View): Initialize and hold lock before
6524 updating current_mapped_bytes.
6526 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6528 * dwarf_reader.cc: Remove outdated comment.
6529 * gold-threads.cc: Fix typo in error message.
6530 * archive.cc: Fix typos in comments.
6531 * archive.h: Likewise.
6532 * arm-reloc-property.cc: Likewise.
6533 * arm-reloc-property.h: Likewise.
6534 * arm-reloc.def: Likewise.
6536 * attributes.h: Likewise.
6537 * cref.cc: Likewise.
6538 * ehframe.cc: Likewise.
6539 * fileread.h: Likewise.
6541 * i386.cc: Likewise.
6543 * incremental.h: Likewise.
6544 * int_encoding.cc: Likewise.
6545 * layout.h: Likewise.
6546 * main.cc: Likewise.
6547 * merge.h: Likewise.
6548 * object.cc: Likewise.
6549 * object.h: Likewise.
6550 * options.cc: Likewise.
6551 * readsyms.cc: Likewise.
6552 * reduced_debug_output.cc: Likewise.
6553 * reloc.cc: Likewise.
6554 * script-sections.cc: Likewise.
6555 * sparc.cc: Likewise.
6556 * symtab.h: Likewise.
6557 * target-reloc.h: Likewise.
6558 * target.cc: Likewise.
6559 * target.h: Likewise.
6560 * timer.cc: Likewise.
6561 * timer.h: Likewise.
6562 * x86_64.cc: Likewise.
6564 2010-12-09 Cary Coutant <ccoutant@google.com>
6566 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6568 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6569 parameter; change all callers.
6570 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6571 * options.h (warn_execstack): New option.
6573 2010-12-07 Doug Kwan <dougkwan@google.com>
6575 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6576 like function call relocations.
6578 2010-12-07 Ian Lance Taylor <iant@google.com>
6580 * archive.cc (Archive::get_elf_object_for_member): Permit
6581 punconfigured to be NULL.
6582 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6583 (Archive::include_member): Pass NULL to get_elf_object_for_member
6584 if we searched for the archive and this is the first included
6587 2010-12-01 Ian Lance Taylor <iant@google.com>
6589 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6590 track_relocs_type_ field.
6591 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6592 Set track_relocs_type_.
6593 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6594 contents when using RELA relocs.
6595 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6597 * reloc.cc (Track_relocs::next_addend): New function.
6598 * reloc.h (class Track_relocs): Declare next_addend.
6600 2010-12-01 Ian Lance Taylor <iant@google.com>
6602 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6605 2010-12-01 Ian Lance Taylor <iant@google.com>
6607 * README: Update compilers known to work and fail.
6609 2010-11-23 Matthias Klose <doko@ubuntu.com>
6611 * configure.in: For --enable-gold, handle value `default' instead of
6612 `both*'. Always install ld as ld.bfd, install as ld if gold is
6614 * configure: Regenerate.
6616 2010-11-18 Doug Kwan <dougkwan@google.com>
6618 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6619 and right_alignment to be zero. Store result alignment only if it is
6620 greater than existing alignment.
6622 2010-11-16 Cary Coutant <ccoutant@google.com>
6625 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6626 Check for ".zdebug_line".
6628 2010-11-16 Doug Kwan <dougkwan@google.com>
6629 Cary Coutant <ccoutant@google.com>
6631 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6632 by reference; adjust all callers.
6633 * output.cc (Output_segment::set_section_addresses): Adjust references
6634 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6636 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6637 end at page boundary.
6639 2010-11-16 Cary Coutant <ccoutant@google.com>
6642 * layout.cc (Layout::choose_output_section): Transform names of
6643 compressed sections even when using a script with a SECTIONS clause.
6644 (Layout::output_section_name): Remove code to transform
6645 compressed debug section names.
6646 * output.cc (Output_section::add_input_section): Use uncompressed
6647 section size when tracking input sections.
6649 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6651 * symtab.h (Symbol::NON_PIC_REF): Remove.
6652 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6653 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6654 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6655 (Symbol::use_plt_offset): Take a flags argument and pass it
6656 directly to needs_dynamic_reloc. Restrict check for undefined
6657 weak symbols to function calls.
6658 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6659 (Target_arm::Scan::global): Use it.
6660 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6661 (Target_arm::Relocate::relocate): Likewise.
6662 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6663 parameter with an r_type parameter. Use get_reference_flags
6665 (Target_arm::Relocate::relocate): Update accordingly.
6666 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6667 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6668 (Target_i386::Scan::global): Likewise.
6669 (Target_i386::Relocate::relocate): Likewise.
6670 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6671 parameter with an r_type parameter. Use get_reference_flags
6673 (Target_i386::Relocate::relocate): Update accordingly.
6674 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6675 (Target_powerpc::Scan::global): Use it.
6676 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6677 (Target_powerpc::Relocate::relocate): Likewise.
6678 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6679 (Target_sparc::Scan::global): Use it.
6680 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6681 (Target_sparc::Relocate::relocate): Likewise.
6682 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6683 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6684 (Target_x86_64::Scan::global): Likewise.
6685 (Target_x86_64::Relocate::relocate): Likewise.
6687 2010-11-08 Doug Kwan <dougkwan@google.com>
6688 Cary Coutant <ccoutant@google.com>
6690 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6691 (Arm_exidx_merge_section::section_contents_): New data member.
6692 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6693 (Arm_input_section::~Arm_input_section): De-allocate memory.
6694 (Arm_input_section::original_contents_): New data member.
6695 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6696 in parameters instead of calling Object::section_contents without
6698 (Arm_output_section::group_section): New parameter TASK. Pass it
6699 to callees that need locking objects.
6700 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6701 to lock EXIDX input sections. Fix a formatting issue. Call
6702 Arm_exidx_merged_section::build_contents to create merged section
6704 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6705 to lock object of stub table owner.
6706 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6707 TEXT_SIZE to initialize data member TEXT_SIZE_.
6708 (Arm_exidx_input_section::addralign): Fix typo in comment.
6709 (Arm_exidx_input_section::text_size): New method.
6710 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6711 that require locking objects. Lock objects before scanning for stubs
6712 and updating local symbols.
6713 (Arm_input_section<big_endian>::init): Copy contents of original
6715 (Arm_input_section<big_endian>::do_write): Use saved contents of
6716 original input section instead of calling Object::section_contents
6718 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6719 size without calling Object::section_size().
6720 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6721 for size. Allocate a buffer for merged EXIDX entries.
6722 (Arm_exidx_merged_section::build_contents): New method.
6723 (Arm_exidx_merged_section::do_write): Move merge section contents
6724 building code to Arm_exidx_merged_section::build_contetns. Write
6725 out contetns in buffer instead of building it on the fly.
6726 (Arm_relobj::make_exidx_input_section): Also pass text section size
6727 to Arm_exidx_input_section constructor.
6728 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6729 (Arm_dynobj::do_read_symbols): Fix memory leak.
6730 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6731 * target.h: (class Task): Add forward declaration.
6732 (Target::relax): Add new parameter TASK and pass it to
6734 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6736 2010-11-05 Cary Coutant <ccoutant@google.com>
6739 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6740 object when reading from the file.
6741 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6743 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6744 when reading section contents.
6745 (get_section_contents): Likewise.
6746 (icf::find_identical_sections): Likewise.
6747 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6748 object when reading from the file.
6749 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6750 the object when doing deferred section layout.
6752 2010-11-03 Nick Clifton <nickc@redhat.com>
6755 * script.h (class Symbol_assignment: name): New member. Returns
6756 the name of the symbol.
6757 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6758 Returns true if the given symbol name is on the list of
6759 assignments wating to be processed.
6760 * archive.cc (should_incldue_member): If the symbol is undefined,
6761 check to see if it is on the list of symbols pending assignment.
6763 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6765 * script-sections.cc (Script_sections::find_memory_region): Check
6766 for a NULL output section pointer.
6768 2010-10-29 Doug Kwan <dougkwan@google.com>
6770 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6771 Output_section::add_relaxed_input_section.
6772 * output.cc (Output_section::add_relaxed_input_section): Add new
6773 arguments LAYOUT and NAME. Set section order index.
6774 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6775 Copy section order index.
6776 * output.h (Output_section::add_relaxed_input_section): Add new
6777 arguments LAYOUT and NAME.
6779 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6781 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6782 NATIVE_OR_CROSS_LINKER.
6783 * testsuite/Makefile.in: Regenerate.
6785 2010-10-20 Doug Kwan <dougkwan@google.com>
6787 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6788 without SHF_LINK_ORDER flags.
6789 * layout.cc (Layout::choose_output_section): Do not filter
6790 SHF_LINK_ORDER flag in a relocatable link.
6792 2010-10-17 Cary Coutant <ccoutant@google.com>
6794 * output.h (Output_segment::set_section_addresses): Change function
6795 signature. Update all callers.
6796 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6798 (Output_segment::set_section_addresses): Align after last TLS
6799 section. Add padding before last relro section instead of after.
6801 2010-10-17 Doug Kwan <dougkwan@google.com>
6803 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6804 GOT output section to be writable.
6806 2010-10-14 Cary Coutant <ccoutant@google.com>
6808 * debug.h (DEBUG_INCREMENTAL): New flag.
6809 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6810 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6812 * incremental.cc (report_command_line): Ignore all forms of
6814 * layout.cc (Layout::Layout): Check parameters for incremental link
6816 * options.cc (General_options::parse_incremental): New function.
6817 (General_options::parse_no_incremental): New function.
6818 (General_options::parse_incremental_full): New function.
6819 (General_options::parse_incremental_update): New function.
6820 (General_options::incremental_mode_): New data member.
6821 (General_options::finalize): Check incremental_mode_.
6822 * options.h (General_options): Update help text for --incremental.
6823 Add --no-incremental, --incremental-full, --incremental-update.
6824 (General_options::Incremental_mode): New enum type.
6825 (General_options::incremental_mode): New function.
6826 (General_options::incremental_mode_): New data member.
6827 * parameters.cc (Parameters::incremental_mode_): New data member.
6828 (Parameters::set_options): Set incremental_mode_.
6829 (Parameters::set_incremental_full): New function.
6830 (Parameters::incremental): New function.
6831 (Parameters::incremental_update): New function.
6832 (set_parameters_incremental_full): New function.
6833 * parameters.h (Parameters::set_incremental_full): New function.
6834 (Parameters::incremental): New function.
6835 (Parameters::incremental_update): New function.
6836 (Parameters::incremental_mode_): New data member.
6837 (set_parameters_incremental_full): New function.
6838 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6839 incremental link mode.
6840 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6841 (Sized_relobj::do_relocate_sections): Likewise.
6842 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6844 * testsuite/Makefile.in: Regenerate.
6845 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6847 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6849 * script-sections.h (class Script_sections): Make
6850 Sections_elements typedef public.
6851 * script-sections.cc (class Sort_output_sections): Add elements_
6852 field. Add constructor which sets it; change all callers.
6853 (Sort_output_sections::is_before): New function.
6854 (Sort_output_sections::operator()): Call is_before.
6855 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6857 * testsuite/script_test_10.sh: New test. Test script section
6859 * testsuite/script_test_10.t: Likewise.
6860 * testsuite/script_test_10.s: Likewise.
6861 * testsuite/Makefile.am: Wrap the cross linker tests and the
6862 common tests into NATIVE_OR_CROSS_LINKER.
6863 (check_SCRIPTS): Add script_test_10.sh.
6864 (check_DATA): Add script_test_10.stdout.
6865 (script_test_10.o, script_test_10): New targets.
6866 (script_test_10.stdout): New target.
6867 * configure, testsuite/Makefile.in: Regenerate.
6869 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6871 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6872 error for the deprecated relocations.
6873 (Target_arm::Scan::global): Likewise.
6874 (Target_arm::Relocate::relocate): Likewise.
6876 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6878 * fileread.cc (Input_file::find_file): Initialize *found_name
6879 and *namep when using the fallback search for case 4.
6881 2010-10-11 Cary Coutant <ccoutant@google.com>
6883 * options.h (class General_options): Redefine -z lazy as an alias for
6884 the negation of -z now.
6886 2010-10-11 Ian Lance Taylor <iant@google.com>
6888 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6891 2010-10-06 Nick Clifton <nickc@redhat.com>
6893 * script-sections.cc(class Memory_region): Remove
6894 current_lma_offset_ field. Rename current_vma_offset_ to
6895 current_offset_. Add last_section_ field.
6896 (Memory_region::get_current_vma_address): Rename to
6897 get_current_address.
6898 (Memory_region::get_current_lma_address): Delete.
6899 (Memory_region::increment_vma_offset): Rename to
6901 (Memory_region::increment_lma_offset): Delete.
6902 (Memory_region::attributes_compatible): New method. Returns
6903 true if the provided section is compatible with the region.
6904 (Memory_region::get_last_section): New method. Returns the last
6905 section to use the region.
6906 (Memory_region::set_last_section): New method. Stores the last
6907 section to use the region.
6908 (Script_sections::block_in_region): New method. Returns true if
6909 a block of memory is contained within a region.
6910 (Script_sections::find_memory_region): New method. Locates a
6911 memory region to be used to set a VMA or LMA address.
6912 (Output_section_definition::set_section_addresses): Add code to
6913 check for addresses set by memory regions.
6914 (Output_segment::set_section_addresses): Remove memory region
6916 (Script_sections::create_segment): Add a warning if a header
6917 segment is created outside of any region.
6918 * script-sections.h (class Script_sections): Add prototypes for
6919 find_memory_region and block_in_region methods.
6920 * testsuite/memory_test.s: Use .long instead of .word.
6921 * testsuite/memory_test.t: Add some more output sections.
6922 * testsuite/memory_test.sh: Update expected output.
6924 2010-10-02 Doug Kwan <dougkwan@google.com>
6926 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6927 defintion to symtab.h
6928 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6929 declaration to defintion.
6931 2010-10-01 Nick Clifton <nickc@redhat.com>
6933 * expression.cc (eval): Replace dummy argument with NULL.
6934 (eval_maybe_dot): Check for a NULL result section pointer.
6935 (Symbol_expression::value): Likewise.
6936 (Dot_expression::value): Likewise.
6937 (BINARY_EXPRESSION): Likewise.
6938 (Max_expression::value): Likewise.
6939 (Min_expression::value): Likewise.
6940 (Absolute_expression::value): Likewise.
6941 (Addr_expression::value_from_output_section): Likewise.
6942 (Loaddddr_expression::value_from_output_section): Likewise.
6943 (Segment_start_expression::value): Likewise.
6944 * script-sections.cc
6945 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6947 (Sections_elememt_dot_assignment::set_section_addresses):
6949 (Output_data_expression::do_write_to_buffer): Likewise.
6950 (Output_section_definition::finalize_symbols): Likewise.
6951 (Output_section_definition::set_section_addresses): Likewise.
6953 2010-09-30 Doug Kwan <dougkwan@google.com>
6955 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6957 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6959 * target.h (Target::can_icf_inline_merge_sections): New virtual
6961 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6963 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6965 * icf.cc (get_section_contents): Inline merge sections only when
6968 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6970 * configure: Regenerate.
6972 2010-09-17 Ian Lance Taylor <iant@google.com>
6974 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6975 * testsuite/Makefile.am (memory_test.o): New target.
6976 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6978 * testsuite/Makefile.in: Rebuild.
6980 2010-09-17 Doug Kwan <dougkwan@google.com>
6982 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6983 defintion if relocation uses GOT entries of the symbol.
6984 * testsuite/icf_safe_test.sh: Fix test.
6985 * testsuite/icf_safe_so_test.sh: Fix test.
6987 2010-09-16 Cary Coutant <ccoutant@google.com>
6989 * script_sections.cc (class Memory_region): Remove "NULL" from
6990 vector initializations.
6992 2010-09-15 Cary Coutant <ccoutant@google.com>
6994 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6995 Resolve forwarding symbols.
6997 2010-09-15 Doug Kwan <dougkwan@google.com>
6999 * gold/testsuite/script_test_3.t: Add ARM special sections.
7000 * gold/testsuite/script_test_4.t: Same.
7001 * gold/testsuite/script_test_5.t: Same.
7002 * gold/testsuite/script_test_6.t: Same.
7003 * gold/testsuite/script_test_7.t: Same.
7004 * gold/testsuite/script_test_7.t: Same.
7005 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7007 2010-09-14 Cary Coutant <ccoutant@google.com>
7009 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7010 (Target_x86_64::Relocate::relocate_tls): Replace check for
7011 saw_tls_block_reloc_ with test for executable section.
7013 2010-09-12 Cary Coutant <ccoutant@google.com>
7015 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7016 position-independent executables to shared libraries need dynamic
7018 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7019 position-independent executables.
7020 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7021 * testsuite/Makefile.in: Regenerate.
7023 2010-09-10 Nick Clifton <nickc@redhat.com>
7026 * testsuite/memory_test.t: Discard any sections that are not
7029 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7032 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7033 "This::" to work around a bug in gcc 4.2.
7035 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7037 2010-09-09 Rafael Espindola <espindola@google.com>
7039 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7040 sections with different PF_X flags in the same segment.
7041 (Layout::find_first_load_seg): Search all segments to find the first
7043 * options.h (rosegment): New.
7045 2010-09-08 Rafael Espindola <espindola@google.com>
7047 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7049 2010-09-08 Doug Kwan <dougkwan@google.com>
7051 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7052 (Arm_relobj::do_relocate_sections): Add new parameter for output
7053 file to match the parent.
7054 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7055 of local symbols instead of input values. Update code to track
7056 changes in gold::relocate_section.
7057 * object.cc (Sized_relobj::compute_final_local_value): New methods.
7058 (Sized_relobj::compute_final_local_value_internal): New methods.
7059 (Sized_relobj::do_finalize_local_symbols): Move code from loop
7060 body into private version of Sized_relobj::compute_final_local_value.
7061 Call the inline method.
7062 * object.h (Symbol_value::Symbol_value): Define destructor. Free
7063 merged symbol value if there is one.
7064 (Symbol_value::has_output_value): New method defintiion.
7065 (Sized_relobj::Compute_final_local_value_status): New enum type.
7066 (Sized_relobj::compute_final_local_value): New methods.
7067 (Sized_relobj::compute_final_local_value_internal): New methods.
7068 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7069 and arm_cortex_a8.sh.
7070 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7071 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7073 * Makefile.in: Regenerate.
7074 * testsuite/arm_bl_out_of_range.s: Update test.
7075 * testsuite/thumb_bl_out_of_range.s: Ditto.
7076 * testsuite/thumb_blx_out_of_range.s: Ditto.
7077 * testsuite/arm_branch_out_of_range.sh: New file.
7078 * testsuite/arm_cortex_a8.sh: Ditto.
7079 * testsuite/arm_cortex_a8_b.s: Ditto.
7080 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7081 * testsuite/arm_cortex_a8_b_local.s: Ditto.
7082 * testsuite/arm_cortex_a8_bl.s: Ditto.
7083 * testsuite/arm_cortex_a8_blx.s: Ditto.
7084 * testsuite/arm_cortex_a8_local.s: Ditto.
7085 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7086 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7088 2010-09-08 Rafael Espindola <espindola@google.com>
7090 * Makefile.am (memory_test.stdout): Run readelf with -W.
7091 * Makefile.in: Regenerate.
7092 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7095 2010-09-08 Rafael Espindola <espindola@google.com>
7097 * script-sections.cc (Script_sections::add_memory_region): Convert
7098 field precision to int.
7099 * script.cc (script_set_section_region, script_set_section_region):
7100 Convert field precision to int.
7102 2010-09-08 Rafael Espindola <espindola@google.com>
7104 * arm.cc (do_finalize_sections): Create the __exidx_start and
7105 __exdix_end symbols even when the section is missing.
7107 2010-09-08 Nick Clifton <nickc@redhat.com>
7109 * README: Remove claim that MEMORY is not supported.
7110 * expression.cc (script_exp_function_origin)
7111 (script_exp_function_length): Move from here to ...
7112 * script.cc: ... here.
7113 (script_set_section_region, script_add_memory)
7114 (script_parse_memory_attr, script_include_directive): New
7116 * script-sections.cc
7117 (class Memory_region): New class.
7118 (class Output_section_definition): Add set_memory_region,
7119 set_section_vma, set_section_lma and get_section_name methods.
7120 (class Script_Sections): Add add_memory_region,
7121 find_memory_region, find_memory_region_origin,
7122 find_memory_region_length and set_memory_region methods.
7123 Have set_section_addresses method walk the list of set memory
7125 Extend the print methos to display memory regions.
7126 * script-sections.h: Add prototypes for new methods.
7127 Add enum for MEMORY region attributes.
7128 * yyscript.y: Add support for parsing MEMORY regions.
7129 * script-c.h: Add prototypes for new functions.
7130 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7131 * testsuite/Makefile.in: Regenerate.
7132 * testsuite/memory_test.sh: New script.
7133 * testsuite/memory_test.s: New assembler source file.
7134 * testsuite/memory_test.t: New linker script.
7136 2010-08-27 Doug Kwan <dougkwan@google.com>
7138 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7139 reference override an existing dynamic weak reference.
7140 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7141 * testsuite/Makefile.in: Regenerate.
7142 * testsuite/dyn_weak_ref.sh: New file.
7143 * testsuite/dyn_weak_ref_1.c: Ditto.
7144 * testsuite/dyn_weak_ref_2.c: Ditto.
7146 2010-08-27 Ian Lance Taylor <iant@google.com>
7148 * incremental.h (class Incremental_input_entry): Add virtual
7151 2010-08-27 Ian Lance Taylor <iant@google.com>
7153 * testsuite/start_lib_test_3.c: Mark t3 as used.
7155 2010-08-27 Nick Clifton <nickc@redhat.com>
7157 * options.cc (version_script): Fix small typo in previous
7160 2010-08-25 Nick Clifton <nickc@redhat.com>
7162 * archive.cc: Formatting fixes: Remove whitespace between
7163 typename and following asterisk. Remove whitespace between
7164 function name and opening parenthesis.
7165 * archive.h: Likewise.
7167 * attributes.cc: Likewise.
7168 * attributes.h: Likewise.
7169 * common.cc: Likewise.
7170 * copy-relocs.cc: Likewise.
7171 * dirsearch.h: Likewise.
7172 * dynobj.cc: Likewise.
7173 * ehframe.cc: Likewise.
7174 * ehframe.h: Likewise.
7175 * expression.cc: Likewise.
7176 * fileread.cc: Likewise.
7177 * fileread.h: Likewise.
7179 * gold-threads.cc: Likewise.
7180 * gold.cc: Likewise.
7181 * i386.cc: Likewise.
7183 * incremental-dump.cc: Likewise.
7184 * incremental.cc: Likewise.
7185 * layout.cc: Likewise.
7186 * layout.h: Likewise.
7187 * main.cc: Likewise.
7188 * merge.cc: Likewise.
7189 * merge.h: Likewise.
7190 * object.cc: Likewise.
7191 * object.h: Likewise.
7192 * options.cc: Likewise.
7193 * options.h: Likewise.
7194 * output.cc: Likewise.
7195 * output.h: Likewise.
7196 * plugin.cc: Likewise.
7197 * plugin.h: Likewise.
7198 * powerpc.cc: Likewise.
7199 * reloc.cc: Likewise.
7200 * script-c.h: Likewise.
7201 * script-sections.cc: Likewise.
7202 * script.cc: Likewise.
7203 * stringpool.cc: Likewise.
7204 * symtab.cc: Likewise.
7205 * symtab.h: Likewise.
7206 * target.cc: Likewise.
7207 * timer.cc: Likewise.
7208 * timer.h: Likewise.
7209 * version.cc: Likewise.
7210 * x86_64.cc: Likewise.
7212 2010-08-24 Nick Clifton <nickc@redhat.com>
7215 * layout.cc (segment_precedes): Sort segments by their physical
7216 addresses, if they have been set.
7218 2010-08-23 Cary Coutant <ccoutant@google.com>
7220 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7222 (Lib_group::include_member): Unlock object after deleting its
7224 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7227 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7228 Cary Coutant <ccoutant@google.com>
7230 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7231 constructor, and set_blocker.
7232 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7234 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7235 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7236 * testsuite/Makefile.am (start_lib_test): New test case.
7237 * testsuite/Makefile.in: Regenerate.
7238 * testsuite/start_lib_test_main.c: New file.
7239 * testsuite/start_lib_test_1.c: New file.
7240 * testsuite/start_lib_test_2.c: New file.
7241 * testsuite/start_lib_test_3.c: New file.
7243 2010-08-19 Ian Lance Taylor <iant@google.com>
7245 * Makefile.in: Rebuild with automake 1.11.1.
7246 * aclocal.m4: Likewise.
7247 * testsuite/Makefile.in: Likewise.
7249 2010-08-19 Ian Lance Taylor <iant@google.com>
7252 * i386.cc (class Output_data_plt_i386): Update declarations.
7253 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7254 local_ifuncs_ fields.
7255 (Target_i386::do_plt_section_for_global): New function.
7256 (Target_i386::do_plt_section_for_local): New function.
7257 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7258 parameter; change all callers. Initialize global_ifuncs_ and
7259 local_ifuncs_. If doing a static link define __rel_iplt_start and
7261 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7262 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7263 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7265 (Target_i386::make_plt_section): New function, broken out of
7266 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7267 (Target_i386::make_plt_entry): Call make_plt_section.
7268 (Target_i386::make_local_ifunc_plt_entry): New function.
7269 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7270 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7271 R_386_IRELATIVE to switch.
7272 (Target_i386::Scan::global): Likewise.
7273 (Target_i386::Relocate::relocate): Likewise.
7274 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7276 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7277 (Target_x86_64::do_plt_section_for_global): New function.
7278 (Target_x86_64::do_plt_section_for_local): New function.
7279 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7280 parameter; change all callers. If doing a static link define
7281 __rela_iplt_start and __rela_iplt_end.
7282 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7283 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7284 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7286 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7287 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7289 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7290 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7291 R_X86_64_IRELATIVE to switch.
7292 (Target_x86_64::Scan::global): Likewise.
7293 (Target_x86_64::Relocate::relocate): Likewise.
7294 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7296 * target.h (class Target): Add plt_section_for_global and
7297 plt_section_for_local functions. Add do_plt_section_for_global
7298 and do_plt_section_for_local virtual functions.
7299 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7300 clarifying comments.
7301 (Symbol::use_plt_offset): Handle IFUNC symbol.
7302 * object.cc (Sized_relobj::Sized_relobj): Initialize
7304 (Sized_relobj::local_has_plt_offset): New function.
7305 (Sized_relobj::local_plt_offset): New function.
7306 (Sized_relobj::set_local_plt_offset): New function.
7307 (Sized_relobj::do_count): Handle IFUNC symbol.
7308 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7309 a bit away from input_shndx_ field. Add set_is_func_symbol and
7310 is_ifunc_symbol functions.
7311 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7312 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7313 local_plt_offsets_ field.
7314 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7315 * output.h (class Output_section_data): Add non-const
7316 output_section function.
7317 (class Output_data_got): Update declarations.
7318 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7319 Add use_plt_offset parameter to global and local constructors.
7320 Change all callers. Change local_sym_index_ field to 31 bits.
7321 Change GSYM_CODE and CONSTANT_CODE accordingly.
7322 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7323 doing a static link don't set sh_link field.
7324 (Output_data_got::Got_entry::write): Use PLT offset if
7326 (Output_data_got::add_global_plt): New function.
7327 (Output_data_got::add_local_plt): New function.
7328 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7329 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7330 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7331 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7332 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7334 * testsuite/ifunc-sel.h: New file.
7335 * testsuite/ifuncmain1.c: New file.
7336 * testsuite/ifuncmain1vis.c: New file.
7337 * testsuite/ifuncmod1.c: New file.
7338 * testsuite/ifuncdep2.c: New file.
7339 * testsuite/ifuncmain2.c: New file.
7340 * testsuite/ifuncmain3.c: New file.
7341 * testsuite/ifuncmod3.c: New file.
7342 * testsuite/ifuncmain4.c: New file.
7343 * testsuite/ifuncmain5.c: New file.
7344 * testsuite/ifuncmod5.c: New file.
7345 * testsuite/ifuncmain6pie.c: New file.
7346 * testsuite/ifuncmod6.c: New file.
7347 * testsuite/ifuncmain7.c: New file.
7348 * configure, testsuite/Makefile.in: Rebuild.
7350 2010-08-18 Ian Lance Taylor <iant@google.com>
7353 (Output_section_incremental_inputs::write_input_files): Add cast
7354 to avoid signed/unsigned comparison warning.
7355 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7357 2010-08-12 Cary Coutant <ccoutant@google.com>
7359 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7361 2010-08-13 Ian Lance Taylor <iant@google.com>
7363 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7365 2010-08-12 Cary Coutant <ccoutant@google.com>
7366 Doug Kwan <dougkwan@google.com>
7368 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7369 defintion overrides non-weak undef, remember that the original undef
7371 * symtab.cc (Symbol_table::sized_write_global): For undef without
7372 an original weak binding, set binding to global in output.
7373 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7374 * testsuite/Makefile.in: Regenerate.
7375 * testsuite/strong_ref_weak_def.sh: New file.
7376 * testsuite/strong_ref_weak_def_1.c: Ditto.
7377 * testsuite/strong_ref_weak_def_2.c: Ditto.
7379 2010-08-12 Cary Coutant <ccoutant@google.com>
7381 * testsuite/incremental_test.sh: Rewrite.
7382 * testsuite/incremental_test_1.c: Rewrite.
7383 * testsuite/incremental_test_2.c: Rewrite.
7385 2010-08-12 Cary Coutant <ccoutant@google.com>
7387 * arm.cc (Target_arm::got_size): Add const.
7388 (Target_arm::got_entry_count): New function.
7389 (Target_arm::plt_entry_count): New function.
7390 (Target_arm::first_plt_entry_offset): New function.
7391 (Target_arm::plt_entry_size): New function.
7392 (Output_data_plt_arm::entry_count): New function.
7393 (Output_data_plt_arm::first_plt_entry_offset): New function.
7394 (Output_data_plt_arm::get_plt_entry_size): New function.
7395 * i386.cc (Target_i386::got_size): Add const.
7396 (Target_i386::got_entry_count): New function.
7397 (Target_i386::plt_entry_count): New function.
7398 (Target_i386::first_plt_entry_offset): New function.
7399 (Target_i386::plt_entry_size): New function.
7400 (Output_data_plt_i386::entry_count): New function.
7401 (Output_data_plt_i386::first_plt_entry_offset): New function.
7402 (Output_data_plt_i386::get_plt_entry_size): New function.
7403 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7404 find_incremental_inputs_sections. Dump incremental_got_plt section.
7405 * incremental.cc: Include target.h.
7406 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7407 parameter. Adjust all callers. Find incremental_got_plt section.
7408 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7410 (Output_section_incremental_inputs::set_final_data_size): Calculate
7411 size of incremental_got_plt section.
7412 (Output_section_incremental_inputs::do_write): Write the
7413 incremental_got_plt section.
7414 (Got_plt_view_info): New struct.
7415 (Local_got_offset_visitor): New class.
7416 (Global_got_offset_visitor): New class.
7417 (Global_symbol_visitor_got_plt): New class.
7418 (Output_section_incremental_inputs::write_got_plt): New function.
7419 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7420 Add parameter. Adjust all callers.
7421 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7422 (Incremental_inputs::got_plt_section): New function.
7423 (Incremental_inputs::got_plt_section_): New data member.
7424 (Incremental_got_plt_reader): New class.
7425 * layout.cc (Layout::create_incremental_info_sections): Add the
7426 incremental_got_plt section.
7427 * object.h (Got_offset_list::get_list): New function.
7428 (Got offset_list::for_all_got_offsets): New function.
7429 (Sized_relobj::local_got_offset_list): New function.
7430 * powerpc.cc (Target_powerpc::got_size): Add const.
7431 (Target_powerpc::got_entry_count): New function.
7432 (Target_powerpc::plt_entry_count): New function.
7433 (Target_powerpc::first_plt_entry_offset): New function.
7434 (Target_powerpc::plt_entry_size): New function.
7435 (Output_data_plt_powerpc::entry_count): New function.
7436 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7437 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7438 * sparc.cc (Target_sparc::got_size): Add const.
7439 (Target_sparc::got_entry_count): New function.
7440 (Target_sparc::plt_entry_count): New function.
7441 (Target_sparc::first_plt_entry_offset): New function.
7442 (Target_sparc::plt_entry_size): New function.
7443 (Output_data_plt_sparc::entry_count): New function.
7444 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7445 (Output_data_plt_sparc::get_plt_entry_size): New function.
7446 * symtab.h (Symbol::got_offset_list): New function.
7447 (Symbol_table::for_all_symbols): New function.
7448 * target.h (Sized_target::got_entry_count): New function.
7449 (Sized_target::plt_entry_count): New function.
7450 (Sized_target::plt_entry_size): New function.
7451 * x86_64.cc (Target_x86_64::got_size): Add const.
7452 (Target_x86_64::got_entry_count): New function.
7453 (Target_x86_64::plt_entry_count): New function.
7454 (Target_x86_64::first_plt_entry_offset): New function.
7455 (Target_x86_64::plt_entry_size): New function.
7456 (Output_data_plt_x86_64::entry_count): New function.
7457 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7458 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7460 2010-08-12 Cary Coutant <ccoutant@google.com>
7462 * archive.cc: Include incremental.h.
7463 (Archive::Archive): Initialize incremental_info_.
7464 (Archive::include_member): Record archive members in incremental info.
7465 (Add_archive_symbols::run): Record begin and end of an archive in
7467 (Lib_group::include_member): Record objects in incremental info.
7468 * archive.h (Incremental_archive_entry): Forward declaration.
7469 (Archive::set_incremental_info): New member function.
7470 (Archive::incremental_info): New member function.
7471 (Archive::Unused_symbol_iterator): New class.
7472 (Archive::unused_symbols_begin): New member function.
7473 (Archive::unused_symbols_end): New member function.
7474 (Archive::incremental_info_): New data member.
7475 * incremental-dump.cc (find_input_containing_global): New function.
7476 (dump_incremental_inputs): Dump new incremental info sections.
7477 * incremental.cc: Include symtab.h.
7478 (Output_section_incremental_inputs): New class.
7479 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7480 new incremental info sections.
7481 (Sized_incremental_binary::do_check_inputs): Likewise.
7482 (Incremental_inputs::report_archive): Remove.
7483 (Incremental_inputs::report_archive_begin): New function.
7484 (Incremental_inputs::report_archive_end): New function.
7485 (Incremental_inputs::report_object): New function.
7486 (Incremental_inputs::finalize_inputs): Remove.
7487 (Incremental_inputs::report_input_section): New function.
7488 (Incremental_inputs::report_script): Rewrite.
7489 (Incremental_inputs::finalize): Do nothing but finalize string table.
7490 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7491 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7492 (Incremental_inputs::create_data_sections): New function.
7493 (Incremental_inputs::relocs_entsize): New function.
7494 (Output_section_incremental_inputs::set_final_data_size): New function.
7495 (Output_section_incremental_inputs::do_write): New function.
7496 (Output_section_incremental_inputs::write_header): New function.
7497 (Output_section_incremental_inputs::write_input_files): New function.
7498 (Output_section_incremental_inputs::write_info_blocks): New function.
7499 (Output_section_incremental_inputs::write_symtab): New function.
7500 * incremental.h (Incremental_script_entry): Forward declaration.
7501 (Incremental_object_entry): Forward declaration.
7502 (Incremental_archive_entry): Forward declaration.
7503 (Incremental_inputs): Forward declaration.
7504 (Incremental_inputs_header_data): Remove.
7505 (Incremental_inputs_header): Remove.
7506 (Incremental_inputs_header_write): Remove.
7507 (Incremental_inputs_entry_data): Remove.
7508 (Incremental_inputs_entry): Remove.
7509 (Incremental_inputs_entry_write): Remove.
7510 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7511 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7512 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7513 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7515 (Incremental_input_entry): New class.
7516 (Incremental_script_entry): New class.
7517 (Incremental_object_entry): New class.
7518 (Incremental_archive_entry): New class.
7519 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7520 (Incremental_inputs::report_inputs): Remove.
7521 (Incremental_inputs::report_archive): Remove.
7522 (Incremental_inputs::report_archive_begin): New function.
7523 (Incremental_inputs::report_archive_end): New function.
7524 (Incremental_inputs::report_object): Change prototype.
7525 (Incremental_inputs::report_input_section): New function.
7526 (Incremental_inputs::report_script): Change prototype.
7527 (Incremental_inputs::get_reloc_count): New function.
7528 (Incremental_inputs::set_reloc_count): New function.
7529 (Incremental_inputs::create_data_sections): New function.
7530 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7531 (Incremental_inputs::inputs_section): New function.
7532 (Incremental_inputs::symtab_section): New function.
7533 (Incremental_inputs::relocs_section): New function.
7534 (Incremental_inputs::get_stringpool): Add const.
7535 (Incremental_inputs::command_line): Add const.
7536 (Incremental_inputs::inputs): Remove.
7537 (Incremental_inputs::command_line_key): New function.
7538 (Incremental_inputs::input_file_count): New function.
7539 (Incremental_inputs::input_files): New function.
7540 (Incremental_inputs::relocs_entsize): New function.
7541 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7542 (Incremental_inputs::finalize_inputs): Remove.
7543 (Incremental_inputs::Input_info): Remove.
7544 (Incremental_inputs::lock_): Remove.
7545 (Incremental_inputs::inputs_): Change type.
7546 (Incremental_inputs::inputs_map_): Remove.
7547 (Incremental_inputs::current_object_entry_): New data member.
7548 (Incremental_inputs::inputs_section_): New data member.
7549 (Incremental_inputs::symtab_section_): New data member.
7550 (Incremental_inputs::relocs_section_): New data member.
7551 (Incremental_inputs::reloc_count_): New data member.
7552 (Incremental_inputs_reader): New class.
7553 (Incremental_symtab_reader): New class.
7554 (Incremental_relocs_reader): New class.
7555 * layout.cc (Layout::finalize): Move finalization of incremental info
7556 and creation of incremental info sections to follow finalization of
7557 symbol table. Set offsets for postprocessing sections.
7558 (Layout::create_incremental_info_sections): Call
7559 Incremental_inputs::create_data_sections. Add incremental symtab
7560 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7561 sections to layout after input sections.
7562 * layout.h (struct Timespec): Forward declaration.
7563 (Layout::incremental_inputs): Add const.
7564 (Layout::create_incremental_info_sections): Add parameter.
7565 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7566 * object.cc: Include incremental.h.
7567 (Relobj::finalize_incremental_relocs): New function.
7568 (Sized_relobj::do_layout): Record input sections in incremental info.
7569 * object.h (Object::output_section): New function.
7570 (Object::output_section_offset): Moved from Relobj.
7571 (Object::get_incremental_reloc_base): New function.
7572 (Object::get_incremental_reloc_count): New function.
7573 (Object::do_output_section): New function.
7574 (Object::do_output_section_offset): Moved from Relobj.
7575 (Object::do_get_incremental_reloc_base): New function.
7576 (Object::do_get_incremental_reloc_count): New function.
7577 (Object::Object): Initialize new data members.
7578 (Relobj::output_section): Renamed do_output_section and moved to
7580 (Relobj::output_section_offset): Moved to Object.
7581 (Relobj::do_get_incremental_reloc_base): New function.
7582 (Relobj::do_get_incremental_reloc_count): New function.
7583 (Relobj::allocate_incremental_reloc_counts): New function.
7584 (Relobj::count_incremental_reloc): New function.
7585 (Relobj::finalize_incremental_relocs): New function.
7586 (Relobj::next_incremental_reloc_index): New function.
7587 (Relobj::reloc_counts_): New data member.
7588 (Relobj::reloc_bases_): New data member.
7589 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7590 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7591 (Sized_relobj::incremental_relocs_scan): New function.
7592 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7593 (Sized_relobj::incremental_relocs_write): New function.
7594 (Sized_relobj::incremental_relocs_write_reltype): New function.
7595 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7597 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7598 archives and object files elsewhere.
7599 (Add_symbols::run): Report object files here.
7600 (Finish_group::run): Report end of archive at end of group.
7601 * reloc.cc: Include layout.h, incremental.h.
7602 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7603 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7604 (Sized_relobj::incremental_relocs_scan): New function.
7605 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7606 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7607 (Sized_relobj::incremental_relocs_write): New function.
7608 (Sized_relobj::incremental_relocs_write_reltype): New function.
7609 * script.cc (read_input_script): Rewrite test for incremental link.
7610 Change call to Incremental_inputs::report_script.
7611 * symtab.h (Symbol_table::first_global_index): New function.
7612 (Symbol_table::output_count): New function.
7614 2010-08-12 Doug Kwan <dougkwan@google.com>
7616 * arm.cc (Target_arm::merge_object_attributes): Check command line
7617 options --no-wchar-size-warning and --no-enum-size-warning.
7618 * options.h (General_options): Add ld-compatible options
7619 --no-enum-size-warning and --no-wchar-size-warning.
7621 2010-08-04 Ian Lance Taylor <iant@google.com>
7623 * x86_64.cc (Target_x86_64::Scan::local): Use
7624 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7625 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7626 (Target_x86_64::Scan::global): Likewise.
7627 (Target_x86_64::Relocate::relocate): Likewise.
7628 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7631 2010-08-03 Cary Coutant <ccoutant@google.com>
7633 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7634 to reserve space in merged_strings vector. Keep total input size
7636 (Output_merge_string::do_print_merge_stats): Print total input size.
7637 * merge.h (Output_merge_string): Add input_size_ field.
7638 * stringpool.cc (Stringpool_template::string_length): Move
7639 implementations out of Stringpool_template class and place in
7641 * stringpool.h (string_length): Move out of Stringpool_template.
7643 2010-08-03 Ian Lance Taylor <iant@google.com>
7646 * layout.cc (relaxation_loop_body): If address of load segment is
7647 set, adjust address to include headers if possible.
7649 2010-08-03 Ian Lance Taylor <iant@google.com>
7651 * version.cc (version_string): Bump to 1.10.
7653 2010-08-03 Ian Lance Taylor <iant@google.com>
7656 * layout.h (enum Output_section_order): Define.
7657 (class Layout): Update declarations.
7658 * layout.cc (Layout::get_output_section): Add order parameter.
7659 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7660 is_first_non_relro parameters. Change all callers.
7661 (Layout::choose_output_section): Likewise.
7662 (Layout::add_output_section_data): Likewise.
7663 (Layout::make_output_section): Likewise. Set order.
7664 (Layout::default_section_order): New function.
7665 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7666 * output.cc (Output_section::Output_section): Initialize order_.
7667 Don't initialize deleted fields.
7668 (Output_segment::Output_segment): Don't initialize deleted
7670 (Output_segment::add_output_section_to_load): New function
7671 replacing add_output_section. Change all callers to call this or
7672 add_output_section_to_nonload.
7673 (Output_segment::add_output_section_to_nonload): New function.
7674 (Output_segment::remove_output_section): Rewrite.
7675 (Output_segment::add_initial_output_data): Likewise.
7676 (Output_segment::has_any_data_sections): Likewise.
7677 (Output_segment::is_first_section_relro): Likewise.
7678 (Output_segment::maximum_alignment): Likewise.
7679 (Output_segment::has_dynamic_reloc): New function replacing
7680 dynamic_reloc_count. Change all callers.
7681 (Output_segment::has_dynamic_reloc_list): New function replacing
7682 dynamic_reloc_count_list. Change all callers.
7683 (Output_segment::set_section_addresses): Rewrite.
7684 (Output_segment::set_offset): Rewrite.
7685 (Output_segment::find_first_and_last_list): Remove.
7686 (Output_segment::set_tls_offsets): Rewrite.
7687 (Output_segment::first_section_load_address): Likewise.
7688 (Output_segment::output_section_count): Likewise.
7689 (Output_segment::section_with_lowest_load_address): Likewise.
7690 (Output_segment::write_section_headers): Likewise.
7691 (Output_segment::print_sections_to_map): Likewise.
7692 * output.h (class Output_data): Remove dynamic_reloc_count_
7693 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7694 (Output_data::add_dynamic_reloc): Rewrite.
7695 (Output_data::has_dynamic_reloc): New function.
7696 (Output_data::dynamic_reloc_count): Remove.
7697 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7698 is_last_relro_, is_first_non_relro_, is_interp_,
7699 is_dynamic_linker_section_ fields. Add order and set_order
7700 functions. Remove is_relro_local, set_is_relro_local,
7701 is_last_relro, set_is_last_relro, is_first_non_relro,
7702 set_is_first_non_relro functions, is_interp, set_is_interp,
7703 is_dynamic_linker_section, and set_is_dynamic_linker_section
7705 (class Output_segment): Change Output_data_list from std::list to
7706 std:;vector. Add output_lists_ field. Remove output_data_ and
7707 output_bss_ fields. Update declarations.
7709 2010-08-02 Ian Lance Taylor <iant@google.com>
7711 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7712 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7713 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7715 2010-08-02 Ian Lance Taylor <iant@google.com>
7718 * script.cc (Script_options::Script_options): Initialize
7719 symbol_definitions_ and symbol_references_.
7720 (Script_options::add_symbol_assignment): Update
7721 symbol_definitions_ and symbol_references_.
7722 (Script_options::add_symbol_reference): New function.
7723 (script_symbol): New function.
7724 * script.h (class Script_options): Add symbol_definitions_ and
7725 symbol_references_ fields.
7726 (Script_options::referenced_const_iterator): New type.
7727 (Script_options::referenced_begin): New function.
7728 (Script_options::referenced_end): New function.
7729 (Script_options::is_referenced): New function.
7730 (Script_options::any_unreferenced): New function.
7731 * script-c.h (script_symbol): Declare.
7732 * yyscript.y (exp): Call script_symbol.
7733 * symtab.cc: Include "script.h".
7734 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7735 Change all callers. Check symbols referenced by scripts.
7736 (Symbol_table::add_undefined_symbols_from_command_line): Add
7737 layout parameter. Change all callers.
7738 (Symbol_table::do_add_undefined_symbols_from_command_line):
7739 Likewise. Break out loop body. Check symbols referenced by
7741 (Symbol_table::add_undefined_symbol_from_command_line): New
7742 function broken out of
7743 do_add_undefined_symbols_from_command_line.
7744 * symtab.h (class Symbol_table): Update declarations.
7745 * archive.cc: Include "layout.h".
7746 (Archive::should_include_member): Add layout parameter. Change
7747 all callers. Check for symbol mentioned in expression.
7748 * archive.h (class Archive): Update declaration.
7749 * object.cc (Sized_relobj::do_should_include_member): Add layout
7751 * object.h (Object::should_include_member): Add layout parameter.
7753 (Object::do_should_include_member): Add layout parameter.
7754 (class Sized_relobj): Update declaration.
7755 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7757 * dynobj.h (class Sized_dynobj): Update declaration.
7758 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7760 * plugin.h (class Sized_pluginobj): Update declaration.
7762 2010-08-02 Ian Lance Taylor <iant@google.com>
7765 * output.cc (Output_segment::set_offset): Search for the first and
7766 last sections rather than assuming that the list is in order.
7767 (Output_segment::find_first_and_last_list): New function.
7768 * output.h (class Output_segment): Update declarations.
7769 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7770 (relro_strip_test_SOURCES): New variable.
7771 (relro_strip_test_DEPENDENCIES): New variable.
7772 (relro_strip_test_LDFLAGS): New variable.
7773 (relro_strip_test_LDADD): New variable.
7774 (relro_strip_test.so): New target.
7776 2010-08-02 Ian Lance Taylor <iant@google.com>
7778 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7779 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7780 (Target_i386::got_tlsdesc_section): New function.
7781 (Target_i386::got_section): Create space for GOT entries for
7782 TLSDESC relocations.
7783 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7785 (Target_i386::Scan::global): Likewise.
7786 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7788 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7789 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7790 (Target_x86_64::got_tlsdesc_section): New function.
7791 (Target_x86_64::got_section): Create space for GOT entries for
7792 TLSDESC relocations.
7793 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7795 (Target_x86_64::Scan::global): Likewise.
7796 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7799 2010-08-02 Ian Lance Taylor <iant@google.com>
7801 * testsuite/final_layout.sh: Use dc to convert from hex to
7804 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7806 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7807 paramter to the call to gold::gc_process_relocs.
7808 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7809 paramter to the call to gold::gc_process_relocs.
7810 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7811 parameter to the call to gold::gc_process_relocs.
7812 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7813 template parameter to the call to gold::gc_process_relocs.
7814 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7815 paramter to the call to gold::gc_process_relocs.
7816 * gc.h (get_embedded_addend_size): New function.
7817 (gc_process_relocs): Save the size of the reloc for use by ICF.
7818 * icf.cc (get_section_contents): Get the addend from the text section
7819 for SHT_REL relocation sections.
7820 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7821 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7822 * int_encoding.h (read_from_pointer): New overloaded function.
7823 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7824 * testsuite/icf_sht_rel_addend_test.sh: New file.
7825 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7826 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7828 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7830 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7831 * Makefile.in: Regenerate.
7832 * testsuite/Makefile.in: Regenerate.
7834 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7836 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7837 * gold/testsuite/debug_msg.cc: Likewise.
7838 * gold/testsuite/odr_violation1.cc
7839 * gold/testsuite/odr_violation2.cc
7841 2010-07-21 Cary Coutant <ccoutant@google.com>
7843 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7844 string, and length fields.
7845 (Output_merge_string::Merged_strings_list): New type.
7846 (Output_merge_string::Merged_strings_lists): New typedef.
7847 (Output_merge_string): Replace merged_strings_ with
7848 merged_strings_lists_.
7849 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7850 Merged_strings_list per input object and section. Don't store pointer
7851 to the string. Don't store length with each merged string entry.
7852 (Output_merge_string::finalize_merged_data): Loop over list of merged
7853 strings lists. Recompute length of each merged string.
7855 2010-07-15 Cary Coutant <ccoutant@google.com>
7857 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7860 2010-07-14 Ian Lance Taylor <iant@google.com>
7862 * descriptors.cc (Descriptors::open): Report correct name in error
7865 2010-07-13 Doug Kwan <dougkwan@google.com>
7867 * arm.cc (Arm_input_section::Arm_input_section): For a
7868 SHT_ARM_EXIDX section, always keeps the input sections.
7869 (Arm_input_section::set_exidx_section_link): New method.
7870 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7871 has_errors_ to false.
7872 (Arm_exidx_input_section::has_errors,
7873 Arm_exidx_input_section::set_has_errors): New methods.
7874 (Arm_exidx_input_section::has_errors_): New data member.
7875 (Arm_relobj::get_exidx_shndx_list): New method.
7876 (Arm_output_section::append_text_sections_to_list): Do not skip
7877 section without SHF_EXECINSTR.
7878 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7880 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7881 section header. Make error messages more verbose. Check for
7882 a non-executable section linked to an EXIDX section.
7883 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7884 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7885 check that there is no deferred EXIDX section if we exit early.
7886 Instead of not making an EXIDX section in case of an error, make one
7887 and set the has_errors flag of it.
7888 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7889 in a relocatable link.
7890 (Target_arm::do_relax): Look for the EXIDX output section instead of
7891 assuming that it is called .ARM.exidx.
7892 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7893 section list. Do not check for SHF_EXECINSTR section flags but
7894 skip any input section with errors.
7895 * output.cc (Output_section::Output_section): Initialize
7896 always_keeps_input_sections_ to false.
7897 (Output_section::add_input_section): Check for
7898 always_keeps_input_sections_.
7899 * output.h (Output_section::always_keeps_input_sections,
7900 Output_section::set_always_keeps_input_sections): New methods.
7901 (Output_section::always_keeps_input_sections): New data member.
7903 2010-07-13 Rafael Espindola <espindola@google.com>
7905 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7906 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7908 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7909 Ian Lance Taylor <iant@google.com>
7911 * output.h (Output_section_lookup_maps::add_merge_section):
7912 Correct check of whether value was inserted.
7913 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7914 (Output_section_lookup_maps::add_relaxed_input_section):
7916 * arm.cc (Target_arm::got_section): Remove used local os.
7917 * i386.cc (Target_i386::got_section): Likewise.
7918 * x86_64.cc (Target_x86_64::got_section): Likewise.
7919 * sparc.cc (Target_sparc::got_section): Likewise.
7920 (Target_sparc::relocate): Remove unused local have_got_offset.
7921 * powerpc.cc (Target_powerpc::relocate): Likewise.
7923 2010-07-13 Ian Lance Taylor <iant@google.com>
7925 * compressed_output.cc (zlib_decompress): Fix signature in
7928 * archive.cc (Archive::include_member): Unlock an external member
7929 of a thin archive. Don't bother to delete an object we know is
7932 2010-07-12 Cary Coutant <ccoutant@google.com>
7934 * compressed_output.cc (zlib_decompress): New function.
7935 (get_uncompressed_size): New function.
7936 (decompress_input_section): New function.
7937 * compressed_output.h (get_uncompressed_size): New function.
7938 (decompress_input_section): New function.
7939 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7940 Handle compressed debug sections.
7941 * layout.cc (is_compressed_debug_section): New function.
7942 (Layout::output_section_name): Map compressed section names to
7944 * layout.h (is_compressed_debug_section): New function.
7945 (is_debug_info_section): Recognize compressed debug sections.
7946 * merge.cc: Include compressed_output.h.
7947 (Output_merge_data::do_add_input_section): Handle compressed
7949 (Output_merge_string::do_add_input_section): Handle compressed
7951 * object.cc: Include compressed_output.h.
7952 (Sized_relobj::Sized_relobj): Initialize new data members.
7953 (build_compressed_section_map): New function.
7954 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7955 * object.h (Object::section_is_compressed): New method.
7956 (Object::do_section_is_compressed): New method.
7957 (Sized_relobj::Compressed_section_map): New type.
7958 (Sized_relobj::do_section_is_compressed): New method.
7959 (Sized_relobj::compressed_sections_): New data member.
7960 * output.cc (Output_section::add_input_section): Handle compressed
7962 * reloc.cc: Include compressed_output.h.
7963 (Sized_relobj::write_sections): Handle compressed debug sections.
7965 2010-07-08 Cary Coutant <ccoutant@google.com>
7967 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7968 weak when resolving to a dynamic def.
7969 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7970 for weak undef/dynamic def cases. Adjust callers.
7971 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7972 undef_binding_weak_.
7973 (Symbol_table::sized_write_globals): Adjust symbol binding.
7974 (Symbol_table::sized_write_symbol): Add binding parameter.
7975 * symtab.h (Symbol::set_undef_binding): New method.
7976 (Symbol::is_undef_binding_weak): New method.
7977 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7978 (Symbol_table::should_override): Add new parameter.
7979 (Symbol_table::sized_write_symbol): Add new parameter.
7981 * testsuite/weak_undef_file1.cc: Add new test case.
7982 * testsuite/weak_undef_file2.cc: Fix header comment.
7983 * testsuite/weak_undef_test.cc: Add new test case.
7985 2010-06-29 Doug Kwan <dougkwan@google.com>
7987 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7988 Initialize USE_SYMBOL_.
7989 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7991 (Arm_reloc_property::uses_symbol_): New data member declaration.
7992 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7993 uses symbol value and symbol is undefined but not weakly undefined.
7995 2010-06-28 Rafael Espindola <espindola@google.com>
7997 * plugin.cc (Plugin::load): Use dlerror.
7999 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8001 * symtab.cc (detect_odr_violations): When reporting an ODR
8002 violation, report an object where the symbol is defined.
8004 2010-06-25 Doug Kwan <dougkwan@google.com>
8006 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8007 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8009 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8010 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8011 target hook to detect function points.
8012 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8013 * icf.h (Icf::check_section_for_function_pointers): Change type of
8014 parameter SECTION_NAME to const reference to std::string. Use
8015 target hook to determine if section may have unsafe pointers.
8016 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8019 2010-06-21 Rafael Espindola <espindola@google.com>
8021 * fileread.cc (Input_file::find_fie): New
8022 (Input_file::open): Use Input_file::find_fie.
8023 * fileread.h (Input_file::find_fie): New
8024 * plugin.cc (set_extra_library_path): New.
8025 (Plugin::load): Add set_extra_library_path to the transfer vector.
8026 (Plugin_manager::set_extra_library_path): New.
8027 (Plugin_manager::add_input_file): Use the extra search path if set.
8028 (set_extra_library_path(): New.
8029 * plugin.h (Plugin_manager): Add set_extra_library_path and
8032 2010-06-19 Cary Coutant <ccoutant@google.com>
8034 * layout.cc (gdb_sections): Add .debug_types.
8035 (lines_only_debug_sections): Likewise.
8037 2010-06-18 Rafael Espindola <espindola@google.com>
8039 * plugin.cc (add_input_file,add_input_library)
8040 (Plugin_manager::add_input_file): Make filename arguments const.
8041 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8044 2010-06-16 Doug Kwan <dougkwan@google.com>
8046 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8047 .ARM.attributes section if we have not merged any input
8048 attributes sections.
8050 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8052 * arm.cc: Allow combining objects with no EABI version
8055 2010-06-15 Rafael Espindola <espindola@google.com>
8057 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8059 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8061 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8062 (struct iovec): Correct !HAVE_READV definition.
8064 2010-06-10 Cary Coutant <ccoutant@google.com>
8066 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8067 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8069 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8072 * symtab.h (Symbol::is_placeholder): New member function.
8073 * target-reloc.h (relocate_section): Check for placeholder symbols.
8075 * testsuite/Makefile.am (plugin_test_8): New test.
8076 (plugin_test_9): New test.
8077 * testsuite/Makefile.in: Regenerate.
8079 2010-06-09 Nick Clifton <nickc@redhat.com>
8081 * yyscript.y (input_list_element): Allow strings prefixed with
8082 the '-' character. Treat these as libraries.
8083 * script.cc (script_add_library): New function. Adds a library
8084 specified by "-l<name>" found in an input script.
8085 * script-c.h: Add prototype for script_add_library.
8087 2010-06-07 Doug Kwan <dougkwan@google.com>
8089 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8090 Restrict stub-group size to be within long conditional branch
8091 range when working around cortex-A8 erratum.
8093 2010-06-07 Damien Diederen <dd@crosstwine.com>
8095 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8098 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8102 (Output_section::Input_section_sort_entry::compare_section_ordering):
8103 Change to return non-zero correctly.
8104 (Output_section::Input_section_sort_section_order_index_compare
8105 ::operator()): Change to fix ambiguity in comparisons.
8107 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8109 * gold.h (is_wildcard_string): New function.
8110 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8111 (Layout::layout_eh_frame): Ditto.
8112 (Layout::find_section_order_index): New method.
8113 (Layout::read_layout_from_file): New method.
8114 * layout.h (Layout::find_section_order_index): New method.
8115 (Layout::read_layout_from_file): New method.
8116 (Layout::input_section_position_): New private member.
8117 (Layout::input_section_glob_): New private member.
8118 * main.cc (main): Call read_layout_from_file here.
8119 * options.h (--section-ordering-file): New option.
8120 * output.cc (Output_section::input_section_order_specified_): New
8122 (Output_section::Output_section): Initialize new member.
8123 (Output_section::add_input_section): Add new parameter.
8124 Keep input sections when --section-ordering-file is used.
8125 (Output_section::set_final_data_size): Sort input sections when
8126 section ordering file is specified.
8127 (Output_section::Input_section_sort_entry): Add new parameter.
8129 (Output_section::Input_section_sort_entry::compare_section_ordering):
8131 (Output_section::Input_section_sort_compare::operator()): Change to
8132 consider section_order_index.
8133 (Output_section::Input_section_sort_init_fini_compare::operator()):
8134 Change to consider section_order_index.
8135 (Output_section::Input_section_sort_section_order_index_compare
8136 ::operator()): New method.
8137 (Output_section::sort_attached_input_sections): Change to sort
8138 according to section order when specified.
8139 (Output_section::add_input_section<32, true>): Add new parameter.
8140 (Output_section::add_input_section<64, true>): Add new parameter.
8141 (Output_section::add_input_section<32, false>): Add new parameter.
8142 (Output_section::add_input_section<64, false>): Add new parameter.
8143 * output.h (Output_section::add_input_section): Add new parameter.
8144 (Output_section::input_section_order_specified): New
8146 (Output_section::set_input_section_order_specified): New method.
8147 (Input_section::Input_section): Initialize section_order_index_.
8148 (Input_section::section_order_index): New method.
8149 (Input_section::set_section_order_index): New method.
8150 (Input_section::section_order_index_): New member.
8151 (Input_section::Input_section_sort_section_order_index_compare): New
8153 (Output_section::input_section_order_specified_): New member.
8154 * script-sections.cc (is_wildcard_string): Delete and move modified
8156 (Output_section_element_input::Output_section_element_input): Modify
8157 call to is_wildcard_string.
8158 (Output_section_element_input::Input_section_pattern
8159 ::Input_section_pattern): Ditto.
8160 (Output_section_element_input::Output_section_element_input): Ditto.
8161 * testsuite/Makefile.am (final_layout): New test case.
8162 * testsuite/Makefile.in: Regenerate.
8163 * testsuite/final_layout.cc: New file.
8164 * testsuite/final_layout.sh: New file.
8166 2010-06-01 Rafael Espindola <espindola@google.com>
8168 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8170 2010-06-01 Rafael Espindola <espindola@google.com>
8172 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8173 visibility of symbols.
8175 2010-05-27 Doug Kwan <dougkwan@google.com>
8177 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8178 from start of output section instead of address for a local symbol
8179 in a merged or relaxed section when doing a relocatable link.
8181 2010-05-26 Rafael Espindola <espindola@google.com>
8184 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8185 adding sections the garbage collector removed.
8186 * gold/testsuite/Makefile.am: Add test.
8187 * gold/testsuite/Makefile.in: Regenerate.
8188 * gold/testsuite/plugin_test_7.sh: New.
8189 * gold/testsuite/plugin_test_7_1.c: New.
8190 * gold/testsuite/plugin_test_7_2.c: New.
8192 2010-05-26 Rafael Espindola <espindola@google.com>
8194 * script-sections.cc (Output_section_definition::set_section_addresses):
8195 Check for --section-start.
8197 2010-05-26 Doug Kwan <dougkwan@google.com>
8199 * arm.cc (Arm_scan_relocatable_relocs): New class.
8200 (Target_arm::relocate_special_relocatable): New method.
8201 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8202 (Arm_relocate_functions::thumb_branch_common): Same.
8203 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8204 instead of Default_scan_relocatable_relocs.
8205 * target-reloc.h (relocate_for_relocatable): Let target handle
8206 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8207 * target.h (Sized_target::relocate_special_relocatable): New method.
8209 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8211 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8213 2010-05-23 Doug Kwan <dougkwan@google.com>
8215 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8217 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8218 with a direct branch, not a conditional branch, to a stub.
8219 * merge.cc (Output_merge_base::record_input_section): New method
8221 (Output_merge_data::do_add_input_section): Record input section if
8222 keeps-input-sections flag is set.
8223 (Output_merge_string::do_add_input_section): Ditto.
8224 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8225 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8227 (Output_merge_base::keeps_input_sections,
8228 Output_merge_base::set_keeps_input_sections,
8229 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8231 (Output_merge_base::Input_sections): New type declaration.
8232 (Output_merge_base::input_sections_begin,
8233 Output_merge_base::input_sections_end,
8234 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8235 (Output_merge_base::bool keeps_input_sections_,
8236 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8237 Output_merge_base::input_sections_): New data members.
8238 (Output_merge_data::do_set_keeps_input_sections): New method
8240 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8241 * output.cc (Output_section::Input_section::relobj): Move method
8242 defintion from class declaration to here and handle merge sections.
8243 (Output_section::Input_section::shndx): Ditto.
8244 (Output_section::Output_section): Remove initializations of removed
8245 data members and initialize new data member LOOKUP_MAPS_.
8246 (Output_section::add_input_section): Set keeps-input-sections flag
8247 for a newly created merge output section as appropriate. Adjust code
8248 to use Output_section_lookup_maps class.
8249 (Output_section::add_relaxed_input_section): Adjst code for lookup
8250 maps code refactoring.
8251 (Output_section::add_merge_input_section): Add a new parameter
8252 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8253 class. If adding input section to a newly created merge output
8254 section fails, remove the new merge section.
8255 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8256 Adjust code for use of the Output_section_lookup_maps class.
8257 (Output_section::find_merge_section): Ditto.
8258 (Output_section::build_lookup_maps): New method defintion.
8259 (Output_section::find_relaxed_input_section): Adjust code to use
8260 Output_section_lookup_maps class.
8261 (Output_section::get_input_sections): Export merge sections. Adjust
8262 code to use Output_section_lookup_maps class.
8263 (Output_section:::add_script_input_section): Adjust code to use
8264 Output_section_lookup_maps class. Update lookup maps for merge
8266 (Output_section::discard_states): Use Output_section_lookup_maps.
8267 (Output_section::restore_states): Same.
8268 * output.h (Merge_section_properties): Move class defintion out of
8270 (Output_section_lookup_maps): New class.
8271 (Output_section::Input_section::is_merge_section): New method
8273 (Output_section::Input_section::relobj): Move defintion out of class
8274 defintion. Declare method only.
8275 (Output_section::Input_section::shndx): Ditto.
8276 (Output_section::Input_section::output_merge_base): New method defintion.
8277 (Output_section::Input_section::u2_.pomb): New union field.
8278 (Output_section::Merge_section_by_properties_map,
8279 Output_section::Output_section_data_by_input_section_map,
8280 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8282 (Output_section::add_merge_input_section): Add new parameter
8283 KEEPS_INPUT_SECTIONS.
8284 (Output_section::build_lookup_maps): New method declaration.
8285 (Output_section::merge_section_map_,
8286 Output_section::merge_section_by_properties_map_,
8287 Output_section::relaxed_input_section_map_,
8288 Output_section::is_relaxed_input_section_map_valid_): Remove data
8290 (Output_section::lookup_maps_): New data member.
8292 2010-05-21 Doug Kwan <dougkwan@google.com>
8295 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8296 avoid a compilation error.
8298 2010-05-19 Rafael Espindola <espindola@google.com>
8300 * script-sections.cc (Output_section_definition::allocate_to_segment):
8301 Update the phdrs_list even when the output section is NULL.
8302 * testsuite/Makefile.am: Add test.
8303 * testsuite/Makefile.in: Regenerate.
8304 * testsuite/script_test_9.cc: New.
8305 * testsuite/script_test_9.sh: New.
8306 * testsuite/script_test_9.t: New.
8308 2010-05-19 Doug Kwan <dougkwan@google.com>
8310 * arm.cc (Arm_input_section::original_size): New method.
8311 (Arm_input_section::do_addralign): Add a cast.
8312 (Arm_input_section::do_output_offset): Remove static cast.
8313 (Arm_input_section::original_addralign,
8314 Arm_input_section::original_size_): Change type to uint32_t.
8315 (Arm_input_section::init): Add safe casts for section alignment
8317 (Arm_input_section::set_final_data_size): Do not set address and
8318 offset of stub table.
8319 (Arm_output_section::fix_exidx_coverage): Change use of of
8320 Output_section::Simple_input_section to that of
8321 Output_section::Input_section.
8322 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8323 except for the first pass.
8324 * output.cc (Output_section::get_input_sections): Change type of
8325 input_sections to std::list<Input_section>.
8326 (Output_section::add_script_input_section): Rename from
8327 Output_section::add_simple_input_section. Change type of SIS
8328 parameter from Simple_input_section to Input_section.
8329 * output.h (Output_section::Simple_input_section): Remove class.
8330 (Output_section::Input_section): Change class visibility to public.
8331 (Output_section::Input_section::addralign): Use stored alignments
8332 for special input sections if set.
8333 (Output_section::Input_section::set_addralign): New method.
8334 (Output_section::get_input_sections): Change parameter type from
8335 list of Simple_input_section to list of Input_section.
8336 (Output_section::add_script_input_section): Rename from
8337 Output_section::add_simple_input_section. Change first parameter's
8338 type from Simple_input_section to Input_section and remove the
8339 second and third parameters.
8340 * script-sections.cc (Input_section::Input_section_list): Change
8341 type to list of Output_section::Input_section/
8342 (Input_section_info::Input_section_info): Change parameter type of
8343 INPUT_SECTION to Output_section::Input_section.
8344 (Input_section_info::input_section): Change return type.
8345 (Input_section_info::input_section_): Change type to
8346 Output_section::Input_section.
8347 (Output_section_element_input::set_section_addresses): Adjust code
8348 to use Output_section::Input_section instead of
8349 Output_section::Simple_input_section. Adjust code for renaming
8350 of Output_section::add_simple_input_section.
8351 (Orphan_output_section::set_section_addresses): Ditto.
8353 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8355 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8356 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8358 2010-05-18 Rafael Espindola <espindola@google.com>
8360 * options.cc (General_options::finalize): Handle -nostdlib.
8361 * options.h (nostdlib): New option.
8362 * script.cc (script_add_search_dir): Handle -nostdlib.
8364 2010-05-12 Doug Kwan <dougkwan@google.com>
8366 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8367 attributes section only if there no attributes section after merging.
8368 (Target_arm::merge_object_attributes): Move value of
8369 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8370 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8371 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8372 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8373 and arm_attr_merge_7.stdout.
8374 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8375 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8376 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8377 arm_attr_merge_7b.o): New rules.
8378 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8380 * testsuite/Makefile.in: Regenerate.
8381 * testsuite/arm_attr_merge.sh: New file.
8382 * testsuite/arm_attr_merge_[67][ab].s: Same.
8384 2010-05-05 Nick Clifton <nickc@redhat.com>
8386 * po/es.po: Updated Spanish translation.
8388 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8390 * Makefile.am (install-exec-local): Properly install gold as
8391 default cross linker.
8392 * Makefile.in: Regenerated.
8394 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8395 Nick Clifton <nickc@redhat.com>
8397 * configure.ac (install_as_default): Define and set to false
8398 unless --enable-gold or --enable-gold=both/gold has been
8400 * configure: Regenerate.
8402 * Makefile.am (install-exec-local): Install the executable as
8403 'ld.gold'. If install_as_default is true then also install it as
8405 * Makefile.in: Regenerated.
8407 2010-04-24 Ian Lance Taylor <iant@google.com>
8409 * layout.cc (Layout::layout_reloc): In relocatable link don't
8410 combine reloc sections for grouped sections.
8412 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8414 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8415 sections that are not ordinary to icf.
8416 * icf.cc (get_section_contents): Handle relocation pointing to section
8417 with no object or shndx information.
8418 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8419 * testsuite/Makefile.in: Regenerate.
8420 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8421 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8423 2010-04-22 Ian Lance Taylor <iant@google.com>
8425 * expression.cc (Expression::Expression_eval_info): Add
8426 result_alignment_pointer field.
8427 (Expression::eval_with_dot): Add result_alignment_pointer
8428 parameter. Change all callers.
8429 (Expression::eval_maybe_dot): Likewise.
8430 (class Binary_expression): Add alignment_pointer parameter to
8431 left_value and right_value. Change all callers.
8432 (BINARY_EXPRESSION): Set result alignment.
8433 (class Trinary_expression): Add alignment_pointer parameter to
8434 arg2_value and arg3_value. Change all callers.
8435 (Trinary_cond::value): Set result alignment.
8436 (Max_expression::value, Min_expression::value): Likewise.
8437 (Align_expression::value): Likewise.
8438 * script-sections.cc (class Sections_element): Add dot_alignment
8439 parameter to set_section_addresses virtual function. Update
8441 (class Output_section_element): Likewise.
8442 (Script_sections::create_segments): Add dot_alignment parameter.
8444 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8445 (Script_sections::set_phdrs_clause_addresses): Likewise.
8446 * script-sections.h: Update declarations.
8447 * script.h: Update declarations.
8448 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8450 * testsuite/script_test_3.t: Set large alignment.
8451 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8452 segment has expected alignment.
8454 2010-04-22 Nick Clifton <nickc@redhat.com>
8456 * po/gold.pot: Updated by the Translation project.
8457 * po/vi.po: Updated Vietnamese translation.
8459 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8461 * testsuite/Makefile.am (check_PROGRAMS): Add
8462 icf_virtual_function_folding_test.
8463 * testsuite/Makefile.in: Regenerated.
8465 2010-04-15 Andrew Haley <aph@redhat.com>
8467 * options.h (merge_exidx_entries): New option.
8468 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8469 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8470 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8471 (Target_arm::merge_exidx_entries): New function.
8472 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8473 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8474 to Arm_exidx_fixup constructor.
8475 Add new arg, merge_exidx_entries.
8476 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8477 Arm_output_section::fix_exidx_coverage.
8479 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8481 * icf.cc (get_section_contents): Check for preemptible functions.
8482 Ignore addend when appropriate.
8483 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8485 (add_from_relobj): Check for section folded.
8486 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8487 * symtab.h (should_add_dynsym_entry): Add new parameter.
8488 * target-reloc.h (scan_relocs): Check for section folded.
8489 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8490 Check reloc types for function pointers in shared objects.
8491 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8493 (icf_preemptible_functions_test): New test case.
8494 (icf_string_merge_test): New test case.
8495 * testsuite.Makefile.in: Regenerate.
8496 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8497 bar_glob. Refactor code.
8498 * testsuite/icf_preemptible_functions_test.cc: New file.
8499 * testsuite/icf_preemptible_functions_test.sh: New file.
8500 * testsuite/icf_string_merge_test.cc: New file.
8501 * testsuite/icf_string_merge_test.sh: New file.
8502 * testsuite/icf_virtual_function_folding_test.cc: New file.
8503 * testsuite/icf_virtual_function_folding_test.sh: New file.
8505 2010-04-14 Doug Kwan <dougkwan@google.com>
8507 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8508 for local symbol recounting if we remove a section due to ICF.
8509 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8510 there are no regular objects in input.
8512 2010-04-13 Doug Kwan <dougkwan@google.com>
8514 * arm.cc (Arm_input_section::set_final_data_size): Compute
8515 accurate final data size instead of using current data size.
8517 2010-04-09 Doug Kwan <dougkwan@google.com>
8519 * layout.cc (Layout::choose_output_section): Handle script section
8521 (Layout::make_output_section_for_script): Add section type parameter.
8522 Handle script section types.
8523 * layout.h (Layout::make_output_section_for_script): Add section
8525 * output.cc (Output_section::Output_section): Initialize data member
8527 (Output_section::do_reset_address_and_file_offset): Do not set address
8528 to 0 if section is a NOLOAD section.
8529 * output.h (Output_section::is_noload): New method.
8530 (Output_section::set_is_noload): Ditto.
8531 (Output_section::is_noload_): New data member.
8532 * script-c.h (Script_section_type): New enum type.
8533 (struct Parser_output_section_header): Add new file section_type.
8534 * script-sections.cc (Sections_element::output_section_name): Add
8535 parameter for returning script section type.
8536 (Output_section_definition::output_section_name): Ditto.
8537 (Output_section_definition::section_type)P; New method.
8538 (Output_section_definiton::script_section_type_name): Ditto.
8539 (Output_section_definition::script_section_type_): New data member.
8540 (Output_section_definition::Output_section_definition): Initialize
8541 data member Output_section_definition::script_section_type_.
8542 (Output_section_definition::create_sections): Pass script section type
8543 to Layout::make_output_section_for_script.
8544 (Output_section_definition::output_section_name): Return script
8545 section type to caller.
8546 (Output_section_definition::set_section_address): Do not advance
8547 dot value and load address if section type is NOLOAD. Set address
8548 of NOLOAD sections regardless of section flags.
8549 (Output_section_definition::print): Print section type if it is
8550 not SCRIPT_SECTION_TYPE_NONE.
8551 (Output_section_definition::section_type): New method.
8552 (Output_section_definition::script_section_type_name): Ditto.
8553 (Script_sections::output_section_name): Add new parameter
8554 PSECTION_TYPE for returning script section type. Pass it to
8555 section elements. Handle discard sections.
8556 (Sort_output_sections::operator()): Handle NOLOAD sections.
8557 * script-sections.h (Script_sections::Section_type): New enum type.
8558 (Script_sections::output_section_name): Add a new parameter for
8559 returning script section type.
8560 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8562 * yyscript.y (union): Add new field SECTION_TYPE.
8563 (COPY, DSECT, INFO, NOLOAD): New tokens.
8564 (opt_address_and_section_type): Change type to output_section_header.
8565 (section_type): New non-terminal
8566 (section_header): Handle section type.
8567 (opt_address_and_section_type): Return section type value.
8569 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8571 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8572 * testsuite/plugin_common_test_2.c (foo): Likewise.
8574 2010-04-08 Doug Kwan <dougkwan@google.com>
8576 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8578 * output.cc (Output_section::add_merge_input_section): Simplify
8579 code and return status of Output_merge_base::add_input_section.
8580 Update merge section map only if Output_merge_base::add_input_section
8583 2010-04-07 Doug Kwan <dougkwan@google.com>
8585 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8586 if section is marked as containing instructions but has no mapping
8588 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8589 correct section index.
8590 (Arm_relobj::find_linked_text_section): Ditto.
8592 2010-04-07 Cary Coutant <ccoutant@google.com>
8594 * archive.cc (include_member): Destroy Read_symbols_data object before
8596 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8597 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8598 (Read_symbols_data::~Read_symbols_data) New destructor.
8599 (Section_relocs::Section_relocs) New constructor.
8600 (Section_relocs::~Section_relocs) New destructor.
8601 (Read_relocs_data::Read_relocs_data) New constructor.
8602 (Read_relocs_data::~Read_relocs_data) New destructor.
8603 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8604 pointers to NULL after deleting.
8606 2010-04-07 Doug Kwan <dougkwan@google.com>
8608 * arm.cc: Replace "endianity" with "endianness" in comments.
8609 (Arm_exidx_cantunwind): Ditto.
8610 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8611 (Arm_relobj::merge_flags_and_attributes): New method.
8612 (Arm_relobj::merge_flags_and_attributes_): New data member.
8613 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8614 (Arm_relobj::scan_sections_for_stubs): Ditto.
8615 (Arm_relobj::do_read_symbols): Check to see if we really want to
8616 merge processor-specific flags and attributes. Exit early if
8617 an object is empty except for section names and the undefined symbol.
8618 (Target_arm::do_finalize_sections): Move check for ELF format to
8619 Arm_relobj::do_read_symbols. Merge processor specific flags and
8620 attributes from a regular object only when we have determined that
8621 it is aapropriate. Do not create an .ARM.attributes section in
8622 output if there is no regular input object.
8623 (Target_arm::merge_processor_specific_flags): Check
8624 --warn-mismatch before printing any error.
8625 (Target_arm::merge_object_attributes): Ditto.
8626 * gold.cc (queue_middle_tasks): Handle the case in which there is
8627 no regular object in input.
8628 * options.cc (General_options::parse_EB): New method.
8629 (General_options::parse_EL): Same.
8630 (General_options::General_options): Initialize endianness_.
8631 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8633 (General_options::Endianness): New enum.
8634 (General_options::endianness): New method.
8635 (General_options::endianness_): New data member.
8636 * parameters.cc (Parameters::set_options): Check target endianness.
8637 (Parameters::set_target_once): Ditto.
8638 (Parameters::check_target_endianness): New method.
8639 (parameters_force_valid_target): If either -EL or -EB is specified,
8640 use it to define endianness of default target.
8641 * parameters.h (Parameters::check_target_endianness): New method
8643 * target.h (class Target): Change "endianity" to "endianness"
8646 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8648 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8649 * configure: Regenerate.
8650 * Makefile.in: Regenerate.
8651 * testsuite/Makefile.in: Regenerate.
8653 2010-04-06 Cary Coutant <ccoutant@google.com>
8656 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8657 prevailing definitions of common symbols.
8658 * testsuite/plugin_test_6.sh: New test case.
8659 * testsuite/plugin_common_test_1.c: New test case.
8660 * testsuite/plugin_common_test_2.c: New test case.
8661 * testsuite/Makefile.am (plugin_test_6): New test case.
8662 * testsuite/Makefile.in: Regenerate.
8664 2010-04-06 Nick Clifton <nickc@redhat.com>
8666 * po/vi.po: New Vietnamese translation.
8668 2010-03-30 Doug Kwan <dougkwan@google.com>
8670 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8672 2010-03-25 Doug Kwan <dougkwan@google.com>
8674 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8675 to avoid a conversion warning on a 32-bit host.
8677 2010-03-24 Ian Lance Taylor <iant@google.com>
8679 * testsuite/script_test_3.t: Add a TLS segment.
8680 * testsuite/Makefile.am (check_PROGRAMS): Add
8681 tls_phdrs_script_test.
8682 (tls_phdrs_script_test_SOURCES): Define.
8683 (tls_phdrs_script_test_DEPENDENCIES): Define.
8684 (tls_phdrs_script_test_LDFLAGS): Define.
8685 (tls_phdrs_script_test_LDADD): Define.
8686 * testsuite/Makefile.in: Rebuild.
8688 2010-03-23 Cary Coutant <ccoutant@google.com>
8690 * fileread.cc (find_or_make_view): Fix comment.
8692 2010-03-23 Ian Lance Taylor <iant@google.com>
8694 * script-sections.cc (class Orphan_section_placement): Define
8695 PLACE_TLS and PLACE_TLS_BSS.
8696 (Orphan_section_placement::Orphan_section_placement): Initialize
8698 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8699 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8700 (tls_script_test_SOURCES): Define.
8701 (tls_script_test_DEPENDENCIES): Define.
8702 (tls_script_test_LDFLAGS): Define.
8703 (tls_script_test_LDADD): Define.
8704 * testsuite/Makefile.in: Rebuild.
8706 2010-03-22 Doug Kwan <dougkwan@google.com>
8708 * arm.cc (Arm_relocate_functions::abs8,
8709 Arm_relocate_functions::abs16): Use correct check for overflow
8710 specified in the ARM ELF specs.
8711 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8712 target of a BLX instruction specially.
8713 (Reloc_stub::stub_type_for_reloc): Ditto.
8714 (Relocate::relocate): Use symbolic names instead of numeric relocation
8715 codes to report error.
8716 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8718 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8719 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8720 thumb2_blx_out_of_range.stdout
8721 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8722 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8723 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8724 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8725 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8726 thumb2_blx_in_range, thumb2_blx_in_range.o,
8727 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8728 thumb2_blx_out_of_range.o): New rules.
8729 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8730 thumb2_blx_in_range and thumb2_blx_out_of_range.
8731 * testsuite/Makefile.in: Regenerate.
8732 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8733 * testsuite/thumb_blx_in_range.s: New file.
8734 * testsuite/thumb_blx_out_of_range.s: New file.
8736 2010-03-22 Rafael Espindola <espindola@google.com>
8738 * archive.cc (Should_include): Move to archive.h.
8739 (should_include_member): Make it a member of Archive.
8741 (Add_lib_group_symbols): New.
8742 * archive.h: Include options.h.
8743 (Archive_member): Moved from Archive.
8744 (Should_include): Moved from archive.cc.
8746 (Add_lib_group_symbols): New.
8747 * dynobj.cc (do_should_include_member): New.
8748 * dynobj.h (do_should_include_member): New.
8749 * gold.cc (queue_initial_tasks): Update call to queue.
8750 * main.cc (main): Print lib group stats.
8751 * object.cc (do_should_include_member): New.
8752 * object.h: Include archive.h.
8753 (Object::should_include_member): New.
8754 (Object::do_should_include_member): New.
8755 (Sized_relobj::do_should_include_member): New.
8756 * options.cc (General_options::parse_start_lib): New.
8757 (General_options::parse_end_lib): New.
8758 (Input_arguments::add_file): Handle lib groups.
8759 (Input_arguments::start_group): Check we are not in a lib.
8760 (Input_arguments::start_lib): New.
8761 (Input_arguments::end_lib): New.
8762 * options.h (General_options): Add start_lib and end_lib.
8763 (Input_argument::lib_): New.
8764 (Input_argument::lib): New.
8765 (Input_argument::is_lib): New.
8766 (Input_file_lib): New.
8767 (Input_arguments::in_lib_): New.
8768 (Input_arguments::in_lib): New.
8769 (Input_arguments::start_lib): New.
8770 (Input_arguments::end_lib_): New.
8771 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8772 in unused members as preempted.
8773 (Sized_pluginobj::do_should_include_member): New.
8774 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8775 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8777 (Read_symbols::do_whole_lib_group): New.
8778 (Read_symbols::do_lib_group): New.
8779 (Read_symbols::do_read_symbols): Handle lib groups.
8780 (Read_symbols::get_name): Handle lib groups.
8781 * readsyms.h (Read_symbols): Add an archive member pointer.
8782 (Read_symbols::do_whole_lib_group): New.
8783 (Read_symbols::do_lib_group): New.
8784 (Read_symbols::member_): New.
8785 * script.cc (read_input_script): Update call to queue_soon.
8787 2010-03-19 Doug Kwan <dougkwan@google.com>
8789 * arm.cc (Stub_table::Stub_table): Initialize new data members
8790 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8791 (Stub_table::add_reloc_stub): Assign stub offset and update
8792 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8793 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8795 (Stub_table::update_data_size_and_addralign): Use
8796 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8797 instead of going over all reloc stubs.
8798 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8799 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8800 Stringpool_template::offset_ to size of Stringpool_char.
8801 (Stringpool_template::new_key_offset): Remove code to initialize
8802 Stringpool_template::offset_.
8803 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8804 Stringpool_template::offset_ to zero.
8806 2010-03-15 Doug Kwan <dougkwan@google.com>
8808 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8810 (Stringpool_template::new_key_offset): New method.
8811 (Stringpool_template::add_string): Assign offsets when adding new
8813 (Stringpool_template::set_string_offsets): Do not set string offsets
8814 when not optimizing.
8815 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8817 (Chunked_vector::clear): Clear size_.
8818 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8819 (Chunked_vector::size): Return size_.
8820 (Chunked_vector::push_back): Use size_ to find insert position.
8821 (Chunked_vector::size_): New data member.
8822 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8823 (Stringpool_template::new_key_offset): New method declaration.
8824 (Stringpool_template::offset_): New data member.
8826 2010-03-15 Rafael Espindola <espindola@google.com>
8828 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8829 Add_symbols' constructor.
8830 * readsyms.h (Add_symbols): Remove the input_group member.
8832 2010-03-10 Ian Lance Taylor <iant@google.com>
8834 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8835 target to ask whether a reference to a symbol requires a stack
8837 * target.h (Target::is_call_to_non_split): New function.
8838 (Target::do_is_call_to_non_split): Declare virtual function.
8839 * target.cc: Include "symtab.h".
8840 (Target::do_is_call_to_non_split): New function.
8841 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8843 2010-03-10 Cary Coutant <ccoutant@google.com>
8845 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8846 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8847 (File_read::open[2]): Add whole_file_view_ to list of views.
8848 (File_read::make_view): Remove test of whole_file_view_.
8849 (File_read::find_or_make_view): Create whole_file_view_ if
8851 (File_read::clear_views): Replace bool parameter with enum;
8852 adjust all callers. Don't delete views with permanent data;
8853 do delete cached views and views from archives if
8854 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8855 if clearing the corresponding view.
8856 * fileread.h (File_read::Clear_views_mode): New enum.
8857 (File_read::View::is_permanent_view): New method.
8858 (File_read::clear_views): Replace bool parameter
8859 with enum; adjust all callers.
8860 * options.h (General_options): Change keep_files_mapped option;
8861 add map_whole_files.
8862 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8864 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8867 2010-03-10 David S. Miller <davem@davemloft.net>
8869 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8871 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8873 * icf.cc (get_section_contents): Add '@' marker after processing the
8876 2010-03-08 Doug Kwan <dougkwan@google.com>
8878 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8879 due to a conversion warning.
8880 (Arm_relobj::update_output_local_symbol_count): Check for local
8881 symbol with unset output index.
8883 2010-03-05 Ian Lance Taylor <iant@google.com>
8885 * options.h (class General_options): Add --spare-dynamic-tags.
8886 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8887 --spare-dynamic-tags.
8889 2010-03-05 Ian Lance Taylor <iant@google.com>
8891 * incremental.cc: Include "libiberty.h".
8893 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8895 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8896 function, is_info_ member.
8897 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8898 (Versions::Versions): Update caller.
8899 (Versions::define_base_version): Likewise.
8900 (Versions::add_def): Likewise.
8902 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8904 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8905 (Scan::possible_function_pointer_reloc): New function.
8906 (Scan::local_reloc_may_be_function_pointer): Change to call
8907 possible_function_pointer_reloc.
8908 (Scan::global_reloc_may_be_function_pointer): Ditto.
8909 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8910 relocations in ".data.rel.ro._ZTV" section.
8911 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8912 * testsuite/icf_safe_so_test.cc: Ditto.
8913 * testsuite/icf_safe_test.cc: Ditto.
8914 * testsuite/icf_safe_test.sh: Ditto.
8916 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8917 Ian Lance Taylor <iant@google.com>
8919 * target-reloc.h (relocate_section): Check the symbol table index
8920 for -1U before setting the local symbol index.
8921 (scan_relocatable_relocs): If copying the relocation, record that
8922 the local symbol is required.
8923 * object.h (Symbol_value::is_output_symtab_index_set): New
8925 (Symbol_value::may_be_discarded_from_output_symtab): New
8927 (Symbol_value::has_output_symtab_entry): New function.
8928 (Symbol_value::needs_output_symtab_entry): Remove.
8929 (Symbol_value::output_symtab_index): Make sure the symbol index is
8931 (Symbol_value::set_output_symtab_index): Make sure the symbol
8932 index is not set. Make sure the new index is valid.
8933 (Symbol_value::set_must_have_output_symtab_entry): New function.
8934 (Symbol_value::has_output_dynsym_entry): New function.
8935 (Symbol_value::set_output_dynsym_index): Make sure the new index
8937 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8938 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8939 local symbol if permitted.
8940 (Sized_relobj::do_finalize_local_symbols): Call
8941 is_output_symtab_index_set rather than needs_output_symtab_entry.
8942 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8943 rather than needs_output_symtab_entry. Call
8944 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8945 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8946 is_output_symtab_index_set rather than needs_output_symtab_entry.
8947 * testsuite/discard_locals_relocatable_test.c: New file.
8948 * testsuite/discard_locals_test.sh: Test -r.
8949 * testsuite/Makefile.am (check_DATA): Add
8950 discard_locals_relocatable_test1.syms,
8951 discard_local_relocatable_test2.syms.
8952 (MOSTLYCLEANFILES): Likewise. Also add
8953 discard_locals_relocatable_test1.lout and
8954 discard_locals_relocatable_test2.out.
8955 (discard_locals_relocatable_test1.syms): New target.
8956 (discard_locals_relocatable_test.o): New target.
8957 (discard_locals_relocatable_test1.out): New target.
8958 (discard_locals_relocatable_test2.syms): New target.
8959 (discard_locals_relocatable_test2.out): New target.
8960 (various): Add missing ../ld-new dependencies.
8961 * testsuite/Makefile.in: Rebuild.
8963 2010-03-03 Nick Clifton <nickc@redhat.com>
8965 * po/fi.po: New Finnish translation.
8967 2010-03-01 Doug Kwan <dougkwan@google.com>
8969 * layout.cc (Layout::Layout): Force section types of .init_array*,
8970 .preinit_array* and .fini_array* sections.
8971 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8972 Fix check of return value of std::string::find.().
8973 (Output_section::Input_section_sort_compare::operator()): Remove
8974 comment about .init_array.
8975 (Output_section::Input_section_sort_init_fini_compare::operator()):
8977 (Output_section::sort_attached_input_sections): Handle .init_array
8978 and .fini_array specially.
8979 * output.h (Output_section::Inut_section_sort_compare): Update
8981 (Output_section::Input_section_sort_init_fini_compare): New struct.
8983 2010-02-26 Doug Kwan <dougkwan@google.com>
8985 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8986 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8987 * testsuite/debug_msg.sh: Avoid matching source line number for
8988 use of global variable undef_int.
8990 2010-02-26 Doug Kwan <dougkwan@google.com>
8992 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8993 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8994 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8995 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8996 * options.cc (General_options::General_options): Initialize member
8998 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8999 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9000 and rm_no_fix_v4bx.stdout
9001 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9002 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9003 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9004 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9005 and arm_no_fix_v4bx.
9006 * Makefile.in: Regenerate.
9007 * testsuite/arm_fix_v4bx.s: New file.
9008 * testsuite/arm_fix_v4bx.sh: Ditto.
9010 2010-02-24 Doug Kwan <dougkwan@google.com>
9012 * arm.cc (Target_arm::got_section): Make the .got section the first
9013 non RELRO section in the data segment.
9014 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9015 suffixes of section names.
9017 2010-02-24 Doug Kwan <dougkwan@google.com>
9019 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9020 flags and attributes merging if an input file is a binary file.
9021 * fileread.cc (Input_file::open): Record format of original file.
9022 * fileread.h (Input_file::Format): New enum type.
9023 (Input_file::Input_file): Initialize data member format_.
9024 (Input_file::format): New method definition.
9025 (Input_file::format_):: New data member.
9027 2010-02-24 Doug Kwan <dougkwan@google.com>
9029 * arm.cc (Arm_output_data_got): New class.
9030 (ARM_TCB_SIZE): New constant
9031 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9032 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9033 If user uses a script with a SECTIONS clause, issue only a warning
9034 for a misplaced EXIDX input section. Otherwise, issue an error.
9035 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9037 (Target_arm::got_mode_index_entry): Handle static linking.
9038 (Target_arm::Scan::local): Ditto.
9039 (Target_arm::Scan::global): Ditto.
9040 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
9041 all incorrectly implemented relocations.
9042 (Target_arm::fix_exidx_coverage): Pass layout to
9043 Arm_output_section::fix_exidx_coverage.
9044 * layout.cc (Layout::section_name_mapping): Remove trailing dots
9045 from ".ARM.exidx." and ".ARM.extab.".
9047 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9049 * arm.cc (Target_arm::do_finalize_sections): Create attribute
9050 section if it does not already exist.
9051 * attributes.cc (Attributes_section_data::Attributes_section_data):
9052 Don't crash if size is zero.
9054 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9055 Ian Lance Taylor <iant@google.com>
9057 * gold.cc (queue_middle_tasks): If no input files were opened,
9059 * workqueue.h (Task_function::Task_function): Assert that there is
9062 2010-02-22 Doug Kwan <dougkwan@google.com>
9064 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9065 * icf.cc (get_section_contents): Cast snprintf arguments to long long
9066 types to avoid warnings due to different uint64_t implementations
9069 2010-02-21 Doug Kwan <dougkwan@google.com>
9071 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9072 handling of the maximum backward branch offset.
9073 (Arm_relocate_functions::thumb_branch_common): Ditto.
9074 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9075 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9076 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9077 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9078 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9079 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9080 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9081 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9082 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9083 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9084 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9085 thumb2_bl_out_of_range.o): New rules.
9086 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9087 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9088 thumb2_bl_out_of_range
9089 * testsuite/Makefile.in: Regenerate.
9090 * testsuite/arm_bl_in_range.s: New file.
9091 * testsuite/arm_bl_out_of_range.s: Ditto.
9092 * testsuite/arm_branch_in_range.sh: Ditto.
9093 * testsuite/arm_branch_range.t: Ditto.
9094 * testsuite/thumb2_branch_range.t: Ditto.
9095 * testsuite/thumb_bl_in_range.s: Ditto.
9096 * testsuite/thumb_bl_out_of_range.s: Ditto.
9097 * testsuite/thumb_branch_range.t: Ditto.
9099 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9101 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9102 Add reloc offset information.
9103 * icf.cc (get_section_contents): Change iterators to point to the new
9104 vectors. Add reloc offset information to the contents.
9105 * icf.h (Icf::Sections_reachable_info): New typedef.
9106 (Icf::Sections_reachable_list): New typedef.
9107 (Icf::Offset_info): New typedef.
9108 (Icf::Reloc_info): New struct typedef.
9109 (Icf::Reloc_info_list): New typedef.
9110 (Icf::symbol_reloc_list): Delete method.
9111 (Icf::addend_reloc_list): Delete method.
9112 (Icf::section_reloc_list): Delete method.
9113 (Icf::reloc_info_list): New method.
9114 (Icf::reloc_info_list_): New member.
9116 2010-02-19 Doug Kwan <dougkwan@google.com>
9118 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9119 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9120 * arm.cc (Arm_relocation_functions): New forward declaration.
9121 (Target_arm::Target_arm): Initialize new data members
9122 got_mod_index_offset_ and tls_base_symbol_defined_.
9123 (Target_arm::Relocate::relocate_tls): New method.
9124 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9125 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9127 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9128 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9129 (Target_arm::got_mod_index_offset_,
9130 Target_arm::tls_base_symbol_defined_): New data members.
9131 (Target_arm::Scan::local, Target::Scan::global,
9132 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9135 2010-02-18 Doug Kwan <dougkwan@google.com>
9137 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9138 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9139 text section as a parameter becuase some broken tools may not set
9140 the link in section header.
9141 (Target_arm::has_got_section): New method.
9142 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9143 without any mapping symbol as data only. Remove warning.
9144 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9145 link in its section header, try to discover the link by inspecting the
9146 REL31 relocation at the beginning of the section.
9147 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9149 (Target_arm::Scan::global): Treat any reference to the symbol
9150 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9152 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9154 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9155 (Scan::global_reloc_may_be_function_pointer): New function.
9156 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9157 (Scan::global_reloc_may_be_function_pointer): New function.
9158 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9159 (Scan::global_reloc_may_be_function_pointer): New function.
9160 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9161 (Scan::global_reloc_may_be_function_pointer): New function.
9162 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9163 (Scan::global_reloc_may_be_function_pointer): New function.
9164 (Scan::possible_function_pointer_reloc): New function.
9165 (Target_x86_64::can_check_for_function_pointers): New function.
9166 * gc.h (gc_process_relocs): Scan relocation types to determine if
9167 function pointers were taken for targets that support it.
9168 * icf.cc (Icf::find_identical_sections): Include functions for
9169 folding in safe ICF whose pointer is not taken.
9170 * icf.h (Secn_fptr_taken_set): New typedef.
9171 (fptr_section_id_): New member.
9172 (section_has_function_pointers): New function.
9173 (set_section_has_function_pointers): New function.
9174 (check_section_for_function_pointers): New function.
9175 * options.h: Fix comment for safe ICF option.
9176 * target.h (can_check_for_function_pointers): New function.
9177 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9178 Modify icf_safe_test for X86-64.
9179 * testsuite/Makefile.in: Regenerate.
9180 * testsuite/icf_safe_so_test.cc: New file.
9181 * testsuite/icf_safe_so_test.sh: New file.
9182 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9183 (main): Change to take pointer to function kept_func_3.
9184 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9185 folding is done correctly for X86-64.
9187 2010-02-12 David S. Miller <davem@davemloft.net>
9189 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9190 is_symbolless parameter.
9191 (Output_reloc<SHT_REL>::is_symbolless): New.
9192 (Output_reloc<SHT_REL>::is_symbolless_): New.
9193 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9194 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9195 (Output_reloc<SHT_RELA>::is_symbolless): New.
9196 (Output_data_reloc::add_global): Handle is_symbolless.
9197 (Output_data_reloc::add_global_relative): Likewise.
9198 (Output_data_reloc::add_local): Likewise.
9199 (Output_data_reloc::add_local_relative): Likewise.
9200 (Output_data_reloc::add_symbolless_global_addend): New.
9201 (Output_data_reloc::add_symbolless_local_addend): New.
9202 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9204 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9205 instead of ->is_relative_
9206 (Output_reloc::write): Likewise.
9207 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9208 (Output_reloc::write_rel): Simplify.
9210 * sparc.cc (Target_sparc::Scan::local): Use
9211 ->add_symbolless_local_addend as needed.
9212 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9213 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9214 based upon relocation offset.
9216 2010-02-11 Doug Kwan <dougkwan@google.com>
9218 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9219 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9220 beginning of function.
9221 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9222 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9223 parameter is_32bit in calls to should_apply_static_reloc.
9224 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9225 (check_DATA): Add arm_abs_global.stdout.
9226 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9227 arm_abs_global.stdout): New rules.
9228 (MOSTLLYCLEANFILES): Add arm_abs_global
9229 * Makefile.in: Regenerate.
9230 * testsuite/arm_abs_global.s: New file.
9231 * testsuite/arm_abs_global.sh: Ditto.
9232 * testsuite/arm_abs_lib.s: Ditto.
9234 2010-02-11 Ian Lance Taylor <iant@google.com>
9236 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9238 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9239 Allocate_commons_task first.
9240 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9241 task, rather than symtab_lock_.
9242 (Gc_process_relocs::~Gc_process_relocs): New function.
9243 (Gc_process_relocs::is_runnable): Check this_blocker_.
9244 (Gc_process_relocs::locks): Use next_blocker_ rather than
9246 (Scan_relocs::~Scan_relocs): New function.
9247 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9249 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9251 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9252 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9253 constructor accordingly.
9254 (class Gc_process_relocs): Likewise.
9255 (class Scan_relocs): Likewise.
9256 * common.h (class Allocate_commons_task): Remove symtab_lock_
9257 field, and corresponding constructor parameter.
9258 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9260 (Allocate_commons_task::locks): Likewise.
9262 2010-02-11 Ian Lance Taylor <iant@google.com>
9264 * gold-threads.h (class Once): Define.
9265 (class Initialize_lock): Rewrite as child of Once.
9266 * gold-threads.cc (class Once_initialize): Define.
9267 (once_pointer_control): New static variable.
9268 (once_pointer, once_arg): New static variables.
9269 (c_run_once): New static function.
9270 (Once::Once, Once::run_once, Once::internal_run): New functions.
9271 (class Initialize_lock_once): Remove.
9272 (initialize_lock_control): Remove.
9273 (initialize_lock_pointer): Remove.
9274 (initialize_lock_once): Remove.
9275 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9276 (Initialize_lock::initialize): Rewrite.
9277 (Initialize_lock::do_run_once): New function.
9278 * archive.cc (Archive::interpret_header): Only clear name if it is
9280 * fileread.cc: Include "gold-threads.h"
9281 (file_counts_lock): New static variable.
9282 (file_counts_initialize_lock): Likewise.
9283 (File_read::release): Only increment counts when using --stats.
9284 Use a lock around the increment.
9285 * parameters.cc (class Set_parameters_target_once): Define.
9286 (set_parameters_target_once): New static variable.
9287 (Parameters::Parameters): Move here from parameters.h.
9288 (Parameters::set_target): Rewrite.
9289 (Parameters::set_target_once): New function.
9290 (Parameters::clear_target): Move here and rewrite.
9291 * parameters.h (class Parameters): Update declarations. Add
9292 set_parameters_target_once_ field.
9293 (Parameters::Parameters): Move to parameters.cc.
9294 (Parameters::clear_target): Likewise.
9295 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9297 (Start_group::~Start_group): New function.
9298 (Start_group::is_runnable): New function.
9299 (Start_group::locks, Start_group::run): New functions.
9300 (Finish_group::run): Change saw_undefined to size_t.
9301 * readsyms.h (class Start_group): Define.
9302 (class Finish_group): Change saw_undefined_ field to size_t.
9303 (Finish_group::Finish_group): Remove saw_undefined and
9304 this_blocker parameters. Change all callers.
9305 (Finish_group::set_saw_undefined): New function.
9306 (Finish_group::set_blocker): New function.
9307 * symtab.h (class Symbol_table): Change saw_undefined to return
9308 size_t. Change saw_undefined_ field to size_t.
9309 * target-select.cc (Set_target_once::do_run_once): New function.
9310 (Target_selector::Target_selector): Initialize set_target_once_
9311 field. Don't initialize lock_ and initialize_lock_ fields.
9312 (Target_selector::instantiate_target): Rewrite.
9313 (Target_selector::set_target): New function.
9314 * target-select.h (class Set_target_once): Define.
9315 (class Target_selector): Update declarations. Make
9316 Set_target_once a friend. Remove lock_ and initialize_lock_
9317 fields. Add set_target_once_ field.
9319 2010-02-10 Ian Lance Taylor <iant@google.com>
9321 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9323 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9324 (queue_middle_tasks): Add all blockers before queueing any tasks.
9325 (queue_final_tasks): Likewise.
9326 * token.h (Task_token::add_blockers): New function.
9327 * object.h (Input_objects::number_of_relobjs): New function.
9329 2010-02-10 Ian Lance Taylor <iant@google.com>
9331 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9332 shared, not if not position independent.
9333 * x86_64.cc (Relocate::relocate_tls): Likewise.
9334 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9335 (tls_pie_pic_test): New target.
9336 * testsuite/Makefile.in: Rebuild.
9338 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9339 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9340 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9341 * testsuite/Makefile.in: Rebuild.
9343 2010-02-09 David S. Miller <davem@davemloft.net>
9345 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9346 R_SPARC_RELATIVE using ->add_local_relative().
9347 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9349 * output.h (Output_data_dynamic::add_section_size): New method
9350 that takes two Output_data objects.
9351 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9352 entry param. Handle it in initializers.
9353 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9354 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9355 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9357 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9358 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9359 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9360 for dynrel_includes_plt.
9361 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9362 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9363 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9365 (Target_sparc::do_finalize_sections): Update to pass true for
9366 dynrel_includes_plt.
9367 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9368 output before .rela.plt
9369 (Target_powerpc::do_finalize_sections): Update to pass true for
9370 dynrel_includes_plt when 32-bit.
9372 2010-02-08 Doug Kwan <dougkwan@google.com>
9374 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9376 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9377 Arm_relobj::scan_section_for_cortex_a8_stubs,
9378 Arm_relobj::do_relocation_section): Instead of calling
9379 Output_section::output_address, use faster
9380 Arm_relobj::simple_input_section_output_address.
9382 2010-02-08 David S. Miller <davem@davemloft.net>
9384 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9385 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9386 relocation helper function.
9388 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9389 just like R_SPARC_GOT{10,13,22}.
9390 (Target_sparc::Scan::local): Likewise.
9391 (Target_sparc::Relocate:relocate): Likewise.
9393 2010-02-06 Ian Lance Taylor <iant@google.com>
9395 * configure.ac: Rewrite targetobjs duplicate removal code to use
9396 only shell constructs.
9397 * configure: Rebuild.
9399 2010-02-05 Doug Kwan <dougkwan@google.com>
9402 * arm.cc (Arm_relobj::section_is_scannable): New method.
9403 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9404 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9406 2010-02-04 Doug Kwan <dougkwan@google.com>
9409 * arm-reloc-property.cc (cstdio): Include.
9410 * configure.ac (targetobjs): Remove duplicates.
9411 * configure: Regenerate.
9412 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9413 big and little endian version for a given address size.
9415 2010-02-03 Doug Kwan <dougkwan@google.com>
9417 * arm-reloc-property.cc
9418 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9420 * arm-reloc-property.h
9421 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9422 New method definition.
9423 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9425 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9427 (GOT_PREL): Change implemented to Y.
9428 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9429 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9430 (Arm_relocate_functions::movw_abs_nc): Remove method.
9431 (Arm_relocate_functions::movt_abs): Ditto.
9432 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9433 (Arm_relocate_functions::thm_movt_abs): Ditto.
9434 (Arm_relocate_functions::movw_rel_nc): Ditto.
9435 (Arm_relocate_functions::movw_rel): Ditto.
9436 (Arm_relocate_functions::movt_rel): Ditto.
9437 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9438 (Arm_relocate_functions:thm_movw_rel): Ditto.
9439 (Arm_relocate_functions:thm_movt_rel): Ditto.
9440 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9441 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9442 New method definitions.
9443 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9444 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9445 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9446 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9447 (Target_arm::Relocate::relocate): Check for non-static or
9448 unimplemented relocation code and exit early. Change calls to
9449 Target_arm::reloc_uses_thumb_bit and
9450 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9451 instead. Refactor code to handle similar relocations to increase
9452 code sharing. Remove check for unsupported relocation code in switch
9454 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9455 relocation property table to find out size. Change error message to
9456 print out the name of a relocation code instead of the numeric value.
9457 (Target_arm::scan_reloc_for_stub): Use relocation property table
9458 instead of calling Target_arm::reloc_uses_thumb_bit().
9460 2010-02-02 Doug Kwan <dougkwan@google.com>
9462 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9463 types of relaxed input section.
9465 2010-02-02 Doug Kwan <dougkwan@google.com>
9467 * Makefile.am (HFILES): Add arm-reloc-property.h.
9469 (TARGETSOURCES): Add arm-reloc-property.cc
9470 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9471 (libgold_a_SOURCES): $(DEFFILES)
9472 * Makefile.in: Regenerate.
9473 * arm-reloc-property.cc: New file.
9474 * arm-reloc-property.h: New file.
9475 * arm-reloc.def: New file.
9476 * arm.cc: Update comments.
9477 (arm-reloc-property.h): New included header.
9478 (arm_reloc_property_table): New global variable.
9479 (Target_arm::do_select_as_default_target): New method definition.
9480 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9481 arm-reloc-property to targ_extra_obj.
9482 * parameters.cc (set_parameters_target): Call
9483 Target::select_as_default_target().
9484 * target.h (Target::select_as_default_target): New method definition.
9485 (Target::do_select_as_default_target): Same.
9487 2010-02-01 Doug Kwan <dougkwan@google.com>
9489 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9490 first_output_text_section_.
9491 (Arm_exidx_fixup::first_output_text_section): New method definition.
9492 (Arm_exidx_fixup::first_output_text_section_): New data member.
9493 (Arm_exidx_fixup::process_exidx_section): Record the first text
9494 output section seen.
9495 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9496 and entsize in output section header.
9498 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9500 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9501 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9502 (Arm_relocate_functions::thm_alu11): New Method.
9503 (Arm_relocate_functions::thm_pc8): New Method.
9504 (Arm_relocate_functions::thm_pc12): New Method.
9505 (Target_arm::Scan::local): Handle the relocations.
9506 (Target_arm::Scan::global): Likewise.
9507 (Target_arm::Relocate::relocate): Likewise.
9508 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9510 2010-01-29 Doug Kwan <dougkwan@google.com>
9512 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9513 of relocation types as ld.
9515 2010-01-29 Doug Kwan <dougkwan@google.com>
9517 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9519 (Arm_relocate_functions::thumb_branch_common): Ditto.
9520 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9521 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9522 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9523 Arm_relocate_functions::jump24): Remove.
9524 (Target_arm::Relocate::relocate): Adjust code to call
9525 Arm_relocation_functions::arm_branch_common and
9526 Arm_relocation_functions::thumb_branch_common instead of their removed
9527 wrappers. Merge switch-cases together to reduce source code size.
9529 2010-01-29 Doug Kwan <dougkwan@google.com>
9531 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9532 output_local_symbol_count_needs_update_.
9533 (Arm_relobj::output_local_symbol_count_needs_update,
9534 Arm_relobj::set_output_local_symbol_count_needs_update,
9535 Arm_relobj::update_output_local_symbol_count): New methods.
9536 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9538 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9539 of pointed function as in a R_ARM_PREL31 relocation.
9540 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9541 for output local symbol count updating.
9542 (Target_arm::do_relax): Update output local symbol counts in objects
9544 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9546 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9548 * arm.cc: Added support for the ARM relocations:
9549 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9550 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9551 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9553 (Arm_relocate_functions::movw_rel): New method.
9554 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9555 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9557 (Arm_relocate_functions::thm_movw_rel): New method.
9558 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9560 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9562 (Target_arm::Scan::global): Likewise.
9563 (Target_arm::Relocate::relocate): Likewise.
9564 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9567 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9569 * arm.cc: Added support for ARM group relocations.
9570 (Target_arm::reloc_needs_sym_origin): New method.
9571 (Arm_relocate_functions::calc_grp_kn): New method.
9572 (Arm_relocate_functions::calc_grp_residual): New method.
9573 (Arm_relocate_functions::calc_grp_gn): New method.
9574 (Arm_relocate_functions::arm_grp_alu): New Method.
9575 (Arm_relocate_functions::arm_grp_ldr): New Method.
9576 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9577 (Arm_relocate_functions::arm_grp_ldc): New Method.
9578 (Target_arm::Scan::local): Handle the ARM group relocations.
9579 (Target_arm::Scan::global): Likewise.
9580 (Target_arm::Relocate::relocate): Likewise.
9581 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9584 2010-01-26 Doug Kwan <dougkwan@google.com>
9586 * arm.cc (set): Include.
9587 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9589 (Arm_output_section::Text_section_list): New type.
9590 (Arm_output_section::append_text_sections_to_list): New method.
9591 (Arm_output_section::fix_exidx_coverage): Ditto.
9592 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9593 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9594 Relobj::set_section_offset() instead of
9595 Sized_relobj::invalidate_section_offset().
9596 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9597 parameter for section headers. Ignore relocation sections for
9598 unallocated sections and EXIDX sections.
9599 (Target_arm::fix_exidx_coverage): New method.
9600 (Target_arm::output_section_address_less_than): New type.
9601 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9602 linked text section instead of the EXIDX section.
9603 (Arm_output_section::create_stub_group): Add an assertion to check
9604 that this is not an EXIDX output section.
9605 (Arm_output_section::append_text_sections_to_list): New method.
9606 (Arm_output_section::fix_exidx_coverage): Ditto.
9607 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9608 Arm_relobj::section_needs_reloc_stub_scanning.
9609 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9611 (Target_arm::fix_exidx_coverage): New method.
9612 * object.h (Relobj::set_output_section): New method.
9613 (Sized_relobj::invalidate_section_offset): Remove method.
9614 (Sized_relobj::do_invalidate_section_offset): Remove method.
9615 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9617 2010-01-25 Doug Kwan <dougkwan@google.com>
9619 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9620 Fix warning due to signed and unsigned comparison on a 32-bit host.
9622 2010-01-22 Doug Kwan <dougkwan@google.com>
9624 * arm.cc (Target_arm::do_relax): Record an output section for section
9625 offset adjustment it contains any stub table that has changed.
9626 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9627 offsets in an output section if necessary.
9628 * output.cc (Output_section::Output_section): Initialize
9629 section_offsets_need_adjustments_.
9630 (Output_section::add_input_section_for_script): Renamed to
9631 Output_section::add_simple_input_section.
9632 (Output_section::save_states): Add a comment.
9633 (Output_section::discard_states): New method defintion.
9634 (Output_section::adjust_section_offsets): Same.
9635 * output.h (Output_section::add_input_section_for_script): Renamed to
9636 Output_section::add_simple_input_section.
9637 (Output_section::discard_states): New method declaration.
9638 (Output_section::adjust_section_offsets): Same.
9639 (Output_section::section_offsets_need_adjustment,
9640 Output_section::set_section_offsets_need_adjustment): New method
9642 (Output_section::section_offsets_need_adjustment_): New data member.
9643 * script-sections.cc
9644 (Output_section_element_input::set_section_address): Adjust code for
9645 renaming of Output_section::add_input_section_for_script.
9646 (Orphan_output_section::set_section_address): Same.
9648 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9650 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9651 Fix_v4bx enum values .
9652 * gold/options.h (General_options): New option definitions.
9653 (General_options::fix_v4bx): New method.
9654 (General_options::Fix_v4bx): New enum.
9655 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9656 (General_options::parse_fix_v4bx_interworking): New method.
9658 2010-01-22 Doug Kwan <dougkwan@google.com>
9660 * arm.cc (Arm_exidx_fixup): New class.
9662 2010-01-21 Doug Kwan <dougkwan@google.com>
9664 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9666 (Arm_exidx_section_offset_map): New type.
9668 2010-01-21 Doug Kwan <dougkwan@google.com>
9670 * arm.cc (Arm_exidx_input_section): New class.
9671 (Arm_relobj::exidx_input_section_by_link,
9672 Arm_relobj::exidx_input_section_by_shndx,
9673 Arm_relobj::make_exidx_input_section): New methods.
9674 (read_arm_attributes_section): Remove.
9675 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9676 information about them.
9677 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9680 2010-01-20 Doug Kwan <dougkwan@google.com>
9682 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9683 Input_section_specifier to Section_id.
9684 (Target_arm::new_arm_input_section: Adjust code for change of key
9686 (Target_arm::find_arm_input_section): Ditto.
9687 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9688 (Section_id): Remove.
9689 (Garbage_collection::Section_id_hash): Remove.
9690 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9691 (Section_id): Remove.
9692 (Icf::Section_id_hash): Remove.
9693 * object.h (Section_id, Const_section_id, Section_id_hash,
9694 Const_section_id_hash): New type definitions.
9695 * output.cc (Output_section::add_relaxed_input_section): Change to
9696 use Const_section_id instead of Input_section_specifier as key type.
9697 (Output_section::add_merge_input_section): Ditto.
9698 (Output_section::build_relaxation_map): Change to use Section_id
9699 instead of Input_section_specifier as key type.
9700 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9702 (Output_section::convert_input_sections_to_relaxed_sections): Change
9703 to use Const_section_id instead of Input_section_specifier as key type.
9704 (Output_section::find_merge_section): Ditto.
9705 (Output_section::find_relaxed_input_section): Ditto.
9706 * output.h (Input_section_specifier): Remove class.
9707 (Output_section::Output_section_data_by_input_section_map): Change
9708 key type to Const_section_id.
9709 (Output_section::Output_relaxed_input_section_by_input_section_map):
9711 (Output_section::Relaxation_map): Change key type to Section_id.
9713 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9715 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9716 (class Arm_v4bx_stub): New class.
9717 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9718 (Stub_factory::make_arm_v4bx_stub): New method.
9719 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9720 (Stub_table::empty): Handle v4bx stubs.
9721 (Stub_table::add_arm_v4bx_stub): New method.
9722 (Stub_table::find_arm_v4bx_stub): New method.
9723 (Arm_relocate_functions::v4bx): New method.
9724 (Target_arm::fix_v4bx): New method.
9725 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9726 (Stub_table::relocate_stubs): Likewise.
9727 (Stub_table::do_write): Likewise.
9728 (Stub_table::update_data_size_and_addralign): Likewise.
9729 (Stub_table::finalize_stubs): Likewise.
9730 (Target_arm::Scan::local): Likewise.
9731 (Target_arm::Scan::global): Likewise.
9732 (Target_arm::do_finalize_sections): Likewise.
9733 (Target_arm::Relocate::relocate): Likewise.
9734 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9736 (Target_arm::scan_reloc_for_stub): Likewise.
9737 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9739 2010-01-19 Ian Lance Taylor <iant@google.com>
9741 * output.cc (Output_section_headers::do_sized_write): Write large
9742 segment count to sh_info field.
9743 (Output_file_header::do_sized_write): For large segment count,
9744 write PN_XNUM to e_phnum field.
9746 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9748 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9749 (Arm_relocate_functions::thm_jump8): New function.
9750 (Arm_relocate_functions::thm_jump11): New function.
9751 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9753 (Target_arm::Scan::global): Likewise.
9754 (Target_arm::Relocate::relocate): Likewise.
9755 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9758 2010-01-14 Doug Kwan <dougkwan@google.com>
9760 * arm.cc (map, utility): Include headers.
9761 (Target_arm::apply_cortex_a8_workaround): New method.
9762 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9763 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9764 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9765 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9766 the --[no-]fix-cortex-a8 command line options.
9767 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9768 (Target_arm::relocate_stub): Use addend in instruction template.
9769 * options.h (DEFINE_bool): Set the user-set flag.
9770 (General_options): Add --[no-]-fix-cortex options.
9771 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9772 : Update fast look-up map after conversion.
9774 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9776 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9777 in the first pass of do_layout.
9779 2010-01-13 Doug Kwan <dougkwan@google.com>
9781 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9782 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9783 apparent compiler problem of not folding static constant integral
9784 data members of elfcpp::Elf_sizes<32>.
9786 2010-01-13 Doug Kwan <dougkwan@google.com>
9788 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9789 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9790 Arm_relobj::scan_section_for_cortex_a8_erratum,
9791 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9792 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9793 sections to scan for relocation stubs into a new method
9794 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9795 relocation and Cortex-A8 stub scanning.
9796 (Target_arm::do_relax): Force stubs to be after stubbed sections
9797 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9798 the beginning of a new relaxation pass. Update a comment.
9799 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9801 2010-01-12 Ian Lance Taylor <iant@google.com>
9803 * target-reloc.h (visibility_error): New inline function.
9804 (relocate_section): Call visibility_error.
9805 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9806 (MOSTLYCLEANFILES): Likewise.
9807 (protected_4_pic.o, protected_3.err): New targets.
9808 * testsuite/protected_4.cc: New file.
9810 2010-01-12 Doug Kwan <dougkwan@google.com>
9812 * arm.cc (Cortex_a8_reloc): New class.
9813 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9814 and cortex_a8_relocs_info_.
9815 (Target_arm::fix_cortex_a8): New method definition.
9816 (Target_arm::Cortex_a8_relocs_info): New type.
9817 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9818 New data member declarations.
9819 (Target_arm::scan_reloc_for_stub): Record information about
9820 relocations for THUMB branches that might be exempted from the
9821 Cortex-A8 workaround.
9822 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9823 at the beginning of a relaxation pass.
9825 2010-01-12 Doug Kwan <dougkwan@google.com>
9827 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9828 (Arm_relobj::Mapping_symbol_position,
9829 Arm_reloj::Mapping_symbol_position_less,
9830 Arm_relobj::Mapping_symbols_info): New types.
9831 (Target_arm::is_mapping_symbol_name): New method definition.
9832 (Arm_relobj::do_count_local_symbols): Save information about mapping
9835 2010-01-11 Doug Kwan <dougkwan@google.com>
9837 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9838 Arm_relocate_functions::thumb32_branch_upper,
9839 Arm_relocate_functions::thumb32_branch_lower,
9840 Arm_relocate_functions::thumb32_cond_branch_offset,
9841 Arm_relocate_functions::thumb32_cond_branch_upper,
9842 Arm_relocate_functions::thumb32_cond_branch_lower,
9843 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9844 branch offset encoding.
9845 (Arm_relocate_functions::thumb_branch_common): Use new branch
9846 offset encoding methods to avoid code duplication.
9847 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9848 (Stub_addend_reader::operator()): Use new branch encoding method
9849 to avoid code duplication.
9851 2010-01-11 Doug Kwan <dougkwan@google.com>
9853 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9854 (Target_arm::do_finalize_sections): Define special EXIDX section
9855 symbols only if referenced.
9856 * gc.h (Garbage_collection::add_reference): New method.
9857 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9860 2010-01-11 Ian Lance Taylor <iant@google.com>
9862 * script.cc (Version_script_info::build_expression_list_lookup):
9863 Change complaing about duplicate wildcard match from error to
9866 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9868 (Version_script_info::Version_script_info): Initialize globs_,
9869 default_version_, default_is_global_, and exact_. Don't
9870 initialize globals_ or locals_.
9871 (Version_script_info::build_lookup_tables): Build local symbols
9873 (Version_script_info::unquote): New function.
9874 (Version_script_info::add_exact_match): New function.
9875 (Version_script_info::build_expression_list_lookup): Remove lookup
9876 parameter. Add is_global parameter. Change all callers. Handle
9877 wildcard pattern specially. Unquote pattern. Call
9879 (Version_script_info::get_name_to_match): New function.
9880 (Version_script_info::get_symbol_version): New function.
9881 (Version_script_info::get_symbol_version_helper): Remove.
9882 (Version_script_info::check_unmatched_names): Call unquote.
9883 * script.h (class Version_script_info): Change get_symbol_version
9884 to be non-inline and add is_global parameter; change all callers.
9885 Rewrite symbol_is_local. Update declarations. Define struct
9886 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9887 Remove globals_ and locals_ members. Add exact_, globs_,
9888 default_version_, is_global_.
9889 (Version_script_info::Glob): Remove pattern, add expression and
9890 is_global. Update constructor. Change all callers.
9891 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9893 (Versions::symbol_section_contents): If a symbol is undefined, or
9894 defined in a dynamic object, set the version index to
9896 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9898 (Symbol_table::add_from_pluginobj): Likewise.
9899 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9901 2010-01-11 Doug Kwan <dougkwan@google.com>
9903 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9904 (incremental_dump_LDADD): Add linking option for libintl.
9905 * Makefile.in: Regenerate.
9907 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9910 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9912 * testsuite/Makefile.in: Regenerated.
9914 2010-01-10 Doug Kwan <dougkwan@google.com>
9916 * options.h (DEFINE_var): Use parentheses around argument varname__
9917 in macro body to avoid any unintended subsequent substitutions.
9919 2010-01-10 Ian Lance Taylor <iant@google.com>
9921 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9922 candidates before doing symbol resolution.
9924 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9925 ODR candidates if only one is weak.
9927 2010-01-08 Ian Lance Taylor <iant@google.com>
9929 * script.cc (Version_script_info::build_expression_list_lookup):
9930 Don't warn about ambiguous version, just record the ambiguity.
9931 (Version_script_info::get_symbol_version_helper): Give error if
9932 version is ambiguous.
9934 2010-01-08 Doug Kwan <dougkwan@google.com>
9936 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9937 prev_data_size_ and prev_addralign_. Remove initializer for
9938 deleted data member has_been_changed_.
9939 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9940 to determine if the table is empty.
9941 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9943 (Stub_table::add_reloc_stub): Define method in class definition
9944 instead of just declaring it there.
9945 (Stub_table::add_cortex_a8_stub): New method definition.
9946 (Stub_table::update_data_size_and_addralign): Ditto.
9947 (Stub_table::finalize_stubs): Ditto.
9948 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9949 (Stub_table::do_addralign_): Return address alignment in the
9950 (Stub_table::do_reset_address_and_file_offset): Define method in
9951 class definition instead of declaring it there. Set current data
9952 size to be the data size of the previous pass.
9953 (Stub_table::set_final_data_size): Use current data size as the
9955 (Stub_table::relocate_stub): Change parameter type of stub from
9956 Reloc_stub pointer to Stub pointer.
9957 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9958 (Stub_table::Cortex_a8_stub_list): New typedef.
9959 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9960 Stub_table::prev_addralign_): New data member.
9961 (Arm_relobj::Arm_relobj): Initialize data member
9962 section_has_cortex_a8_workaround_.
9963 (Arm_relobj::section_has_cortex_a8_workaround,
9964 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9966 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9968 (Target_arm::relocate_stub): Change parameter type of stub from
9969 Reloc_stub pointer to Stub pointer.
9970 (Insn_template::size, Insn_template::alignment): Handle
9971 THUMB16_SPECIAL_TYPE.
9972 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9973 Stub_table::update_data_size_and_addralign,
9974 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9976 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9977 (Stub_table::do_write): Ditto.
9978 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9980 2010-01-08 Ian Lance Taylor <iant@google.com>
9983 * symtab.h (class Symbol): Remove fields is_target_special_ and
9984 has_plt_offset_. Add field is_defined_in_discarded_section_.
9985 (Symbol::is_defined_in_discarded_section): New function.
9986 (Symbol::set_is_defined_in_discarded_section): New function.
9987 (Symbol::has_plt_offset): Rewrite.
9988 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9989 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9990 Don't initialize is_target_special_ or has_plt_offset_.
9991 Initialize is_defined_in_discarded_section_.
9992 (Symbol_table::add_from_relobj): If appropriate, set
9993 is_defined_in_discarded_section.
9994 * resolve.cc (Symbol::override_base_with_special): Don't test
9995 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9996 * target-reloc.h (relocate_section): Do special handling for
9997 symbols defined in discarded sections for global symbols as well
10000 2010-01-08 Ian Lance Taylor <iant@google.com>
10002 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10003 the SHT_SYMTAB case.
10005 2010-01-08 Ian Lance Taylor <iant@google.com>
10007 * object.cc (Sized_relobj::do_layout): Don't get confused if
10008 layout_eh_frame returns NULL.
10010 2010-01-08 Ian Lance Taylor <iant@google.com>
10013 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10014 dynamic symbol table, use the normal symbol table.
10015 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10018 2010-01-08 Ian Lance Taylor <iant@google.com>
10021 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10024 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10026 * version.cc (print_version): Change to "Copyright 2010".
10028 2010-01-08 Ian Lance Taylor <iant@google.com>
10032 * i386.cc (class Target_i386): Change return type of plt_section
10034 (class Output_data_plt_i386): Add tls_desc_rel_ field.
10035 (Output_data_plt_i386::Output_data_plt_i386): Initialize
10036 tls_desc_rel_ field.
10037 (Output_data_plt_i386::rel_tls_desc): New function.
10038 (Target_i386::rel_tls_desc_section): New function.
10039 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10040 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10041 R_386_TLS_DESC reloc in rel_tls_desc_section.
10042 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10043 Define struct Tlsdesc_info.
10044 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10045 (Target_x86_64::do_reloc_symbol_index): New function.
10046 (Target_x86_64::add_tlsdesc_info): New function.
10047 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10048 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10049 tlsdesc_rel_ field.
10050 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
10052 (Output_data_plt_x86_64::rela_tlsdesc): New function.
10053 (Target_x86_64::rela_tlsdesc_section): New function.
10054 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10056 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10057 (Target_x86_64::do_reloc_addend): New function.
10058 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10059 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10060 declarations. Define TARGET_CODE. Add arg field to u1_ union.
10061 (Output_reloc::type): New function.
10062 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10063 (Output_reloc::is_target_specific): New function.
10064 (Output_reloc::target_arg): New function.
10065 (class Output_reloc) [SHT_RELA]: Add four new constructors for
10066 absolute relocs and target specific relocs.
10067 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10068 add_target_specific.
10069 (class Output_data_reloc) [SHT_RELA]: Likewise.
10070 * output.cc (Output_reloc::Output_reloc): Add four new versions
10071 for absolute relocs and target specific relocs.
10072 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10073 (Output_reloc::get_symbol_index): Likewise.
10074 (Output_reloc::local_section_offset): Check that local_sym_index_
10075 is not TARGET_CODE or 0.
10076 (Output_reloc::symbol_value): Likewise.
10077 (Output_reloc::write) [SHT_RELA]: Call target for target specific
10079 * target.h (class Target): Add reloc_symbol_index and reloc_addend
10080 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
10082 * layout.cc (add_target_dynamic_tags): Use output section for
10083 DT_PLTRELSZ and DT_JMPREL.
10085 2010-01-07 Ian Lance Taylor <iant@google.com>
10088 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10090 (class Output_data_reloc_generic): Define.
10091 (class Output_data_reloc_base): Change base class to
10092 Output_data_reloc_generic. Change add() method to call
10093 bump_relative_reloc_count for a relative reloc. Remove
10094 sort_relocs_ field.
10095 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10097 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10098 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10100 * layout.h (class Layout): Update declaration.
10102 2010-01-07 Ian Lance Taylor <iant@google.com>
10104 * output.h (class Output_data): Add const version of
10105 output_section and do_output_section.
10106 (class Output_section_data): Add const version of
10108 (class Output_section): Likewise.
10109 * layout.cc (Layout::add_target_dynamic_tags): New function.
10110 * layout.h (class Layout): Update declarations.
10111 * arm.cc (Target_arm::do_finalize_sections): Use
10112 add_target_dynamic_tags.
10113 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10114 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10115 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10116 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10118 2010-01-07 Ian Lance Taylor <iant@google.com>
10121 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10124 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10125 Ian Lance Taylor <iant@google.com>
10128 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10129 Xindex::read_symtab_xindex.
10131 2010-01-07 Doug Kwan <dougkwan@google.com>
10133 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10134 (Insn_template::thumb16_bcond_insn): New method declaration.
10135 (Insn_template): Fix spelling.
10136 (Stub::thumb16_special): New method declaration.
10137 (Stub::do_write): Define virtual method which was previously pure
10139 (Stub::do_thumb16_special): New method declaration.
10140 (Stub::do_fixed_endian_write): New template member.
10141 (Reloc_stub::do_write): Remove.
10142 (Reloc_stub::do_fixed_endian_write): Remove.
10143 (Cortex_a8_stub): New class definition.
10144 (Stub_factory::make_cortex_a8_stub): New method definition.
10145 (Stub_factory::Stub_factory): Add missing static storage class
10146 qualifier for elf32_arm_stub_a8_veneer_blx.
10148 2010-01-07 Ian Lance Taylor <iant@google.com>
10151 * options.h (class General_options): Add --warn-unresolved-symbols
10152 and --error-unresolved-symbols.
10153 * errors.cc (Errors::undefined_symbol): Implement
10154 --warn-unresolved-symbols.
10156 * options.h (class General_options): Add -z text and -z textoff.
10157 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10159 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10161 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10162 (Garbage_collection::cident_sections): New function.
10163 (Garbage_collection::add_cident_section): New function.
10164 (Garbage_collection::cident_sections_): New member.
10165 (gc_process_relocs): Add references to sections whose names are C
10167 * gold.h (cident_section_start_prefix): New constant.
10168 (cident_section_stop_prefix): New constant.
10169 (is_cident): New function.
10170 * layout.cc (Layout::define_section_symbols): Replace string constants
10171 with the newly defined constants.
10172 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10174 * testsuite/Makefile.am: Add gc_orphan_section_test.
10175 * testsuite/Makefile.in: Regenerate.
10176 * testsuite/gc_orphan_section_test.cc: New file.
10177 * testsuite/gc_orphan_section_test.sh: New file.
10179 2010-01-06 Ian Lance Taylor <iant@google.com>
10182 * options.h (class General_options): Add --warn-shared-textrel.
10183 * layout.cc (Layout::finish_dynamic_section): Implement
10184 --warn-shared-textrel.
10187 * options.h (class General_options): Add --warn-multiple-gp.
10189 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10191 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10192 $(THREADSLIB) and $(LIBDL).
10193 * Makefile.in: Rebuild.
10195 2010-01-06 Ian Lance Taylor <iant@google.com>
10198 * options.cc (General_options::parse_section_start): New function.
10199 (General_options::section_start): New function.
10200 (General_options::General_options): Initialize all members.
10201 * options.h: Include <map>
10202 (class General_options): Add --section-start. Add section_starts_
10204 * layout.cc (Layout::attach_allocated_section_to_segment): If
10205 --section-start was used, set the address of the segment. Remove
10206 local sort_sections.
10207 (Layout::relaxation_loop_body): If the address of the load segment
10208 has been set by --section-start, don't use it.
10209 * output.h (Output_segment::update_flags_for_output_section): New
10211 * output.cc (Output_segment::add_output_section): Call
10212 update_flags_for_output_section.
10214 2010-01-05 Ian Lance Taylor <iant@google.com>
10217 * options.h (class General_options): Add --undefined-version.
10218 * script.cc (struct Version_expression): Add was_matched_by_symbol
10220 (Version_script_info::matched_symbol): New function.
10221 (Version_script_info::get_symbol_version_helper): Call
10223 (Version_script_info::check_unmatched_names): New function.
10224 * script.h (class Version_script_info): Update declarations.
10225 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10227 * options.h (class General_options): Use DEFINE_bool_alias for
10228 allow_multiple_definition.
10229 * resolve.cc (Symbol_table::should_override): Don't test
10230 allow_multiple_definition.
10233 * options.h (class General_options): Add --cref.
10234 * main.cc (main): Print cref table if --cref. Don't close mapfile
10235 until after printing cref table.
10236 * cref.cc: Include "symtab.h".
10237 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10238 (Cref_table_compare::operator()): New function.
10239 (Cref_inputs::gather_cref): New function.
10240 (filecol): New static const.
10241 (Cref_inputs::print_cref): New function.
10242 (Cref::print_cref): New function.
10243 * cref.h: Include <cstdio>.
10244 (class Cref): Update declarations.
10245 * mapfile.h (Mapfile::file): New function.
10246 * object.h (class Object): Define Symbols. Declare virtual
10247 do_get_global_symbols.
10248 (Object::get_global_symbols): New function.
10249 * object.cc (Input_objects::add_object): Pass object to cref_ if
10251 (Input_objects::archive_start): Likewise.
10252 (Input_objects::archive_stop): Likewise.
10253 (Input_objects::print_cref): New function.
10254 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10255 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10257 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10259 * plugin.h (class Sized_pluginobj): Update declarations.
10261 2010-01-05 Ian Lance Taylor <iant@google.com>
10263 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10264 to is_default_version. Rename insdef to insdefault.
10265 (Symbol_table::add_from_relobj): Rename def to is_default_version
10266 and local to is_forced_local.
10267 (Symbol_table::add_from_pluginobj): Likewise.
10268 (Symbol_table::add_from_dynobj): Likewise.
10269 (Symbol_table::define_special_symbol): Rename insdef to
10272 2010-01-04 Ian Lance Taylor <iant@google.com>
10275 * options.h (class General_options): Add
10276 --allow-multiple-definition and -z muldefs.
10277 * resolve.cc (Symbol_table::should_override): Don't warn about a
10278 multiple symbol definition if --allow-multiple-definition or -z
10282 * options.h (class General_options): Add --add-needed and
10283 --copy-dt-needed-entries. Tweak --as-needed help entry.
10284 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10285 error if --copy-dt-needed-entries aka --add-needed is used and
10286 would cause a change in behaviour.
10289 * options.h (class General_options): Add -G as a short version of
10290 --shared. Add no-op options -assert, -g, and -i.
10292 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10294 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10295 check for .text or .gnu.linkonce.t sections.
10296 * icf.cc (Icf::find_identical_sections): Ditto.
10297 Change the detection for mangled function name within the section
10299 * icf.h (is_section_foldable_candidate): New function.
10301 2009-12-30 Ian Lance Taylor <iant@google.com>
10304 * options.h (class General_options): Permit two dashes with
10305 --retain-symbols-file.
10307 2009-12-30 Ian Lance Taylor <iant@google.com>
10310 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10311 don't put the file header and segment headers in the text
10315 * common.cc (Sort_commons::operator()): Stabilize sort when both
10317 (Symbol_table::do_allocate_commons_list): When allocating common
10318 symbols, skip a symbol which is no longer common.
10319 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10320 an object before checking its type.
10321 * testsuite/common_test_2.c: New file.
10322 * testsuite/common_test_3.c: New file.
10323 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10324 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10325 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10326 (common_test_2_pic.o, common_test_2.so): New targets.
10327 (common_test_3_pic.o, common_test_3.so): New targets.
10328 * testsuite/Makefile.in: Rebuild.
10331 * script.cc (read_input_script): If we see a new SECTIONS clause,
10332 and we have added an input section, give an error.
10333 * layout.h (class Layout): Add have_added_input_section function.
10334 Add have_added_input_section_ field.
10335 * layout.cc (Layout::Layout): Initialize
10336 have_added_input_section_.
10337 (Layout::layout): Set have_added_input_section_.
10338 (Layout::layout_eh_frame): Likewise.
10340 2009-12-30 Ian Lance Taylor <iant@google.com>
10343 * options.h (class General_options): Add --sort-common option.
10344 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10345 * common.cc (Sort_common): Add sort_order parameter to
10346 constructor. Add sort_order_ field.
10347 (Sort_commons::operator): Check sort_order_.
10348 (Symbol_table::allocate_commons): Determine the sort order.
10349 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10350 Change all callers.
10351 (Symbol_table::do_allocate_commons_list): Likewise.
10353 2009-12-30 Ian Lance Taylor <iant@google.com>
10356 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10357 symbols from this object, don't change the visibility of an
10359 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10361 2009-12-30 Ian Lance Taylor <iant@google.com>
10364 * script.h (class Version_script_info): Define Language enum.
10365 Update declarations. Define Glob, Exact, and Lookup types. Add
10366 new fields globals_, locals_, and is_finalized_.
10367 * script.cc: Various formatting fixes.
10368 (class Parser_closure): Change language_stack_ from a vector of
10369 std::string to one of Version_script_info::Language. Adjust all
10371 (class Lazy_demangler): Remove.
10372 (struct Version_expression): Change language from std::string to
10373 Version_script_info::Language.
10374 (Version_script_info::Version_script_info): New function.
10375 (Version_script_info::~Version_script_info): Don't call clear.
10376 (Version_script_info::finalize): New function.
10377 (Version_script_info::build_lookup_tables): New function.
10378 (Version_script_info::build_expression_list_lookup): New
10380 (Version_script_info::get_symbol_version_helper): Rewrite to use
10382 (Version_script_info::print_expression_list): Adjust to use
10383 Version_script_info::Language.
10384 (script_push_lex_into_version_mode): Check that the version script
10385 has not been finalized.
10386 (version_script_push_lang): Change language string to
10387 Version_script_info::Language.
10388 * options.cc (Command_line::version_script): New function.
10389 * options.h (class General_options): Add finalize_dynamic_list
10390 function. Change version_script from declaration to definition.
10391 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10392 * testsuite/version_script.map: Remove duplicate def of foo.
10393 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10394 version_script.map.
10395 * testsuite/Makefile.in: Rebuild.
10397 2009-12-30 Ian Lance Taylor <iant@google.com>
10400 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10401 if the input symbol index is 0, make the output symbol index 0.
10403 2009-12-30 Ian Lance Taylor <iant@google.com>
10406 * options.h (class General_options): Add -x/--discard-all.
10407 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10408 --discard-all. If the local symbol needs a dynamic entry, check
10409 that before handling --discard-locals.
10411 2009-12-30 Ian Lance Taylor <iant@google.com>
10414 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10416 (Output_segment::add_output_section): Don't change the flags if
10417 the type is PT_TLS.
10420 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10421 GNU hash table if they need a dynamic value. Otherwise, don't add
10422 them if they are defined in a dynamic object or are forced local.
10424 2009-12-29 Ian Lance Taylor <iant@google.com>
10427 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10428 .gnu.hash table for a 32-bit target.
10431 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10432 regular and a dynamic object only needs a dynamic symbol table
10433 entry if it is externally visible.
10436 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10437 constructor. Add global_offset_table_ field.
10438 (Target_i386::got_section): Set global_offset_table_.
10439 (Target_i386::do_finalize_sections): Set global_offset_table_
10441 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10442 in constructor. Add global_offset_table_ field.
10443 (Target_x86_64::got_section): Set global_offset_table_.
10444 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10447 * layout.cc (Layout::Layout): Initialize increase_relro_.
10448 (Layout::get_output_section): Add is_relro, is_last_relro, and
10449 is_first_non_relro parameters. Change all callers.
10450 (Layout::choose_output_section): Likewise.
10451 (Layout::add_output_section_data): Likewise.
10452 (Layout::make_output_section): Likewise.
10453 (Layout::set_segment_offsets): Clear increase_relro when using a
10455 * layout.h (class Layout): Add increase_relro method. Add
10456 increase_relro_ field. Update declarations.
10457 * output.cc (Output_section::Output_section): Initialize
10458 is_last_relro_ and is_first_non_relro_.
10459 (Output_segment::add_output_section): Group relro sections is
10460 do_sort is true. Handle is_last_relro and is_first_non_relro.
10461 (Output_segment::maximum_alignment): Remove relro handling.
10462 (Output_segment::set_section_addresses): Add increase_relro
10463 parameter. Change all callers. Add initial alignment to align
10464 relro sections on separate page. Remove old relro handling.
10465 (Output_segment::set_section_list_addresses): Remove in_relro
10466 parameter. Change all callers.
10467 (Output_segment::set_offset): Add increase parameter. Change all
10468 callers. Remove old relro handling.
10469 * output.h (class Output_section): Add new methods: is_last_relro,
10470 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10471 Add is_last_relro_ and is_first_non_relro_ fields.
10472 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10473 Create separate .got.plt section. Call increase_relro.
10474 * x86_64.cc (Target_x86_64::got_section): Likewise.
10475 * testsuite/relro_script_test.t: Add .got.plt.
10478 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10479 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10480 (Layout::finalize): Call set_dynamic_symbol_size.
10481 (Layout::set_dynamic_symbol_size): New function.
10482 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10483 set_dynamic_symbol_size.
10486 * output.h (class Output_section): Add is_entsize_zero_ field.
10487 * output.cc (Output_section::Output_section): Initialize
10489 (Output_section::set_entsize): If two different entsizes are
10490 requested, force it to zero.
10491 (Output_section::add_input_section): Set flags for .debug_str
10492 before updating section flags. Set entsize.
10493 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10494 and SHF_STRING if all input sections have those flags.
10496 2009-12-29 Rafael Espindola <espindola@google.com>
10498 * main.cc (main): Fix the sys time reporting.
10499 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10502 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10504 * options.cc (General_options::parse_version): Allow -v to exit
10505 without an error if there is nothing to link.
10507 2009-12-29 Ian Lance Taylor <iant@google.com>
10509 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10510 using a version of gcc before 4.1.
10511 * configure: Rebuild.
10513 2009-12-28 Chris Demetriou <cgd@google.com>
10515 * attributes.cc (Output_attributes_section_data::do_write): Use
10516 std::vector::front rather than std::vector::data.
10518 2009-12-28 Ian Lance Taylor <iant@google.com>
10520 * symtab.h (class Symbol_table): Add enum Defined.
10521 * resolve.cc (Symbol_table::should_override): Add defined
10522 parameter. Change all callers. Test whether object is NULL
10523 before calling a method on it.
10524 (Symbol_table::report_resolve_problem): Add defined parameter.
10525 Change all callers.
10526 (Symbol_table::should_override_with_special): Likewise.
10527 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10528 parameter. Change all callers.
10529 (Symbol_table::do_define_in_output_data): Likewise.
10530 (Symbol_table::define_in_output_segment): Likewise.
10531 (Symbol_table::do_define_in_output_segment): Likewise.
10532 (Symbol_table::define_as_constant): Likewise.
10533 (Symbol_table::do_define_as_constant): Likewise.
10534 * script.h (class Symbol_assignment): Add is_defsym parameter to
10535 constructor; change all callers.
10536 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10537 parameter. Change all callers. Add is_defsym_ field.
10538 (class Parser_closure): Add parsing_defsym parameter to
10539 constructor; change all callers. Add parsing_defsym accessor
10540 function. Add parsing_defsym_ field.
10542 2009-12-28 Ian Lance Taylor <iant@google.com>
10544 * gold.cc (queue_middle_tasks): Fix formatting.
10545 * object.cc (Relobj::is_section_name_included): Likewise.
10547 2009-12-23 Ian Lance Taylor <iant@google.com>
10549 * i386.cc (Target_i386::do_calls_non_split): Recognize
10550 -fsplit-stack prologue for a function with a static chain.
10551 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10552 -fsplit-stack prologue when using %r11.
10554 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10556 * options.cc (General_options::parse_version): Make -v continue and do
10557 the link like GNU ld does.
10559 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10561 * Makefile.am (CCFILES): Add timer.cc.
10562 (HFILES): Add timer.h.
10563 * configure.ac: Check for sysconf and times.
10564 * main.cc: include timer.h.
10565 (main): Use Timer instead of get_run_time.
10568 * workqueue.cc: include timer.h.
10569 (Workqueue::find_and_run_task):
10570 Report user, sys and wall time.
10571 * Makefile.in: Regenerate.
10572 * config.in: Regenerate.
10573 * configure: Regenerate.
10575 2009-12-16 Doug Kwan <dougkwan@google.com>
10577 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10579 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10580 relaxed input sections.
10581 * output.cc (Output_section::find_relaxed_input_section): Change
10582 return type to Output_relaxed_input_section pointer. Adjust code
10583 for new type of relaxed_input_section_map_.
10584 * output.h (Output_section::find_relaxed_input_section): Change
10585 return type to Output_relaxed_input_section pointer.
10586 (Output_section::Output_relaxed_input_section_by_input_section_map):
10588 (Output_section::relaxed_input_section_map_): Change type to
10589 Output_section::Output_relaxed_input_section_by_input_section_map.
10590 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10593 2009-12-15 Ian Lance Taylor <iant@google.com>
10595 * layout.cc (Layout::create_shstrtab): Only write out after input
10596 sections if we are compressing debug sections.
10598 2009-12-15 Ian Lance Taylor <iant@google.com>
10600 * archive.cc (Archive::add_symbols): Only look up a symbol without
10601 a version if there is, in fact, a version.
10603 2009-12-14 Ian Lance Taylor <iant@google.com>
10605 Revert -Wshadow changes, all changes from:
10606 2009-12-11 Doug Kwan <dougkwan@google.com>
10607 2009-12-11 Nick Clifton <nickc@redhat.com>
10608 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10610 2009-12-11 Doug Kwan <dougkwan@google.com>
10612 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10614 * attributes.cc (Object_attribute::size): Ditto.
10615 (Attributes_section_data::size): Ditto.
10616 (Attributes_section_data::Attributes_section_data): Ditto.
10617 (Output_attributes_section_data::do_write): Ditto.
10618 * attributes.h (Object_attribute::set_type): Ditto.
10619 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10621 2009-12-11 Nick Clifton <nickc@redhat.com>
10623 * archive.cc: Fix shadowed variable warnings.
10624 * arm.cc: Likewise.
10625 * compressed_output.cc: Likewise.
10626 * compressed_output.h: Likewise.
10627 * configure: Likewise.
10628 * dwarf_reader.cc: Likewise.
10629 * dynobj.cc: Likewise.
10630 * dynobj.h: Likewise.
10631 * ehframe.cc: Likewise.
10632 * ehframe.h: Likewise.
10633 * errors.cc: Likewise.
10634 * expression.cc: Likewise.
10635 * fileread.cc: Likewise.
10636 * fileread.h: Likewise.
10637 * freebsd.h: Likewise.
10638 * i386.cc: Likewise.
10639 * icf.cc: Likewise.
10640 * incremental.h: Likewise.
10641 * layout.cc: Likewise.
10642 * layout.h: Likewise.
10643 * mapfile.cc: Likewise.
10644 * merge.cc: Likewise.
10645 * merge.h: Likewise.
10646 * object.cc: Likewise.
10647 * object.h: Likewise.
10648 * options.h: Likewise.
10649 * output.cc: Likewise.
10650 * output.h: Likewise.
10651 * parameters.cc: Likewise.
10652 * plugin.cc: Likewise.
10653 * powerpc.cc: Likewise.
10654 * reduced_debug_output.cc: Likewise.
10655 * reduced_debug_output.h: Likewise.
10656 * reloc.cc: Likewise.
10657 * reloc.h: Likewise.
10658 * resolve.cc: Likewise.
10659 * script-sections.cc: Likewise.
10660 * script.cc: Likewise.
10661 * script.h: Likewise.
10662 * sparc.cc: Likewise.
10663 * symtab.cc: Likewise.
10664 * symtab.h: Likewise.
10665 * target-select.cc: Likewise.
10666 * target-select.h: Likewise.
10667 * token.h: Likewise.
10668 * workqueue.cc: Likewise.
10669 * workqueue.h: Likewise.
10670 * x86_64.cc: Likewise.
10672 2009-12-10 Doug Kwan <dougkwan@google.com>
10674 * arm.cc (attributes.h): New include.
10675 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10676 (Arm_relobj::~Arm_relobj): Delete object pointed by
10677 attributes_section_data_.
10678 (Arm_relobj::attributes_section_data): New method definition.
10679 (Arm_relobj::attributes_section_data_): New data member declaration.
10680 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10681 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10682 attributes_section_data_.
10683 (Arm_dynobj::attributes_section_data): New method definition.
10684 (Arm_dynobj::attributes_section_data_): New data member declaration.
10685 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10686 initialization value of may_use_blx_ to false.
10687 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10688 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10689 object attributes to compute results instead of hard-coding.
10690 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10691 Target_arm::get_secondary_compatible_arch,
10692 Target_arm::set_secondary_compatible_arch
10693 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10694 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10695 New method declarations.
10696 (Target_arm::get_aeabi_object_attribute): New method definition.
10697 (Target_arm::attributes_section_data_): New data member declaration.
10698 (read_arm_attributes_section): New template definition.
10699 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10700 (Arm_dynobj::do_read_symbols): Ditto.
10701 (Target_arm::do_finalize_sections): Merge attributes sections from
10702 input. Check for BLX use after attributes section merging.
10703 Fix __exidx_start and __exidx_end visibility. Create an
10704 .ARM.attributes section if necessary.
10705 (Target_arm::get_secondary_compatible_arch,
10706 Target_arm::set_secondary_compatible_arch,
10707 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10708 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10709 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10710 New method definitions.
10712 2009-12-09 Ian Lance Taylor <iant@google.com>
10714 * plugin.cc (Plugin::load): Don't cast from void* to a function
10717 2009-12-09 Ian Lance Taylor <iant@google.com>
10719 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10720 information fields.
10722 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10724 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10725 Replace two_file_shared_1.so with two_file_shared_2.so.
10726 * testsuite/Makefile.in: Regenerated.
10728 2009-12-08 Doug Kwan <dougkwan@google.com>
10730 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10731 (HFILES): Add attributes.h and int_encoding.h.
10732 * Makefile.in: Regenerate.
10733 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10734 function definitions to int_encoding.cc
10735 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10736 prototypes to int_encoding.h
10737 * reduced_debug_output.cc (int_encoding.h): New include.
10738 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10739 function definitions to int_encoding.cc
10740 (insert_into_vector, read_from_pointer): Move template definitions to
10742 * attributes.cc: New file.
10743 * attributes.h: New file.
10744 * int_encoding.cc: New file.
10745 * int_encoding.h: New file.
10747 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10750 * incremental-dump.cc (dump_incremental_inputs): New.
10751 (main): Use dump_incremental_inputs.
10753 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10756 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10757 checking elfcpp::STT_FUNC.
10758 (Target_i386::Relocate::relocate): Likewise.
10759 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10761 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10762 symbols from shared libraries into normal FUNC symbols.
10764 * symtab.h (Symbol): Add is_func and use it.
10766 2009-12-05 Doug Kwan <dougkwan@google.com>
10768 * arm.cc (Target_arm::arm_info): Initialize new fields
10769 attributes_section and attributes_vendor.
10770 * i386.cc (Target_i386::i386_info): Same.
10771 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10772 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10773 fields attributes_section and attributes_vendor.
10774 * sparc.cc (Target_sparc::sparc_info): Same.
10775 * target.h (Target::attributes_section, Target::attributes_vendor,
10776 Target::is_attributes_section, Target::attribute_arg_type,
10777 Target::attributes_order): New method definitions.
10778 (Target::Target_info::attributes_section,
10779 Target::Target_info::attributes_vendor): New fields.
10780 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10781 virtual method definitions.
10782 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10783 attributes_section and attributes_vendor.
10784 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10786 2009-12-05 Doug Kwan <dougkwan@google.com>
10788 * arm.cc: Update comments about interworking and stub generation.
10789 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10790 considered as non-PIC.
10791 (Arm_relocate_functions::base_abs): Fix formatting.
10792 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10793 of function to use GOT entry address instead of offset.
10794 (Target_arm::Scan::global): Issue an error if a symbol would need a
10795 PLT does not get one because it is untyped. Remove code to create
10796 dynamic symbols for relative branches.
10797 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10798 takes unsigned integer instead of boolean.
10800 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10802 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10803 (two_file_test_LDADD): Likewise.
10804 (common_test_1_LDADD): Likewise.
10805 (exception_test_LDADD) Likewise.
10806 (weak_test_LDADD): Likewise.
10807 (many_sections_test_LDADD): Likewise.
10808 (initpri1_LDADD): Likewise.
10809 (script_test_1_LDADD): Likewise.
10810 (script_test_2_LDADD): Likewise.
10811 (justsyms_LDADD): Likewise.
10812 (binary_test_LDADD): Likewise.
10813 (large_LDADD): Likewise.
10814 * testsuite/Makefile.in: Regenerated.
10816 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10818 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10819 (Symbol_table::override_with_special): Likewise.
10820 (Symbol_table::add_from_object): Likewise.
10822 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10824 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10825 Don't set the data_offset twice.
10827 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10829 * testsuite/Makefile.in: Regenerate.
10831 2009-12-03 Doug Kwan <dougkwan@google.com>
10833 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10834 (Target_arm::do_finalize_sections): Add parameter for symbol table
10835 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10836 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10837 parameter for symbol table pointer.
10838 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10839 an additional parameter for a pointer to symbol table.
10840 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10841 parameter for a symbol table pointer.
10842 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10843 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10845 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10846 parameter for a symbol table pointer.
10848 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10850 * incremental.cc (Incremental_inputs_header)
10851 (Incremental_inputs_header_write, Incremental_inputs_entry)
10852 (Incremental_inputs_entry_write): Move ...
10853 * incremental.h (Incremental_inputs_header)
10854 (Incremental_inputs_header_write, Incremental_inputs_entry)
10855 (Incremental_inputs_entry_write): here.
10857 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10859 * incremental.cc (make_sized_incremental_binary): Set the target.
10860 Error if it is incompatible.
10861 * output.h (Output_file): Add filename method.
10863 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10865 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10866 from the get_* methods.
10868 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10870 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10871 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10872 Write 0 for the data_offset of scripts.
10874 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10876 * testsuite/Makefile.am: Add the incremental_test.sh test.
10877 * testsuite/incremental_test.sh: New.
10878 * testsuite/incremental_test_1.c: New.
10879 * testsuite/incremental_test_2.c: New.
10881 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10883 * incremental-dump.cc (main): Fix typos.
10885 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10888 * incremental-dump.cc (main): Use llu to print 64 bit values.
10890 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10891 H.J. Lu <hongjiu.lu@intel.com>
10893 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10895 (incremental_dump_LDADD): Likewise.
10896 * Makefile.in: Regenerated.
10898 2009-11-25 Doug Kwan <dougkwan@google.com>
10902 2009-11-25 Doug Kwan <dougkwan@google.com>
10904 * arm.cc (Target_arm::Target_arm): Move method definition
10905 outside of class definition. Add code to handle
10906 --target1-rel, --target1-abs and --target2= options.
10907 (Target_arm::get_reloc_reloc_type): Change method to be
10908 non-static and const.
10909 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10910 New data member declaration.
10911 (Target_arm::Scan::local, Target_arm::Scan::global,
10912 Target_arm::Relocate::relocate,
10913 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10914 Adjust call to Target_arm::get_real_reloc_type.
10915 (Target_arm::get_real_reloc_type): Use command line options
10916 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10917 * options.h (--target1-rel, --target1-abs, --target2): New
10920 2009-11-25 Doug Kwan <dougkwan@google.com>
10922 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10923 class definition. Add code to handle --target1-rel, --target1-abs
10924 and --target2= options.
10925 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10927 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10928 member declaration.
10929 (Target_arm::Scan::local, Target_arm::Scan::global,
10930 Target_arm::Relocate::relocate,
10931 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10932 call to Target_arm::get_real_reloc_type.
10933 (Target_arm::get_real_reloc_type): Use command line options to
10934 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10935 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10938 2009-11-25 Doug Kwan <dougkwan@google.com>
10940 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10941 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10942 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10944 (Arm_relocate_functions::thm_call): Replace body with a call to
10945 Arm_relocate_functions::thumb_branch_common.
10946 (Arm_relocate_functions::thm_jump24,
10947 Arm_relocate_functions::thm_xpc22): New method definitions.
10948 (Arm_relocate_functions::thumb_branch_common): New method definition.
10949 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10951 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10952 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10954 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10956 * Makefile.am: Build incremental-dump
10957 * Makefile.in: Regenerate.
10958 * incremental-dump.cc: New.
10959 * incremental.cc (Incremental_inputs_header_data,
10960 Incremental_inputs_entry_data): Move to incremental.h
10961 * incremental.h: (Incremental_inputs_header_data,
10962 Incremental_inputs_entry_data): Move from incremental.cc
10964 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10966 * incremental.cc (Incremental_inputs_header,
10967 Incremental_inputs_header_write, Incremental_inputs_entry,
10968 Incremental_inputs_entry_write): Add a typedef with the data type.
10970 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10972 * incremental.cc (Incremental_inputs_header,
10973 Incremental_inputs_header_write, Incremental_inputs_entry,
10974 Incremental_inputs_entry_write): Update comment about which
10975 type has the filed descriptions.
10977 2009-11-15 Doug Kwan <dougkwan@google.com>
10979 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10980 (Arm_relocate_functions::arm_branch_common): Change method defintion
10981 in class definition to a method declaration and update list of formal
10983 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10984 Arm_relocation_functions::jump24): Adjust call to
10985 Arm_relocate_functions::arm_branch_common. Update list of formal
10987 (Arm_relocate_functions::xpc25): New method definition.
10988 (Arm_relocate_functions::arm_branch_common): Move method defintion
10989 out from class definition. Use stubs for mode-switching and extending
10991 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10992 specially. Change code to enable use of stubs in ARM branches.
10994 2009-11-10 Doug Kwan <dougkwan@google.com>
10996 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10997 in method declaration.
10998 (Target_arm::relocate_stub): New method declaration.
10999 (Target_arm::default_target): Change to return a pointer instead of
11001 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11002 Target_arm::default_target.
11003 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11005 (Target_arm::relocate_section): Adjust view.
11006 (Target_arm::relocate_stub): New method definition.
11008 2009-11-10 Doug Kwan <dougkwan@google.com>
11010 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11012 * incremental.cc (open_incremental_binary): Initialized local
11013 variables to avoid warnings.
11014 * object.cc (make_elf_object): Ditto.
11015 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11018 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11021 * testsuite/plugin_test.c: Include "config.h".
11023 2009-11-09 Doug Kwan <dougkwan@google.com>
11025 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11026 (arm_symbol_value): Remove.
11027 (Arm_relocate_functions::arm_branch_common,
11028 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11029 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11030 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11031 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11032 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11033 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11034 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11035 Arm_relocate_functions::thm_mobw_abs_nc,
11036 Arm_relocate_functions::thm_mov_abs,
11037 Arm_relocate_functions::movw_prel_nc,
11038 Arm_relocate_functions::thm_movt_abs,
11039 Arm_relocate_functions::movt_prel,
11040 Arm_relocate_functions::thm_movw_prel_nc,
11041 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11042 (Target_arm::Relocate::relocate): Only decompose address into two
11043 parts if relocation type uses the thumb-bit and pass the actual
11044 bit instead of a flag indicating that the thumb-bit is used. Adjust
11045 calls to methods in Arm_relocate_functions for this change.
11047 2009-11-08 Ian Lance Taylor <iant@google.com>
11050 * reloc.cc: Instantiate
11051 Sized_relobj::initialize_input_to_output_maps and
11052 Sized_relobj:free_input_to_output_maps.
11054 2009-11-06 Ian Lance Taylor <iant@google.com>
11057 * defstd.cc (in_segment): Set only_if_ref true for "end".
11059 2009-11-06 Doug Kwan <dougkwan@google.com>
11061 * arm.cc (class Reloc_stub): Correct a comment.
11062 (Target_arm::Target_arm): Initialize arm_input_section_map_.
11063 (Target_arm::scan_section_for_stubs): New method declaration.
11064 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11065 Change methods from private to protected.
11066 (Target_arm::do_may_relax): New method definition.
11067 (Target_arm::do_relax, Target_arm::group_sections,
11068 Target_arm::scan_reloc_for_stub,
11069 Target_arm::scan_reloc_section_for_stubs): New method declarations.
11070 (Target_arm::arm_input_section_map_): New data member declaration.
11071 (Target_arm::scan_reloc_for_stub,
11072 Target_arm::scan_reloc_section_for_stubs,
11073 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11074 Target_arm::do_relax): New method definitions.
11076 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
11078 * configure.ac: Check for (struct stat)::st_mtim
11079 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11080 * config.in: Regenerate.
11081 * configure: Regenerate.
11083 2009-11-05 Ian Lance Taylor <iant@google.com>
11086 * output.cc (Output_segment::add_output_section): Add missing
11089 2009-11-04 Ian Lance Taylor <iant@google.com>
11092 * object.h (class Object): Add is_needed and set_is_needed
11093 methods. Add is_needed_ field. Make bool fields into bitfields.
11094 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11095 defined in a dynamic object and referenced by a regular object,
11096 set is_needed for the dynamic object.
11097 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11098 if the file is marked with as_needed and it is not needed.
11100 2009-11-04 Ian Lance Taylor <iant@google.com>
11103 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11104 tags if data is discarded by linker script.
11105 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11106 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11107 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11108 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11110 2009-11-04 Ian Lance Taylor <iant@google.com>
11112 * layout.cc (Layout::get_output_section): Add is_interp and
11113 is_dynamic_linker_section parameters. Change all callers.
11114 (Layout::choose_output_section): Likewise.
11115 (Layout::make_output_section): Likewise.
11116 (Layout::add_output_section_data): Add is_dynamic_linker_section
11117 parameter. Change all callers.
11118 * layout.h (class Layout): Update declarations.
11119 * output.h (class Output_section): Add is_interp, set_is_interp,
11120 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11121 Add is_interp_, is_dynamic_linker_section_ fields. Change
11122 generate_code_fills_at_write_ to a bitfield.
11123 * output.cc (Output_section::Output_sections): Initialize new
11125 (Output_segment::add_output_section): Add do_sort parameter.
11126 Change all callers.
11128 2009-11-03 Ian Lance Taylor <iant@google.com>
11131 * options.h (class General_options): Add --warn-common.
11132 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11133 merging two common symbols.
11134 (Symbol_table::should_override): Handle --warn-common when merging
11135 a common symbol with a defined symbol. Use report_resolve_problem
11136 for multiple definitions.
11137 (Symbol_table::report_resolve_problem): New function.
11138 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11140 2009-11-03 Doug Kwan <dougkwan@google.com>
11142 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11144 (Target_arm::stub_factory): New method definition.
11145 (Target_arm::new_arm_input_section,
11146 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11147 Target_arm::reloc_uses_thumb_bit): New method declarations.
11148 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11149 New type definitions.
11150 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11151 member declarations.
11152 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11153 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11154 New method definitions.
11156 2009-11-03 Ian Lance Taylor <iant@google.com>
11158 * options.h (class General_options): Add --warn_constructors.
11160 2009-11-03 Ian Lance Taylor <iant@google.com>
11163 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11164 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11166 2009-11-03 Ian Lance Taylor <iant@google.com>
11169 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11170 --msgid-bugs-address.
11171 (install-pdf): New target.
11172 (install-data_yes): Look up one directory to find mkinstalldirs.
11174 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11176 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11179 2009-10-30 Doug Kwan <dougkwan@google.com>
11181 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11183 2009-10-30 Doug Kwan <dougkwan@google.com>
11185 * arm.cc (Stub_addend_reader): New struct template definition
11186 and partial specializations.
11187 (Stub_addend_reader::operator()): New method definition for a
11188 partially specialized template.
11190 2009-10-30 Doug Kwan <dougkwan@google.com>
11192 * arm.cc (Arm_relobj::processor_specific_flags): New method
11194 (Arm_relobj::do_read_symbols): New method declaration.
11195 (Arm_relobj::processor_specific_flags_): New data member declaration.
11196 (Arm_dynobj): New class definition.
11197 (Target_arm::do_finalize_sections): Add input_objects parameter.
11198 (Target_arm::do_adjust_elf_header): New method declaration.
11199 (Target_arm::are_eabi_versions_compatible,
11200 (Target_arm::merge_processor_specific_flags): New method declaration.
11201 (Target_arm::do_make_elf_object): New overloaded method definitions
11203 (Arm_relobj::do_read_symbols): New method definition.
11204 (Arm_dynobj::do_read_symbols): Ditto.
11205 (Target_arm::do_finalize_sections): Add input_objects parameters.
11206 Merge processor-specific flags from all input objects.
11207 (Target_arm::are_eabi_versions_compatible,
11208 Target_arm::merge_processor_specific_flags,
11209 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11210 New method definitions.
11211 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11212 Input_objects pointer type parameter.
11213 * layout.cc (Layout::finalize): Pass input objects to target's.
11214 finalize_sections function.
11215 * output.cc (Output_file_header::do_sized_write): Set ELF file
11216 header's processor-specific flags.
11217 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11218 Input_objects pointer type parameter.
11219 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11220 * target.h (Input_objects): New forward class declaration.
11221 (Target::processor_specific_flags,
11222 Target::are_processor_specific_flags_sect): New method definitions.
11223 (Target::finalize_sections): Add input_objects parameter.
11224 (Target::Target): Initialize processor_specific_flags_ and
11225 are_processor_specific_flags_set_.
11226 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11228 (Target::set_processor_specific_flags): New method definition.
11229 (Target::processor_specific_flags_,
11230 Target::are_processor_specific_flags_set_): New data member
11232 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11233 Input_objects pointer type parameter.
11235 2009-10-30 Doug Kwan <dougkwan@google.com>
11237 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11239 2009-10-28 Ian Lance Taylor <iant@google.com>
11241 * object.h (class Relobj): Drop options parameter from
11242 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11243 do_scan_relocs, do_relocate. Change all callers.
11244 (class Sized_relobj): Drop options parameters from
11245 do_gc_process_relocs, do_scan_relocs, do_relocate,
11246 do_relocate_sections, relocate_sections, emit_relocs_scan,
11247 emit_relocs_scan_reltype. Change all callers.
11248 (struct Relocate_info): Remove options field and all references to
11250 * reloc.h (class Read_relocs): Remove options constructor
11251 parameter and options_ field. Change all callers.
11252 (class Gc_process_relocs, class Scan_relocs): Likewise.
11253 (class Relocate_task): Likewise.
11254 * target-reloc.h (scan_relocs): Remove options parameter. Change
11256 (scan_relocatable_relocs): Likewise.
11257 * target.h (class Sized_target): Remove options parameter from
11258 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11260 * gc.h (gc_process_relocs): Remove options parameter. Change all
11262 * arm.cc: Update functions to remove options parameters.
11263 * i386.cc: Likewise.
11264 * powerpc.cc: Likewise.
11265 * sparc.cc: Likewise.
11266 * x86_64.cc: Likewise.
11267 * testsuite/testfile.cc: Likewise.
11269 2009-10-28 Doug Kwan <dougkwan@google.com>
11271 * arm.cc (Arm_relobj): New class definition.
11272 (Arm_relobj::scan_sections_for_stubs,
11273 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11274 New method definitions.
11276 2009-10-28 Cary Coutant <ccoutant@google.com>
11278 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11279 (Plugin::cleanup_done_): New member.
11280 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11281 (Plugin_manager::cleanup_done_): Remove.
11282 (Plugin_manager::add_input_file): Edit error message.
11283 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11284 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11286 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11288 * fileread.cc: (File_read::View::~View): Use the new
11289 data_ownership_ filed.
11290 (File_read::~File_read): Dispose the new whole_file_view_.
11291 (File_read::open): Mmap the whole file if needed.
11292 (File_read::open): Use whole_file_view_ instead of contents_.
11293 (File_read::find_view): Use whole_file_view_ if applicable.
11294 (File_read::do_read): Use whole_file_view_ instead of contents_.
11295 (File_read::make_view): Use whole_file_view_ instead of contents_,
11296 update File_read::View::View call.
11297 (File_read::find_or_make_view): Update File_read::View::View
11299 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11301 (File_read::View::Data_ownership): New enum.
11302 (File_read::View::View): Replace bool mapped_ with Data_ownership
11304 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11305 (File_read::View::data_ownership_): New field.
11306 (File_read::contents_): Remove (replaced by whole_file_view_).
11307 (File_read::whole_file_view_): New field.
11308 * options.h (class General_options): Add --keep-files-mapped.
11310 2009-10-27 Cary Coutant <ccoutant@google.com>
11312 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11313 * testsuite/Makefile.am (plugin_test_5): New test case.
11314 * testsuite/Makefile.in: Regenerate.
11316 2009-10-25 Doug Kwan <dougkwan@google.com>
11318 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11319 from private to protected to allow access by child class.
11320 (Sized_relobj::do_relocate_sections): New method declaration.
11321 (Sized_relobj::relocate_sections): Virtualize.
11322 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11323 Sized_relobj::relocate_sections. Instantiate template explicitly
11324 for different target sizes and endianity.
11326 2009-10-24 Doug Kwan <dougkwan@google.com>
11328 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11329 (Arm_input_section::as_arm_input_section): New method.
11330 (Arm_output_section): New class definition.
11331 (Arm_output_section::create_stub_group,
11332 Arm_output_section::group_sections): New method definitions.
11334 2009-10-22 Doug Kwan <dougkwan@google.com>
11336 * arm.cc (Arm_input_section): New class definition.
11337 (Arm_input_section::init, Arm_input_section:do_write,
11338 Arm_input_section::set_final_data_size,
11339 Arm_input_section::do_reset_address_and_file_offset): New method
11342 2009-10-21 Doug Kwan <dougkwan@google.com>
11344 * arm.cc (Stub_table, Arm_input_section): New forward class
11346 (Stub_table): New class defintion.
11347 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11348 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11349 New method definition.
11351 2009-10-21 Doug Kwan <dougkwan@google.com>
11353 * arm.cc: Update copyright comments.
11354 (Target_arm): New forward class template declaration.
11355 (Arm_address): New type.
11356 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11357 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11358 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11360 (Insn_template): Same.
11361 (DEF_STUBS): New macro.
11362 (Stub_type): New enum type.
11363 (Stub_template): New class definition.
11365 (Reloc_stub): Same.
11366 (Stub_factory): Same.
11367 (Target_arm::Target_arm): Initialize may_use_blx_ and
11368 should_force_pic_veneer_.
11369 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11370 Target_arm::should_force_pic_veneer,
11371 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11372 Target_arm::using_thumb_only, Target_arm:;default_target): New
11374 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11375 New data member declarations.
11376 (Insn_template::size, Insn_template::alignment): New method defintions.
11377 (Stub_template::Stub_template): New method definition.
11378 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11379 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11380 (Stub_factory::Stub_factory): New method definition.
11381 * gold.h (string_hash): New template.
11382 * output.h (Input_section_specifier::hash_value): Use
11384 (Input_section_specifier::string_hash): Remove.
11385 * stringpool.cc (Stringpool_template::string_hash): Use
11388 2009-10-20 Doug Kwan <dougkwan@google.com>
11390 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11391 symbols of relaxed input sections.
11392 * output.h (Output_section::find_relaxed_input_section): Make
11395 2009-10-16 Doug Kwan <dougkwan@google.com>
11397 * dynobj.cc (Versions::Versions): Initialize version_script_.
11398 Only insert base version symbol definition for a shared object
11399 if version script defines any version versions.
11400 (Versions::define_base_version): New method definition.
11401 (Versions::add_def): Check that base version is not needed.
11402 (Versions::add_need): Define base version lazily.
11403 * dynobj.h (Versions::define_base_version): New method declaration.
11404 (Versions::needs_base_version_): New data member declaration.
11405 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11406 (check_DATA): Add no_version_test.stdout.
11407 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11409 * testsuite/Makefile.in: Regenerate.
11410 * testsuite/no_version_test.c: New file.
11411 * testsuite/no_version_test.sh: Ditto.
11413 2009-10-16 Doug Kwan <dougkwan@google.com>
11415 * expression.cc (class Segment_start_expression): New class definition.
11416 (Segment_start_expression::value): New method definition.
11417 (script_exp_function_segment_start): Return a new
11418 Segment_start_expression.
11419 * gold/script-c.h (script_saw_segment_start_expression): New function
11421 * script-sections.cc (Script_sections::Script_sections): Initialize
11422 SAW_SEGMENT_START_EXPRESSION_ to false.
11423 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11424 and -Tbbs options to specify section addresses if given in
11425 command line and no SEGMENT_START expression is seen in a script.
11426 * script-sections.h (Script_sections::saw_segment_start_expression,
11427 Script_sections::set_saw_segment_start_expression): New method
11429 (Script_sections::saw_segment_start_expression_): New data member
11431 * script.cc (script_saw_segment_start_expression): New function.
11432 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11433 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11434 script_test_7.sh and script_test_8.sh.
11435 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11436 script_test_8.stdout.
11437 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11438 (script_test_6, script_test_6.stdout, script_test_7,
11439 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11440 * Makefile.in: Regenerate.
11441 * testsuite/script_test_6.sh: New file.
11442 * testsuite/script_test_6.t: Same.
11443 * testsuite/script_test_7.sh: Same.
11444 * testsuite/script_test_7.t: Same.
11445 * testsuite/script_test_8.sh: Same.
11447 2009-10-16 Doug Kwan <dougkwan@google.com>
11449 * output.cc (Output_segment::set_section_list_address): Cast
11450 expressions to unsigned long long type to avoid format warnings.
11452 2009-10-15 Ian Lance Taylor <iant@google.com>
11454 * script.cc (Script_options::add_symbol_assignment): Always add a
11455 dot assignment to script_sections_.
11456 * script-sections.cc (Script_sections::add_dot_assignment):
11457 Initialize if necessary.
11459 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11460 program headers with no load segment if there is a linker script.
11462 * layout.cc (Layout::set_segment_offsets): Align the file offset
11463 to the segment aligment for -N or -n with no load segment.
11464 * output.cc (Output_segment::add_output_section): Don't crash if
11465 the first section is a TLS section.
11466 (Output_segment::set_section_list_addresses): Print an error
11467 message if the address moves backward in a linker script.
11468 * script-sections.cc
11469 (Output_section_element_input::set_section_addresses): Don't
11470 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11471 (Orphan_output_section::set_section_addresses): Likewise.
11473 2009-10-15 Doug Kwan <dougkwan@google.com>
11475 * layout.cc (Layout::finish_dynamic_section): Generate tags
11476 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11477 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11478 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11480 2009-10-14 Ian Lance Taylor <iant@google.com>
11482 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11484 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11485 data_shdr fields of relinfo.
11486 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11487 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11488 R_386_TLS_LDO_32, adjust based on section flags.
11489 (Target_i386::Relocate::fix_up_ldo): Remove.
11491 2009-10-13 Ian Lance Taylor <iant@google.com>
11493 Add support for -pie.
11494 * options.h (class General_options): Add -pie and
11496 (General_options::output_is_position_independent): Test -pie.
11497 (General_options::output_is_executable): Return true if not shared
11498 and not relocatable.
11499 (General_options::output_is_pie): Remove.
11500 * options.cc (General_options::finalize): Reject incompatible uses
11502 * gold.cc (queue_middle_tasks): A -pie link is not static.
11503 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11504 * symtab.cc (Symbol::final_value_is_known): Return false if
11505 output_is_position_independent.
11506 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11507 output_is_position_independent.
11508 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11509 output_is_position_independent.
11510 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11511 output_is_position_independent.
11512 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11514 (basic_pie_test.o, basic_pie_test): New targets.
11515 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11516 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11517 (two_file_pie_test): New target.
11518 * testsuite/Makefile.in: Rebuild.
11519 * README: Remove note saying that -pie is not supported.
11521 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11523 * options.h (class General_options): Add -init and -fini.
11524 * layout.cc (Layout::finish_dynamic_section): Emit
11525 given init and fini functions.
11527 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11529 * gc.h (gc_process_relocs): Check if icf is enabled using new
11531 * gold.cc (queue_initial_tasks): Likewise.
11532 (queue_middle_tasks): Likewise.
11533 * object.cc (do_layout): Likewise.
11534 * symtab.cc (is_section_folded): Likewise.
11535 * main.cc (main): Likewise.
11536 * reloc.cc (Read_relocs::run): Likewise.
11537 (Sized_relobj::do_scan_relocs): Likewise.
11538 * icf.cc (is_function_ctor_or_dtor): New function.
11539 (Icf::find_identical_sections): Check if function is ctor or dtor when
11540 safe icf is chosen.
11541 * options.h (General_options::icf): Change option to be an enum.
11542 (Icf_status): New enum.
11543 (icf_enabled): New method.
11544 (icf_safe_folding): New method.
11545 (set_icf_status): New method.
11546 (icf_status_): New variable.
11547 * (options.cc) (General_options::finalize): Set icf_status_.
11548 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11549 icf_test and icf_keep_unique_test to use the --icf enum flag.
11550 * testsuite/icf_safe_test.sh: New file.
11551 * testsuite/icf_safe_test.cc: New file.
11553 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11555 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11556 includes to gc.h and icf.h.
11557 * arm.cc: Include gc.h.
11558 * gold.cc: Likewise.
11559 * i386.cc: Likewise.
11560 * powerpc.cc: Likewise.
11561 * sparc.cc: Likewise.
11562 * x86_64.cc: Likewise.
11563 * gc.h: Include icf.h.
11565 2009-10-11 Ian Lance Taylor <iant@google.com>
11567 * plugin.cc: Include "gold.h" before other header files.
11569 2009-10-10 Chris Demetriou <cgd@google.com>
11571 * options.h (Input_file_argument::Input_file_type): New enum.
11572 (Input_file_argument::is_lib_): Replace with...
11573 (Input_file_argument::type_): New member.
11574 (Input_file_argument::Input_file_argument): Take Input_file_type
11575 'type' rather than boolean 'is_lib' as second argument.
11576 (Input_file_argument::is_lib): Use type_.
11577 (Input_file_argument::is_searched_file): New function.
11578 (Input_file_argument::may_need_search): Handle is_searched_file.
11579 * options.cc (General_options::parse_library): Support -l:filename.
11580 (General_options::parse_just_symbols): Update for Input_file_argument
11582 (Command_line::process): Likewise.
11583 * archive.cc (Archive::get_file_and_offset): Likewise.
11584 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11585 * script.cc (read_script_file, script_add_file): Likewise.
11586 * fileread.cc (Input_file::Input_file): Likewise.
11587 (Input_file::will_search_for): Handle is_searched_file.
11588 (Input_file::open): Likewise.
11589 * readsyms.cc (Read_symbols::get_name): Likewise.
11590 * testsuite/Makefile.am (searched_file_test): New test.
11591 * testsuite/Makefile.in: Regenerate.
11592 * testsuite/searched_file_test.cc: New file.
11593 * testsuite/searched_file_test_lib.cc: New file.
11595 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11596 Ian Lance Taylor <iant@google.com>
11598 * descriptor.cc: Include <cstdio> and "binary-io.h".
11599 (Descriptors::open): Open the files in binary mode always.
11600 * script.cc (Lex::get_token): Treat \r as whitespace.
11602 2009-10-09 Ian Lance Taylor <iant@google.com>
11604 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11606 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11607 Ian Lance Taylor <iant@google.com>
11609 * configure.ac: Check for readv function also.
11610 * fileread.cc (readv): Define if not HAVE_READV.
11611 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11613 * config.in: Regenerate.
11614 * configure: Regenerate.
11616 2009-10-09 Doug Kwan <dougkwan@google.com>
11618 * layout.cc (Layout::make_output_section): Call target hook to make
11619 ordinary output section.
11620 (Layout::finalize): Adjust parameter list of call the
11621 Target::may_relax().
11622 * layout.h (class Layout::section_list): New method.
11623 * merge.h (Output_merge_base::entsize): Change visibility to public.
11624 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11626 (Output_merge_string::do_is_string): New method.
11627 * object.cc (Sized_relobj::do_setup): renamed from
11628 Sized_relobj::set_up.
11629 * object.h (Sized_relobj::adjust_shndx,
11630 Sized_relobj::initializ_input_to_output_maps,
11631 Sized_relobj::free_input_to_output_maps): Change visibilities to
11633 (Sized_relobj::setup): Virtualize.
11634 (Sized_relobj::do_setup): New method declaration.
11635 (Sized_relobj::invalidate_section_offset,
11636 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11637 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11638 * options.cc (parse_int): New function.
11639 * options.h (parse_int): New declaration.
11640 (DEFINE_int): New macro.
11641 (stub_group_size): New option.
11642 * output.cc (Output_section::Output_section): Initialize memebers
11643 merge_section_map_, merge_section_by_properties_map_,
11644 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11645 (Output_section::add_input_section): Handled deferred code-fill
11646 generation and remove an old comment.
11647 (Output_section::add_relaxed_input_section): New method definition.
11648 (Output_section::add_merge_input_section): Use merge section by
11649 properties map to speed to search. Update merge section maps
11651 (Output_section::build_relaxation_map): New method definition.
11652 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11654 (Output_section::relax_input_section): Renamed to
11655 Output_section::convert_input_sections_to_relaxed_sections and change
11656 interface to take a vector of pointers to relaxed sections.
11657 (Output_section::find_merge_section,
11658 Output_section::find_relaxed_input_section): New method definitions.
11659 (Output_section::is_input_address_mapped,
11660 Output_section::output_offset, Output_section::output_address):
11661 Use output section data maps to speed up searching.
11662 (Output_section::find_starting_output_address): Add comments.
11663 (Output_section::do_write,
11664 Output_section::write_to_postprocessing_buffer): Do code-fill
11665 generation as appropriate.
11666 (Output_section::get_input_sections): Invalidate relaxed input section
11668 (Output_section::restore_states): Adjust type of checkpoint .
11669 Invalidate relaxed input section map.
11670 * output.h (Output_merge_base): New class declaration.
11671 (Input_section_specifier): New class defintion.
11672 (class Output_relaxed_input_section) Change base class to
11673 Output_section_data_build.
11674 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11675 base class initializer.
11676 (Output_section::add_relaxed_input_section): New method declaration.
11677 (Output_section::Input_section): Change visibility to protected.
11678 (Output_section::Input_section::relobj,
11679 Output_section::Input_section::shndx): Handle relaxed input sections.
11680 Output_section::input_sections) Change visibility to protected. Also
11681 define overload to return a non-const pointer.
11682 (Output_section::Merge_section_properties): New class defintion.
11683 (Output_section::Merge_section_by_properties_map,
11684 Output_section::Output_section_data_by_input_section_map,
11685 Output_section::Relaxation_map): New types.
11686 (Output_section::relax_input_section): Rename method to
11687 Output_section::convert_input_sections_to_relaxed_sections and change
11688 interface to take a vector of relaxed section pointers.
11689 (Output_section::find_merge_section,
11690 Output_section::find_relaxed_input_section,
11691 Output_section::build_relaxation_map,
11692 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11693 New method declarations.
11694 (Output_section::merge_section_map_
11695 Output_section::merge_section_by_properties_map_,
11696 Output_section::relaxed_input_section_map_,
11697 Output_section::is_relaxed_input_section_map_valid_,
11698 Output_section::generate_code_fills_at_write_): New data members.
11699 * script-sections.cc
11700 (Output_section_element_input::set_section_addresses): Call
11701 current_data_size and addralign methods of relaxed input sections.
11702 (Orphan_output_section::set_section_addresses): Call current_data_size
11703 and addralign methods of relaxed input sections.
11704 * symtab.cc (Symbol_table::compute_final_value): Extract template
11705 from the body of Symbol_table::sized_finalize_symbol.
11706 (Symbol_table::sized_finalized_symbol): Call
11707 Symbol_table::compute_final_value.
11708 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11709 (Symbol_table::compute_final_value): New templated method declaration.
11710 * target.cc (Target::do_make_output_section): New method defintion.
11711 * target.h (Target::make_output_section): New method declaration.
11712 (Target::relax): Add more parameters for input objects, symbol table
11713 and layout. Adjust call to do_relax.
11714 (Target::do_make_output_section): New method declaration.
11715 (Target::do_relax): Add parameters for input objects, symbol table
11718 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11720 * pread.c: Include stdio.h.
11722 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11724 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11727 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11729 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11730 Change read_shndx type to unsigned int.
11731 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11733 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11734 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11735 Change read_shndx type to unsigned int.
11736 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11738 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11739 * layout.cc (Layout::create_symtab_sections): Cast the result of
11740 local_symcount * symsize to off_t in the gold_assert.
11742 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11744 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11745 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11747 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11748 (Arm_relocate_functions::thm_abs5): New function.
11749 (Arm_relocate_functions::abs12): New function.
11750 (Arm_relocate_functions::abs16): New function.
11751 (Arm_relocate_functions::base_abs): New function.
11752 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11753 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11754 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11756 (Scan::global): Likewise.
11757 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11758 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11759 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11760 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11763 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11765 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11766 (Arm_relocate_functions::movt_prel): New function.
11767 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11768 (Arm_relocate_functions::thm_movt_prel): New function.
11769 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11770 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11771 (Scan::global, Relocate::relocate): Likewise.
11772 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11774 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11776 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11777 Incremental_checker.
11778 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11780 (class Incremental_inputs_header): New class.
11781 (Incremental_inputs_header_writer): Edit comment.
11782 (Incremental_inputs_entry): New class.
11783 (Incremental_inputs_entry_writer): Edit comment.
11784 (Sized_incremental_binary::do_find_incremental_inputs_section):
11785 Add *strtab_shndx parameter, fill it.
11786 (Sized_incremental_binary::do_check_inputs): New method.
11787 (Incremental_checker::can_incrementally_link_output_file): Use
11788 Sized_incremental_binary::check_inputs.
11789 (Incremental_inputs::report_command_line): Save command line in
11792 (Incremental_binary::find_incremental_inputs_section): New
11794 (Incremental_binary::do_find_incremental_inputs_section): Add
11795 strtab_shndx parameter.
11796 (Incremental_binary::do_check_inputs): New pure virtual method.
11797 (Sized_incremental_binary::do_check_inputs): Declare.
11798 (Incremental_checker::Incremental_checker): Add incremental_inputs
11799 parameter, use it to initialize incremental_inputs_.
11800 (Incremental_checker::incremental_inputs_): New field.
11801 (Incremental_checker::command_line): New method.
11802 (Incremental_checker::inputs): New method.
11803 (Incremental_checker::command_line_): New field.
11805 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11807 * incremental.cc: Include <cstdarg> and "target-select.h".
11808 (vexplain_no_incremental): New function.
11809 (explain_no_incremental): New function.
11810 (Incremental_binary::error): New method.
11811 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11813 (make_sized_incremental_binary): New function.
11814 (open_incremental_binary): New function.
11815 (can_incrementally_link_file): Add checks if output is ELF and has
11817 * incremental.h: Include "elfcpp_file.h" and "output.h".
11818 (Incremental_binary): New class.
11819 (Sized_incremental_binary): New class.
11820 (open_incremental_binary): Declare.
11821 * object.cc (is_elf_object): Use
11822 elfcpp::Elf_recognizer::is_elf_file.
11823 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11824 * output.h (Output_file::filesize): New method.
11826 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11828 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11830 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11831 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11833 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11835 (Arm_relocate_functions::movw_abs_nc): New function.
11836 (Arm_relocate_functions::movt_abs): New function.
11837 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11838 (Arm_relocate_functions::thm_movt_abs): New function.
11839 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11840 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11841 (Scan::global): Likewise.
11842 (Relocate::relocate): Likewise.
11843 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11845 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11847 * arm.cc (Arm_relocate_functions::got_prel) New function.
11848 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11849 (Relocate::relocate): Likewise.
11850 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11852 2009-10-06 Ian Lance Taylor <iant@google.com>
11854 * options.h (class General_options): Define
11855 split_stack_adjust_size parameter.
11856 * object.h (class Object): Add uses_split_stack_ and
11857 has_no_split_stack_ fields. Add uses_split_stack and
11858 has_no_split_stack accessor functions. Declare
11859 handle_split_stack_section.
11860 (class Reloc_symbol_changes): Define.
11861 (class Sized_relobj): Define Function_offsets. Declare
11862 split_stack_adjust, split_stack_adjust_reltype, and
11864 * object.cc (Object::handle_split_stack_section): New function.
11865 (Sized_relobj::do_layout): Call handle_split_stack_section.
11866 * dynobj.cc (Sized_dynobj::do_layout): Call
11867 handle_split_stack_section.
11868 * reloc.cc (Sized_relobj::relocate_sections): Call
11869 split_stack_adjust for executable sections in split_stack
11870 objects. Pass reloc_map to relocate_section.
11871 (Sized_relobj::split_stack_adjust): New function.
11872 (Sized_relobj::split_stack_adjust_reltype): New function.
11873 (Sized_relobj::find_functions): New function.
11874 * target-reloc.h: Include "object.h".
11875 (relocate_section): Add reloc_symbol_changes parameter. Change
11877 * target.h (class Target): Add calls_non_split method. Declare
11878 do_calls_non_split virtual method. Declare match_view and
11880 * target.cc: Include "elfcpp.h".
11881 (Target::do_calls_non_split): New function.
11882 (Target::match_view): New function.
11883 (Target::set_view_to_nop): New function.
11884 * gold.cc (queue_middle_tasks): Give an error if mixing
11885 split-stack and non-split-stack objects with -r.
11886 * i386.cc (Target_i386::relocate_section): Add
11887 reloc_symbol_changes parameter.
11888 (Target_i386::do_calls_non_split): New function.
11889 * x86_64.cc (Target_x86_64::relocate_section): Add
11890 reloc_symbol_changes parameter.
11891 (Target_x86_64::do_calls_non_split): New function.
11892 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11894 * powerpc.cc (Target_powerpc::relocate_section): Add
11895 reloc_symbol_changes parameter.
11896 * sparc.cc (Target_sparc::relocate_section): Add
11897 reloc_symbol_changes parameter.
11898 * configure.ac: Call AM_CONDITIONAL for the default target.
11899 * configure: Rebuild.
11900 * testsuite/Makefile.am (TEST_AS): New variable.
11901 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11902 (check_DATA): Add split_i386 and split_x86_64 files.
11903 (SPLIT_DEFSYMS): Define.
11904 (split_i386_[1234n].o): New targets.
11905 (split_i386_[124]): New targets.
11906 (split_i386_[1234r].stdout): New targets.
11907 (split_x86_64_[1234n].o): New targets.
11908 (split_x86_64_[124]): New targets.
11909 (split_x86_64_[1234r].stdout): New targets.
11910 (MOSTLYCLEANFILES): Add new executables.
11911 * testsuite/split_i386.sh: New file.
11912 * testsuite/split_x86_64.sh: New file.
11913 * testsuite/split_i386_1.s: New file.
11914 * testsuite/split_i386_2.s: New file.
11915 * testsuite/split_i386_3.s: New file.
11916 * testsuite/split_i386_4.s: New file.
11917 * testsuite/split_i386_n.s: New file.
11918 * testsuite/split_x86_64_1.s: New file.
11919 * testsuite/split_x86_64_2.s: New file.
11920 * testsuite/split_x86_64_3.s: New file.
11921 * testsuite/split_x86_64_4.s: New file.
11922 * testsuite/split_x86_64_n.s: New file.
11923 * testsuite/testfile.cc (Target_test): Update relocation_section
11925 * testsuite/Makefile.in: Rebuild.
11927 2009-10-06 Ian Lance Taylor <iant@google.com>
11929 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11930 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11931 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11932 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11933 the address on ldo_addrs_.
11934 (Target_i386::Relocate::fix_up_ldo): New function.
11936 2009-10-06 Rafael Espindola <espindola@google.com>
11938 * plugin.cc (add_input_library): New.
11939 (Plugin::load): Add add_input_library to tv.
11940 (Plugin_manager::add_input_file): Add the is_lib argument.
11941 (add_input_file): Update call to Plugin_manager::add_input_file.
11942 (add_input_library): New.
11943 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11945 2009-09-30 Doug Kwan <dougkwan@google.com>
11947 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11948 symbol and call Symbol::may_need_copy_reloc to determine if
11949 a copy reloc is needed.
11950 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11951 nocopyreloc is given in command line.
11952 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11953 given in command line.
11954 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11955 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11956 of the removed Target_i386::may_need_copy_reloc.
11957 * options.h (copyreloc): New option with default value false.
11958 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11959 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11960 instead of the removed Target_powerpc::may_need_copy_reloc.
11961 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11962 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11963 instead of the removed Target_sparc::may_need_copy_reloc.
11964 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11965 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11966 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11967 instead of the removed Target_x86_64::may_need_copy_reloc.
11969 2009-09-30 Ian Lance Taylor <iant@google.com>
11971 * object.h (class Object): Remove target_ field, and target,
11972 sized_target, and set_target methods.
11973 (Object::sized_target): Remove.
11974 (class Sized_relobj): Update declarations. Remove sized_target.
11975 * object.cc (Sized_relobj::setup): Remove target parameter.
11976 Change all callers.
11977 (Input_objects::add_object): Don't do anything with the target.
11978 (make_elf_sized_object): Add punconfigured parameter. Change all
11979 callers. Set or test parameter target.
11980 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11981 Change all callers.
11982 * parameters.cc (Parameters::set_target): Change parameter type to
11984 (Parameters::default_target): Remove.
11985 (set_parameters_target): Change parameter type to be non-const.
11986 (parameters_force_valid_target): New function.
11987 (parameters_clear_target): New function.
11988 * parameters.h (class Parameters): Update declarations. Remove
11989 default_target method. Add sized_target and clear_target
11990 methods. Change target_ to be non-const.
11991 (set_parameters_target): Update declaration.
11992 (parameters_force_valid_target): Declare.
11993 (parameters_clear_target): Declare.
11994 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11995 as NULL if we aren't searching.
11996 (Add_symbols::run): Don't check for compatible target.
11997 * fileread.cc (Input_file::open_binary): Call
11998 parameters_force_valid_target.
11999 * gold.cc (queue_middle_tasks): Likewise.
12000 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12001 set_target on object.
12002 * dynobj.h (class Sized_dynobj): Update declarations.
12003 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12004 make_elf_object returns NULL.
12005 (Archive::include_member): Don't check whether object target is
12007 * output.cc (Output_section::add_input_section): Get target from
12009 (Output_section::relax_input_section): Likewise.
12010 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12012 (Sized_relobj::do_scan_relocs): Likewise.
12013 (Sized_relobj::relocate_sections): Likewise.
12014 * resolve.cc (Symbol_table::resolve): Likewise.
12015 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12016 parameter. Change all callers.
12017 (Symbol_table::add_from_object): Get target from parameters.
12018 (Symbol_table::add_from_relobj): Don't check object target.
12019 (Symbol_table::add_from_dynobj): Likewise.
12020 (Symbol_table::define_special_symbol): Get target from
12022 * symtab.h (class Symbol_table): Update declaration.
12023 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12024 parameter. Change all callers. Clear parameter target.
12025 (Binary_test): Test target here.
12026 * testsuite/object_unittest.cc (gold_testsuite): Remove
12027 target_test_pointer parameter. Change all callers.
12028 (Object_test): Test target here.
12030 2009-09-26 Ian Lance Taylor <iant@google.com>
12032 * testsuite/initpri1.c: Don't try to use constructor priorities if
12033 compiling with gcc before 4.3.
12035 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
12037 * testsuite/retain_symbols_file_test.sh (check_present): Change
12038 output file name to retain_symbols_file_test.stdout.
12039 (check_absent): Likewise.
12041 2009-09-18 Craig Silverstein <csilvers@google.com>
12043 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12044 * options.cc: Include <cerrno> and <fstream>.
12045 (General_options::finalize): Parse -retain-symbols-file tag.
12046 * options.h: New flag.
12047 (General_options): New method should_retain_symbol, new
12048 variable symbols_to_retain.
12049 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12050 should_retain_symbol map.
12051 * testsuite/Makefile.am (retain_symbols_file_test): New test.
12052 * testsuite/Makefile.in: Regenerate.
12053 * testsuite/retain_symbols_file_test.sh: New file.
12055 2009-09-18 Nick Clifton <nickc@redhat.com>
12057 * po/es.po: Updated Spanish translation.
12059 2009-09-17 Doug Kwan <dougkwan@google.com>
12061 * debug.h (DEBUG_RELAXATION): New constant.
12062 (DEBUG_ALL): Add DEBUG_RELAXATION.
12063 (debug_string_to_enum): Add relaxation debug option.
12065 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12066 Layout::Relaxation_debug_check::read_sections,
12067 Layout::Relaxation_debug_check::read_sections): New method definitions.
12068 (Layout::Layout): Initialize data members
12069 record_output_section_data_from_scrips_,
12070 script_output_section_data_list_ and relaxation_debug_check_.
12071 (Layout::save_segments, Layout::restore_segments,
12072 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12073 Layout::relaxation_loop_body): New method definitions.
12074 (Layout::finalize): Support relaxation. Move section layout code to
12075 Layout::relaxation_loop_body.
12076 (Layout::set_asection_address_from_script): Move code for orphan
12077 section placement out.
12078 (Layout::place_orphan_sections_in_script): New method definition.
12079 * layout.h (Output_segment_headers, Output_file_header):
12080 New forward class declarations.
12081 (Layout::~Layout): Define.
12082 (Layout::new_output_section_data_from_script): New method definition.
12083 (Layout::place_orphan_sections_in_script): New method declaration.
12084 (Layout::Segment_states): New type declaration.
12085 (Layout::save_segments, Layout::restore_segments,
12086 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12087 Layout::relaxation_loop_body): New method declarations.
12088 (Layout::Output_section_data_list): New type declaration.
12089 (Layout::Relaxation_debug_check): New class definition.
12090 (Layout::record_output_section_data_from_script_,
12091 Layout::script_output_section_data_list_, Layout::segment_states_,
12092 Layout::relaxation_debug_check_): New data members.
12093 * output.cc: (Output_section_headers::do_size): New method definition.
12094 (Output_section_headers::Output_section_headers): Move size
12095 computation to Output_section_headers::do_size.
12096 (Output_segment_headers::do_size): New method definition.
12097 (Output_file_header::Output_file_header): Move size computation to
12098 Output_file_header::do_size and call it.
12099 (Output_file_header::do_size): New method definition.
12100 (Output_data_group::Output_data_group): Adjust call to
12101 Output_section_data.
12102 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12103 (Output_symtab_xindex::do_write): Add array bound check.
12104 (Output_section::Input_section::print_to_mapfile): Handle
12105 RELAXED_INPUT_SECTION_CODE.
12106 (Output_section::Output_section): Initialize data member checkpoint_.
12107 (Output_section::~Output_section): Delete checkpoint object pointed
12109 (Output_section::add_input_section): Always add an Input_section if
12111 (Output_section::add_merge_input_section): Add assert.
12112 (Output_section::relax_input_section): New method definition.
12113 (Output_section::set_final_data_size): Set load address to zero for
12114 an unallocated section.
12115 (Output_section::do_address_and_file_offset_have_reset_values):
12116 New method definition.
12117 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12118 Handle relaxed input section.
12119 (Output_section::sort_attached_input_sections): Checkpoint input
12120 section list lazily.
12121 (Output_section::get_input_sections): Change type of input_sections to
12122 list of Simple_input_section pointers. Checkpoint input section list
12123 lazily. Also handle relaxed input sections.
12124 (Output_section::add_input_section_for_script): Take a reference to
12125 a Simple_input_section object instead of Relobj pointer and section
12126 index as parameter. Handle relaxed input sections.
12127 (Output_section::save_states, Output_section::restore_states): New
12128 method definitions.
12129 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12130 (Output_data::is_data_size_fixed): New method definition.
12131 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12133 (Output_data::address_and_file_offset_have_reset_values): New method
12135 (Output_data::do_address_and_file_offset_have_reset_values): New method
12137 (Output_data::set_data_size): Check that data size is not fixed.
12138 (Output_data::fix_data_size): New method definition.
12139 (Output_data::is_data_size_fixed_): New data member.
12140 (Output_section_headers::set_final_data_size): New method definition.
12141 (Output_section_headers::do_size): New method declaration.
12142 (Output_segment_headers::set_final_data_size): New method definition.
12143 (Output_segment_headers::do_size): New method declaration.
12144 (Output_file_header::set_final_data_size)::New method definition.
12145 (Output_file_header::do_size)::New method declaration.
12146 (Output_section_data::Output_section_data): Add new parameter
12147 is_data_size_fixed and use it to fix data size.
12148 (Output_data_const::Output_data_const): Adjust call to base class
12149 constructor and fix data size.
12150 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12151 base class constructor and fix data size.
12152 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12153 base class constructor and fix data size.
12154 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12155 class constructor and fix data size.
12156 (Output_data_group::set_final_data_size): New method definition.
12157 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12158 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12159 class constructor and fix data size.
12160 (Output_relaxed_input_section): New class definition.
12161 (Output_section::Simple_input_section): New class definition.
12162 (Output_section::get_input_sections): Adjust parameter list.
12163 (Output_section::add_input_section_for_script): Same.
12164 (Output_section::save_states, Output_section::restore_states,
12165 Output_section::do_address_and_file_offset_have_reset_values,
12166 (Output_section::Input_section::Input_section): Handle
12167 RELAXED_INPUT_SECTION_CODE. Add new overload for
12168 Output_relaxed_input_section.
12169 (Output_section::Input_section::is_input_section,
12170 Output_section::Input_section::set_output_section): Handle relaxed
12172 (Output_section::Input_section::is_relaxed_input_section,
12173 Output_section::Input_section::output_section_data,
12174 Output_section::Input_section::relaxed_input_section): New method
12176 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12178 (Output_section::Input_section::u1_): Update comments.
12179 (Output_section::Input_section::u2_): Add new union member poris.
12180 (Output_section::Checkpoint_output_section): New classs definition.
12181 (Output_section::relax_input_section): New method declaration.
12182 (Output_section::checkpoint_): New data member.
12183 (Output_segment): Update comments.
12184 (Output_segment::Output_segment): Un-privatize copy constructor.
12185 (Output_segment::operator=): Un-privatize.
12186 * script-sections.cc (Output_section_element::Input_section_list):
12187 Change element type to Output_section::Simple_input_section.
12188 (Output_section_element_dot_assignment::set_section_addresses):
12189 Register output section data for relaxation clean up.
12190 (Output_data_exression::Output_data_expression): Adjust call to base
12191 constructor to fix data size.
12192 (Output_section_element_data::set_section_addresses): Register
12193 Output_data_expression object for relaxation clean up.
12194 (struct Input_section_info): Replace Relobj pointer and section index
12195 pair with Output_section::Simple_input_section and Convert struct to a
12197 (Input_section_sorter::operator()): Adjust access to
12198 Input_section_info data member to use accessors.
12199 (Output_section_element_input::set_section_addresses): Use layout
12200 parameter. Adjust code to use Output_section::Simple_input_section
12201 and Input_secction_info classes. Register filler for relaxation
12203 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12204 and section index pair with Output_section::Simple_input_section
12205 class. Adjust code accordingly.
12206 (Phdrs_element::release_segment): New method definition.
12207 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12209 (Script_sections::release_segments): New method definition.
12210 * gold/script-sections.h (Script_sections::release_segments): New
12211 method declaration.
12212 * gold/target.h (Target::may_relax, Target::relax,
12213 Target::do_may_relax, Target::do_relax): New method definitions.
12215 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12217 * arm.cc (has_signed_unsigned_overflow): New function.
12218 (Arm_relocate_functions::abs8): New function.
12219 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12220 (Target_arm::Scan::global): Likewise.
12221 (Target_arm::relocate::relocate): Likewise.
12222 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12225 2009-09-16 Cary Coutant <ccoutant@google.com>
12227 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12228 * testsuite/Makefile.in: Regenerate.
12230 2009-09-11 Nick Clifton <nickc@redhat.com>
12232 * po/gold.pot: Updated by the Translation project.
12234 2009-09-08 Cary Coutant <ccoutant@google.com>
12236 * output.cc (Output_file::open): Add execute permission to empty file.
12237 * testsuite/Makefile.am (permission_test): New test.
12238 * testsuite/Makefile.in: Regenerate.
12240 2009-09-02 Ian Lance Taylor <iant@google.com>
12242 * output.cc (Output_file::resize): Call map_no_anonymous rather
12245 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12247 * gold.cc: Include "incremental.h".
12248 (queue_initial_tasks): Call Incremental_checker methods.
12249 * incremental.cc: Include "output.h".
12250 (Incremental_checker::can_incrementally_link_output_file): New
12252 * incremental.h (Incremental_checker): New class.
12254 * output.cc (Output_file::open_for_modification): New method.
12255 (Output_file::map_anonymous): Changed return type to bool. Record
12256 map in base_ field.
12257 (Output_file::map_no_anonymous): New method, broken out of map.
12258 (Output_file::map): Use map_no_anonymous and map_anonymous.
12259 * output.h (class Output_file): Update declarations.
12261 2009-08-24 Cary Coutant <ccoutant@google.com>
12263 * options.h (Command_line::Pre_options): New class.
12264 (Command_line::pre_options): New member.
12265 * options.cc (gold::options::ready_to_register): New variable.
12266 (One_option::register_option): Do nothing if not registering options.
12267 Assert if same short option registered twice.
12268 (General_options::General_options): Turn off option registration when
12270 (Command_line::Pre_options::Pre_options): New constructor.
12272 2009-08-24 Cary Coutant <ccoutant@google.com>
12274 * options.h (General_options::no_keep_memory): Remove incorrect
12277 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12279 * Makefile.am (am__skiplex, am__skipyacc): New.
12280 * Makefile.in: Regenerate.
12282 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12284 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12285 (INCLUDES): ... this.
12286 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12287 (AM_CPPFLAGS): Renamed from ...
12288 (INCLUDE): ... this.
12289 * Makefile.in, testsuite/Makefile.in: Regenerate.
12291 * Makefile.in: Regenerate.
12292 * aclocal.m4: Likewise.
12293 * config.in: Likewise.
12294 * configure: Likewise.
12295 * testsuite/Makefile.in: Likewise.
12297 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12298 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12299 * Makefile.in: Regenerate.
12300 * testsuite/Makefile.in: Regenerate.
12302 2009-08-19 Cary Coutant <ccoutant@google.com>
12304 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12305 symbols in shared libraries overridden by hidden or internal symbols
12306 in the main program.
12308 2009-08-19 Chris Demetriou <cgd@google.com>
12310 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12311 checking source file names in error messages.
12313 2009-08-18 Doug Kwan <dougkwan@google.com>
12315 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12316 an elcpp::Ehdr as parameter. Adjust call to set_target.
12317 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12318 an elfcpp::Ehdr as parameter.
12319 * object.cc (Object::set_target): Remove the version that looks up
12320 a target and sets it.
12321 (Sized_relobj::setup): Take a Target object instead of
12322 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12323 (make_elf_sized_object): Find target and ask target to
12324 make an ELF object.
12325 * object.h: (Object::set_target): Remove the version that looks up
12326 a target and sets it.
12327 (Sized_relobj::setup): Take a Target object instead of
12328 an elfcpp:Ehdr as parameter.
12329 * target.cc: Include dynobj.h.
12330 (Target::do_make_elf_object_implementation): New.
12331 (Target::do_make_elf_object): New.
12332 * target.h (Target::make_elf_object): New template declaration.
12333 (Target::do_make_elf_object): New method declarations.
12334 (Target::do_make_elf_object_implementation): New template declaration.
12336 2009-08-14 Ian Lance Taylor <iant@google.com>
12338 * gold.h (FUNCTION_NAME): Define.
12339 (gold_unreachable): Use FUNCTION_NAME.
12341 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12343 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12344 symbol in the --keep-unique list is not found.
12346 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12348 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12349 been maked as --keep-unique.
12350 (Icf::unfold_section): New function.
12351 * icf.h (Icf::unfold_section): New function.
12352 * options.h (General_options::keep_unique): New option.
12353 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12354 * testsuite/Makefile.in: Regenerate.
12355 * testsuite/icf_keep_unique_test.sh: New file.
12356 * testsuite/icf_keep_unique_test.cc: New file.
12358 2009-08-12 Cary Coutant <ccoutant@google.com>
12361 * resolve.cc (Symbol_table::resolve): Check for references from
12362 dynamic objects to hidden and internal symbols.
12363 * testsuite/Makefile.am (hidden_test.sh): New test.
12364 * testsuite/Makefile.in: Regenerate.
12365 * testsuite/hidden_test.sh: New script.
12366 * testsuite/hidden_test_1.c: New test source.
12367 * testsuite/hidden_test_main.c: New test source.
12369 2009-08-11 Doug Kwan <dougkwan@google.com>
12371 * arm.cc: Update comments.
12372 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12373 segment to locate the .ARM.exidx section if present.
12375 2009-08-09 Doug Kwan <dougkwan@google.com>
12377 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12380 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12381 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12384 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12386 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12387 valid tls_segment only for non-debug-section relocations.
12388 * testsuite/Makefile.am: Add gc_tls_test.
12389 * testsuite/Makefile.in: Regenerate.
12390 * testsuite/gc_tls_test.cc: New file.
12391 * testsuite/gc_tls_test.sh: New file.
12393 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12395 * icf.cc: New file.
12397 * Makefile.am (CCFILES): Add icf.cc.
12398 (HFILES): Add icf.h
12399 * Makefile.in: Regenerate.
12400 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12401 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12402 section, symbol and addend information for the relocs.
12403 * gold.cc (queue_middle_tasks): Call identical code folding.
12404 * gold.h: Add defines for multimap.
12405 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12406 to the call of finalize_local_symbols.
12407 * main.cc (main): Create object of class Icf.
12408 * object.cc (Sized_relobj::do_layout): Allow this function to be
12409 called twice during icf.
12410 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12411 to sections marked as identical by icf.
12412 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12414 (Sized_relobj::do_section_entsize): New function.
12415 * object.h (Object::section_entsize): New function.
12416 (Object::do_section_entsize): New pure virtual function.
12417 (Relobj::finalize_local_symbols): Add new parameter.
12418 (Relobj::do_section_entsize): New function.
12419 * options.h (General_options::icf): New option.
12420 (General_options::icf_iterations): New option.
12421 (General_options::print_icf_sections): New option.
12422 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12423 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12424 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12426 * symtab.cc (Symbol_table::is_section_folded): New function.
12427 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12428 to sections marked as identical by icf.
12429 * symtab.h (Symbol_table::set_icf): New function.
12430 (Symbol_table::icf): New function.
12431 (Symbol_table::is_section_folded): New function.
12432 (Symbol_table::icf_): New data member.
12433 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12434 * testsuite/Makefile.am: Add commands to build icf_test.
12435 * testsuite/Makefile.in: Regenerate.
12436 * testsuite/icf_test.sh: New file.
12437 * testsuite/icf_test.cc: New file.
12439 2009-07-24 Chris Demetriou <cgd@google.com>
12441 * layout.cc (is_compressible_debug_section): Fix incorrect
12442 comment about compressed section names.
12444 2009-07-20 Ian Lance Taylor <ian@airs.com>
12447 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12449 2009-07-16 Ian Lance Taylor <iant@google.com>
12452 * layout.h: #include <map>.
12453 (class Kept_section): Change from struct to class. Add accessors
12454 and setters. Add section size to Comdat_group mapping. Change
12455 Comdat_group to std::map. Add is_comdat_ field. Add
12456 linkonce_size field in union.
12457 (class Layout): Update declaration of find_or_add_kept_section.
12458 Don't declare find_kept_object.
12459 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12460 parameter. Add object, shndx, is_comdat, and is_group_name
12461 parameters. Change all callers. Adjust for new Kept_section.
12462 (Layout::find_kept_object): Remove.
12463 * object.cc (Sized_relobj::include_section_group): Update use of
12464 Kept_section. Rename secnum to shndx. Only record
12465 Kept_comdat_section if sections are the same size.
12466 (Sized_relobj::include_linkonce_section): Update use of
12467 Kept_section. Only record Kept_comdat_section if sections are the
12468 same size. Set size of linkonce section.
12469 (Sized_relobj::map_to_kept_section): Update call to
12470 get_kept_comdat_section.
12471 * object.h (class Sized_relobj): Rename fields in
12472 Kept_comdat_section to drop trailing underscores; change object
12473 field to Relobj*. Change Kept_comdat_section_table to store
12474 struct rather than pointer.
12475 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12476 Add kept_object and kept_shndx parameters. Change all callers.
12477 (Sized_relobj::get_kept_comdat_section): Change return type to
12478 bool. Add kept_object and kept_shndx parameters. Change all
12480 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12481 Layout::find_or_add_kept_section.
12483 2009-07-09 Ian Lance Taylor <iant@google.com>
12485 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12486 Reserve space in the hash table.
12488 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12490 * fileread.cc (File_read::get_mtime): New method.
12491 * fileread.h (Timespec): New structure.
12492 (File_read::get_mtime): New method.
12493 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12494 Renamed from timestamp_nsec.
12495 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12497 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12499 (Incremental_inputs::report_archive): Save mtime; style fix.
12500 (Incremental_inputs::report_obejct): Save mtime; style fix.
12501 (Incremental_inputs::report_script): Save mtime; style fix.
12502 (Incremental_inputs::finalize_inputs): Style fix.
12503 (Incremental_inputs::finalize): Style fix.
12504 (Incremental_inputs::create_input_section_data): Store inputs
12506 * incremental.h (Incremental_inputs::report_script): Add mtime
12508 (Incremental_inputs::Input_info::Input_info): Intialize only one
12510 (Incremental_inputs::Input_info::archive): Move to nameless
12512 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12513 (Incremental_inputs::Input_info::script): Move to nameless union.
12514 (Incremental_inputs::mtime): New field.
12515 * script.cc (read_input_script): Pass file mtime to
12517 * script.h (Script_info::inputs): Style fix.
12519 2009-07-01 Ian Lance Taylor <ian@airs.com>
12521 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12524 2009-06-24 Ian Lance Taylor <iant@google.com>
12527 * layout.cc (Layout::choose_output_section): If we find an
12528 existing section, update the flags.
12529 (Layout::create_notes): New function, broken out of
12531 (Layout::finalize): Don't create note sections.
12532 (Layout::create_note): Don't crash if linker script discards
12534 (Layout::create_gold_note): Likewise.
12535 (Layout::create_build_id): Likewise. Don't set
12536 after_input_sections on the section.
12537 (Layout::create_executable_stack_info): Remove target parameter.
12539 * layout.h (class Layout): Declare create_notes. Update
12540 declaration of create_executable_stack_info.
12541 * gold.cc (queue_middle_tasks): Call create_notes.
12542 * output.cc (Output_section::update_flags_for_input_section): Move
12543 here from output.h. If SHF_ALLOC flag is newly set, mark address
12545 * output.h (Output_data::mark_address_invalid): New function.
12546 (class Output_section): Only declare, not define,
12547 update_flags_for_input_section. Remove set_flags.
12549 2009-06-24 Ian Lance Taylor <iant@google.com>
12551 * script-sections.cc (Output_section_definition::
12552 set_section_addresses): Rename shadowing local load_address to
12555 2009-06-24 Ian Lance Taylor <iant@google.com>
12558 * reloc.cc (relocate_sections): Skip empty relocation sections.
12560 2009-06-23 Ian Lance Taylor <iant@google.com>
12563 * layout.cc (Layout::create_note): Use choose_output_section
12564 rather than make_output_section.
12566 2009-06-23 Ian Lance Taylor <iant@google.com>
12569 * options.cc (General_options::parse_V): Set printed_version_.
12570 (General_options::General_options): Initialize printed_version_.
12571 * options.h (class General_options): Add printed_version_ field.
12572 * gold.cc (queue_initial_tasks): If there are no input files,
12573 don't give a fatal error if we printed the version information.
12574 (queue_middle_tasks): If using -r with a shared object, give a
12575 fatal error rather than an ordinary error.
12577 2009-06-23 Ian Lance Taylor <iant@google.com>
12580 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12581 (Layout::make_output_section): Set have_stabstr_section_ if we see
12582 a .stab*str section.
12583 (Layout::finalize): Call link_stabs_sections.
12584 (Layout::link_stabs_sections): New file.
12585 * layout.h (class Layout): Add have_stabstr_section_ field.
12586 Declare link_stabs_sections.
12588 2009-06-23 Doug Kwan <dougkwan@google.com>
12590 * Makefile.am (libgold_a_LIBADD): New.
12591 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12592 * Makefile.in: Regenerate.
12593 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12594 * configure: Regenerate.
12595 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12596 * fileread.cc: Include sys/state.h
12597 * gold.h: Declare memmem and strndup if found missing.
12598 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12600 2009-06-23 Ian Lance Taylor <iant@google.com>
12602 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12603 * configure: Rebuild.
12605 2009-06-23 Ian Lance Taylor <iant@google.com>
12608 * object.cc (Object::section_contents): Don't try to get a view if
12609 the section has length zero.
12610 (Object::handle_gnu_warning_section): If the section is empty, use
12611 the name of the section as the warning.
12613 2009-06-23 Ian Lance Taylor <iant@google.com>
12616 * stringpool.h (class Stringpool_template): Add optimize_ field.
12617 (Stringpool_template::set_optimize): New function.
12618 * stringpool.cc (Stringpool_template::Stringpool_template):
12619 Initialize optimize_ field.
12620 (Stringpool_template::set_string_offsets): Test local optimize
12621 fild rather than parameter.
12622 * layout.cc (Layout::Layout): Call set_optimize on the section
12625 2009-06-22 Ian Lance Taylor <iant@google.com>
12628 * yyscript.y: Parse TARGET.
12629 * script.cc (script_set_target): New function.
12630 * script-c.h (script_set_target): Declare.
12631 * options.cc (General_options::string_to_object_format): Rename
12632 from string_to_object_format in anonymous namespace. Change
12634 * options.h (class General_options): Declare
12635 string_to_object_format.
12637 2009-06-22 Ian Lance Taylor <iant@google.com>
12639 * script-sections.cc (Script_sections::create_segments): Don't put
12640 program headers in a PT_LOAD segment if -n or -N.
12642 2009-06-22 Ian Lance Taylor <iant@google.com>
12645 * options.h (class General_options): Add -z lazy and -z now. Sort
12646 -z options into alphabetical order.
12647 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12649 2009-06-21 Ian Lance Taylor <iant@google.com>
12651 * layout.cc (Layout::make_output_section): Call
12652 Target::new_output_section.
12653 (Layout::attach_allocated_section_to_segment): Put large section
12654 sections in a separate load segment with the large segment flag
12656 (Layout::segment_precedes): Sort large data segments after other
12658 (align_file_offset): New static function.
12659 (Layout::set_segment_offsets): Use align_file_offset.
12660 * output.h (class Output_section): Add is_small_section_ and
12661 is_large_section_ fields.
12662 (Output_section::is_small_section): New function.
12663 (Output_section::set_is_small_section): New function.
12664 (Output_section::is_large_section): New function.
12665 (Output_section::set_is_large_section): New function.
12666 (Output_section::is_large_data_section): New function.
12667 (class Output_segment): Add is_large_data_segment_ field.
12668 (Output_segment::is_large_data_segment): New function.
12669 (Output_segment::set_is_large_data_segment): New function.
12670 * output.cc (Output_section::Output_section): Initialize new
12672 (Output_segment::Output_segment): Likewise.
12673 (Output_segment::add_output_section): Add assertion that large
12674 data sections always go in large data segments. Force small data
12675 sections to the end of the list of data sections. Force small BSS
12676 sections to the start of the list of BSS sections. For large BSS
12677 sections to the end of the list of BSS sections.
12678 * symtab.h (class Symbol): Declare is_common_shndx.
12679 (Symbol::is_defined): Check Symbol::is_common_shndx.
12680 (Symbol::is_common): Likewise.
12681 (class Symbol_table): Define enum Commons_section_type. Update
12682 declarations. Add small_commons_ and large_commons_ fields.
12683 * symtab.cc (Symbol::is_common_shndx): New function.
12684 (Symbol_table::Symbol_table): Initialize new fields.
12685 (Symbol_table::add_from_object): Put small and large common
12686 symbols in the right list.
12687 (Symbol_table::sized_finalized_symbol): Check
12688 Symbol::is_common_shndx.
12689 (Symbol_table::sized_write_globals): Likewise.
12690 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12691 common symbol lists. Don't call do_allocate_commons_list if the
12693 (Symbol_table::do_allocate_commons_list): Remove is_tls
12694 parameter. Add comons_section_type parameter. Change all
12695 callers. Handle small and large common symbols.
12696 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12697 Symbol::is_common_shndx.
12698 * resolve.cc (symbol_to_bits): Likewise.
12699 * target.h (Target::small_common_shndx): New function.
12700 (Target::small_common_section_flags): New function.
12701 (Target::large_common_shndx): New function.
12702 (Target::large_common_section_flags): New function.
12703 (Target::new_output_section): New function.
12704 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12705 small_common_section_flags, and large_common_section_flags
12707 (Target::do_new_output_section): New virtual function.
12708 * arm.cc (Target_arm::arm_info): Initialize new fields.
12709 * i386.cc (Target_i386::i386_info): Likewise.
12710 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12712 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12713 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12714 (Target_x86_64::do_new_output_section): New function.
12715 * configure.ac: Define conditional MCMODEL_MEDIUM.
12716 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12717 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12718 (large_LDFLAGS): Define.
12719 * testsuite/large.c: New file.
12720 * testsuite/testfile.cc (Target_test::test_target_info):
12721 Initialize new fields.
12722 * configure, testsuite/Makefile.in: Rebuild.
12724 2009-06-05 Doug Kwan <dougkwan@google.com>
12726 * Makefile.am (CCFILES): Add target.cc.
12727 * Makefile.in: Regenerate.
12728 * i386.cc (class Target_i386): Define new virtual method to
12729 override do_is_local_label_name in parent.
12730 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12731 local symbols if --discard-locals or -X is given.
12732 * options.h (class General_options): Declare new options
12733 '--discard-locals' and '-X' for discarding locals.
12734 * target.h (class Target): Define new methods is_local_label_name.
12735 Declare new virtual method do_is_local_label_name.
12736 * target.cc: New file.
12737 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12738 (check_SCRIPTS): Add discard_locals_test.sh.
12739 (check_DATA): Add discard_local_tests.syms.
12740 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12741 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12742 * testsuite/Makefile.in: Regenerate.
12743 * testsuite/discard_locals_test.c: New file.
12744 * testsuite/discard_locals_test.sh: Same.
12746 2009-06-05 Doug Kwan <dougkwan@google.com>
12748 * object.cc (Sized_relobj::Sized_relobj): Initialize
12749 discarded_eh_frame_shndx_ to -1U.
12750 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12752 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12753 a discarded .eh_frame section.
12754 (Sized_relobj::do_finalize_local_symbols): Ditto.
12755 * object.h (class Sized_relobj): Declare new member
12756 discarded_eh_frame_shndx_.
12757 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12758 (local_labels_test.o, local_labels_test): New rules.
12759 * testsuite/Makefile.in: Regenerate.
12761 2009-06-04 Doug Kwan <dougkwan@google.com>
12763 * layout.cc (Layout::section_name_mapping): Add mapping for
12764 special ARM sections.
12766 2009-06-03 Doug Kwan <dougkwan@google.com>
12768 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12769 (utils::has_overflow): Same.
12771 2009-06-03 Ian Lance Taylor <iant@google.com>
12773 * layout.cc (Layout::section_name_mapping): New array, replacing
12774 Layout::linkonce_mapping.
12775 (Layout::section_name_mapping_count): New variable, replacing
12776 Layout::linkonce_mapping_count.
12777 (Layout::linkonce_output_name): Remove.
12778 (Layout::output_section_name): Rewrite.
12779 * layout.h (class Layout): Rename Linkonce_mapping to
12780 Section_name_mapping, linkonce_mapping to section_name_mapping,
12781 linkonce_mapping_count to section_name_mapping_count. Don't
12782 declare linkonce_output_name.
12784 2009-06-03 Doug Kwan <dougkwan@google.com>
12786 * gold/arm.cc (namespace utils): New.
12787 (Target_arm::reloc_is_non_pic): Define new method.
12788 (class Arm_relocate_functions): New.
12789 (Target_arm::Relocate::relocate): Handle relocation types used by
12792 2009-06-03 Ian Lance Taylor <iant@google.com>
12794 * arm.cc (Target_arm::scan::global): Use || instead of |.
12796 2009-06-02 Doug Kwan <dougkwan@google.com>
12798 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12799 issued_non_pic_error_.
12800 (class Target_arm::Scan): Declare new method check_non_pic.
12801 Define new method symbol_needs_plt_entry.
12802 Declare new data member issued_non_pic_error_.
12803 (class Target_arm::Relocate): Declare new method
12804 should_apply_static_reloc.
12805 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12806 (Target_arm::Scan::check_non_pic): Define new method.
12807 (Target_arm::Scan::local): Handle a small subset of reloc types used
12809 (Target_arm::Scan::local): Same.
12810 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12812 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12814 * incremental.cc (Incremental_inputs::report_command_line): Filter
12815 out --incremental-* options.
12817 2009-05-29 Doug Kwan <dougkwan@google.com>
12819 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12821 (class Target_arm): Update comment.
12822 (Target_arm::Target_arm): Initialize new data members GOT_,
12823 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12824 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12825 and Target_arm::rel_dyn_section.
12826 Declare new_enum Target_arm::Got_type.
12827 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12829 Update commments for member do_dynsym_value.
12830 (Target_arm::got_size, Target_arm::plt_section,
12831 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12832 new methods inside class defintion.
12833 (Target_arm::got_section): Define new method.
12834 (Target_arm::rel_dyn_section): Same.
12835 (Output_data_plt_arm): New template class.
12836 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12837 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12838 (Output_data_plt_arm::add_entry): Same.
12839 (Output_data_plt_arm::first_plt_entry): Define new
12840 static data member for PLT instruction template.
12841 (Output_data_plt_arm::plt_entry): Same.
12842 (Output_data_plt_arm::do_write): Define new method.
12843 (Target_arm::make_plt_entry): Same.
12844 (Target_arm::do_finalize_sections): Same.
12845 (Target_arm::do_dynsym_value): Same.
12847 2009-05-28 Doug Kwan <dougkwan@google.com>
12849 * Makefile.am (TARGETSOURCES): Add arm.cc.
12850 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12851 * Makefile.in: Regenerate.
12852 * arm.cc: New file.
12853 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12855 2009-05-26 Doug Kwan <dougkwan@google.com>
12857 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12858 (General_options::check_excluded_libs): Strip off directories in
12859 archive name before matching like GNU ld does.
12860 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12861 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12862 (exclude_libs_test_LDFLAGS): Add linker option
12863 -Wl,--exclude-libs,libexclude_libs_test_3
12864 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12865 an explicit archive without using -l.
12866 (alt/libexclude_libs_test_3.a): New make rule.
12867 * testsuite/Makefile.in: Regenerate.
12868 * testsuite/exclude_libs_test.c : Declare lib3_default().
12870 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12871 * exclude_libs_test_3.c: New file.
12873 2009-05-26 Nick Clifton <nickc@redhat.com>
12875 * po/id.po: New Indonesian translation.
12876 * po/gold.pot: Updated template file.
12878 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12880 * testsuite/Makefile.am: Add -ffunction-sections to compile
12881 gc_comdat_test files. Add -Wl,--gc-sections to build
12883 * testsuite/Makefile.in: Regenerate.
12884 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12886 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12888 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12889 kept comdat section was garbage collected.
12890 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12891 * testsuite/Makefile.in: Regenerate.
12892 * testsuite/gc_comdat_test.sh: New file.
12893 * testsuite/gc_comdat_test_1.cc: New file.
12894 * testsuite/gc_comdat_test_2.cc: New file.
12896 2009-05-19 Doug Kwan <dougkwan@google.com>
12898 * archive.cc (Archive::Archive): Move constructor from archive.h
12899 to here. Initialize no_export_.
12900 (Archive::get_elf_object_for_member): Set no_export flag of object.
12901 * archive.h (Archive::Archive): Move constructor body to
12903 (Archive::no_export): New method.
12904 (Archive::no_export_): New field.
12905 * object.h (Object::Object): Initialize no_export_ to false.
12906 (Object::no_export, Object::set_no_export): New methods.
12907 (Object::no_export_): New field.
12908 * options.cc (General_options::parse_exclude_libs): New method.
12909 (General_options::check_excluded_libs) Same.
12910 * options.h (exclude_libs): New option.
12911 (General_options::check_excluded_libs): New method declaration.
12912 (General_options::excluded_libs_): New field.
12913 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12914 default or protected visibility if an object has no-export flag set.
12915 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12916 (check_SCRIPTS): Add exclude_libs_test.sh.
12917 (check_DATA): Add exclude_libs_test.syms.
12918 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12919 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12920 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12921 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12922 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12923 libexclude_libs_test_2.a): New rules.
12924 * testsuite/Makefile.in: Regenerate.
12925 * testsuite/exclude_libs_test.c: New file.
12926 * testsuite/exclude_libs_test.sh: Ditto.
12927 * testsuite/exclude_libs_test_1.c: Ditto.
12928 * testsuite/exclude_libs_test_2.c: Ditto.
12930 2009-05-15 Ian Lance Taylor <iant@google.com>
12932 * configure.ac: Check for declarations for cases where libiberty.h
12933 checks HAVE_DECL_xxx.
12934 * configure, config.in: Rebuild.
12936 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12938 * gold.h (Incremental_argument_list): Remove (invalid) forward
12940 * incremental.cc (Incremental_inputs::report_achive): New method.
12941 (Incremental_inputs::report_object): New method.
12942 (Incremental_inputs::report_script): New method.
12943 (Incremental_inputs::finalize_inputs): New method.
12944 (Incremental_inputs::finalize): Call finalize_inputs().
12945 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12946 Create inputs entries.
12947 * incremental.h (Incremental_input_type): New enum.
12948 (Incremental_inputs::Incremental_input): Initialize new fields.
12949 (Incremental_inputs::report_inputs): New method.
12950 (Incremental_inputs::report_achive): New method.
12951 (Incremental_inputs::report_object): New method.
12952 (Incremental_inputs::report_script): New method.
12953 (Incremental_inputs::finalize_inputs): New method.
12954 (Incremental_inputs::Input_info): New struct.
12955 (Incremental_inputs::Input_info_map): New typedef.
12956 (Incremental_inputs::lock_): New field.
12957 (Incremental_inputs::Inputs_): New field.
12958 (Incremental_inputs::Inputs_map): New field.
12959 * main.cc (main): Call Incremental_input::report_inputs.
12960 * options.h (Input_argument_list): Typedef moved from
12962 (Input_file_group::Files): Remove, use ::Input_argument_list.
12963 (Input_file_group::Input_argument_list): Remove, use
12964 ::Input_argument_list.
12965 * plugin.cc (Plugin_manager::add_input_file): Add error in
12967 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12969 * script.cc (read_input_script): Call
12970 Incremental_input::report_script.
12971 * script.h (Script_info): New class.
12973 2009-04-27 Ian Lance Taylor <iant@google.com>
12975 * x86_64.cc (do_adjust_output_section): Set entsize to
12978 2009-04-23 Elliott Hughes <enh@google.com>
12980 * output.cc (Output_file::close): After short writes, continue
12981 writing from the correct offset in the buffer being written.
12983 2009-04-23 Chris Demetriou <cgd@google.com>
12985 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12986 * configure: Regenerate.
12987 * config.in: Regenerate.
12988 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12989 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12991 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12993 * incremental.cc (Incremental_inputs_header_data): Renamed from
12994 Incremental_input_header_data.
12995 (Incremental_inputs_header_data::data_size): New field.
12996 (Incremental_inputs_header_data::put_input_file_count): Renamed
12997 from input_file_count.
12998 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12999 from command_line_offset.
13000 (Incremental_inputs_header_data::put_reserved): Renamed from
13002 (Incremental_inputs_entry_data): Renamed from
13003 Incremental_input_entry_data.
13004 (Incremental_inputs_entry_data::data_size): New field.
13005 (Incremental_inputs::report_command_line): New method.
13006 (Incremental_inputs::finalize): New method.
13007 (Incremental_inputs::create_incremental_inputs_data): New method.
13008 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13009 * incremental.h: New file.
13010 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13011 (Layout::finalize): Create incremental inputs section in
13012 incremental builds.
13013 (Layout::create_incremental_info_sections): New method.
13014 * layout.h (Layout::incremental_inputs): New method.
13015 (Layout::create_incremental_info_sections): New method.
13016 (Layout::incremental_inputs_): New field.
13017 * main.cc (main): Notify Incremental_input of the command line.
13019 2009-04-01 Ian Lance Taylor <iant@google.com>
13020 Mikolaj Zalewski <mikolajz@google.com>
13022 * gold.h (reserve_unordered_map): Define, three versions, one for
13023 each version of Unordered_map.
13024 * layout.cc (Layout::Layout): Remove options parameter. Add
13025 number_of_input_files parameter. Don't initialize options_.
13026 Initialize number_of_input_files_ and resized_signatures_. Move
13027 sections_are_attached_.
13028 (Layout::layout_group): Reserve space for group_signatures_.
13029 (Layout::find_or_add_kept_section): Change name parameter to be a
13030 reference. Resize signatures_ map when it gets large enough.
13031 (Layout::layout_eh_frame): Use parameters->options() instead of
13033 (Layout::make_output_section): Likewise.
13034 (Layout::attach_allocated_section_to_segment): Likewise.
13035 (Layout::finalize, Layout::create_executable_stack): Likewise.
13036 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13037 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13038 * layout.h (class Layout): Update declarations. Remove options_
13039 field. Add number_of_input_files_ and resized_signatures_
13040 fields. Move sections_are_attached_ field.
13041 * main.cc (main): Pass number of input files to Layout
13042 constructor. Don't pass options.
13044 2009-03-30 Ian Lance Taylor <iant@google.com>
13046 * ffsll.c (ffsll): Correct implementation.
13048 2009-03-27 Ian Lance Taylor <iant@google.com>
13050 * ffsll.c: New file.
13051 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13052 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13053 * ftruncate.c (ftruncate): Declare before definition.
13054 * mremap.c (mremap): Likewise.
13055 * pread.c (pread): Likewise.
13056 * configure, Makefile.in, config.in: Rebuild.
13058 * mremap.c: New file.
13059 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13060 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13061 (mremap): Declare if HAVE_MREMAP is not defined.
13062 * configure, Makefile.in, config.in: Rebuild.
13064 2009-03-27 Cary Coutant <ccoutant@google.com>
13066 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13067 position independent.
13068 * sparc.cc (Target_sparc::check_non_pic): Likewise.
13069 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13071 2009-03-24 Cary Coutant <ccoutant@google.com>
13073 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13075 (needs_dynamic_reloc): Likewise.
13077 2009-03-24 Ian Lance Taylor <iant@google.com>
13079 * yyscript.y (file_cmd): Recognize EXTERN.
13080 (extern_name_list, extern_name_list_body): New nonterminals.
13081 * script.cc (script_add_extern): Define.
13082 * script-c.h (script_add_extern): Declare.
13084 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13086 * object.cc (is_elf_object): Define.
13087 * object.h (is_elf_object): Declare.
13088 * archive.cc (Archive::get_elf_object_for_member): Call
13090 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13092 2009-03-24 Elliott Hughes <enh@google.com>
13094 * output.cc (Output_file::map_anonymous): Define.
13095 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13096 try an anonymous one. Report the size if the mmap fails.
13097 * output.h (class Output_file): Declare map_anonymous.
13099 2009-03-24 Ian Lance Taylor <iant@google.com>
13101 * target-select.cc (instantiate_target): Don't acquire the lock if
13102 the instantiated_target_ field has already been set.
13104 2009-03-23 Ian Lance Taylor <iant@google.com>
13106 * gold-threads.h (class Initialize_lock): Define.
13107 * gold-threads.cc (class Initialize_lock_once): Define.
13108 (initialize_lock_control): New static variable.
13109 (initialize_lock_pointer): New static variable.
13110 (initialize_lock_once): New static function.
13111 (Initialize_lock::Initialize_lock): Define.
13112 (Initialize_lock::initialize): Define.
13113 * target-select.h: Include "gold-threads.h".
13114 (class Target_selector): Add lock_ and initialize_lock_ fields.
13115 Don't define instantiate_target, just declare it.
13116 * target-select.cc (Target_selector::Target_selector): Initialize
13118 (Target_selector::instantiate_target): Define.
13119 * descriptors.h: Include "gold-threads.h".
13120 (class Descriptors): Add initialize_lock_ field.
13121 * descriptors.cc (Descriptors::Descriptors): Initialize new
13123 (Descriptors::open): Use initialize_lock_ field
13124 * errors.h (class Errors): Add initialize_lock_ field.
13125 * errors.cc (Errors::Errors): Initialize new field.
13126 (Errors::initialize_lock): Use initialize_lock_ field.
13127 * powerpc.cc (class Target_selector_powerpc): Remove
13128 instantiated_target_ field. In do_recognize call
13129 instantiate_target rather than do_instantiate_target. In
13130 do_instantiate_target just allocate a new target.
13131 * sparc.cc (class Target_selector_sparc): Likewise.
13133 * freebsd.h: New file.
13134 * i386.cc: Include "freebsd.h".
13135 (Target_i386): Derive from Target_freebsd rather than
13137 (Target_selector_i386): Derive from Target_selector_freebsd rather
13138 than Target_selector.
13139 * x86_64.cc: Include "freebsd.h".
13140 (Target_x86_64): Derive from Target_freebsd rather than
13142 (Target_selector_x86_64): Derive from Target_selector_freebsd
13143 rather than Target_selector.
13144 * target.h (class Target): Add adjust_elf_header and
13145 do_adjust_elf_header.
13146 * output.cc (Output_file_header:: do_sized_write): Call target
13147 adjust_elf_header routine.
13148 * configure.tgt: Set targ_osabi.
13149 * configure.ac: Define GOLD_DEFAULT_OSABI.
13150 * parameters.cc (Parameters::default_target): Pass
13151 GOLD_DEFAULT_OSABI to select_target.
13152 * target-select.h (class Target_selector): Make instantiate_target
13153 protected rather than private.
13154 * Makefile.am (HFILES): Add freebsd.h.
13155 * configure, Makefile.in, config.in: Rebuild.
13157 * merge.cc (do_add_input_section): Correct pend value. Change
13158 message about last entry not being null terminated from error to
13161 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13163 * incremental.cc: New file.
13164 * Makefile.am (CCFILES): Add incremental.cc.
13165 * Makefile.in: Rebuild.
13167 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13169 * layout.cc (Layout::output_section_name): Preserve names
13170 of '.note.' sections.
13172 2009-03-19 Ian Lance Taylor <iant@google.com>
13174 * descriptors.cc (Descriptors::open): Check that the options are
13175 valid before using them.
13177 2009-03-18 Ian Lance Taylor <iant@google.com>
13179 * script-sections.h: Include <list>.
13180 (class Script_sections): Change Sections_elements from std::vector
13181 to std::list. Typedef public Elements_iterator. Add
13182 orphan_section_placement_, data_segment_align_start_, and
13183 saw_data_segment_align_ fields. Remove data_segment_align_index_
13185 * script-sections.cc (class Orphan_section_placement): New class.
13186 (class Sections_element): Add virtual functions is_relro and
13187 orphan_section_init. Remove virtual function place_orphan_here.
13188 (class Output_section_definition): Add is_relro and
13189 orphan_section_init. Remove place_orphan_here.
13190 (class Orphan_output_section): Likewise.
13191 (Script_sections::Script_sections): Update for field changes.
13192 (Script_sections::data_segment_align): Set saw_data_segment_align_
13193 and data_segment_align_start_, not data_segment_align_index.
13194 (Script_sections::data_segment_relro_end): Check
13195 saw_data_segment_align_. Use data_segment_align_start_ rather
13196 than data_segment_align_index_.
13197 (Script_sections::place_orphan): Rewrite to use
13198 Orphan_section_placement.
13200 2009-03-17 Ian Lance Taylor <iant@google.com>
13202 * archive.cc (Archive::add_symbols): Check for a version attached
13203 to the symbol name in the archive map.
13204 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13205 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13206 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13207 (ver_test_11.a): New target.
13208 * testsuite/Makefile.in: Rebuild.
13210 * configure.ac: Check for chsize and posix_fallocate. Replace
13212 * ftruncate.c: New file, from gnulib.
13213 * output.cc (posix_fallocate): Define dummy version if not
13214 HAVE_POSIX_FALLOCATE.
13215 (Output_file::map): Call posix_fallocate rather than lseek and
13217 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13218 * configure, Makefile.in, config.in: Rebuild.
13220 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13222 * layout.h (Layout::create_note): Add section_name parameter.
13223 * layout.cc (Layout::create_note): Likewise.
13224 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13226 2009-03-17 Ian Lance Taylor <iant@google.com>
13228 * descriptors.cc: Include "options.h".
13229 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13230 (Descriptors::open): Always use O_CLOEXEC when opening a new
13231 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13232 then set FD_CLOEXEC.
13234 * sparc.cc (class Target_sparc): Add has_got_section.
13235 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13236 make sure we have a GOT section.
13238 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13239 (Target_sparc::Scan::local): Likewise.
13240 (Target_sparc::Scan::global): Likewise.
13241 (Target_sparc::Relocate::relocate): Likewise.
13242 (Target_sparc::Relocate::relocate_tls): Likewise.
13244 * symtab.cc (Symbol_table::define_default_version): New function,
13245 broken out of add_from_object.
13246 (Symbol_table::add_from_object): Call define_default_version.
13247 (Symbol_table::define_special_symbol): Add resolve_oldsym
13248 parameter. Change all callers. If the version for a symbol comes
13249 from a version script, resolve it with the symbol with the same
13250 name with no version. Also add the symbol without a version if
13252 (do_define_in_output_data): If resolving with oldsym, don't delete
13254 (do_define_in_output_segment): Likewise.
13255 (do_define_as_constant): Likewise.
13256 * symtab.h (class Symbol_table): Update declarations.
13258 2009-03-13 Ian Lance Taylor <iant@google.com>
13260 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13261 (Read_symbols::requeue): New function.
13262 (Read_symbols::do_read_symbols): If make_elf_object fails because
13263 the target type is not configured, and the file was searched for,
13264 issue a warning and retry with the next directory.
13265 (Add_symbols::run): If the file has an incompatible format, and
13266 it was searched for, requeue the Read_symbols task. On error,
13267 release the object.
13268 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13269 dirindex parameter to constructor. Change all callers. Declare
13270 incompatible_warning and requeue.
13271 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13272 input_argument_ and input_group_ fields. Add them to
13273 constructor. Change all callers.
13274 (class Read_script): Add dirindex_ field. Add it to constructor.
13275 Change all callers.
13276 * archive.cc (Archive::setup): Remove input_objects parameter.
13277 Change all callers.
13278 (Archive::get_file_and_offset): Likewise.
13279 (Archive::read_all_symbols): Likewise.
13280 (Archive::read_symbols): Likewise.
13281 (Archive::get_elf_object_for_member): Remove input_objects
13282 parameter. Add punconfigured parameter. Change all callers.
13283 (Archive::add_symbols): Change return type to bool. Check return
13284 value of include_member.
13285 (Archive::include_all_members): Likewise.
13286 (Archive::include_member): Change return type to bool. Return
13287 false if first included object has incompatible target. Set
13288 included_member_ field.
13289 (Add_archive_symbols::run): If add_symbols returns false, requeue
13291 * archive.h (class Archive): Add included_member_ field.
13292 Initialize it in constructor. Add input_file and searched_for
13293 methods. Update declarations.
13294 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13295 input_argument_ fields. Add them to constructor. Change all
13297 * script.cc: Include "target-select.h".
13298 (class Parser_closure): Add skip_on_incompatible_target_ and
13299 found_incompatible_target_ fields. Add
13300 skip_on_incompatible_target parameter to constructor. Change all
13301 callers. Add methods skip_on_incompatible_target,
13302 clear_skip_on_incompatible_target, found_incompatible_target, and
13303 set_found_incompatible_target.
13304 (read_input_script): Add dirindex parameter. Change all callers.
13305 If parser finds an incompatible target, requeue Read_symbols
13307 (script_set_symbol): Clear skip_on_incompatible_target in
13309 (script_add_assertion, script_parse_option): Likewise.
13310 (script_start_sections, script_add_phdr): Likewise.
13311 (script_check_output_format): New function.
13312 * script.h (read_input_script): Update declaration.
13313 * script-c.h (script_check_output_format): Declare.
13314 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13315 (ignore_cmd): Remove OUTPUT_FORMAT.
13316 * fileread.cc (Input_file::Input_file): Add explicit this.
13317 (Input_file::will_search_for): New function.
13318 (Input_file::open): Add pindex parameter. Change all callers.
13319 * fileread.h (class Input_file): Add input_file_argument method.
13320 Declare will_search_for. Update declarations.
13321 * object.cc (make_elf_object): Add punconfigured parameter.
13322 Change all callers.
13323 * object.h (class Object): Make input_file public. Add
13324 searched_for method.
13325 (make_elf_object): Update declaration.
13326 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13328 * dirsearch.h (class Dirsearch): Update declaration.
13329 * options.h (class General_options): Add --warn-search-mismatch.
13330 * parameters.cc (Parameters::is_compatible_target): New function.
13331 * parameters.h (class Parameters): Declare is_compatible_target.
13332 * workqueue.cc (Workqueue::add_blocker): New function.
13333 * workqueue.h (class Workqueue): Declare add_blocker.
13335 * fileread.cc (Input_file::open): Remove options parameter.
13336 Change all callers.
13337 (Input_file::open_binary): Likewise.
13338 * script.cc (read_input_script): Likewise.
13339 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13340 options parameter from constructor. Change all callers.
13341 (class Read_script): Likewise.
13342 * fileread.h (class Input_file): Update declarations.
13343 * script.h (read_input_script): Update declaration.
13345 2009-03-10 Nick Clifton <nickc@redhat.com>
13347 * po/es.po: New Spanish translation.
13349 2009-03-06 Cary Coutant <ccoutant@google.com>
13351 * options.cc (parse_short_option): Keep dash_z from registering itself.
13353 2009-03-03 Ian Lance Taylor <iant@google.com>
13356 * target-reloc.h (relocate_section): Pass output_section to
13358 * i386.cc (Target_i386::should_apply_static_reloc): Add
13359 output_section parameter. Change all callers.
13360 (Target_i386::Relocate::relocate): Add output_section parameter.
13361 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13362 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13363 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13364 * testsuite/two_file_shared.sh: New script.
13365 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13366 (check_DATA): Add two_file_shared.dbg.
13367 (two_file_shared.dbg): New target.
13368 * testsuite/Makefile.in: Rebuild.
13370 2009-03-01 Ian Lance Taylor <iant@google.com>
13372 * configure.ac: Check for byteswap.h.
13373 * configure: Rebuild.
13374 * config.in: Rebuild.
13376 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13378 * layout.cc (Layout::find_or_add_kept_section): New function.
13379 (Layout::add_comdat): Removed.
13380 * layout.h (struct Kept_section): Move out of class Layout.
13381 Remove trailing underscores from field names. Add group_sections
13382 field. Rename group_ field to is_group. Change all uses.
13383 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13384 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13385 comdat_groups_ field.
13386 (Sized_relobj::include_section_group): Use
13387 find_or_add_kept_section and Kept_section::group_sections.
13388 (Sized_relobj::include_linkonce_section): Likewise.
13389 * object.cc (class Sized_relobj): Don't define Comdat_group or
13390 Comdat_group_table. Remove find_comdat_group and
13391 add_comdat_group. Remove comdat_groups_ field.
13392 * plugin.cc (include_comdat_group): Use
13393 Layout::find_or_add_kept_section.
13395 2009-02-28 Ian Lance Taylor <iant@google.com>
13397 * README: --gc-sections and map files are now supported. Document
13398 some build requirements.
13401 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13402 relocatable link set the value of the section symbol to zero.
13403 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13404 relocatable link don't include the section address in the local
13407 2009-02-27 Ian Lance Taylor <iant@google.com>
13410 * options.h (class Search_directory): Add is_system_directory.
13411 (class General_options): Declare is_in_system_directory.
13412 * options.cc (get_relative_sysroot): Make static.
13413 (get_default_sysroot): Make static.
13414 (General_optoins::is_in_system_directory): New function.
13415 * fileread.cc (Input_file::is_in_system_directory): New function.
13416 * fileread.h (class Input_file): Declare is_in_system_directory.
13417 * object.h (class Object): Add is_in_system_directory.
13418 (class Input_objects): Remove system_library_directory_ field.
13419 * object.cc (Input_objects::add_object): Don't set
13420 system_library_directory_.
13421 (input_objects::found_in_system_library_directory): Remove.
13422 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13423 parameter. Change all callers.
13424 (Symbol_table::sized_write_globals): Likewise.
13425 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13426 Call Object::is_in_system_directory.
13427 * symtab.h (class Symbol_table): Update declarations.
13430 * descriptors.h (Open_descriptor): Add is_on_stack field.
13431 * descriptors.cc (Descriptors::open): If the descriptor is on the
13432 top of the stack, remove it. Initialize is_on_stack field.
13433 (Descriptors::release): Only add pod to stack if it is not on the
13435 (Descriptors::close_some_descriptor): Clear stack_next and
13436 is_on_stack fields.
13439 * output.cc (Output_section::find_starting_output_address): Rename
13440 from starting_output_address; add PADDR parameter; change return
13442 * output.h (class Output_section): Declare
13443 find_starting_output_address instead of starting_output_address.
13444 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13445 section symbol for which we can't find a merge section.
13448 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13449 hidden or internal, force the symbol to be local.
13450 * resolve.cc (Symbol::override_visibility): Define.
13451 (Symbol::override_base): Use override_visibility.
13452 (Symbol_table::resolve): Likewise.
13453 (Symbol::override_base_with_special): Likewise.
13454 (Symbol_table::override_with_special): If the visibility is hidden
13455 or internal, force the symbol to be local.
13456 * symtab.h (class Symbol): Add set_visibility and
13457 override_visibility.
13458 * testsuite/ver_test_1.sh: New file.
13459 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13460 (check_DATA): Add ver_test_1.syms.
13461 (ver_test_1.syms): New target.
13462 * testsuite/Makefile.in: Rebuild.
13464 2009-02-25 Cary Coutant <ccoutant@google.com>
13466 * layout.cc (Layout::choose_output_section): Don't rename sections
13467 when using a linker script that has a SECTIONS clause.
13468 * Makefile.in: Regenerate.
13470 * testsuite/Makefile.am (script_test_5.sh): New test case.
13471 * testsuite/Makefile.in: Regenerate.
13472 * testsuite/script_test_5.cc: New file.
13473 * testsuite/script_test_5.sh: New file.
13474 * testsuite/script_test_5.t: New file.
13476 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13478 * archive.cc (Archive::include_member): Update calls to add_symbols.
13479 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13480 the Layout argument.
13481 * dynobj.h (do_add_symbols): Add the Layout argument.
13482 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13484 * object.h (Object::add_symbols): Add the Layout argument.
13485 (Object::do_add_symbols): Add the Layout argument.
13486 (Sized_relobj::do_add_symbols): Add the Layout argument.
13487 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13488 Unify the two versions.
13489 (Add_plugin_symbols): Remove.
13490 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13491 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13492 (Add_plugin_symbols): Remove.
13493 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13494 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13495 (Add_symbols::run): Make it work with Pulginobj.
13497 2009-02-06 Ian Lance Taylor <iant@google.com>
13499 * object.cc (Sized_relobj::do_layout): Make info message start
13500 with lower case letter.
13502 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13504 * binary.cc: Fix file comment.
13506 * options.h (enum Incremental_disposition): Define.
13507 (class General_options): Add new options: --incremental,
13508 --incremental_changed, --incremental_unchanged,
13509 --incremental_unknown. Add incremental_disposition_ and
13510 implicit_incremental_ fields.
13511 (General_options::incremental_disposition): New function.
13512 (class Position_dependent_options): Add incremental_disposition
13514 (Position_dependent_options::copy_from_options): Set incremental
13516 * options.cc (General_options::parse_incremental_changed): New
13518 (General_options::parse_incremental_unchanged): New function.
13519 (General_options::parse_incremental_unknown): New function.
13520 (General_options::General_options): Initialize new fields
13521 incremental_disposition_ and implicit_incremental_.
13522 (General_options::finalize): Check for uasge of --incremental-*
13523 without --incremental.
13525 2009-02-06 Chris Demetriou <cgd@google.com>
13527 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13528 pointer and to report location as the file name associated with
13530 (gold_undefined_symbol_at_location): New function to replace the
13531 old gold_undefined_symbol functionality.
13532 * target-reloc.h (relocate_section): Update to use
13533 gold_undefined_symbol_at_location.
13534 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13535 Call gold_undefined_symbol function rather than gold_error.
13536 * errors.h (Errors::undefined_symbol): Take location as a
13537 string, rather than calculating it from a relocation.
13538 * errors.cc (Errors::fatal): Print "fatal error:" before the
13540 (Errors::error, Errors::error_at_location): Print "error: "
13541 before the formatted message.
13542 (Errors::undefined_symbol): Take location as a string, rather
13543 than calculating it from a relocation.
13544 (gold_undefined_symbol_at_location): New function akin to
13545 old gold_undefined_symbol, calculates location from relocation.
13546 (gold_undefined_symbol): Change to take only a Symbol pointer
13547 and to report location as the file name associated with the symbol.
13548 * testsuite/debug_msg.sh: Update for changed error messages.
13549 * testsuite/undef_symbol.sh: Likewise.
13551 2009-02-04 Duncan Sands <baldrick@free.fr>
13554 * reduced_debug_output.h
13555 (Output_reduced_debug_abbrev_section::failed): Use format for
13557 (Output_reduced_debug_info_section::faild): Likewise.
13559 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13561 * script.cc (Lazy_demangler): New class.
13562 (Version_script_info::get_symbol_version_helper): Demangle a
13565 2009-01-29 Cary Coutant <ccoutant@google.com>
13567 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13569 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13571 2009-01-28 Ian Lance Taylor <iant@google.com>
13573 * version.cc (version_string): Bump to 1.9.
13575 * gold.h: Include <cstring> and <stdint.h>.
13576 * version.cc: Include <cstdio>.
13577 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13579 * reduced_debug_output.cc (insert_into_vector): Rename from
13580 Insert_into_vector; change all callers. Use Swap_unaligned to
13581 avoid aliasing issue; remove union since it is unnecessary.
13583 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13585 * Makefile.am (CCFILES): Add gc.cc.
13586 (HFILES): Add gc.h.
13587 * Makefile.in: Regenerate.
13588 * gold.cc (Gc_runner): New class.
13589 (queue_initial_tasks): Call garbage collection related tasks
13590 when corresponding options are invoked.
13591 (queue_middle_gc_tasks): New function.
13592 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13593 processed early before laying out sections during garbage collection.
13594 * gold.h (queue_middle_gc_tasks): New function.
13595 (is_prefix_of): Move from "layout.cc".
13596 * i386.cc (Target_i386::gc_process_relocs): New function.
13597 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13598 * main.cc (main): Create object of class "Garbage_collection".
13599 * object.cc (Relobj::copy_symbols_data): New function.
13600 (Relobj::is_section_name_included): New function.
13601 (Sized_relobj::do_layout): Allow this function to be called twice
13602 during garbage collection and defer layout of section during the
13604 * object.h (Relobj::get_symbols_data): New function.
13605 (Relobj::is_section_name_included): New function.
13606 (Relobj::copy_symbols_data): New function.
13607 (Relobj::set_symbols_data): New function.
13608 (Relobj::get_relocs_data): New function.
13609 (Relobj::set_relocs_data): New function.
13610 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13611 (Relobj::gc_process_relocs): New function.
13612 (Relobj::do_gc_process_relocs): New pure virtual function.
13613 (Relobj::sd_): New data member.
13614 (Sized_relobj::is_output_section_offset_invalid): New function.
13615 (Sized_relobj::do_gc_process_relocs): New function.
13616 * options.h (General_options::gc_sections): Modify to not be a no-op.
13617 (General_options::print_gc_sections): New option.
13618 * plugin.cc (Plugin_finish::run): Remove function call to
13619 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13620 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13621 * reloc.cc (Read_relocs::run): Add task to process relocs and
13622 determine unreferenced sections when doing garbage collection.
13623 (Gc_process_relocs): New class.
13624 (Sized_relobj::do_gc_process_relocs): New function.
13625 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13626 sections that are garbage collected.
13627 * reloc.h (Gc_process_relocs): New class.
13628 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13629 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13630 symbols whose corresponding sections are garbage collected.
13631 (Symbol_table::Symbol_table): Add new parameter for the garbage
13633 (Symbol_table::gc_mark_undef_symbols): New function.
13634 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13635 (Symbol_table::gc_mark_dyn_syms): New function.
13636 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13638 (Symbol_table::add_from_object): Likewise.
13639 (Symbol_table::add_from_relobj): When building shared objects, do not
13640 treat externally visible symbols as garbage.
13641 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13642 table information for static and relocatable links.
13643 * symtab.h (Symbol_table::set_gc): New function.
13644 (Symbol_table::gc): New function.
13645 (Symbol_table::gc_mark_undef_symbols): New function.
13646 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13647 (Symbol_table::gc_mark_dyn_syms): New function.
13648 (Symbol_table::gc_): New data member.
13649 * target.h (Sized_target::gc_process_relocs): New pure virtual
13651 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13652 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13654 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13656 * options.h (General_options::gc_sections): Define as a no-op for now.
13657 (General_options::no_keep_memory): Ditto.
13658 (General_options::Bshareable): Define.
13659 * options.cc (General_options::finalize): Honor -Bshareable.
13661 2009-01-20 Andreas Schwab <schwab@suse.de>
13663 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13664 read the value in the contents, since we don't use it. Use the
13665 template endianness when writing.
13666 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13668 2009-01-19 Andreas Schwab <schwab@suse.de>
13670 * configure.tgt (powerpc64-*): Fix targ_obj.
13672 2009-01-15 Ian Lance Taylor <iant@google.com>
13674 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13675 local symbols when stripping all symbols.
13677 2009-01-14 Cary Coutant <ccoutant@google.com>
13679 * output.cc (Output_reloc): Add explicit instantiations.
13681 2009-01-14 Cary Coutant <ccoutant@google.com>
13683 * archive.cc (Archive::get_elf_object_for_member): Remove call
13684 to File_read::claim_for_plugin.
13685 * descriptors.cc (Descriptors::open): Remove reference to
13687 (Descriptors::claim_for_plugin): Remove.
13688 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13689 (Descriptors::is_claimed): Remove.
13690 (claim_descriptor_for_plugin): Remove.
13691 * fileread.cc (File_read::claim_for_plugin): Remove.
13692 * fileread.h (File_read::claim_for_plugin): Remove.
13693 (File_read::descriptor): Reopen descriptor if necessary.
13694 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13695 (Plugin_manager::all_symbols_read): Add task parameter. Change
13697 (Plugin_manager::get_input_file): New function.
13698 (Plugin_manager::release_input_file): New function.
13699 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13700 corresponding data member.
13701 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13702 and pass to base constructor. Change all callers.
13703 (get_input_file, release_input_file): New functions.
13704 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13705 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13706 (Plugin_manager::all_symbols_read): Add task parameter.
13707 (Plugin_manager::get_input_file): New function.
13708 (Plugin_manager::release_input_file): New function.
13709 (Plugin_manager::task_): New data member.
13710 (Pluginobj::Pluginobj): Add filesize parameter.
13711 (Pluginobj::filename): New function.
13712 (Pluginobj::descriptor): New function.
13713 (Pluginobj::filesize): New function.
13714 (Pluginobj::filesize_): New data member.
13715 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13716 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13717 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13719 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13720 with archive libraries.
13721 * testsuite/Makefile.in: Regenerate.
13722 * testsuite/plugin_test.c (struct sym_info): New type.
13723 (get_input_file, release_input_file): New static variables.
13724 (onload): Capture new transfer vector entries.
13725 (claim_file_hook): Stop reading at end of file according to filesize.
13726 Factor out parsing of readelf output into separate function.
13727 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13728 APIs and get the source file name from the symbol table. Convert
13729 source file name to corresponding object file name. Print info
13730 message when adding new input files.
13731 (parse_readelf_line): New function.
13732 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13733 * testsuite/plugin_test_2.sh: Likewise.
13734 * testsuite/plugin_test_3.sh: Likewise.
13735 * testsuite/plugin_test_4.sh: New test case.
13737 2009-01-07 Ian Lance Taylor <iant@google.com>
13739 * version.cc (version_string): Bump to 1.8.
13741 2008-12-23 Cary Coutant <ccoutant@google.com>
13743 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13744 * plugin.cc (Plugin_manager::finish): Rename as
13745 layout_deferred_objects. Move cleanup to separate function.
13746 (Plugin_manager::cleanup): New function.
13747 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13749 * plugin.h (Plugin_manager::finish): Rename as
13750 layout_deferred_objects.
13751 (Plugin_manager::cleanup): New function.
13752 (Plugin_manager::cleanup_done): New field.
13754 2008-12-23 Cary Coutant <ccoutant@google.com>
13756 * plugin.cc (is_visible_from_outside): New function.
13757 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13758 so we don't return "IR only" status for exported symbols or -r links.
13760 * testsuite/Makefile.am (plugin_test_3): New test case.
13761 * testsuite/Makefile.in: Regenerate.
13762 * testsuite/plugin_test_3.sh: New file.
13764 2008-12-22 Cary Coutant <ccoutant@google.com>
13766 * object.cc (Sized_relobj::layout_section): New function.
13767 (Sized_relobj::do_layout): Defer layout of input sections until after
13768 plugin has provided replacement files.
13769 (Sized_relobj::do_layout_deferred_sections): New function.
13770 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13771 (Relobj::layout_deferred_sections): New function.
13772 (Relobj::do_layout_deferred_sections): New function.
13773 (Sized_relobj::do_layout_deferred_sections): New function.
13774 (Sized_relobj::layout_section): New function.
13775 (Sized_relobj::Deferred_layout): New structure.
13776 (Sized_relobj::deferred_layout_): New field.
13777 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13778 Change all callers. Layout deferred sections.
13779 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13781 (Plugin_hook::run): Move code from do_plugin_hook inline.
13782 (Plugin_hook::do_plugin_hook): Remove.
13783 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13784 (Plugin_manager::finish): Renamed, was cleanup.
13785 (Plugin_manager::should_defer_layout): New function.
13786 (Plugin_manager::add_deferred_layout_object): New function.
13787 (Plugin_manager::Deferred_layout_list): New type.
13788 (Plugin_manager::deferred_layout_objects_): New field.
13789 (Plugin_hook::do_plugin_hook): Remove.
13791 2008-12-17 Ian Lance Taylor <iant@google.com>
13793 * options.h (class General_options): Add --no case for
13796 2008-12-16 Cary Coutant <ccoutant@google.com>
13798 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13800 (Plugin_manager::claim_file): Create plugin object even if
13801 plugin did not call the add_symbols callback.
13802 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13803 asking for more symbols than were added.
13804 * testsuite/Makefile.am (plugin_test_1): Add test case with
13806 (empty.syms): New target.
13807 * testsuite/Makefile.in: Regenerate.
13808 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13809 message. Don't call add_symbols if no globals.
13810 (all_symbols_read_hook): Don't provide replacement for empty
13813 2008-12-12 Ian Lance Taylor <iant@google.com>
13815 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13816 r_type == 0 for a local symbol with r_sym == 0.
13817 (scan_relocatable_relocs): Pass r_sym to
13818 local_non_section_strategy.
13819 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13822 * configure.ac: Update test for TLS descriptors: they are
13823 supported as of glibc 2.9.
13824 * configure: Rebuild.
13826 2008-12-11 Ian Lance Taylor <iant@google.com>
13829 * target-reloc.h (Default_scan_relocatable_relocs): For each
13830 function, map r_type == 0 to RELOC_DISCARD.
13832 2008-12-10 Cary Coutant <ccoutant@google.com>
13834 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13835 object to override a kept COMDAT group from a plugin object.
13837 2008-12-09 Ian Lance Taylor <iant@google.com>
13840 * yyscript.y (file_cmd): Handle INPUT.
13842 * testsuite/initpri1.c: Change all declarations to be full
13843 prototypes by adding void, to avoid compiler warnings.
13845 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13847 * options.cc (General_options::parse_plugin_opt): New.
13848 (General_options::add_plugin): The argument now is just the filename.
13849 (General_options::add_plugin_option): New.
13850 * options.h (plugin_opt): New.
13851 (add_plugin): Change argument name.
13852 (add_plugin_option): New.
13853 * plugin.cc (Plugin::load): Don't parse the plugin option.
13854 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13855 (Plugin::add_option): New.
13856 (Plugin::args_): Change type.
13857 (Plugin::filename_): New.
13858 (Plugin_manager::add_plugin_option): New.
13859 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13860 * testsuite/Makefile.in: Regenerate.
13862 2008-12-05 Cary Coutant <ccoutant@google.com>
13864 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13865 Handle --strip-lto-sections option.
13866 * options.h (strip_lto_sections): New option.
13868 2008-12-01 Cary Coutant <ccoutant@google.com>
13870 * plugin.cc (ld_plugin_message): Change format parameter to const.
13871 Fix mismatch between new[] and delete.
13873 2008-11-14 Cary Coutant <ccoutant@google.com>
13875 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13878 2008-11-05 Craig Silverstein <csilvers@google.com>
13880 * options.cc (General_options::parse_dynamic_list): New function.
13881 * options.h (General_options): New flags dynamic_list,
13882 dynamic_list_data, dynamic_list_cpp_new, and
13883 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13884 (General_options::in_dynamic_list): New function.
13885 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13886 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13887 (Lex::can_continue_name): Likewise.
13889 (read_script_file): New parameter script_options.
13890 (read_dynamic_list): New function.
13891 (Script_options::define_dynamic_list): New function.
13892 (dynamic_list_keyword_parsecodes): New variable.
13893 (dynamic_list_keywords): New variable.
13894 * script.h (Script_options::define_dynamic_list): New function
13896 (read_dynamic_list): New function prototype.
13897 * symtab.cc (strprefix): New macro.
13898 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13899 dynamic_list_data, dynamic_list_cpp_new, and
13900 dynamic_list_cpp_typeinfo.
13901 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13902 (dynamic_list_expr): New rule.
13903 (dynamic_list_nodes): Likewise.
13904 (dynamic_list_node): Likewise.
13905 * testsuite/Makefile.am (dynamic_list): New test.
13906 * testsuite/Makefile.in: Regenerated.
13907 * testsuite/dynamic_list.t: New file.
13908 * testsuite/dynamic_list.sh: New file.
13910 2008-11-05 Craig Silverstein <csilvers@google.com>
13912 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13913 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13914 (t11_last): Likewise.
13915 * testsuite/ver_test_6.c (main): Likewise.
13917 2008-10-07 Cary Coutant <ccoutant@google.com>
13919 * options.c (General_options::finalize): Add check for -static and
13921 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13924 2008-10-02 Cary Coutant <ccoutant@google.com>
13926 * plugin.cc (make_sized_plugin_object): Fix conditional
13927 compilation to work when not all targets are enabled.
13929 2008-09-29 Cary Coutant <ccoutant@google.com>
13931 * archive.cc (Archive::get_file_and_offset): Use filename instead
13932 of name to get library path.
13933 (Archive::include_member): Unlock external member of a thin archive.
13935 * testsuite/Makefile.am (TEST_AR): New variable.
13936 (thin_archive_test_1): New test.
13937 (thin_archive_test_2): New test.
13938 * testsuite/Makefile.in: Regenerate.
13939 * testsuite/thin_archive_main.cc: New file.
13940 * testsuite/thin_archive_test_1.cc: New file.
13941 * testsuite/thin_archive_test_2.cc: New file.
13942 * testsuite/thin_archive_test_3.cc: New file.
13943 * testsuite/thin_archive_test_4.cc: New file.
13945 2008-09-29 Cary Coutant <ccoutant@google.com>
13947 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13948 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13950 (Sized_relobj::do_finalize_local_symbols): Likewise.
13951 (Sized_relobj::map_to_kept_section): Likewise.
13952 * object.h (Sized_relobj::invalid_address): New constant.
13953 (Sized_relobj::do_output_section_offset): Check for invalid_address
13955 * output.cc (Output_reloc::local_section_offset): Use constant
13956 invalid_address instead of -1U.
13957 (Output_reloc::get_address): Likewise.
13958 (Output_section::output_address): Change -1U to -1ULL.
13959 * output.h (Output_reloc::invalid_address): New constant.
13960 * reloc.cc (Sized_relobj::write_sections): Use constant
13961 invalid_address instead of -1U.
13962 (Sized_relobj::relocate_sections): Likewise.
13963 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13964 values for merge sections.
13965 * target-reloc.h (relocate_for_relocatable): Use constant
13966 invalid_address instead of -1U.
13968 2008-09-19 Cary Coutant <ccoutant@google.com>
13970 Add plugin functionality for link-time optimization (LTO).
13971 * configure.ac (plugins): Add --enable-plugins option.
13972 * configure: Regenerate.
13973 * config.in: Regenerate.
13974 * Makefile.am (LIBDL): New variable.
13975 (CCFILES): Add plugin.cc.
13976 (HFILES): Add plugin.h.
13977 (ldadd_var): Add LIBDL.
13978 * Makefile.in: Regenerate.
13980 * archive.cc: Include "plugin.h".
13981 (Archive::setup): Don't preread archive symbols when using a plugin.
13982 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13983 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13985 (Archive::include_member): Add symbols from plugin objects.
13986 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13987 * descriptors.cc (Descriptors::open): Check for file descriptors
13988 abandoned by plugins.
13989 (Descriptors::claim_for_plugin): New function.
13990 * descriptors.h (Descriptors::claim_for_plugin): New function.
13991 (Open_descriptor::is_claimed): New field.
13992 (claim_descriptor_for_plugin): New function.
13993 * fileread.cc (File_read::claim_for_plugin): New function.
13994 * fileread.h (File_read::claim_for_plugin): New function.
13995 (File_read::descriptor): New function.
13996 * gold.cc: Include "plugin.h".
13997 (queue_initial_tasks): Add task to call plugin hooks for generating
13999 * main.cc: Include "plugin.h".
14000 (main): Load plugin libraries.
14001 * object.h (Pluginobj): Declare.
14002 (Object::pluginobj): New function.
14003 (Object::do_pluginobj): New function.
14004 (Object::set_target): New function.
14005 * options.cc: Include "plugin.h".
14006 (General_options::parse_plugin): New function.
14007 (General_options::General_options): Initialize plugins_ field.
14008 (General_options::add_plugin): New function.
14009 * options.h (Plugin_manager): Declare.
14010 (General_options): Add --plugin option.
14011 (General_options::has_plugins): New function.
14012 (General_options::plugins): New function.
14013 (General_options::add_plugin): New function.
14014 (General_options::plugins_): New field.
14015 * plugin.cc: New file.
14016 * plugin.h: New file.
14017 * readsyms.cc: Include "plugin.h".
14018 (Read_symbols::do_read_symbols): Check for archive before checking
14019 for ELF file. Call plugin hooks to claim files.
14020 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14021 from a real object file; force override when processing replacement
14023 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14024 (Symbol::init_base_object): Likewise.
14025 (Symbol::init_base_output_data): Likewise.
14026 (Symbol::init_base_output_segment): Likewise.
14027 (Symbol::init_base_constant): Likewise.
14028 (Symbol::init_base_undefined): Likewise.
14029 (Symbol::output_section): Assert that object is not a plugin.
14030 (Symbol_table::add_from_pluginobj): New function.
14031 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14033 (Symbol_table::sized_write_globals): Likewise.
14034 (Symbol_table::add_from_pluginobj): Instantiate template.
14035 * symtab.h (Sized_pluginobj): Declare.
14036 (Symbol::in_real_elf): New function.
14037 (Symbol::set_in_real_elf): New function.
14038 (Symbol::in_real_elf_): New field.
14039 (Symbol_table::add_from_pluginobj): New function.
14041 * testsuite/Makefile.am (AM_CFLAGS): New variable.
14042 (LIBDL): New variable.
14043 (LDADD): Add LIBDL.
14044 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14045 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14046 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14047 (MOSTLYCLEANFILES): Likewise.
14048 * testsuite/Makefile.in: Regenerate.
14049 * testsuite/plugin_test.c: New file.
14050 * testsuite/plugin_test_1.sh: New file.
14051 * testsuite/plugin_test_2.sh: New file.
14053 2008-09-16 Ian Lance Taylor <iant@google.com>
14055 * target-reloc.h (relocate_section): Check whether a symbol is
14056 defined by the ABI before reporting an undefined symbol error.
14057 * target.h (Target::is_defined_by_abi): Make parameter const.
14058 (Target::do_is_defined_by_abi): Likewise.
14059 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14060 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14061 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14062 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14063 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14064 * testsuite/Makefile.in: Rebuild.
14066 * fileread.cc (make_view): Add casts to avoid warning.
14068 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14070 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14071 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14073 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14075 * options.h (General_options::output_is_executable): New.
14076 (General_options::output_is_pie): New.
14077 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14078 for shared libraries.
14079 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14081 2008-09-11 Chris Demetriou <cgd@google.com>
14083 * options.h (origin): New -z option.
14084 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14085 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14088 2008-09-05 Cary Coutant <ccoutant@google.com>
14090 * fileread.cc (File_read::make_view): Add check for attempt to map
14091 beyond end of file.
14093 2008-09-05 Cary Coutant <ccoutant@google.com>
14095 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14096 explicit instantiations.
14098 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14101 * options.cc (General_options::finalize): Allow undefined symbols
14102 in shlibs if linking -shared.
14105 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14106 symbols as not needing a dynsym entry.
14108 2008-08-20 Craig Silverstein <csilvers@google.com>
14110 * fileread.cc (File_read::open): Do not lock the file unless it
14111 was successfully opened.
14113 2008-08-14 Cary Coutant <ccoutant@google.com>
14115 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14116 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14117 * testsuite/tls_test.cc (struct int128): 128-bit struct
14118 for testing TLS relocs with non-zero addend.
14119 (v12): New TLS variable.
14121 (t_last): Add check for v12.
14122 * testsuite/tls_test.h (t12): New function.
14123 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14125 2008-08-13 Ian Lance Taylor <iant@google.com>
14127 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14128 set tls_segment_ or relro_segment_.
14129 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14131 * output.h (Output_section::clear_is_relro): New function.
14132 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14133 sections specially even when output_data_ is empty.
14134 (Output_segment::maximum_alignment): When first section is relro,
14135 only force alignment for PT_LOAD segments.
14136 * script.cc (script_data_segment_align): New function.
14137 (script_data_segment_relro_end): New function.
14138 * script-c.h (script_data_segment_align): Declare.
14139 (script_data_segment_relro_end): Declare.
14140 * script-sections.h (class Script_sections): Declare
14141 data_segment_align and data_segment_relro_end. Add fields
14142 segment_align_index_ and saw_relro_end_.
14143 * script-sections.cc (class Sections_element): Add set_is_relro
14144 virtual function. Add new bool* parameter to place_orphan_here.
14145 Add get_output_section virtual function.
14146 (class Output_section_definition): Add set_is_relro. Add new
14147 bool* parameter to place_orphan_here. Add get_output_section.
14148 Add is_relro_ field.
14149 (Output_section_definition::Output_section_definition): Initialize
14150 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14151 and is_relro_ fields.
14152 (Output_section_definition::place_orphan_here): Add is_relro
14154 (Output_section_definition::set_section_addresses): Set relro for
14156 (Output_section_definition::alternate_constraint): Likewise.
14157 (class Orphan_output_section): Add new bool* parameter to
14158 place_orphan_here. Add get_output_section.
14159 (Orphan_output_section::place_orphan_here): Add is_relro
14161 (Script_sections::Script_sections): Initialize
14162 data_segment_align_index_ and saw_relro_end_.
14163 (Script_sections::data_segment_align): New function.
14164 (Script_sections::data_segment_relro_end): New function.
14165 (Script_sections::place_orphan): Set or clear is_relro.
14166 (Script_sections::set_section_addresses): Force alignment of first
14168 * yyscript.y (exp): Call script_data_segment_align and
14169 script_data_segment_relro_end.
14170 * testsuite/relro_script_test.t: New file.
14171 * testsuite/relro_test.cc (using_script): Declare.
14172 (t1, t2): Test using_script.
14173 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14174 (relro_script_test_SOURCES): Define.
14175 (relro_script_test_DEPENDENCIES): Define.
14176 (relro_script_test_LDFLAGS): Define.
14177 (relro_script_test_LDADD): Define.
14178 (relro_script_test.so): New target.
14179 * testsuite/Makefile.in: Rebuild.
14181 2008-08-06 Cary Coutant <ccoutant@google.com>
14183 * archive.cc (Archive::total_archives, Archive::total_members)
14184 (Archive::total_members_loaded): New variables.
14185 (Archive::setup): Add parameter. Add option to preread
14187 (Archive::read_armap): Add counter.
14188 (Archive::get_file_and_offset): New function.
14189 (Archive::get_elf_object_for_member): New function.
14190 (Archive::read_all_symbols): New function.
14191 (Archive::read_symbols): New function.
14192 (Archive::add_symbols): Add counters.
14193 (Archive::include_all_members): Use armap to find members if it's
14195 (Archive::include_member): Skip reading symbols if already read.
14196 Factored code into Archive::get_file_and_offset and
14197 Archive::get_elf_object_for_member. Changed call to
14198 Mapfile::report_include_archive_member.
14199 (Archive::print_stats): New function.
14200 * archive.h: Declare Object and Read_symbols_data classes.
14201 (Archive::Archive): Add initializers for new members.
14202 (Archive::setup): Add parameter.
14203 (Archive::print_stats): New function.
14204 (Archive::total_archives, Archive::total_members)
14205 (Archive::total_members_loaded): New variables.
14206 (Archive::get_file_and_offset): New function.
14207 (Archive::get_elf_object_for_member): New function.
14208 (Archive::read_all_symbols): New function.
14209 (Archive::read_symbols): New function.
14210 (Archive::Archive_member): New class.
14211 (Archive::members_): New member.
14212 (Archive::num_members_): New member.
14213 * main.cc: Include archive.h.
14214 (main): Call Archive::print_stats.
14215 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14216 archive parameter; member_name is now the fully-decorated name.
14217 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14218 * options.h: (General_options): Add --preread-archive-symbols option.
14219 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14222 2008-08-04 Ian Lance Taylor <iant@google.com>
14224 * symtab.h (Symbol::use_plt_offset): New function.
14225 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14226 * powerpc.cc (Relocate::relocate): Likewise.
14227 * sparc.cc (Relocate::relocate): Likewise.
14228 * x86_64.cc (Relocate::relocate): Likewise.
14229 * testsuite/weak_plt.sh: New test.
14230 * testsuite/weak_plt_main.cc: New test.
14231 * testsuite/weak_plt_shared.cc: New test.
14232 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14233 (check_PROGRAMS): Add weak_plt.
14234 (check_DATA): Add weak_plt_shared.so.
14235 (weak_plt_main_pic.o, weak_plt): New targets.
14236 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14237 * testsuite/Makefile.in: Rebuild.
14239 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14241 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14242 * testsuite/Makefile.in: Rebuild.
14244 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14246 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14247 * Makefile.in: Regenerate.
14248 * po/POTFILES.in: Regenerate.
14250 2008-07-29 Ian Lance Taylor <iant@google.com>
14252 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14253 symbols before other symbols.
14254 * testsuite/script_test_2.cc (test_addr): Declare.
14255 (test_addr_alias): Declare.
14256 (main): Check that test_addr and test_addr_alias have the right
14258 * testsuite/script_test_2.t: Define test_addr_alias and
14261 2008-07-24 Ian Lance Taylor <iant@google.com>
14264 * descriptors.cc: New file.
14265 * descriptors.h: New file.
14266 * gold-threads.h (class Hold_optional_lock): New class.
14267 * fileread.cc: Include "descriptors.h".
14268 (File_read::~File_read): Release descriptor rather than closing
14270 (File_read::open) [file]: Call open_descriptor rather than open.
14271 Set is_descriptor_opened_.
14272 (File_read::open) [memory]: Assert that descriptor is not open.
14273 (File_read::reopen_descriptor): New function.
14274 (File_read::release): Release descriptor.
14275 (File_read::do_read): Make non-const. Reopen descriptor.
14276 (File_read::read): Make non-const.
14277 (File_read::make_view): Reopen descriptor.
14278 (File_read::do_readv): Likewise.
14279 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14280 Update declarations.
14281 * layout.cc: Include "descriptors.h".
14282 (Layout::create_build_id): Use open_descriptor rather than open.
14283 * output.cc: Include "descriptors.h".
14284 (Output_file::open): Use open_descriptor rather than open.
14285 * archive.cc (Archive::const_iterator): Change Archive to be
14287 (Archive::begin, Archive::end): Make non-const.
14288 (Archive::count_members): Likewise.
14289 * archive.h (class Archive): Update declarations.
14290 * object.h (Object::read): Make non-const.
14291 * Makefile.am (CCFILES): Add descriptors.cc.
14292 (HFILES): Add descriptors.h.
14293 * Makefile.in: Rebuild.
14296 * gold.h: Always include <clocale>. Add Solaris workarounds
14297 following code in binutils/sysdep.h.
14300 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14301 this->eh_frame_hdr_ is NULL before using it.
14303 * dynobj.cc (Versions::Versions): Update comment.
14305 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14306 the base version name.
14308 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14309 array size plus one.
14310 (Stringpool_template::set_string_offsets): Subtract one from key
14311 before using it as an array index.
14312 (Stringpool_template::get_offset_with_length): Likewise.
14313 (Stringpool_template::write_to_buffer): Likewise.
14314 * stringpool.h (Stringpool_template::get_offset_from_key):
14317 2008-07-23 Ian Lance Taylor <iant@google.com>
14320 * object.h (Merged_symbol_value::value): Do our best to handle a
14324 * script.cc (Version_script_info::get_versions): Don't add empty
14325 version tag to return value.
14326 (Version_script_info::get_symbol_version_helper): Change return
14327 type to bool. Add pversion parameter. Change all callers.
14328 (script_register_vers_node): Don't require a non-NULL tag.
14329 * script.h (class Version_script_info): Update declarations.
14330 (Version_script_info::get_symbol_version): Change return type to
14331 bool. Add version parameter. Change all callers.
14332 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14333 handling. Handle an empty version from a version script.
14334 (Symbol_table::define_special_symbol): Likewise.
14335 * testsuite/ver_test_10.script: New file.
14336 * testsuite/ver_test_10.sh: New file.
14337 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14338 (check_DATA): Add ver_test_10.syms.
14339 (ver_test_10.syms, ver_test_10.so): New target.
14340 * testsuite/Makefile.in: Rebuild.
14342 2008-07-23 Simon Baldwin <simonb@google.com>
14344 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14345 to zero for undefined symbols from dynamic libraries.
14347 2008-07-23 Ian Lance Taylor <iant@google.com>
14349 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14350 Change all callers.
14351 * symtab.h (class Symbol_table): Update declaration.
14352 * testsuite/ver_test_9.cc: New file.
14353 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14354 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14355 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14356 (ver_test_9.so, ver_test_9.o): New targets.
14357 * testsuite/Makefile.in: Rebuild.
14359 2008-07-22 Ian Lance Taylor <iant@google.com>
14361 * options.h (class General_options): Define --check-sections.
14362 * layout.cc (Layout::set_segment_offsets): Handle
14365 * options.h (class General_options): Define -n/--nmagic and
14367 * options.cc (General_options::finalize): For -n/--nmagic or
14368 -N/--omagic, set -static.
14369 * layout.cc (Layout::attach_allocated_section_to_segment): If
14370 -N/--omagic, don't put read-only and read-write sections in
14371 different segments.
14372 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14373 finding a read-only segment.
14374 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14375 don't set the minimum segment alignment to the common page size,
14376 and don't set the file offset to the address modulo the page size.
14377 * script-sections.cc (Script_sections::create_segments): If
14378 -n/--omagic, don't put read-only and read-write sections in
14379 different segments.
14381 * cref.cc: New file.
14382 * cref.h: New file.
14383 * options.h (class General_options): Add --print-symbol-counts.
14384 * main.cc (main): Issue defined symbol report if requested.
14385 * archive.cc (Archive::interpret_header): Make into a const member
14387 (Archive::add_symbols): Call Input_objects::archive_start and
14389 (Archive::const_iterator): Define new class.
14390 (Archive::begin, Archive::end): New functions.
14391 (Archive::include_all_members): Rewrite to use iterator.
14392 (Archive::count_members): New function.
14393 * archive.h (class Archive): Update declarations.
14394 (Archive::filename): New function.
14395 * object.cc: Include "cref.h".
14396 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14397 (Sized_relobj::do_get_global_symbol_counts): New function.
14398 (Input_objects::add_object): Add object to cross-referencer.
14399 (Input_objects::archive_start): New function.
14400 (Input_objects::archive_stop): New function.
14401 (Input_objects::print_symbol_counts): New function.
14402 * object.h: Declare Cref and Archive.
14403 (Object::get_global_symbol_counts): New function.
14404 (Object::do_get_global_symbol_counts): New pure virtual function.
14405 (class Sized_relobj): Add defined_count_ field. Update
14407 (class Input_objects): Add cref_ field. Update constructor.
14408 Update declarations.
14409 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14411 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14413 (Sized_dynobj::do_get_global_symbol_counts): New function.
14414 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14415 defined_count_. Update declarations. Define Symbols typedef.
14416 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14417 parameter. Change all callers.
14418 (Symbol_table::add_from_dynobj): Add sympointers and defined
14419 parameters. Change all callers.
14420 * symtab.h (class Symbol_table): Update declarations.
14421 * Makefile.am (CCFILES): Add cref.cc.
14422 (HFILES): Add cref.h.
14423 * Makefile.in: Rebuild.
14425 2008-07-22 Simon Baldwin <simonb@google.com>
14427 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14428 to zero when writing undefined symbols.
14430 2008-07-22 Ian Lance Taylor <iant@google.com>
14432 * output.cc (Output_section::add_input_section): Don't try to
14433 merge empty merge sections.
14435 2008-07-21 Craig Silverstein <csilvers@google.com>
14437 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14438 Include symbol version in error message.
14440 2008-07-20 Chris Demetriou <cgd@google.com>
14442 * configure.ac (gold_cv_c_random_seed): New configured variable.
14443 (RANDOM_SEED_CFLAGS): New substituted variable.
14444 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14445 * configure: Rebuild.
14446 * Makefile.in: Likewise.
14447 * testsuite/Makefile.in: Likewise.
14449 2008-07-18 Ian Lance Taylor <iant@google.com>
14451 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14452 where we see NAME/NULL and NAME/VERSION as separate symbols.
14453 * testsuite/ver_test_main.cc (main): Call t4.
14454 (t4, t4_2a): Define.
14455 * testsuite/ver_test_2.cc (t4_2): Define.
14456 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14457 * testsuite/ver_test_4.cc (t4_2a): Define.
14458 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14459 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14461 2008-07-17 Ian Lance Taylor <iant@google.com>
14463 * dynobj.cc (Versions::add_def): If we give an error about a
14464 missing version, go ahead and create the version anyhow.
14466 2008-07-10 Ian Lance Taylor <iant@google.com>
14468 Handle output sections with more than 0x7fffffff bytes.
14469 * object.h (class Relobj): Change map_to_output_ to
14470 output_sections_, and just keep a section pointer. Change all
14471 uses. Move comdat group support to Sized_relobj.
14472 (Relobj::is_section_specially_mapped): Remove.
14473 (Relobj::output_section): Remove poff parameter. Change all
14475 (Relobj::output_section_offset): New function.
14476 (Relobj::set_section_offset): Rewrite.
14477 (Relobj::map_to_output): Remove.
14478 (Relobj::output_sections): New function.
14479 (Relobj::do_output_section_offset): New pure virtual function.
14480 (Relobj::do_set_section_offset): Likewise.
14481 (class Sized_relobj): Add section_offsets_ field. Add comdat
14482 group support from Relobj. Update declarations.
14483 (Sized_relobj::get_output_section_offset): New function.
14484 (Sized_relobj::do_output_section_offset): New function.
14485 (Sized_relobj::do_set_section_offset): New function.
14486 * object.cc (Relobj::output_section_address): Remove.
14487 (Sized_relobj::Sized_relobj): Initialize new fields.
14488 (Sized_relobj::include_section_group): Cast find_kept_object to
14490 (Sized_relobj::include_linkonce_section): Likewise.
14491 (Sized_relobj::do_layout): Use separate arrays for output section
14493 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14495 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14496 output_sections and section_offsets.
14497 (Sized_relobj::write_local_symbols): Likewise.
14498 (map_to_kept_section): Compute output address directly.
14499 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14500 output_sections and section_offsets.
14501 (Sized_relobj::write_sections): Likewise.
14502 (Sized_relobj::relocate_sections): Likewise.
14503 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14504 * output.h (class Output_reloc): Update declarations. Change
14505 u2_.relobj to Sized_relobj*.
14506 (class Output_data_reloc): Change add functions to use
14508 * output.cc (Output_reloc::Output_reloc): Change relobj to
14510 (Output_reloc::local_section_offset): Change return type to
14511 Elf_Addr. Use get_output_section_offset.
14512 (Output_reloc::get_address): Likewise.
14513 (Output_section::is_input_address_mapped): Don't call
14514 is_section_specially_mapped.
14515 (Output_section::output_offset): Likewise.
14516 (Output_section::output_address): Likewise.
14517 (Output_section::starting_output_address): Likewise.
14518 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14519 parameter to Sized_relobj*.
14520 (Copy_relocs::need_copy_reloc): Likewise.
14521 (Copy_relocs::save): Likewise.
14522 * copy-relocs.h (class Copy_relocs): Update declarations.
14523 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14524 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14525 * target-reloc.h (relocate_for_relocatable): Change
14526 offset_in_output_section type to Elf_Addr. Change code that uses
14528 * layout.cc (Layout::layout): Always set *off.
14529 * mapfile.cc (Mapfile::print_input_section): Use
14530 output_section_offset.
14531 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14533 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14534 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14535 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14537 2008-07-03 Ian Lance Taylor <iant@google.com>
14539 * layout.cc (Layout::include_section): Do not discard unrecognized
14540 SHT_STRTAB sections.
14542 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14544 * script.cc (Lex::can_continue_name): Make '?' allowable in
14545 version-script names.
14546 * testsuite/version_script.map: Change glob pattern to use '?'
14548 2008-06-30 Manish Singh <yosh@gimp.org>
14551 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14554 2008-06-30 Ian Lance Taylor <iant@google.com>
14558 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14559 versions]: Don't try to read the value in the contents, since we
14560 don't use it. Use the template endianness when writing.
14562 2008-06-25 Cary Coutant <ccoutant@google.com>
14564 * fileread.cc (File_read::make_view): Assert on zero-length view.
14565 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14566 symbol table when there are no symbols to read.
14568 2008-06-23 Craig Silverstein <csilvers@google.com>
14570 * version.cc (version_string): Bump to 1.7
14572 2008-06-18 Craig Silverstein <csilvers@google.com>
14574 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14575 constant 0xFFFF to type Valtype.
14576 (Powerpc_relocate_functions::rel16_ha): Likewise.
14578 2008-06-17 Ian Lance Taylor <iant@google.com>
14580 * output.h (Output_section::Input_section): Initialize p2align_ to
14581 zero for Output_section_data constructors.
14582 (Output_section::Input_section::addralign): If not an input
14583 section, return the alignment of the Output_section_data.
14584 * testsuite/copy_test.cc: New file.
14585 * testsuite/copy_test_1.cc: New file.
14586 * testsuite/copy_test_2.cc: New file.
14587 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14588 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14589 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14590 (copy_test_1_pic.o, copy_test_1.so): New targets.
14591 (copy_test_2_pic.o, copy_test_2.so): New targets.
14592 * testsuite/Makefile.in: Rebuild.
14594 * script-sections.cc (Script_sections::place_orphan): Initialize
14595 local variable exact.
14597 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14599 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14601 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14602 David S. Miller <davem@davemloft.net>
14604 * powerpc.cc: New file.
14605 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14606 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14607 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14608 * Makefile.in: Rebuild.
14610 2008-06-09 Ian Lance Taylor <iant@google.com>
14612 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14614 (throwing, orig_terminate): New static variables.
14615 (terminate_handler): New static function.
14616 (t2): Set terminate handler.
14618 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14621 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14624 2008-05-30 Cary Coutant <ccoutant@google.com>
14626 * archive.cc (Archive::include_all_members) Correct to step
14627 over symbol table and extended name table in thin archives.
14629 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14632 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14635 2008-05-28 Caleb Howe <cshowe@google.com>
14637 * reduced_debug_output.cc: New file.
14638 * reduced_debug_output.h: New file.
14639 * options.h (class General_options): Add --strip-debug-non-line.
14640 * options.cc (General_options::finalize): Add strip_debug_non_line
14641 to the strip heirarchy.
14642 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14644 * layout.cc: Include "reduced_debug_output.h".
14645 (Layout::Layout): Initialize new fields.
14646 (line_only_debug_sections): New static array.
14647 (is_lines_only_debug_sections): New static inline function.
14648 (Layout::include_section): Handle --strip-debug-non-line.
14649 (Layout::make_output_section): If --strip-debug-non-line, build
14650 new output sections for .debug_abbrev and .debug_info.
14651 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14652 gold. Warn about possible overflow.
14653 (read_signed_LEB_128): Likewise.
14654 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14655 (read_signed_LEB_128): Declare.
14656 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14657 (HFILES): Add reduced_debug_output.h.
14658 * Makefile.in: Rebuild.
14660 2008-05-21 Ian Lance Taylor <iant@google.com>
14662 * mapfile.cc: New file.
14663 * mapfile.h: New file.
14664 * options.h (class General_options): Add -M/--print-map and -Map.
14665 * options.cc (General_options::finalize): Make -M equivalent to
14667 * main.cc: Include <cstdio> and "mapfile.h".
14668 (main): Open mapfile if requested.
14669 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14670 constructor. Change caller.
14671 (queue_initial_tasks): Add mapfile parameter. Change caller.
14672 (queue_middle_tasks): Likewise.
14673 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14675 * archive.cc: Include "mapfile.h".
14676 (Archive::add_symbols): Add mapfile parameter. Change all
14677 callers. Pass mapfile, symbol, and reason to include_member.
14678 (Archive::include_all_members): Add mapfile parameter. Change all
14680 (Archive::include_member): Add mapfile, sym, and why parameters.
14681 Change all callers. Report inclusion to map file.
14682 * archive.h: Include "fileread.h".
14683 (class Archive): Update declarations.
14684 (Archive::file): New const method.
14685 (class Add_archive_symbols): Add mapfile_ field. Update
14686 constructor. Change all callers.
14687 * readsyms.h (class Read_symbols): Likewise.
14688 (class Finish_group): Likewise.
14689 (class Read_script): Likewise.
14690 * common.cc: Include "mapfile.h".
14691 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14693 (Symbol_table::do_allocate_commons): Likewise.
14694 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14695 symbol allocation to mapfile.
14696 * common.h (class Allocate_commons_task): Add mapfile_ field.
14697 Update constructor. Change all callers.
14698 * symtab.h (class Symbol_table): Update declarations.
14699 * layout.cc: Include "mapfile.h".
14700 (Layout_task_runner::run): Print information to mapfile.
14701 (Layout::create_gold_note): Change Output_data_fixed_space to
14702 Output_data_zero_fill.
14703 (Layout::create_build_id): Likewise.
14704 (Layout::print_to_mapfile): New function.
14705 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14706 constructor. Change caller.
14707 (class Layout): Declare print_to_mapfile.
14708 * output.cc (Output_section::Input_section::print_to_mapfile): New
14710 (Output_section::add_input_section): If producing a map, always
14711 add to input_sections_ list.
14712 (Output_section::do_print_to_mapfile): New function.
14713 (Output_segment::print_sections_to_mapfile): New function.
14714 (Output_segment::print_section_list_to_mapfile): New function.
14715 * output.h: Include "mapfile.h".
14716 (Output_data::print_to_mapfile): New function.
14717 (Output_data::do_print_to_mapfile): New virtual function.
14718 (Output_segment_headers::do_print_to_mapfile): New function.
14719 (Output_file_header::do_print_to_mapfile): New function.
14720 (Output_data_const::do_print_to_mapfile): New function.
14721 (class Output_data_const_buffer): Add map_name_ field. Update
14722 constructor. Change all callers. Add do_print_to_mapfile
14724 (class Output_data_fixed_space): Likewise.
14725 (class Output_data_space): Likewise.
14726 (class Output_data_zero_fill): New class.
14727 (Output_data_strtab::do_print_to_mapfile): New function.
14728 (Output_data_reloc_base::do_print_to_mapfile): New function.
14729 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14730 (Output_data_group::do_print_to_mapfile): New function.
14731 (Output_data_got::do_print_to_mapfile): New function.
14732 (Output_data_dynamic::do_print_to_mapfile): New function.
14733 (Output_symtab_xindex::do_print_to_mapfile): New function.
14734 (class Output_section): Declare do_print_to_mapflie. Declare
14735 print_to_mapfile in Input_section.
14736 (class Output_segment): Declare new functions.
14737 * object.h (Sized_relobj::symbol_count): New function.
14738 * script-sections.cc
14739 (Output_section_element_dot_assignment::set_section_addresses):
14740 Change Output_data_fixed_space to Output_data_zero_fill.
14741 (Output_data_expression::do_print_to_mapfile): New function.
14742 * script.cc (read_input_script): Add mapfile parameter. Change
14744 * script.h (read_input_script): Update declaration.
14745 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14746 (Eh_frame::do_print_to_mapfile): New function.
14747 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14748 (Output_merge_string::do_print_to_mapfile): New function.
14749 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14751 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14753 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14755 * Makefile.am (CCFILES): Add mapfile.cc.
14756 (HFILES): Add mapfile.h.
14757 * Makefile.in: Rebuild.
14759 2008-05-19 Ian Lance Taylor <iant@google.com>
14761 * options.h (class General_options): Add -z relro.
14762 * layout.cc (Layout::Layout): Initialize relro_segment_.
14763 (Layout::add_output_section_data): Return the output section.
14764 (Layout::make_output_section): Rcognize relro sections and mark
14765 them appropriately.
14766 (Layout::attach_allocated_section_to_segment): Put relro sections
14767 in a PT_GNU_RELRO segment.
14768 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14770 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14772 (Layout::linkonce_mapping): Map d.rel.ro.local to
14773 .data.rel.ro.local.
14774 (Layout::output_section_name): Us .data.rel.ro.local for any
14775 section which begins with that.
14776 * layout.h (class Layout): Update add_output_section_data
14777 declaration. Add relro_segment_ field.
14778 * output.cc (Output_section::Output_section): Initialize is_relro_
14779 and is_relro_local_ fields.
14780 (Output_segment::add_output_section): Group relro sections.
14781 (Output_segment::is_first_section_relro): New function.
14782 (Output_segment::maximum_alignment): If there is a relro section,
14783 align the segment to the common page size.
14784 (Output_segment::set_section_addresses): Track whether we are
14785 looking at relro sections. If the last section is a relro
14786 section, align to the common page size.
14787 (Output_segment::set_section_list_addresses): Add in_relro
14788 parameter. Change all callers. Align to the page size when
14789 moving from relro to non-relro section.
14790 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14792 * output.h (class Output_section): Add is_relro_ and
14793 is_relro_local_ fields.
14794 (Output_section::is_relro): New function.
14795 (Output_section::set_is_relro): New function.
14796 (Output_section::is_relro_local): New function.
14797 (Output_section::set_is_relro_local): New function.
14798 (class Output_segment): Update declarations.
14799 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14800 * sparc.cc (Target_sparc::got_section): Likewise.
14801 * x86_64.cc (Target_x86_64::got_section): Likewise.
14802 * testsuite/relro_test_main.cc: New file.
14803 * testsuite/relro_test.cc: New file.
14804 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14805 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14806 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14807 (relro_test.so, relro_test_pic.o): New targets.
14808 * testsuite/Makefile.in: Rebuild.
14810 2008-05-16 Ian Lance Taylor <iant@google.com>
14812 * output.cc (Output_segment::add_output_section): Remove front
14814 * output.h (class Output_segment): Remove
14815 add_initial_output_section and overloaded add_output_section.
14816 Update declaration of remaining add_output_section.
14817 * layout.cc (Layout::create_interp): Call add_output_section
14818 rather than add_initial_output_section.
14819 (Layout::finish_dynamic_section): Likewise.
14821 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14822 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14823 know the dynamic type.
14824 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14825 field. Initialize it in constructor.
14826 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14827 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14828 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14831 * output.cc (Output_reloc::get_address): Change return type to
14833 * output.h (class Output_reloc): Update get_address declaration.
14834 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14835 for section addresses.
14837 2008-05-09 Ian Lance Taylor <iant@google.com>
14840 * gold.cc (gold_nomem): Use return value of write.
14842 2008-05-08 Ian Lance Taylor <iant@google.com>
14844 * symtab.c (Symbol::init_base_output_data): Add version
14845 parameter. Change all callers.
14846 (Symbol::init_base_output_segment): Likewise.
14847 (Symbol::init_base_constant): Likewise.
14848 (Symbol::init_base_undefined): Likewise.
14849 (Sized_symbol::init_output_data): Likewise.
14850 (Sized_symbol::init_output_segment): Likewise.
14851 (Sized_symbol::init_constant): Likewise.
14852 (Sized_symbol::init_undefined): Likewise.
14853 (Symbol_table::do_define_in_output_data): If the new symbol has a
14854 version, mark it as the default.
14855 (Symbol_table::do_define_in_output_segment): Likewise.
14856 (Symbol_table::do_define_as_constant): Likewise.
14857 * symtab.h (class Symbol): Update declarations.
14858 (class Sized_symbol): Likewise.
14859 * resolve.cc (Symbol::override_version): New function.
14860 (Symbol::override_base): Call override_version.
14861 (Symbol::override_base_with_special): Likewise.
14862 * testsuite/ver_script_8.script: New file.
14863 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14864 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14865 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14866 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14868 2008-05-06 Ian Lance Taylor <iant@google.com>
14871 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14873 (class General_options): Remove existing --undefined, and add
14874 --no-undefined instead. Add new --undefined as synonym for -u.
14875 * archive.cc (Archive::add_symbols): Check whether symbol was
14877 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14878 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14879 all uses. Add IS_UNDEFINED. Update declarations to split
14880 different versions of init_base. Declare init_base_undefined.
14881 (Symbol::is_defined): Handle IS_UNDEFINED.
14882 (Symbol::is_undefined): Likewise.
14883 (Symbol::is_weak_undefined): Call is_undefined.
14884 (Symbol::is_absolute): Handle IS_CONSTANT.
14885 (class Sized_symbol): Update declarations to split different
14886 versions of init. Declare init_undefined.
14887 (class Symbol_table): Declare new functions.
14888 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14889 Change all callers.
14890 (Symbol::init_base_output_data): Likewise.
14891 (Symbol::init_base_output_segment): Likewise.
14892 (Symbol::init_base_constant): Likewise.
14893 (Symbol::init_base_undefined): New function.
14894 (Sized_symbol::init_object): Rename from init. Change all
14896 (Sized_symbol::init_output_data): Likewise.
14897 (Sized_symbol::init_output_segment): Likewise.
14898 (Sized_symbol::init_constant): Likewise.
14899 (Sized_symbol::init_undefined): New function.
14900 (Symbol_table::add_undefined_symbols_from_command_line): New
14902 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14904 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14905 (Symbol::output_section): Likewise.
14906 (Symbol::set_output_section): Likewise.
14907 (Symbol_table::sized_finalize_symbol): Likewise.
14908 (Symbol_table::sized_write_globals): Likewise.
14909 * resolve.cc (Symbol_table::should_override): Likewise.
14910 (Symbol::override_base_with_special): Likewise.
14912 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14913 symbol, change it to have default visibility.
14914 * testsuite/protected_1.cc: New file.
14915 * testsuite/protected_2.cc: New file.
14916 * testsuite/protected_3.cc: New file.
14917 * testsuite/protected_main_1.cc: New file.
14918 * testsuite/protected_main_2.cc: New file.
14919 * testsuite/protected_main_3.cc: New file.
14920 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14921 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14922 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14923 (protected_1.so): New target.
14924 (protected_1_pic.o, protected_2_pic.o): New targets.
14925 (protected_3_pic.o): New target.
14926 (check_PROGRAMS): Add protected_2.
14927 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14928 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14929 * testsuite/Makefile.in: Rebuild.
14931 * options.h (DEFINE_var): Add set_user_set_##varname__.
14932 (DEFINE_bool_alias): New macro.
14933 (class General_options): Define -Bstatic using DEFINE_bool_alias
14934 rather than DEFINE_special. Add --undefined as an alias for -z
14936 * options.cc (General_options::parse_Bstatic): Remove.
14938 * options.h (class General_options): Add --fatal-warnings.
14939 * main.cc (main): Implement --fatal-warnings.
14940 * errors.h (Errors::warning_count): New function.
14942 * options.h (class General_options): Add -Bsymbolic-functions.
14943 * symtab.h (Symbol::is_preemptible): Check for
14944 -Bsymbolic-functions.
14946 2008-05-05 Ian Lance Taylor <iant@google.com>
14948 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14949 as noVARNAME rather than no-VARNAME.
14950 (class General_options): Add option -z combreloc.
14951 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14953 (Output_reloc::sort_before) [SHT_REL]: New function.
14954 (Output_reloc::sort_before) [SHT_RELA]: New function.
14955 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14956 Sort_relocs_comparison.
14957 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14958 parameter. Change all callers.
14959 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14960 sort_relocs parameter. Change all callers.
14961 * output.cc (Output_reloc::get_address): New function, broken out
14963 (Output_reloc::write_rel): Call it.
14964 (Output_reloc::compare): New function.
14965 (Output_data_reloc_base::do_write): Optionally sort relocs.
14967 * configure.ac: If targ_extra_obj is set, link it in.
14968 * configure.tgt: Initialize all variables.
14969 (x86_64*): Set targ_extra_obj and targ_extra_size.
14970 * configure: Rebuild.
14972 * object.cc (Sized_relobj::include_section_group): Adjust section
14973 indexes read from group data. Build vector to pass to
14975 * layout.cc (Layout::layout_group): Add flags and shndxes
14976 parameters. Remove contents parameter. Change caller. Update
14977 explicit instantiations.
14978 * layout.h (class Layout): Update layout_group declaration.
14979 * output.cc (Output_data_group::Output_data_group): Add flags and
14980 input_shndxes parameters. Remove contents parameter. Change
14982 (Output_data_group::do_write): Change input_sections_ to
14984 * output.h (class Output_data_group): Update constructor
14985 declaration. Rename input_sections_ to input_shndxes_.
14986 * testsuite/many_sections_test.cc: Add template.
14988 2008-04-30 Cary Coutant <ccoutant@google.com>
14990 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14992 * layout.cc (Layout::include_section): Refactored check for debug
14994 (Layout::add_comdat): Add new parameters. Change type
14995 of signature parameter. Add object and shndx to signatures table.
14996 (Layout::find_kept_object): New function.
14997 * layout.h: Include <cstring>.
14998 (Layout::is_debug_info_section): New function.
14999 (Layout::add_comdat): Add new parameters.
15000 (Layout::find_kept_object): New function.
15001 (Layout::Kept_section): New struct.
15002 (Layout::Signatures): Change type of map range.
15003 * object.cc (Relobj::output_section_address): New function.
15004 (Sized_relobj::include_section_group): Add new parameters. Change
15005 calls to Layout::add_comdat. Change to build table of kept comdat
15006 groups and table mapping discarded sections to kept sections.
15007 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15008 (Sized_relobj::do_layout): Change calls to include_section_group and
15009 include_linkonce_section.
15010 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15011 value to zero when section is discarded.
15012 (Sized_relobj::map_to_kept_section): New function.
15013 * object.h (Relobj::output_section_address): New function.
15014 (Relobj::Comdat_group): New type.
15015 (Relobj::find_comdat_group): New function.
15016 (Relobj::Comdat_group_table): New type.
15017 (Relobj::Kept_comdat_section): New type.
15018 (Relobj::Kept_comdat_section_table): New type.
15019 (Relobj::add_comdat_group): New function.
15020 (Relobj::set_kept_comdat_section): New function.
15021 (Relobj::get_kept_comdat_section): New function.
15022 (Relobj::comdat_groups_): New field.
15023 (Relobj::kept_comdat_sections_): New field.
15024 (Symbol_value::input_value): Update comment.
15025 (Sized_relobj::map_to_kept_section) New function.
15026 (Sized_relobj::include_linkonce_section): Add new parameter.
15027 * target-reloc.h (Comdat_behavior): New type.
15028 (get_comdat_behavior): New function.
15029 (relocate_section): Add code to map a discarded section to the
15030 corresponding kept section when applying a relocation.
15032 2008-04-30 Craig Silverstein <csilvers@google.com>
15034 * dwarf_reader.cc (next_generation_count): New static var.
15035 (Addr2line_cache_entry): New struct.
15036 (addr2line_cache): New static var.
15037 (Dwarf_line_info::one_addr2line): Added caching.
15038 (Dwarf_line_info::clear_addr2line_cache): New function.
15039 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15040 cache-size parameter.
15041 (Dwarf_line_info::one_addr2line_cache): New function.
15042 * symtab.cc (Symbol_table::detect_odr_violations): Pass
15043 new cache-size argument to one_addr2line(), and clear cache.
15045 2008-04-28 Cary Coutant <ccoutant@google.com>
15047 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15048 R_386_PC8 relocations.
15050 2008-04-23 Ian Lance Taylor <iant@google.com>
15052 * object.cc (Sized_relobj::include_section_group): Check for
15053 invalid section group.
15055 * object.cc (make_elf_object): Correct test for 64-bit ELF file
15058 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15059 than read for file header.
15060 * archive.cc (Archive::include_member): Likewise.
15062 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
15064 * aclocal.m4: Regenerate.
15065 * configure: Regenerate.
15067 2008-04-19 Ian Lance Taylor <iant@google.com>
15069 * version.cc (version_string): Bump to 1.6.
15071 * testsuite/Makefile.am (many_sections_r_test): New target.
15072 (many_sections_r_test_SOURCES): Remove.
15073 (many_sections_r_test_DEPENDENCIES): Remove.
15074 (many_sections_r_test_LDFLAGS): Remove.
15075 (many_sections_r_test_LDADD): Remove.
15077 * object.cc (Sized_relobj::do_add_symbols): Always pass
15078 local_symbol_count_ to add_from_relobj.
15080 * testsuite/Makefile.am (many_sections_check.h): Only check one in
15081 every thousand variables.
15082 * testsuite/Makefile.in: Rebuild.
15084 * object.cc (Xindex::initialize_symtab_xindex): New function.
15085 (Xindex::read_symtab_xindex): New function.
15086 (Xindex::sym_xindex_to_shndx): New function.
15087 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15089 (Sized_relobj::do_initialize_xindex): New function.
15090 (Sized_relobj::do_read_symbols): Adjust section links.
15091 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15092 parameter. Change all callers.
15093 (Sized_relobj::include_section_group): Adjust section links and
15094 symbol section indexes.
15095 (Sized_relobj::do_layout): Adjust section links.
15096 (Sized_relobj::do_count_local_symbols): Adjust section links and
15097 symbol section indexes.
15098 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15099 ordinary and special symbols.
15100 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15101 dynsym_xindex parameters. Change all callers. Adjust section
15102 links. Use SHN_XINDEX when needed.
15103 (Sized_relobj::get_symbol_location_info): Adjust section links.
15104 Don't get fooled by special symbols.
15105 * object.h (class Xindex): Define.
15106 (class Object): Add xindex_ parameter. Declare virtual functoin
15107 do_initialize_xindex.
15108 (Object::adjust_sym_shndx): New function.
15109 (Object::set_xindex): New protected function.
15110 (class Symbol_value): Add is_ordinary_shndx_ field.
15111 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15112 (Symbol_value::value): Assert ordinary section.
15113 (Symbol_value::initialize_input_to_output_map): Likewise.
15114 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15115 Change all callers.
15116 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15118 (class Sized_relobj): Update declarations.
15119 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15120 parameter. Change all callers.
15121 (Sized_relobj::adjust_shndx): New function.
15122 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15124 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15125 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15126 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15127 (Sized_dynobj::read_dynsym_section): Adjust section links.
15128 (Sized_dynobj::read_dynamic): Likewise.
15129 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15131 (Sized_dynobj::do_initialize_xindex): New function.
15132 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15133 do_initialize_xindex.
15134 (Sized_dynobj::adjust_shndx): New function.
15135 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15136 dynsym_xindex_ fields.
15137 (Layout::finalize): Add a call to set_section_indexes before
15138 creating the symtab sections.
15139 (Layout::set_section_indexes): Don't do anything if the section
15140 already has a section index.
15141 (Layout::create_symtab_sections): Add shnum parameter. Change
15142 caller. Create .symtab_shndx section if needed.
15143 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15145 (Layout::allocated_output_section_count): New function.
15146 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15148 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15149 fields. Update declarations.
15150 (Layout::symtab_xindex): New function.
15151 (Layout::dynsym_xindex): New function.
15152 (class Write_symbols_task): Add layout_ field.
15153 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15155 * output.cc (Output_section_headers::Output_section_headers): Add
15156 shstrtab_section parameter. Change all callers.
15157 (Output_section_headers::do_sized_write): Store overflow values
15158 for section count and section string table section index in
15159 section header zero.
15160 (Output_file_header::do_sized_write): Check for overflow of
15161 section count and section string table section index.
15162 (Output_symtab_xindex::do_write): New function.
15163 (Output_symtab_xindex::endian_do_write): New function.
15164 * output.h (class Output_section_headers): Add shstrtab_section_.
15165 Update declarations.
15166 (class Output_symtab_xindex): Define.
15167 (Output_section::has_out_shndx): New function.
15168 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15170 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15171 Change all callers.
15172 (Sized_symbol::init): Likewise.
15173 (Symbol::output_section): Check for ordinary symbol.
15174 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15175 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15177 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15178 Change all callers. Simplify handling of symbols from sections
15179 not included in the link.
15180 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15182 (Weak_alias_sorter::operator()): Assert that symbols are
15184 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15186 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15187 parameters. Change all callers.
15188 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15189 symbol distinction. Use SHN_XINDEX when needed.
15190 (Symbol_table::write_section_symbol): Add symtab_xindex
15191 parameter. Change all callers.
15192 (Symbol_table::sized_write_section_symbol): Likewise. Use
15193 SHN_XINDEX when needed.
15194 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15196 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15197 (Symbol::is_defined): Check is_ordinary.
15198 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15199 (Symbol::is_absolute, Symbol::is_common): Likewise.
15200 (class Sized_symbol): Update declarations.
15201 (class Symbol_table): Update declarations.
15202 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15203 parameters. Change all callers.
15204 (Sized_symbol::override): Likewise.
15205 (Symbol_table::override): Likewise.
15206 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15207 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15208 is_ordinary, and orig_st_shndx parameters. Change all callers.
15209 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15210 to be in an ordinary section.
15211 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15212 object and is_ordinary parameters. Change all callers.
15213 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15214 Change all callers. Don't add undefined or non-ordinary symbols
15216 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15217 Change all callers.
15218 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15220 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15221 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15222 (Sized_relobj::relocate_sections): Likewise.
15223 * target-reloc.h (scan_relocs): Adjust section symbol index.
15224 (scan_relocatable_relocs): Likewise.
15225 * i386.cc (Scan::local): Check for ordinary symbols.
15226 * sparc.cc (Scan::local): Likewise.
15227 * x86_64.cc (Scan::local): Likewise.
15228 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15229 to symbol_section_and_value.
15230 * testsuite/many_sections_test.cc: New file.
15231 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15232 (check_PROGRAMS): Add many_sections_test.
15233 (many_sections_test_SOURCES): Define.
15234 (many_sections_test_DEPENDENCIES): Define.
15235 (many_sections_test_LDFLAGS): Define.
15236 (BUILT_SOURCES): Add many_sections_define.h.
15237 (many_sections_define.h): New target.
15238 (BUILT_SOURCES): Add many_sections_check.h.
15239 (many_sections_check.h): New target.
15240 (check_PROGRAMS): Add many_sections_r_test.
15241 (many_sections_r_test_SOURCES): Define.
15242 (many_sections_r_test_DEPENDENCIES): Define.
15243 (many_sections_r_test_LDFLAGS): Define.
15244 (many_sections_r_test_LDADD): Define.
15245 (many_sections_r_test.o): New target.
15246 * testsuite/Makefile.in: Rebuild.
15248 2008-04-17 Cary Coutant <ccoutant@google.com>
15250 * errors.cc (Errors::info): New function.
15251 (gold_info): New function.
15252 * errors.h (Errors::info): New function.
15253 * gold.h (gold_info): New function.
15254 * object.cc (Input_objects::add_object): Print trace output.
15255 * options.cc (options::parse_set): New function.
15256 (General_options::parse_wrap): Deleted.
15257 (General_options::General_options): Deleted initializer.
15258 * options.h (options::String_set): New typedef.
15259 (options::parse_set): New function.
15260 (DEFINE_set): New macro.
15261 (General_options::wrap): Changed to use DEFINE_set. Changed
15262 callers of any_wrap_symbols and is_wrap_symbol.
15263 (General_options::trace, General_options::trace_symbol):
15265 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15266 (General_options::wrap_symbols_): Deleted.
15267 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15269 2008-04-17 David S. Miller <davem@davemloft.net>
15271 * options.cc (General_options::parse_V): New function.
15272 * options.h: Add entries for -V and -Qy.
15274 2008-04-17 Ian Lance Taylor <iant@google.com>
15276 * common.cc (Symbol_table::allocate_commons): Remove options
15277 parameter. Change caller.
15278 (Symbol_table::do_allocate_commons): Remove options parameter.
15279 Change caller. Just call do_allocate_commons_list twice.
15280 (Symbol_table::do_allocate_commons_list): New function, broken out
15281 of do_allocate_commons.
15282 * common.h (class Allocate_commons_task): Remove options_ field.
15283 Update constructor.
15284 * symtab.cc (Symbol_table::Symbol_table): Initialize
15286 (Symbol_table::add_from_object): Put TLS common symbols on
15288 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15289 which are IN_OUTPUT_DATA.
15290 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15291 allocate_commons and do_allocate_commons declarations. Declare
15292 do_allocate_commons_list.
15293 * gold.cc (queue_middle_tasks): Update creation of
15294 Allocate_commons_task to not pass options.
15295 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15296 (TLS_TEST_C_FLAGS): New variable.
15297 (tls_test_c_pic.o): New target.
15298 (tls_test_shared.so): Link in tls_test_c_pic.o.
15299 (tls_test_c_pic_ie.o): New target.
15300 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15301 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15302 (tls_test_c.o): New target.
15303 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15304 (tls_pic_test_LDADD): Likewise.
15305 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15306 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15307 (tls_test_c_gnu2.o): New target.
15308 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15310 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15311 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15312 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15313 * testsuite/tls_test.cc: Include "config.h".
15314 (t_last): Call t11_last.
15315 * testsuite/tls_test.h (t11, t11_last): Declare.
15316 * testsuite/tls_test_c.c: New file.
15317 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15318 * configure.ac: Check for OpenMP support.
15319 * configure, config.in, Makefile.in: Rebuild.
15320 * testsuite/Makefile.in: Rebuild.
15322 2008-04-16 Cary Coutant <ccoutant@google.com>
15324 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15325 (Target_i386::tls_base_symbol_defined_): New field.
15326 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15327 (Target_i386::Scan::global): Likewise.
15328 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15329 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15330 (Target_x86_64::tls_base_symbol_defined_): New field.
15331 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15332 (Target_x86_64::Scan::global): Likewise.
15334 2008-04-16 Cary Coutant <ccoutant@google.com>
15336 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15337 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15338 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15339 building shared libraries.
15340 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15341 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15342 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15343 * testsuite/Makefile.in: Rebuild.
15344 * testsuite/weak_undef.h: New file.
15345 * testsuite/weak_undef_file1.cc: Add extra test cases.
15346 * testsuite/weak_undef_file2.cc: Likewise.
15347 * testsuite/weak_undef_test.cc: Likewise.
15349 2008-04-16 David S. Miller <davem@davemloft.net>
15351 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15352 Add issued_non_pic_error_ field. Declare check_non_pic.
15353 (Target_sparc::Scan::check_non_pic): New function.
15354 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15355 (Target_sparc::Scan::global): Likewise.
15357 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15358 * configure: Rebuild.
15360 * options.h (DEFINE_enable): New macro.
15361 (new_dtags): New enable option.
15362 (initfirst, interpose, loadfltr, nodefaultlib,
15363 nodelete, nodlopen, nodump): New -z options.
15364 * layout.cc (Layout:finish_dynamic_section): If new
15365 dtags enabled, emit DT_RUNPATH. Also, emit a
15366 DT_FLAGS_1 containing any specified -z flags.
15368 2008-04-16 Ian Lance Taylor <iant@google.com>
15370 * copy-relocs.cc: New file.
15371 * copy-relocs.h: New file.
15372 * reloc.cc: Remove Copy_relocs code.
15373 * reloc.h: Likewise.
15374 * reloc-types.h (struct Reloc_types) [both versions]: Add
15375 get_reloc_addend_noerror.
15376 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15377 variants of add_global which take an addend which must be zero.
15378 * i386.cc: Include "copy-relocs.h".
15379 (class Target_i386): Change type of copy_relocs_ to variable,
15380 update initializer.
15381 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15382 Change all callers.
15383 (Target_i386::do_finalize_sections): Change handling of
15385 * sparc.cc: Include "copy-relocs.h".
15386 (class Target_sparc): Change type of copy_relocs_ to variable,
15387 update initializer.
15388 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15389 Change all callers.
15390 (Target_sparc::do_finalize_sections): Change handling of
15392 * x86_64.cc: Include "copy-relocs.h".
15393 (class Target_x86_64): Change type of copy_relocs_ to variable,
15394 update initializer.
15395 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15396 class. Change all callers.
15397 (Target_x86_64::do_finalize_sections): Change handling of
15399 * Makefile.am (CCFILES): Add copy-relocs.cc.
15400 (HFILES): Add copy-relocs.h.
15402 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15404 * testsuite/script_test_4.sh: Permit leading zeroes.
15406 2008-04-15 Ian Lance Taylor <iant@google.com>
15408 * script-sections.cc (Script_sections::create_segments): Use
15409 header_size_adjustment even when there is enough room for the
15411 * testsuite/script_test_4.sh: New file.
15412 * testsuite/script_test_4.t: New file.
15413 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15414 (check_DATA): Add script_test_4.stdout.
15415 (MOSTLYCLEANFILES): Likewise.
15416 (script_test_4): New target.
15417 (script_test_4.stdout): New target.
15418 * testsuite/Makefile.in: Rebuild.
15420 * sparc.cc: Add definitions for Output_data_plt_sparc class
15423 2008-04-14 David S. Miller <davem@davemloft.net>
15425 * sparc.cc: New file.
15426 * Makefile.am (TARGETSOURCES): Add sparc.cc
15427 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15428 * configure.tgt: Document targ_extra_size and
15429 targ_extra_big_endian. Add entries for sparc-* and
15431 * configure.ac: Handle targ_extra_size and
15432 targ_extra_big_endian.
15433 * Makefile.in: Rebuild.
15434 * configure: Likewise.
15435 * po/POTFILES.in: Likewise.
15436 * po/gold.pot: Likewise.
15438 2008-04-14 Ian Lance Taylor <iant@google.com>
15440 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15441 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15442 in the name/type/flags to section mapping. Don't call
15443 allocate_output_section.
15444 (Layout::choose_output_section): Change parameter from adjust_name
15445 to is_input_section. Don't permit input sections after sections
15446 are attached to segments. Don't call allocate_output_section.
15447 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15448 not write_enable_output_section.
15449 (Layout::make_output_section): Don't push to
15450 unattached_section_list_ nor call attach_to_segment. Call
15451 attach_section_to_segment if sections are attached.
15452 (Layout::attach_sections_to_segments): New function.
15453 (Layout::attach_section_to_segment): New function.
15454 (Layout::attach_allocated_section_to_segment): Rename from
15455 attach_to_segment. Remove flags parameter.
15456 (Layout::allocate_output_section): Remove function.
15457 (Layout::write_enable_output_section): Remove function.
15458 * layout.h (class Layout): Update for above changes. Add new
15459 field sections_are_attached_.
15460 * output.h (Output_section::update_flags_for_input_section): New
15462 * output.cc (Output_section::add_input_section): Call
15463 update_flags_for_input_section.
15464 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15466 2008-04-11 Cary Coutant <ccoutant@google.com>
15468 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15469 thought unnecessary.
15470 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15472 2008-04-11 Ian Lance Taylor <iant@google.com>
15474 * output.h (class Output_section_data): Remove inline definition
15476 * output.cc (Output_section_data::set_addralign): New function.
15478 2008-04-11 Cary Coutant <ccoutant@google.com>
15480 Add support for TLS descriptors for i386 and x86_64.
15481 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15482 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15483 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15485 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15486 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15487 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15489 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15490 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15491 Fix problem with initial-exec relocations.
15492 (Target_i386::Relocate::relocate_tls): Likewise.
15493 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15495 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15496 support for section-plus-offset dynamic table entries.
15497 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15498 (Output_data_dynamic::Dynamic_entry): Add support for
15499 section-plus-offset dynamic table entries.
15500 (Output_data_dynamic::Classification): Likewise.
15501 (Output_data_dynamic::classification_): Renamed offset_.
15502 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15503 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15504 (Target_x86_64::make_plt_section): New function.
15505 (Target_x86_64::reserve_tlsdesc_entries): New function.
15506 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15507 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15508 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15509 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15510 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15511 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15512 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15513 add extra PLT entry for TLS descriptors.
15514 (Output_data_plt_x86_64::got_): New field.
15515 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15516 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15518 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15520 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15521 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15522 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15523 R_386_TLS_DESC_CALL relocations.
15524 (Target_x86_64::Scan::global): Likewise.
15525 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15526 for TLS descriptors.
15527 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15528 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15529 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15530 GD-to-IE relaxation.
15531 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15532 and TLS_DESCRIPTORS.
15533 * Makefile.in: Rebuild.
15534 * configure: Rebuild.
15535 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15536 (tls_test_shared2.so): New target.
15537 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15538 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15539 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15540 (tls_shared_gd_to_ie_test_LDADD): New variable.
15541 (tls_shared_gnu2_gd_to_ie_test): New target.
15542 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15544 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15545 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15546 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15547 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15548 (tls_shared_gnu2_test): New target.
15549 (tls_test_gnu2_shared.so): New target.
15550 (tls_shared_gnu2_test_SOURCES): New variable.
15551 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15552 (tls_shared_gnu2_test_LDFLAGS): New variable.
15553 (tls_shared_gnu2_test_LDADD): New variable.
15554 * testsuite/Makefile.in: Rebuild.
15555 * testsuite/Makefile.
15557 2008-04-11 Ian Lance Taylor <iant@google.com>
15559 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15561 * testsuite/Makefile.in: Rebuild.
15563 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15565 * testsuite/script_test_2.cc (main): Adjust test.
15567 2008-04-11 David S. Miller <davem@davemloft.net>
15568 Ian Lance Taylor <iant@google.com>
15570 * options.h (General_options): Add entries for '-Y' and
15572 * options.cc (General_options:finalize): If -Y was used, add those
15573 entries to the library path instead of the default "/lib" and
15576 2008-04-11 David S. Miller <davem@davemloft.net>
15578 * testsuite/justsyms.t: Start at 0x100.
15579 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15580 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15582 * testsuite/script_test_2.cc: Adjust string and section length
15585 2008-04-09 Ian Lance Taylor <iant@google.com>
15588 * script-sections.cc (Sections_element::allocate_to_segment): Add
15590 (Output_section_definition::allocate_to_segment): Likewise.
15591 (Orphan_output_section::allocate_to_segment): Likewise.
15592 (Script_sections::attach_sections_using_phdrs_clause): Don't
15593 propagate non-PT_LOAD segments to orphan sections.
15594 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15595 readelf rather than objdump.
15596 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15597 .interp section and PT_INTERP segment are the same size.
15598 * testsuite/Makefile.in: Rebuild.
15600 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15601 aliases for symbols defined in the same object.
15602 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15603 (weak_alias_test_SOURCES): New variable.
15604 (weak_alias_test_DEPENDENCIES): New variable.
15605 (weak_alias_test_LDFLAGS): New variable.
15606 (weak_alias_test_LDADD): New variable.
15607 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15608 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15609 (weak_alias_test_3.o): New target.
15610 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15611 * testsuite/weak_alias_test_main.cc: New file.
15612 * testsuite/weak_alias_test_1.cc: New file.
15613 * testsuite/weak_alias_test_2.cc: New file.
15614 * testsuite/weak_alias_test_3.cc: New file.
15616 2008-04-08 Ian Lance Taylor <iant@google.com>
15618 * options.h (class General_options): Add --noinhibit-exec option.
15619 * main.cc (main): Check --noinhibit-exec.
15621 * options.h (class General_options): Define --wrap as a special
15622 option. Add wrap_symbols_ field.
15623 (General_options::any_wrap_symbols): New function.
15624 (General_options::is_wrap_symbol): New function.
15625 * options.cc (General_options::parse_wrap): New function.
15626 (General_options::General_options): Initialize wrap_symbols_.
15627 * symtab.cc (Symbol_table::wrap_symbol): New function.
15628 (Symbol_table::add_from_object): Handle --wrap.
15629 * symtab.h (class Symbol_table): Declare wrap_symbol.
15630 * target.h (Target::wrap_char): New function.
15631 (Target::Target_info): Add wrap_char field.
15632 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15633 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15634 * testsuite/testfile.cc (Target_test::test_target_info):
15637 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15640 * layout.h (class Layout): Add added_eh_frame_data_ field.
15641 * layout.cc (Layout::Layout): Initialize new field.
15642 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15643 output section until we find a section we merged successfully.
15644 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15645 that the size be non-zero.
15647 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15650 2008-04-08 Craig Silverstein <csilvers@google.com>
15652 * configure.ac: Export new conditional variable HAVE_ZLIB.
15653 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15655 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15656 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15658 2008-04-07 Ian Lance Taylor <iant@google.com>
15660 * version.cc (version_string): Set to "1.5".
15662 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15663 Add issued_non_pic_error_ field. Declare check_non_pic.
15664 (Target_x86_64::Scan::check_non_pic): New function.
15665 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15666 (Target_x86_64::Scan::global): Likewise.
15668 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15669 addend parameter. Change caller. Handle merge sections.
15670 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15671 Address to Addend. Don't add in the result of
15672 local_section_offset, pass down the addend and use the returned
15674 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15675 Update declarations of local_section_offset and symbol_value.
15676 * testsuite/two_file_test_1.cc (t18): New function.
15677 * testsuite/two_file_test_2.cc (f18): New function.
15678 * testsuite/two_file_test_main.cc (main): Call t18.
15679 * testsuite/two_file_test.h (t18, f18): Declare.
15681 * configure.ac: Don't test for objdump, c++filt, or readelf.
15682 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15684 (TEST_READELF): New variable.
15685 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15686 (check_PROGRAMS): Add two_file_strip_test.
15687 (two_file_strip_test): New target.
15688 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15689 (two_file_same_shared_strip_test_SOURCES): New variable.
15690 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15691 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15692 (two_file_same_shared_strip_test_LDADD): New variable.
15693 (two_file_shared_strip.so): New target.
15694 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15695 (ver_test_5.syms, ver_test_7.syms): Likewise.
15696 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15697 (strip_test_3.stdout): Use TEST_OBJDUMP.
15698 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15700 2008-04-04 Cary Coutant <ccoutant@google.com>
15702 * symtab.h (Symbol::is_weak_undefined): New function.
15703 (Symbol::is_strong_undefined): New function.
15704 (Symbol::is_absolute): New function.
15705 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15706 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15708 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15709 (weak_undef_test): New target.
15710 * testsuite/Makefile.in: Rebuild.
15711 * testsuite/weak_undef_file1.cc: New file.
15712 * testsuite/weak_undef_file2.cc: New file.
15713 * testsuite/weak_undef_test.cc: New file.
15715 2008-04-03 Craig Silverstein <csilvers@google.com>
15717 * compressed_output.h (class Output_compressed_section): Use
15719 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15721 (zlib_compressed_suffix): Removed.
15722 (Output_compressed_section::set_final_data_size): Use unsigned
15724 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15725 Fix linker invocation.
15726 (flagstest_o_specialfile_and_compress_debug_sections):
15728 * testsuite/Makefile.in: Regenerated.
15730 2008-04-02 David S. Miller <davem@davemloft.net>
15732 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15733 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15735 2008-04-02 Craig Silverstein <csilvers@google.com>
15739 2008-04-02 Ian Lance Taylor <iant@google.com>
15741 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15742 parameters. Update for new key type to views_. Change all
15744 (File_read::read): Adjust for byteshift in returned view.
15745 (File_read::add_view): New function, broken out of
15746 find_and_make_view.
15747 (File_read::make_view): New function, broken out of
15748 find_and_make_view.
15749 (File_read::find_or_make_view): Add offset and aligned
15750 parameters. Rewrite accordingly. Change all callers.
15751 (File_read::get_view): Add offset and aligned parameters. Adjust
15752 for byteshift in return value.
15753 (File_read::get_lasting_view): Likewise.
15754 * fileread.h (class File_read): Update declarations.
15755 (class File_read::View): Add byteshift_ field. Add byteshift to
15756 constructor. Add byteshift method.
15757 * archive.h (Archive::clear_uncached_views): New function.
15758 (Archive::get_view): Add aligned parameter. Change all callers.
15759 * object.h (Object::get_view): Add aligned parameter. Change all
15761 (Object::get_lasting_view): Likewise.
15763 * fileread.cc (File_read::release): Don't call clear_views if
15764 there are multiple objects.
15765 * fileread.h (File_read::clear_uncached_views): New function.
15766 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15769 2008-03-31 Cary Coutant <ccoutant@google.com>
15771 Add thin archive support.
15772 * archive.cc (Archive::armagt): New const.
15773 (Archive::setup): Remove task parameter and calls to unlock.
15774 (Archive::unlock_nested_archives): New function.
15775 (Archive::read_header): Add nested_off parameter. Change
15777 (Archive::interpret_header): Likewise.
15778 (Archive::include_all_members): Change to handle thin
15780 (Archive::include_member): Likewise.
15781 * archive.h (Archive::Archive): Add new parameters and
15783 (Archive::armagt): New const.
15784 (Archive::setup): Remove task parameter.
15785 (Archive::unlock_nested_archives): New function.
15786 (Archive::read_header): Add nested_off parameter.
15787 (Archive::interpret_header): Likewise.
15788 (Archive::Nested_archive_table): New typedef.
15789 (Archive::is_thin_archive_): New field.
15790 (Archive::nested_archives_): New field.
15791 (Archive::options_): New field.
15792 (Archive::dirpath_): New field.
15793 (Archive::task_): New field.
15794 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15795 for thin archives. Pass additional parameters to
15796 Archive::Archive. Unlock the archive file after calling
15799 2008-03-29 Ian Lance Taylor <iant@google.com>
15801 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15802 version symbol to be local.
15803 * testsuite/ver_test_4.sh: New file.
15804 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15805 (check_DATA): Add ver_test_4.syms.
15806 (ver_test_4.syms): New target.
15807 * testsuite/Makefile.in: Rebuild.
15810 (Output_section::Input_section_sort_entry::has_priority): New
15812 (Output_section::Input_section_sort_entry::match_file_name): New
15814 (Output_section::Input_section_sort_entry::match_section_name):
15816 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15818 (Output_section::Input_section_sort_entry::match_section_file):
15820 (Output_section::Input_section_sort_compare::operator()): Rewrite
15821 using new Input_section_sort_entry functions. Sort crtbegin and
15822 crtend first. Sort sections with no priority before sections with
15824 * testsuite/initpri1.c (d3): Check j != 4.
15825 (cd5): New constructor/destructor function.
15826 (main): Check j != 2.
15828 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15829 new symbol when resolving, don't call set_is_default.
15830 * testsuite/ver_test_7.cc: New file.
15831 * testsuite/ver_test_7.sh: New file.
15832 * testsuite/Makefile.am (ver_test_7.so): New target.
15833 (ver_test_7.o): New target.
15834 (check_SCRIPTS): Add ver_test_7.sh.
15835 (check_DATA): Add ver_test_7.syms.
15836 (ver_test_7.syms): New target.
15838 2008-03-28 Ian Lance Taylor <iant@google.com>
15840 * layout.cc (Layout::layout): If we see an input section with a
15841 name that needs sorting, set the must_sort flag for the output
15843 (Layout::make_output_section): If the name of the output section
15844 indicates that it might require sorting, set the may_sort flag.
15845 * output.h (Output_section::may_sort_attached_input_sections): New
15847 (Output_section::set_may_sort_attached_input_sections): New
15849 (Output_section::must_sort_attached_input_sections): New
15851 (Output_section::set_must_sort_attached_input_sections): New
15853 (class Output_section): Declare Input_section_sort_entry. Define
15854 Input_section_sort_compare. Declare
15855 sort_attached_input_sections. Add new fields:
15856 may_sort_attached_input_sections_,
15857 must_sort_attached_input_sections_,
15858 attached_input_sections_are_sorted_.
15859 * output.cc (Output_section::Output_section): Initialize new
15861 (Output_section::add_input_section): Add an entry to
15862 input_sections_ if may_sort or must_sort are true.
15863 (Output_section::set_final_data_size): Call
15864 sort_attached_input_sections if necessary.
15865 (Output_section::Input_section_sort_entry): Define new class.
15866 (Output_section::Input_section_sort_compare::operator()): New
15868 (Output_section::sort_attached_input_sections): New function.
15869 * configure.ac: Check whether the compiler supports constructor
15870 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15871 * testsuite/initpri1.c: New file.
15872 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15873 CONSTRUCTOR_PRIORITY.
15874 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15875 (initpri1_LDFLAGS): New variable.
15876 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15878 2008-03-27 Ian Lance Taylor <iant@google.com>
15880 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15881 * testsuite/common_test_1.c: New file.
15882 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15883 (common_test_1_SOURCES): New variable.
15884 (common_test_1_DEPENDENCIES): New variable.
15885 (common_test_1_LDFLAGS): New variable.
15887 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15888 and commons_ correctly when NAME/VERSION does not override
15890 * testsuite/ver_test_6.c: New file.
15891 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15892 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15893 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15895 2008-03-26 Ian Lance Taylor <iant@google.com>
15897 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15898 of an undefined symbol from a version script.
15899 * testsuite/Makefile.am (ver_test_5.so): New target.
15900 (ver_test_5.o): New target.
15901 (check_SCRIPTS): Add ver_test_5.sh.
15902 (check_DATA): Add ver_test_5.syms.
15903 (ver_test_5.syms): New target.
15904 * testsuite/ver_test_5.cc: New file.
15905 * testsuite/ver_test_5.script: New file.
15906 * testsuite/ver_test_5.sh: New file.
15907 * Makefile.in, testsuite/Makefile.in: Rebuild.
15910 Fix problems building gold with gcc 4.3.0.
15911 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15912 (gold_error_at_location, gold_warning_at_location): Use it.
15913 * configure.ac: Check whether we can compile and use a template
15914 function with a printf attribute.
15915 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15916 when jumping over bytes.
15917 * object.cc: Instantiate Object::read_section_data.
15918 * debug.h: Include <cstring>
15919 * dwarf_reader.cc: Include <algorithm>
15920 * main.cc: Include <cstring>.
15921 * options.cc: Include <cstring>.
15922 * output.cc: Include <cstring>.
15923 * script.cc: Include <cstring>.
15924 * script.h: Include <string>.
15925 * symtab.cc: Include <cstring> and <algorithm>.
15926 * target-select.cc: Include <cstring>.
15927 * version.cc: Include <string>.
15928 * testsuite/testmain.cc: Include <cstdlib>.
15929 * configure, config.in: Rebuild.
15931 2008-03-25 Ian Lance Taylor <iant@google.com>
15933 * options.cc: Include "../bfd/bfdver.h".
15934 (options::help): Print bug reporting address.
15936 * version.cc (print_version): Adjust output for current value of
15937 BFD_VERSION_STRING.
15941 * options.cc (options::help): Print list of supported targets.
15942 * target-select.h: Include <vector>.
15943 (class Target_selector): Make machine_, size_, and is_big_endian_
15944 fields const. Add bfd_name_ and instantiated_target_ fields.
15945 (Target_selector::Target_selector): Add bfd_name parameter.
15946 (Target_selector::recognize): Make non-virtual, call
15948 (Target_selector::recognize_by_name): Make non-virtual, call
15949 do_recognize_by_name.
15950 (Target_selector::supported_names): New function.
15951 (Target_selector::bfd_name): New function.
15952 (Target_selector::do_instantiate_target): New pure virtual
15954 (Target_selector::do_recognize): New virtual function.
15955 (Target_selector::do_recognize_by_name): New virtual function.
15956 (Target_selector::instantiate_target): New private function.
15957 (supported_target_names): Declare.
15958 * target-select.cc (Target_selector::Target_selector): Update for
15959 new parameter and fields.
15960 (select_target_by_name): Check that the name matches before
15961 calling recognize_by_name.
15962 (supported_target_names): New function.
15963 * i386.cc (class Target_selector_i386): Update Target_selector
15964 constructor call. Remove recognize and recognize_by_name. Add
15965 do_instantiate_target.
15966 * x86_64.cc (class Target_selector_x86_64): Likewise.
15967 * testsuite/testfile.cc (class Target_selector_test): Update for
15968 changes to Target_selector.
15970 * README: Rewrite, with some notes on unsupported features.
15972 2008-03-24 Cary Coutant <ccoutant@google.com>
15974 * i386.cc (Target_i386::Got_type): New enum declaration.
15975 (Target_i386::Scan::local): Updated callers of Output_data_got
15977 (Target_i386::Scan::global): Likewise.
15978 (Target_i386::Relocate::relocate): Likewise.
15979 (Target_i386::Relocate::relocate_tls): Likewise.
15980 * object.h (Got_offset_list): New class.
15981 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15982 (Sized_relobj::local_got_offset): Likewise.
15983 (Sized_relobj::set_local_got_offset): Likewise.
15984 (Sized_relobj::local_has_tls_got_offset): Removed.
15985 (Sized_relobj::local_tls_got_offset): Removed.
15986 (Sized_relobj::set_local_tls_got_offset): Removed.
15987 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15988 * output.cc (Output_data_got::add_global): Added got_type parameter.
15989 (Output_data_got::add_global_with_rel): Likewise.
15990 (Output_data_got::add_global_with_rela): Likewise.
15991 (Output_data_got::add_global_pair_with_rel): New function.
15992 (Output_data_got::add_global_pair_with_rela): New function.
15993 (Output_data_got::add_local): Added got_type parameter.
15994 (Output_data_got::add_local_with_rel): Likewise.
15995 (Output_data_got::add_local_with_rela): Likewise.
15996 (Output_data_got::add_local_pair_with_rel): New function.
15997 (Output_data_got::add_local_pair_with_rela): New function.
15998 (Output_data_got::add_global_tls): Removed.
15999 (Output_data_got::add_global_tls_with_rel): Removed.
16000 (Output_data_got::add_global_tls_with_rela): Removed.
16001 (Output_data_got::add_local_tls): Removed.
16002 (Output_data_got::add_local_tls_with_rel): Removed.
16003 (Output_data_got::add_local_tls_with_rela): Removed.
16004 * output.h (Output_data_got::add_global): Added got_type parameter.
16005 (Output_data_got::add_global_with_rel): Likewise.
16006 (Output_data_got::add_global_with_rela): Likewise.
16007 (Output_data_got::add_global_pair_with_rel): New function.
16008 (Output_data_got::add_global_pair_with_rela): New function.
16009 (Output_data_got::add_local): Added got_type parameter.
16010 (Output_data_got::add_local_with_rel): Likewise.
16011 (Output_data_got::add_local_with_rela): Likewise.
16012 (Output_data_got::add_local_pair_with_rel): New function.
16013 (Output_data_got::add_local_pair_with_rela): New function.
16014 (Output_data_got::add_global_tls): Removed.
16015 (Output_data_got::add_global_tls_with_rel): Removed.
16016 (Output_data_got::add_global_tls_with_rela): Removed.
16017 (Output_data_got::add_local_tls): Removed.
16018 (Output_data_got::add_local_tls_with_rel): Removed.
16019 (Output_data_got::add_local_tls_with_rela): Removed.
16020 * resolve.cc (Symbol::override_base_with_special): Removed
16021 reference to has_got_offset_ field.
16022 * symtab.cc (Symbol::init_fields): Replaced initialization
16023 of got_offset_ with got_offsets_. Removed initialization
16025 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16026 (Symbol::got_offset): Likewise.
16027 (Symbol::set_got_offset): Likewise.
16028 (Symbol::has_tls_got_offset): Removed.
16029 (Symbol::tls_got_offset): Removed.
16030 (Symbol::set_tls_got_offset): Removed.
16031 (Symbol::got_offset_): Removed.
16032 (Symbol::tls_mod_got_offset_): Removed.
16033 (Symbol::tls_pair_got_offset_): Removed.
16034 (Symbol::got_offsets_): New field.
16035 (Symbol::has_got_offset): Removed.
16036 (Symbol::has_tls_mod_got_offset): Removed.
16037 (Symbol::has_tls_pair_got_offset): Removed.
16038 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16039 (Target_x86_64::Scan::local): Updated callers of Output_data_got
16041 (Target_x86_64::Scan::global): Likewise.
16042 (Target_x86_64::Relocate::relocate): Likewise.
16043 (Target_x86_64::Relocate::relocate_tls): Likewise.
16045 2008-03-25 Ben Elliston <bje@au.ibm.com>
16047 * yyscript.y: Fix spelling error in comment.
16049 2008-03-24 Ian Lance Taylor <iant@google.com>
16051 * options.h (class General_options): Define build_id option.
16052 * layout.h (class Layout): Declare write_build_id, create_note,
16053 create_build_id. Add build_id_note_ member.
16054 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16055 "libiberty.h", "md5.h", "sha1.h".
16056 (Layout::Layout): Initialize eh_frame_data_,
16057 eh_frame_hdr_section_, and build_id_note_.
16058 (Layout::finalize): Call create_build_id.
16059 (Layout::create_note): New function, broken out of
16060 Layout::create_gold_note.
16061 (Layout::create_gold_note): Call create_note.
16062 (Layout::create_build_id): New function.
16063 (Layout::write_build_id): New function.
16064 (Close_task_runner::run): Call write_build_id.
16066 * x86_64.cc: Correct license to GPLv3.
16068 2008-03-23 Ian Lance Taylor <iant@google.com>
16070 * options.cc: Include "demangle.h".
16071 (parse_optional_string): New function.
16072 (parse_long_option): Handle takes_optional_argument.
16073 (parse_short_option): Update dash_z initializer. Handle
16074 takes_optional_argument.
16075 (General_options::General_options): Initialize do_demangle_.
16076 (General_options::finalize): Set do_demangle_. Handle demangling
16078 * options.h (parse_optional_string): Declare.
16079 (struct One_option): Add optional_arg field. Update constructor.
16080 Update call constructor calls. Add takes_optional_argument
16082 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16083 (DEFINE_optional_string): Define.
16084 (General_options::demangle): Change from DEFINE_bool to
16085 DEFINE_optional_string.
16086 (General_options::no_demangle): New function.
16087 (General_options::do_demangle): New function.
16088 (General_options::set_do_demangle): New function.
16089 (General_options::execstack_status_): Move definition to end of
16091 (General_options::static_): Likewise.
16092 (General_options::do_demangle_): New field.
16093 * object.cc (big_endian>::get_symbol_location_info): Call
16094 Options::do_demangle, not Options::demangle.
16095 * symtab.cc (demangle): Likewise.
16097 2008-03-22 Ian Lance Taylor <iant@google.com>
16099 * gold.h: Include <cstddef> and <sys/types.h>
16100 * options.h: Include <cstring>.
16102 2008-03-21 Ian Lance Taylor <iant@google.com>
16104 * Added source code to GNU binutils.
16106 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16108 Copying and distribution of this file, with or without modification,
16109 are permitted in any medium without royalty provided the copyright
16110 notice and this notice are preserved.
16116 version-control: never