1 2015-04-07 HC Yen <hc.yen@mediatek.com>
3 Add AArch32 support for gold linker.
5 * arm.cc: Add V8 arch combine table.
7 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
9 * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
11 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
13 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
14 to find by using the return value of insert.
16 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
18 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
21 2015-04-06 Ilya Tocar <ilya.tocar@intel.com>
24 * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
25 (Target_x86_64::Scan::local): Don't create GOT entry, when we
26 can convert mov to lea.
27 (Target_x86_64::Scan::global): Ditto.
28 (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
29 %reg to lea foo(%rip), %reg if possible.
30 * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
31 * testsuite/x86_64_mov_to_lea1.s: New.
32 * testsuite/x86_64_mov_to_lea2.s: Ditto.
33 * testsuite/x86_64_mov_to_lea3.s: Ditto.
34 * testsuite/x86_64_mov_to_lea4.s: Ditto.
35 * testsuite/x86_64_mov_to_lea.sh: Ditto.
37 2015-04-02 H.J. Lu <hongjiu.lu@intel.com>
39 * configure: Regenerated.
41 2015-04-01 Ilya Tocar <ilya.tocar@intel.com>
44 * i386.cc (Target_i386::can_convert_mov_to_lea): New.
45 (Target_i386::Scan::local): Don't create GOT entry, when we
46 can convert GOT to GOTOFF.
47 (Target_i386::Scan::global): Ditto.
48 (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
49 lea foo@GOTOFF(%reg), %reg if possible.
50 * testsuite/Makefile.am (i386_mov_to_lea): New test.
51 * testsuite/i386_mov_to_lea1.s: New.
52 * testsuite/i386_mov_to_lea2.s: Ditto.
53 * testsuite/i386_mov_to_lea3.s: Ditto.
54 * testsuite/i386_mov_to_lea4.s: Ditto.
55 * testsuite/i386_mov_to_lea5.s: Ditto.
56 * testsuite/i386_mov_to_lea.sh: Ditto.
58 2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
60 * Makefile.am (ZLIB): New.
62 (AM_CFLAGS): Add $(ZLIBINC).
63 (AM_CXXFLAGS): Likewise.
64 (ldadd_varldadd_var): Add $(ZLIB).
65 (incremental_dump_LDADD): Likewise.
66 (dwp_LDADD): Likewise.
67 * compressed_output.cc: Don't check HAVE_ZLIB_H to include
69 (zlib_compress): Don't check HAVE_ZLIB_H.
70 (zlib_decompress): Likewise.
71 * options.h (compress_debug_sections): Likewise.
72 * configure.ac (AM_CONDITIONAL): Removed.
73 * testsuite/Makefile.am (ZLIB): New.
75 Don't check HAVE_ZLIB.
76 * Makefile.in: Regenerated.
77 * config.in: Likewise.
78 * configure: Likewise.
79 * testsuite/Makefile.in: Likewise.
81 2015-03-30 Jing Yu <jingyu@google.com>
83 * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
84 TLSLD_ADD_DTPREL_LO12_NC.
85 * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
86 _TLS_MODULE_BASE_ point to the start of tls segment.
87 (Target_aarch64::optimize_tls_reloc): Add cases for
88 R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
89 R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
90 (Target_aarch64::Scan::local): Likewise.
91 (Target_aarch64::Scan::global): Likewise.
92 (Target_aarch64::Relocate::relocate): Likewise.
93 (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
94 subtracting tls segment size from symbol value for TLSLD_*_DTPREL
97 2015-03-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
99 * merge.cc (Object_merge_map::add_mapping): call
100 Object_merge_map::Input_merge_map::add_mapping.
101 (Object_merge_map::Input_merge_map::add_mapping): New.
102 (Output_merge_data::do_add_input_section): Call
103 get_or_make_input_merge_map before a loop.
104 (Output_merge_string<Char_type>::finalize_merged_data): Call
105 get_or_make_input_merge_map before a loop.
106 * merge.h (Object_merge_map): Make Input_merge_map public.
107 * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
108 (Relobj::get_or_create_merge_map): New.
109 * object.h (Relobj::get_or_create_merge_map): New.
111 2015-03-24 Alan Modra <amodra@gmail.com>
114 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
115 relocation errors for branches to strong undefined symbols.
117 2015-03-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
119 * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
120 (Object_merge_map::is_merge_section_for): Remove.
121 (Object_merge_map::find_merge_section): New.
122 * merge.h (Object_merge_map::is_merge_section_for): Remove.
123 (Object_merge_map::find_merge_section): New.
124 (Object_merge_map::get_input_merge_map): Add a const version.
125 * object.cc (Relobj::is_merge_section_for): Remove.
126 (Relobj::find_merge_section): New.
127 * object.h (Relobj::is_merge_section_for): Remove.
128 (Relobj::find_merge_section): New.
130 (Output_section::Input_section::is_merge_section_for): Remove.
131 (Output_section::add_merge_input_section): Don't call
132 add_merge_input_section.
133 (Output_section::find_merge_section): Return const. Use
134 object->find_merge_section.
135 (Output_section::build_lookup_maps): Don't build a map for
137 (Output_section::is_input_address_mapped): Return false if
138 section is not found.
139 (Output_section::find_starting_output_address): Use
140 find_merge_section instead of is_merge_section_for.
141 (Output_section::add_script_input_section): Don't build a map for
143 * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
144 (Output_section_lookup_maps::find_merge_section): Remove.
145 (Output_section_lookup_maps::add_merge_input_section) Remove.
146 (Output_section::find_merge_section): Return const.
148 2015-03-22 Cary Coutant <cary@google.com>
151 * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
152 non-SIB form of lea, with nop after the call.
154 2015-03-21 Cary Coutant <cary@google.com>
157 * output.cc (Output_segment::is_first_section_relro): Don't ignore
159 (Output_segment::set_section_addresses): Don't align size of relro
162 2015-03-21 Cary Coutant <cary@google.com>
165 * stringpool.cc (Stringpool_template): Don't optimize if section
166 alignment is greater than sizeof(char).
168 2015-03-21 Cary Coutant <cary@google.com>
171 * script-c.h (script_include_directive): Add first_token parameter.
172 * script.cc (script_include_directive): Add first_token parameter, and
173 pass it to read_script_file.
174 * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
175 (PARSING_MEMORY_DEF): New tokens.
176 (top): Add new productions for INCLUDE files.
177 (file_cmd): Replace file_or_sections_cmd with copy of its productions.
178 Pass PARSING_LINKER_SCRIPT to script_include_directive.
179 (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
180 (section_cmd): Pass PARSING_SECTION_CMDS.
181 (file_or_sections_cmd): Remove.
182 (memory_def): Pass PARSING_MEMORY_DEF.
183 * testsuite/Makefile.am (memory_test_2): New test.
184 * testsuite/Makefile.in: Regenerate.
185 * testsuite/memory_test_inc.t: New script file.
186 * testsuite/memory_test_inc_1.t.src: New script file.
187 * testsuite/memory_test_inc_2.t.src: New script file.
188 * testsuite/memory_test_inc_3.t.src: New script file.
190 2015-03-21 Cary Coutant <cary@google.com>
192 * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
193 (Sized_relobj_dwo::setup): Build compressed section map.
194 (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
195 * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
197 * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
198 compressed_sections_ field.
199 (build_compressed_section_map): Take Object instead of
200 Sized_relobj_file parameter; add decompress_if_needed parameter.
201 (Sized_relobj_file::do_find_special_sections): Store compressed
202 section map in parent Object.
203 (Sized_relobj_file::do_decompressed_section_contents): Move
204 implementation to Object::decompressed_section_contents.
205 (Sized_relobj_file::do_discard_decompressed_sections): Move
206 implementation to Object::discard_decompressed_sections.
207 * object.h (build_compressed_section_map): Declare.
208 (Object::Object): Add compressed_sections_ field.
209 (Object::section_is_compressed): Move implementation here.
210 (Object::decompressed_section_contents): De-virtualize.
211 (Object::discard_decompressed_sections): De-virtualize.
212 (Object::do_section_is_compressed): Delete.
213 (Object::do_decompressed_section_contents): Delete.
214 (Object::set_compressed_sections): New method.
215 (Object::compressed_sections): New method.
216 (Object::compressed_sections_): New data member.
217 (Compressed_section_info, Compressed_section_map): Move to top of file.
218 (Sized_relobj_file::do_section_is_compressed): Delete.
219 (Sized_relobj_file::do_decompressed_section_contents): Delete.
220 (Sized_relobj_file::do_discard_decompressed_sections): Delete.
221 (Sized_relobj_file::compressed_sections_): Move to Object class.
223 2015-03-21 Cary Coutant <ccoutant@google.com>
226 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
229 2015-03-11 Cary Coutant <ccoutant@google.com>
231 * options.cc (General_options::finalize): Don't allow -z relro
232 with incremental linking.
233 * testsuite/Makefile.am (incremental_test): Add -z norelro.
234 (incremental_test_2): Likewise.
235 (incremental_test_3): Likewise.
236 (incremental_test_4): Likewise.
237 (incremental_test_5): Likewise.
238 (incremental_test_6): Likewise.
239 (incremental_copy_test): Likewise.
240 (incremental_common_test_1): Likewise.
241 (incremental_comdat_test_1): Likewise.
242 * testsuite/Makefile.in: Regenerate.
244 2015-03-09 Cary Coutant <ccoutant@google.com>
247 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
248 return enum indicating whether .eh_frame section is empty, optimizable,
249 unrecognized, or an end marker. Adjust explicit instantiations.
250 * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
251 (Eh_frame::add_ehframe_input_section): Change return type.
252 * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
253 * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
254 to the .eh_frame output section until we see the end marker.
255 (Layout::finalize_eh_frame_section): New.
256 * layout.h: (Layout::finalize_eh_frame_section): New.
258 2015-03-05 H.J. Lu <hongjiu.lu@intel.com>
260 * output.cc (Relobj::initialize_input_to_output_map<size>):
261 Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
263 2015-03-04 Cary Coutant <ccoutant@google.com>
265 * parameters.cc (Parameters::set_target_once): Call
266 Target::select_as_default_target just once from here...
267 (set_parameters_target): ...instead of from here.
269 2015-03-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
271 * ehframe.cc (Cie::set_output_offset): Pass in and use a
272 Output_section_data instead of a Merge_map.
273 (Eh_frame::Eh_frame): Don't initialize merge_map_.
274 (Eh_frame::read_cie): Use add_merge_mapping instead of
275 Merge_map::add_mapping.
276 (Eh_frame::read_fde): Ditto.
277 (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
278 (Eh_frame::do_output_offset): Use merge_output_offset istead of
279 merge_map_->get_output_offset.
280 (Eh_frame::do_is_merge_section_for): Delete.
281 * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
282 instead of a Merge_map.
283 (Cie::set_output_offset): Pass in a Output_section_data instead of a
285 (Eh_frame::do_is_merge_section_for): Delete.
286 (Eh_frame::merge_map_): Delete.
287 * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
288 and use a Output_section_data instead of a Merge_map.
289 (Object_merge_map::add_mapping): Ditto.
290 (Object_merge_map::get_output_offset): Remove the merge_map argument.
291 (Object_merge_map::is_merge_section_for): Pass in and use a
292 Output_section_data instead of a Merge_map.
294 (Output_merge_base::do_output_offset): Use merge_output_offset instead
295 of merge_map_.get_output_offset.
296 (Output_merge_base::do_is_merge_section_for): Delete.
297 (Output_merge_data::do_add_input_section): Use
298 object->add_merge_mapping instead of add_mapping.
299 (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
300 * merge.h (Merge_map): Delete forward declaration.
301 (Object_merge_map::add_mapping): Pass in and use a Output_section_data
302 instead of a Merge_map.
303 (Object_merge_map::get_output_offset): Remove the merge_map argument.
304 (Object_merge_map::is_merge_section_for): Pass in and use a
305 Output_section_data instead of a Merge_map.
306 (Input_merge_map::Object_merge_map::merge_map): Replace with
308 (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
309 Output_section_data instead of a Merge_map.
311 (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
312 (Output_merge_base::do_is_merge_section_for): Delete.
313 (Output_merge_base::add_mapping): Delete.
314 (Output_merge_base::merge_map_): Delete.
315 * object.cc (Relobj::initialize_input_to_output_map): New.
316 (Relobj::initialize_input_to_output_map): New.
317 (Relobj::merge_output_offset): New.
318 (Relobj::is_merge_section_for): New.
319 (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
321 * object.h (Relobj::merge_map): Delete.
322 (initialize_input_to_output_map): New.
323 (set_merge_map): Delete.
324 (add_merge_mapping): New.
325 (merge_output_offset): New.
326 (is_merge_section_for): New.
327 * output.cc (Output_section::Input_section::is_merge_section_for):
328 Use object->is_merge_section_for.
329 * output.h (Output_section_data::is_merge_section_for): Delete.
330 (Output_section_data::do_is_merge_section_for): Delete.
331 * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
332 Use object->initialize_input_to_output_map.
333 (Merged_symbol_value<size>::value_from_output_section): Use
334 object->merge_output_offset.
336 2015-03-02 Peter Collingbourne <pcc@google.com>
337 Cary Coutant <ccoutant@google.com>
339 * output.cc (Output_section::add_merge_input_section): Do not
340 attempt to merge sections with an entsize of 0.
342 2015-03-02 Khem Raj <raj.khem@gmail.com>
344 * attributes.h (class Output_attributes_section_data ): Add
345 do_print_to_mapfile function.
347 2015-02-24 Alan Modra <amodra@gmail.com>
350 * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
351 complain if value is not a multiple of four.
352 (Target_powerpc::Relocate::relocate): Correct handling of
353 R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
355 2015-02-21 H.J. Lu <hongjiu.lu@intel.com>
357 * configure.ac (default_size): Set to 32 for x32.
358 * configure: Regenerated.
360 2015-02-18 Alan Modra <amodra@gmail.com>
363 * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
366 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
368 * gc.h (Garbage_collection::add_reference): Don't use find.
370 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
372 * object.cc (write_local_symbols): avoid std::vector copy.
374 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
376 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
378 2015-02-09 Mark Wielaard <mjw@redhat.com>
380 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
381 DW_LANG_Fortran03 and DW_LANG_Fortran08.
383 2015-02-16 Cary Coutant <ccoutant@google.com>
387 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
388 DF_SYMBOLIC if --dynamic-list option is used.
389 * options.cc (General_options::finalize): --dynamic-list is not
390 mutually exclusive with -Bsymbolic.
391 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
392 listed in --dynamic-list.
393 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
394 -Bsymbolic-functions.
395 * testsuite/Makefile.in: Regenerate.
397 2015-02-16 Cary Coutant <ccoutant@google.com>
400 * incremental.cc: Remove redundant include of "output.h".
402 2015-02-12 Jing Yu <jingyu@google.com>
404 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
405 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
407 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
408 TLSLE_MOVW_* relocations.
409 (Target_aarch64::Scan::global): Likewise.
410 (Target_aarch64::Relocate::relocate): Likewise.
411 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
412 for new TLSLE_MOVW_* relocations.
414 2015-02-11 Will Newton <will.newton@linaro.org>
417 * arm.cc (Target_arm::make_plt_section): Create an ARM
418 state mapping symbol at the start of the PLT.
420 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
422 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
423 Replace two_file_shared_2.so with two_file_shared_1.so.
424 * testsuite/Makefile.in: Regenerated.
426 2015-02-09 Alan Modra <amodra@gmail.com>
428 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
429 plugin_test_thin.a and defsym_test.
430 * testsuite/Makefile.in: Regenerate.
432 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
434 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
437 2015-02-04 Peter Collingbourne <pcc@google.com>
439 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
440 forwarding symbols when computing symbol resolution info for plugins.
441 * plugin.h (Plugin_manager::symtab): New method.
442 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
444 2015-02-03 Cary Coutant <ccoutant@google.com>
445 Peter Collingbourne <pcc@google.com>
448 * archive.cc (Thin_archive_object_unlocker): New class.
449 (Archive::include_member): Unlock external members of thin archives.
450 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
451 (plugin_test_2): Likewise.
452 (plugin_test_3): Likewise.
453 (plugin_test_4): Likewise.
454 (plugin_test_5): Likewise.
455 (plugin_test_6): Likewise.
456 (plugin_test_7): Likewise.
457 (plugin_test_8): Likewise.
458 (plugin_test_9): Likewise.
459 (plugin_test_10): Likewise.
460 (plugin_test_11): New test case.
461 * testsuite/Makefile.in: Regenerate.
462 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
463 file to decide whether to claim file.
464 (all_symbols_read_hook): Likewise.
465 * testsuite/plugin_test_1.sh: Adjust expected output.
466 * testsuite/plugin_test_2.sh: Likewise.
467 * testsuite/plugin_test_3.sh: Likewise.
468 * testsuite/plugin_test_6.sh: Likewise.
469 * testsuite/plugin_test_tls.sh: Likewise.
470 * testsuite/plugin_test_11.sh: New testcase.
472 2015-02-03 Cary Coutant <ccoutant@google.com>
474 * descriptors.cc (Descriptors::open): Set artificially-low limit for
475 file descriptors when debugging enabled. Add debug output.
476 (Descriptors::release): Add debug output.
477 (Descriptors::close_some_descriptor): Likewise.
478 (Descriptors::close_all): Likewise.
479 * fileread.cc (File_read::lock): Likewise.
480 (File_read::unlock): Likewise.
482 2015-02-02 Cary Coutant <ccoutant@google.com>
484 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
485 executable output file.
487 2015-01-22 Han Shen <shenhan@google.com>
489 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
490 (Target_arm::do_plt_address_for_global): New method.
491 (Target_arm::do_plt_address_for_local): New method.
492 (Target_arm::rel_irelative_section): New method.
493 (Target_arm::make_data_plt): Add more parameters for plt ctor.
494 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
495 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
496 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
497 (Target_arm::Scan::check_non_pic): Add ifunc support.
498 (Target_arm::Scan::local): Add ifunc support.
499 (Target_arm::Scan::global): Add ifunc support.
500 (Target_arm::make_plt_section): New method.
501 (Target_arm::make_plt_entry): Change to call to make_plt_section.
502 (Target_arm::make_local_ifunc_plt_entry): New method.
503 (Target_arm::got_irelative_): New member.
504 (Target_arm::rel_irelative_): New member.
505 (Target_arm::got_section): Add creation for got_irelative_.
506 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
507 (Target_arm::Relocate::relocate): Properly set local ifunc address.
508 (Target_arm::do_dynsym_value): Properly set global ifunc address.
509 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
510 (Output_data_plt_arm::IRelative_data): New type.
511 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
512 (Output_data_plt_arm::add_entry): Add more parameters.
513 (Output_data_plt_arm::add_relocation): New method.
514 (Output_data_plt_arm::add_local_ifunc_entry): New method.
515 (Output_data_plt_arm::rel_irelative): New method.
516 (Output_data_plt_arm::entry_count): Modified.
517 (Output_data_plt_arm::address_for_global): New method.
518 (Output_data_plt_arm::address_for_local): New method.
520 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
521 (Output_data_plt_arm::insert_irelative_data): New method.
522 (Output_data_plt_arm::irelative_rel_): New member.
523 (Output_data_plt_arm::got_): New member.
524 (Output_data_plt_arm::got_irelative_): New member.
525 (Output_data_plt_arm::irelative_count_): New member.
526 (Output_data_plt_arm::IRelative_data_vec): New typedef.
527 (Output_data_plt_arm::irelative_data_vec_): New member.
528 (Output_data_plt_arm::do_write): Write out irelative entries.
529 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
530 more parameters to ctor.
531 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
532 more parameters to ctor.
533 * output.h (Output_data_reloc::add_local_relative): New method.
534 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
536 2015-01-29 Alan Modra <amodra@gmail.com>
538 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
539 and GOT_TLSGD to LE optimization.
541 2015-01-28 Cary Coutant <ccoutant@google.com>
543 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
544 for undef TLS symbols.
545 (Target_x86_64::Relocate::relocate_tls): Likewise.
546 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
548 2015-01-25 Cary Coutant <ccoutant@google.com>
550 * output.cc (Output_segment::set_section_addresses): Fix calculation
551 of size of relro segment.
553 2015-01-22 Alan Modra <amodra@gmail.com>
555 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
556 condition for need of ifunc plt entry.
557 (Target_powerpc::Scan::global <got relocs>): Likewise.
559 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
561 * mips.cc (reloc_high): Add r_sym.
562 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
563 reloc_high constructor.
564 (Mips_relocate_functions::relgot16_local): Likewise.
565 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
566 r_type to decide whether LO16 matches HI16.
567 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
568 rello16 and relgot16_local.
570 2015-01-09 Cary Coutant <ccoutant@google.com>
572 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
573 unless alignment is larger than page size.
575 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
576 Cary Coutant <ccoutant@google.com>
579 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
580 (DEFAULT_TARGET_X32): Set for x32.
581 * x86_64.cc (cmp_insn_32): New.
582 (lea_r10_insn_32): Likewise.
583 (lea_r11_insn_32): Likewise.
584 (cmp_insn_64): Likewise.
585 (lea_r10_insn_64): Likewise.
586 (lea_r11_insn_64): Likewise.
587 (Target_x86_64<size>::do_calls_non_split): Handle x32.
588 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
589 (check_DATA): Add split_x32 files.
590 (split_x32_[1234n].o): New targets.
591 (split_x32_[124]): New targets.
592 (split_x32_[1234r].stdout): New targets.
593 * testsuite/split_x32.sh: New file.
594 * testsuite/split_x32_1.s: Likewise.
595 * testsuite/split_x32_2.s: Likewise.
596 * testsuite/split_x32_3.s: Likewise.
597 * testsuite/split_x32_4.s: Likewise.
598 * testsuite/split_x32_n.s: Likewise.
599 * configure: Regenerated.
600 * testsuite/Makefile.in: Likewise.
602 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
605 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
608 2015-01-02 Alan Modra <amodra@gmail.com>
610 * version.cc (print_version): Just print current year.
611 * dwp.cc (print_version): Likewise.
613 2015-01-01 Alan Modra <amodra@gmail.com>
615 Update year range in copyright notice of all files.
617 2014-12-25 Alan Modra <amodra@gmail.com>
619 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
621 (Target_arm::merge_object_attributes, ): Likewise.
623 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
625 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
626 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
627 AEABI_VFP_args_vfp to check that.
628 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
629 value and replace hardcoded values by enum values.
631 2014-12-22 Cary Coutant <ccoutant@google.com>
633 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
635 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
638 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
639 to "return i * i * 3;".
641 2014-12-16 Cary Coutant <ccoutant@google.com>
643 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
644 (Mapfile::print_output_data): Use current_data_size() to avoid
645 assert for sections requiring postprocessing; if address is not valid,
647 (Mapfile::print_output_section): Use current_data_size(); print note
648 that addresses and sizes are before compression.
650 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
652 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
653 Cast current_group_size to unsigned long when reporting error.
655 2014-12-10 Jing Yu <jingyu@google.com>
657 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
658 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
659 Update error message.
660 (Target_aarch64::do_relax): Use absolute value of option
661 stub_group_size. Replace local variable with class member
664 2014-12-04 Alan Modra <amodra@gmail.com>
666 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
667 addend of PLTREL24 reloc when not generating a plt stub. Make
668 max_branch_offset an "Address".
669 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
670 (Target_powerpc::Relocate::relocate): Likewise.
672 2014-12-04 Alan Modra <amodra@gmail.com>
675 * symtab.cc (Symbol::set_undefined): Remove assertion.
676 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
677 on symbols defined in discarded sections, instead return false.
678 Rearrange params, update all callers.
679 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
680 branches to syms in discarded sections.
681 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
682 undefined and flag as discarded.
683 (Target_powerpc::Relocate::relocate): Localize variable.
685 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
688 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
689 * testsuite/Makefile.in: Regenerated.
691 2014-12-03 Alan Modra <amodra@gmail.com>
694 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
695 when adding dynamic relocations against section symbols.
697 2014-12-01 Dimitry Ivanov <dimitry@google.com>
699 * layout.cc (Layout::finish_dynamic_section): When '-z global'
700 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
701 * options.h (General_options): New -z option (global).
703 2014-12-01 Cary Coutant <ccoutant@google.com>
706 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
708 (Layout::create_executable_stack_info): Warn when -z noexecstack is
709 given but some inputs require executable stack.
711 2014-11-26 Cary Coutant <ccoutant@google.com>
713 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
714 .debug_str_offsets; strip .debug_gnu_pubnames and
716 (lines_only_debug_sections): Strip all four new sections.
718 2014-11-26 Jing Yu <jingyu@google.com>
720 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
721 register to be x0 when to relax TLSDESC_LD64_LO12.
723 2014-11-26 Alan Modra <amodra@gmail.com>
725 * powerpc.cc (struct Stub_table_owner): New.
726 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
727 unsigned int vector. Update all references.
728 (powerpc_relobj::set_stub_table): Take an unsigned int param
729 rather than a Stub_table. Update callers.
730 (Powerpc_relobj::clear_stub_table): New function.
731 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
732 stub_group_size_ vars.
733 (Target_powerpc::new_stub_table): Delete.
734 (max_branch_delta): New function, extracted from..
735 (Target_powerpc::Relocate::relocate): ..here..
736 (Target_powerpc::Branch_info::make_stub): ..and here. Return
737 status on whether stub created successfully.
738 (Stub_control::Stub_control): Add "no_size_errors" param. Move
740 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
741 reduce on relax failure.
742 (Target_powerpc::group_sections): Add "no_size_errors" param.
743 Use stub_group_size_. Set up group info in a temp vector,
744 before building Stub_table vector. Account for input sections
745 possibly already converted to relaxed sections.
746 (Stub_table::init): Delete. Merge into..
747 (Stub_table::Stub_table): ..here.
748 (Stub_table::can_reach_stub): New function.
749 (Stub_table::add_plt_call_entry): Add "from" parameter and
750 return true iff stub could be reached.
751 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
753 (Stub_table::clear_stubs): Add "all" param.
755 2014-11-26 Alan Modra <amodra@gmail.com>
757 * powerpc.cc (Stub_control::set_output_and_owner): New function.
758 (Target_powerpc::group_sections): Use it.
760 2014-11-25 Cary Coutant <ccoutant@google.com>
762 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
763 (Binary_to_elf::write_symbol): Add st_size parameter.
764 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
766 2014-11-25 Cary Coutant <ccoutant@google.com>
769 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
770 (Sized_relobj_file::do_layout): Handle deferred sections properly
771 during GC pass 1. Don't add reloc sections to deferred list twice.
772 * object.h (Sized_relobj_file::is_deferred_layout): New function.
773 (Sized_relobj_file::is_deferred_layout_): New data member.
775 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
778 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
779 Check PC-relative offset overflow in PLT entry.
781 2014-11-21 Alan Modra <amodra@gmail.com>
783 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
786 2014-11-20 Alan Modra <amodra@gmail.com>
788 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
789 from --stub-group-size parameter divided by 1024.
790 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
791 template parameter. Update all uses.
792 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
793 has_stub_value. Set for long branches. Don't report overflow for
794 branch to undefined weak symbols. Print info message on
795 overflowing branch to stub.
797 2014-11-20 Alan Modra <amodra@gmail.com>
799 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
801 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
803 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
804 entry for R_X86_64_GOTPLT64.
805 (Target_x86_64<size>::Relocate::relocate): Update comments for
808 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
810 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
811 * plugin.h: add lock definition
813 2014-10-29 Han Shen <shenhan@google.com>
814 Jing Yu <jingyu@google.com>
816 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
817 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
818 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
820 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
822 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
823 (Target_aarch64::tls_ld_to_le): New method.
824 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
826 (Output_data_plt_aarch64::irelative_rel_): New data member.
827 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
828 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
829 (Output_data_plt_aarch64::add_relocation): New method.
830 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
831 offset. Add got_irelative size to got size.
832 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
833 type string with the new typename.
834 (AArch64_relocate_functions::update_adr): Replace parameter x with
836 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
837 (AArch64_relocate_functions::reloc_common): New method.
838 (AArch64_relocate_funcsions::rela_general): Extract common part out
839 into reloc_common method.
840 (AArch64_relocate_functions::rela_general): Likewise.
841 (AArch64_relocate_functions::pcrela_general): Likewise.
842 (AArch64_relocate_functions::adr): New method.
843 (AArch64_relocate_functions::adrp): Calculate immed before calling
845 (AArch64_relocate_functions::adrp): Likewise.
846 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
847 comparing x to 0. Calculate immed from ~x when x < 0.
848 (Target_aarch64::optimize_tls_reloc): Add new cases for
849 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
850 TLSLD_MOVW_DTPREL_G0_NC.
851 (Target_aarch64::possible_function_pointer_reloc): Implement this
853 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
855 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
856 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
857 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
858 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
859 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
860 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
861 (Target_aarch64::make_plt_entry): Call add_entry with two more
863 (Target_aarch64::make_local_ifunc_plt_entry): New method.
864 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
865 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
866 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
867 (Target_aarch64::Relocate::relocate_tls): Add cases for
868 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
869 TLSLD_MOVW_DTPREL_G0_NC.
870 * testsuite/icf_safe_so_test.cc: Correct test comment.
871 * testsuite/icf_safe_test.sh: Add AArch64 arch.
873 2014-10-22 Alan Modra <amodra@gmail.com>
875 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
878 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
880 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
882 2014-10-17 Cary Coutant <ccoutant@google.com>
884 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
885 Add "typename" keyword.
887 2014-10-15 Han Shen <shenhan@google.com>
888 Jing Yu <jingyu@google.com>
890 Patch for gold aarch64 backend to support relaxation.
891 * aarch64-reloc.def: Change format.
892 * aarch64.cc (class Reloc_stub): New class.
893 (class Stub_table): New class.
894 (class AArch64_relobj): New class.
895 (class AArch64_input_section): New class.
896 (class AArch64_output_section): New class.
897 (Target_aarch64::new_stub_table): New method.
898 (Target_aarch64::new_aarch64_input_section): New method.
899 (Target_aarch64::find_aarch64_input_section): New method.
900 (Target_aarch64::scan_section_for_stubs): New method.
901 (Target_aarch64::scan_reloc_section_for_stubs): New method.
902 (Target_aarch64::relocate_stub): New method.
903 (Target_aarch64::current_target): New method.
904 (Target_aarch64::do_make_elf_object): New method.
905 (Target_aarch64::do_may_relax): New method.
906 (Target_aarch64::do_relax): New method.
907 (Target_aarch64::group_sections): New method.
908 (Target_aarch64::scan_reloc_for_stub): New method.
909 (Target_aarch64::do_make_output_section): New method.
910 (Target_aarch64::stub_tables_): New data member.
911 (Target_aarch64::aarch64_input_section_map_): New data member.
912 (AArch64_relocate_functions::maybe_apply_stub): New method.
914 2014-09-30 Cary Coutant <ccoutant@google.com>
917 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
919 2014-09-30 Kito Cheng <kito@0xlab.org>
922 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
923 hash table before sysv-style hash table.
925 2014-09-29 Sriraman Tallam <tmsriram@google.com>
927 * options.h (--pic-executable): Add negative to alias to -no-pie.
929 2014-09-26 Cary Coutant <ccoutant@google.com>
932 * object.cc (Sized_relobj_file): Compute value of section symbols
933 for TLS sections the same as TLS symbols.
935 2014-09-25 Cary Coutant <ccoutant@google.com>
938 * resolve.cc (Symbol_table::resolve): Override common placeholder
939 symbols, but adjust sizes.
940 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
941 symbols to common lists.
943 2014-09-24 Alan Modra <amodra@gmail.com>
945 * po/POTFILES.in: Regenerate.
947 2014-09-23 Taiju Tsuiki <tzik@google.com>
948 Cary Coutant <ccoutant@google.com>
951 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
952 on input_sections_blocker.
953 * layout.cc (Write_sections_task::locks): Unblock
954 input_sections_blocker_.
955 * layout.h (Write_sections_task::Write_sections_task): Add
956 input_sections_blocker.
957 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
959 * testsuite/Makefile.in: Regenerate.
961 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
963 * testsuite/Makefile.am (plugin_test_10): New test.
964 * testsuite/Makefile.in: Regenerate
965 * testsuite/plugin_common_test_2.c (c1): Align to 8.
966 * testsuite/plugin_test_10.sh: New file.
968 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
970 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
971 * resolve.cc (Symbol_table::resolve): Don't override common symbols
972 during the replacement phase.
974 2014-09-17 Han Shen <shenhan@google.com>
975 Jing Yu <jingyu@google.com>
977 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
978 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
979 * aarch64.cc (Target_aarch64): Add data members
980 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
981 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
983 (Target_aarch64::do_reloc_symbol_index): New method.
984 (Target_aarch64::do_reloc_addend): New method.
985 (Target_aarch64::add_tlsdesc_info): New method.
986 (Target_aarch64::do_dynsym_value): New method.
987 (Target_aarch64::do_make_data_plt): Add new parameters: got,
988 got_irelative. Pass them to Output_data_plt_aarch64_standard.
989 (Target_aarch64::make_data_plt): Add new parameters: got,
990 got_irelative. Pass them to do_make_data_plt.
991 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
992 (Target_aarch64::Relocate:tls_gd_to_le): New method.
993 (Target_aarch64::Relocate:tls_ie_to_le): New method.
994 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
995 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
996 (Target_aarch64::got_tlsdesc_section): New method.
997 (Target_aarch64::make_local_ifunc_plt_entry): New method.
998 (Target_aarch64::define_tls_base_symbol): New method.
999 (Target_aarch64::reserve_tlsdesc_entries): New method.
1000 (Target_aarch64::got_mod_index_entry): New method.
1001 (Target_aarch64::rela_tlsdesc_section): New method.
1002 (Target_aarch64::rela_irelative_section): New method.
1003 (Target_aarch64::Tlsdesc_info): New struct.
1004 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1005 relocations and tlsdesc relocations.
1006 (Target_aarch64::optimize_tls_reloc): Implement method.
1007 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1008 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1010 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1011 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1012 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1013 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1014 (Output_data_plt_aarch64::rela_tlsdesc): New method.
1015 (Output_data_plt_aarch64::rela_irelative): New method.
1016 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1017 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1018 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1019 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1020 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1021 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1022 (Output_data_plt_aarch64_standard): New member variables:
1023 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1024 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1025 New parameter: got, got_irelative.
1026 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1027 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1028 (Output_data_plt_aarch64::do_write): Replace got_address with
1029 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1030 (AArch64_relocate_functions::update_movnz): New method.
1031 (AArch64_relocate_functions): Correct format.
1032 (AArch64_relocate_functions::movnz): New method.
1033 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1034 before the switch. Add new cases to switch.
1035 Check ie_to_le relaxation on tlsie relocations. Add code handling
1036 tlsgd tlsdesc cases.
1037 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1038 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1039 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1040 Call reloc_name_in_error_message to print unsupported reloc.
1041 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1043 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1044 relocs. Fill in some more dynamic tags.
1045 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1046 Skip call tls_get_addr when tlsgd is relaxed.
1047 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1048 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1049 tlsdesc->ie relaxation.
1051 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1053 * mips.cc (Target_mips_nacl): New class.
1054 (Target_selector_mips_nacl): New class.
1055 (target_selector_mips32): Rename from target_selector_mips32be and use
1056 Target_selector_mips_nacl instead of Target_selector_mips.
1057 (target_selector_mips32el): Rename from target_selector_mips32 and use
1058 Target_selector_mips_nacl instead of Target_selector_mips.
1059 (target_selector_mips64): Rename from target_selector_mips64be and use
1060 Target_selector_mips_nacl instead of Target_selector_mips.
1061 (target_selector_mips64el): Rename from target_selector_mips64 and use
1062 Target_selector_mips_nacl instead of Target_selector_mips.
1063 (Target_mips::mips_info): Add const attribute.
1065 2014-09-02 Cary Coutant <ccoutant@google.com>
1067 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1068 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1069 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1070 (Sized_incr_dynobj::do_section_name): Likewise.
1071 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1072 (Sized_incr_dynobj::do_section_name): Likewise.
1073 * object.h (Object::section_name): Likewise.
1074 (Object::do_section_name): Likewise.
1075 (Sized_relobj_file::do_section_name): Likewise.
1076 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1077 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1079 2014-09-02 Cary Coutant <ccoutant@google.com>
1082 * ehframe.cc (Fde::write): Add output_offset parameter.
1083 (Cie::write): Likewise.
1084 (Eh_frame::set_final_data_size): Account for offset within output
1086 (Eh_frame::do_sized_write): Likewise.
1087 * ehframe.h (Fde::write): Add output_offset parameter.
1088 (Cie::write): Likewise.
1089 * output.cc (Output_section::Input_section_sort_entry): Remove
1090 section_has_name_; add output_section_name parameter. Use
1091 output section name for non-input sections.
1092 (Output_section::Input_section_sort_entry::section_has_name): Remove.
1093 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1094 (Output_section::Input_section_sort_compare): Remove logic for
1095 sections without names.
1096 (Output_section::Input_section_sort_init_fini_compare): Likewise.
1097 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1099 (Output_section::Input_section_sort_section_name_compare): Likewise.
1101 2014-08-29 Han Shen <shenhan@google.com>
1102 Jing Yu <jingyu@google.com>
1104 * aarch64-reloc-property.cc
1105 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1106 reference reloc property in the table.
1107 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1109 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1110 2 new overloaded methods.
1111 (Output_data_got_aarch64::do_write): Add code to write out
1113 (class Output_data_got_aarch64::Static_reloc): New class to wrap
1115 (Output_data_got_aarch64::static_relocs): New vector to
1117 (Target_aarch64::TCB_SIZE): New const static memeber.
1118 (Target_aarch64::tcb_size): New method.
1119 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1120 (Target_aarch64::Relocate::relocate_tls): New method.
1121 (Target_aarch64::Scan::local): Add code handling new reloc types.
1122 (Target_aarch64::Scan::global): Add code handling new reloc types.
1124 2014-08-13 Sriraman Tallam <tmsriram@google.com>
1126 * options.h (-no-pie): Add option.
1128 2014-08-08 Jing Yu <jingyu@google.com>
1129 Han Shen <shenhan@google.com>
1131 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1132 (DEFFILES): add aarch64-reloc.def.
1133 (TARGETSOURCES): Add aarch64-reloc-property.cc.
1134 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1135 * Makefile.in: Regenerate.
1136 * aarch64-reloc-property.cc: New file.
1137 * aarch64-reloc-property.h: New file.
1138 * aarch64-reloc.def: New file.
1139 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1140 with tab to make the format consistent.
1141 (Output_data_got_aarch64::symbol_table_): New method.
1142 (Target_aarch64::do_plt_address_for_global): New method.
1143 (Target_aarch64::do_plt_address_for_local): New method.
1144 (Target_aarch64::do_select_as_default_target): New method.
1145 (Target_aarch64::do_make_data_plt): New method.
1146 (Target_aarch64::make_data_plt): New method.
1147 (Output_data_plt_aarch64::has_irelative_section): New method.
1148 (Output_data_plt_aarch64::address_for_global): New method.
1149 (Output_data_plt_aarch64::address_for_local): New method.
1150 (Output_data_plt_aarch64::irelative_rel_): New parameter.
1151 (Output_data_plt_aarch64::add_entry): Implement contents.
1152 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1153 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1154 the got_pov entry to plt0.
1155 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1157 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1158 (AArch64_howto): New struct.
1159 (aarch64_howto[]): New static const array.
1160 (AArch64_relocate_functions): New class.
1161 (Target_aarch64::Scan::get_reference_flags): Remove method.
1162 (Target_aarch64::Scan::local): Implement to support a few relocations.
1163 (Target_aarch64::Scan::global): Implement to support a few relocations.
1164 (Target_aarch64::make_plt_section): Implement contents.
1165 (Target_aarch64::make_plt_entry): Implement contents.
1166 (Target_aarch64::do_finalize_sections): Implement contents.
1167 (Target_aarch64::Relocate::relocate): Implement a few relocations.
1168 (Target_aarch64::relocate_section): Implement contents.
1170 2014-08-06 Alan Modra <amodra@gmail.com>
1172 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1174 2014-08-06 Alan Modra <amodra@gmail.com>
1177 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1179 2014-07-21 Sriraman Tallam <tmsriram@google.com>
1181 * object.cc (Relobj::is_section_name_included): Add
1182 ".rodata.nptl_version" to not garbage collect this section.
1184 2014-07-08 Cary Coutant <ccoutant@google.com>
1186 * expression.cc (struct Expression::Expression_eval_info): Add
1187 new fields type_pointer, vis_pointer, and nonvis_pointer.
1188 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1189 nonvis_pointer parameters. Adjust all calls.
1190 (Symbol_expression::value): Update type, visibility, and nonvis bits
1192 * script.cc (Symbol_assignment::sized_finalize): Update type,
1193 visibility, and remaining st_other bits for new symbol.
1194 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1195 vis_pointer, and nonvis_pointer parameters.
1196 * symtab.h (Symbol::set_type): New method.
1198 * testsuite/Makefile.am (defsym_test): New test.
1199 * testsuite/Makefile.in: Regenerate.
1200 * testsuite/defsym_test.c: New file.
1201 * testsuite/defsym_test.sh: New file.
1203 2014-07-08 Cary Coutant <ccoutant@google.com>
1206 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1207 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1208 (Sized_dynobj::base_read_symbols): ...new method.
1209 * object.h (Sized_relobj_file::base_read_symbols): New method.
1210 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1211 (Sized_relobj_file::base_read_symbols): ...new method.
1212 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1213 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1214 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1216 2014-07-04 Alan Modra <amodra@gmail.com>
1218 * po/POTFILES.in: Regenerate.
1220 2014-07-02 Jing Yu <jingyu@google.com>
1222 * aarch64.cc: New file
1223 * Makefile.am (TARGETSOURCES): Add aarch64.cc
1224 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1225 * Makefile.in: Regenerate.
1226 * configure.tgt: Add entries for aarch64*.
1227 * configure.ac: Likewise.
1228 * configure: Likewise.
1230 2014-06-27 Alan Modra <amodra@gmail.com>
1232 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1234 2014-06-24 Cary Coutant <ccoutant@google.com>
1236 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1238 (Dwo_file::sized_read_unit_index): Likewise.
1240 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1242 * mips.cc: New file.
1243 * Makefile.am (TARGETSOURCES): Add mips.cc
1244 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1245 * configure.tgt: Add entries for mips*.
1246 * configure.ac: Likewise.
1247 * Makefile.in: Regenerate.
1248 * configure: Likewise.
1250 2014-06-09 Cary Coutant <ccoutant@google.com>
1252 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1253 unit_length is within section bounds.
1255 2014-06-09 Cary Coutant <ccoutant@google.com>
1258 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1261 2014-06-07 Alan Modra <amodra@gmail.com>
1263 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1265 2014-06-06 Cary Coutant <ccoutant@google.com>
1267 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1268 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1269 (Dwarf_pubnames_table::read_header): Likewise.
1270 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1271 .debug_gnu_pubtypes.
1273 2014-06-05 Joel Brobecker <brobecker@adacore.com>
1275 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1276 * Makefile.in, configure: Regenerate.
1278 2014-06-03 Alan Modra <amodra@gmail.com>
1280 * powerpc.cc (addis_12_2): Define.
1281 (Stub_table::do_write): Support fusion on ELFv2 stubs.
1283 2014-06-03 Alan Modra <amodra@gmail.com>
1285 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1288 2014-06-02 Alan Modra <amodra@gmail.com>
1290 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1291 Only ignore relocs on ELFv1.
1292 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1294 2014-05-30 Cary Coutant <ccoutant@google.com>
1296 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1297 * testsuite/Makefile.in: Regenerate.
1298 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1300 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
1303 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1304 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
1306 2014-05-15 Alan Modra <amodra@gmail.com>
1308 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1309 Compare FDE contents with DW_CFA_nop rather than 0.
1311 2014-05-13 Sriraman Tallam <tmsriram@google.com>
1313 * symtab.h (may_need_copy_reloc): Remove check for position independent
1315 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1316 position independence before pc absolute may_need_copy_reloc call.
1317 Add check for executable output befor pc relative may_need_copy_reloc
1323 * powerpc.cc: Add check for no position independence before
1324 may_need_copy_reloc calls.
1325 * testsuite/pie_copyrelocs_test.cc: New file.
1326 * testsuite/pie_copyrelocs_shared_test.cc: New file.
1327 * Makefile.am (pie_copyrelocs_test): New test.
1328 * Makefile.in: Regenerate.
1330 2014-05-08 Martin Liška <mliska@suse.cz>
1332 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1334 2014-05-06 Cary Coutant <ccoutant@google.com>
1337 * i386.cc (Output_data_got_plt_i386): New class.
1338 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1339 parameter. Change all callers.
1340 (Output_data_plt_i386::layout_): Remove.
1341 (Output_data_plt_i386::got_plt_): Change type.
1342 (Target_i386::got_plt_): Change type. Change all references.
1343 (Target_i386::got_section): Create instance of new class.
1344 (Output_data_got_plt_i386::do_write): New function.
1345 * x86_64.cc (Output_data_got_plt_x86_64): New class.
1346 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1347 parameter. Change all callers.
1348 (Output_data_plt_x86_64::layout_): Remove.
1349 (Output_data_plt_x86_64::got_plt_): Change type.
1350 (Target_x86_64::got_plt_): Change type. Change all references.
1351 (Target_x86_64::got_section): Create instance of new class.
1352 (Output_data_got_plt_x86_64::do_write): New function.
1353 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1354 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1357 2014-05-05 Cary Coutant <ccoutant@google.com>
1359 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1360 if we have pubnames/pubtypes.
1362 2014-05-02 Cary Coutant <ccoutant@google.com>
1364 * defstd.cc (in_segment): Define __ehdr_start here...
1365 * layout.cc (Layout::finalize): ...Instead of here. Set the
1366 output segment when known.
1367 * resolve.cc (Symbol::override_base_with_special): Remember
1368 the original binding.
1369 * symtab.cc (Symbol::set_output_segment): New function.
1370 (Symbol::set_undefined): New function.
1371 * symtab.h (Symbol::is_weak_undefined): Check original undef
1373 (Symbol::is_strong_undefined): New function.
1374 (Symbol::set_output_segment): New function.
1375 (Symbol::set_undefined): New function.
1376 * target-reloc.h (is_strong_undefined): Remove.
1377 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1378 Check for hidden undefs.
1379 (relocate_section): Call Symbol::is_strong_undefined.
1381 * testsuite/Makefile.am (ehdr_start_test_1)
1382 (ehdr_start_test_2, ehdr_start_test_3)
1383 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1384 * testsuite/Makefile.in: Regenerate.
1385 * testsuite/ehdr_start_def.cc: New source file.
1386 * testsuite/ehdr_start_test.cc: New source file.
1387 * testsuite/ehdr_start_test.t: New linker script.
1388 * testsuite/ehdr_start_test_4.sh: New shell script.
1390 2014-04-23 Cary Coutant <ccoutant@google.com>
1393 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1395 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1397 * layout.cc (Layout::include_section): Allow a target to decide
1398 whether to include a section.
1399 * target.h (Target::should_include_section): New function.
1400 (Target::do_should_include_section): New function.
1402 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1404 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1406 (Copy_relocs::emit): ... here.
1407 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1408 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1409 (Copy_reloc_entry::entries_): Change from private to protected.
1411 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1413 * icf.cc (get_section_contents): Replace copies of reloc
1414 vectors with const references.
1416 2014-04-02 Cary Coutant <ccoutant@google.com>
1418 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1419 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1420 * configure: Regenerate.
1421 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1422 -fno-use-linker-plugin.
1423 (LINK1, CXXLINK1): Add it to the link command.
1424 * testsuite/Makefile.in: Regenerate.
1426 2014-03-12 Alan Modra <amodra@gmail.com>
1428 * Makefile.in: Regenerate.
1430 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1432 * symtab.h (Symbol::set_nonvis): New function.
1434 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1436 * symtab.cc (Sized_symbol<32>::init_output_data):
1437 Instantiate the template.
1438 (Sized_symbol<64>::init_output_data): Likewise.
1440 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1442 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1443 adjust dynamic symbol value.
1444 * target.h (Target::adjust_dyn_symbol): New function.
1445 (Target::do_adjust_dyn_symbol): New function.
1447 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1449 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1450 Get the value of DYNAMIC_CUSTOM dynamic entry.
1451 * output.h (Output_data_dynamic::add_custom): New function.
1452 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1454 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1455 * target.h (Target::dynamic_tag_custom_value): New function.
1456 (Target::do_dynamic_tag_custom_value): New function.
1458 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1460 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1462 * target.h (Target::has_custom_set_dynsym_indexes): New function.
1463 (Target::do_has_custom_set_dynsym_indexes): New function.
1464 (Target::set_dynsym_indexes): New function.
1465 (Target::do_set_dynsym_indexes): New function.
1467 2014-03-07 Alan Modra <amodra@gmail.com>
1469 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1470 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1471 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1472 (Powerpc_relocate_functions::has_overflow_bitfield,
1473 overflowed): Use the above.
1474 (Target_powerpc::Relocate::relocate): Correct overflow checking
1475 for a number of relocations. Modify overflow test for 16-bit
1476 fields in instructions to signed/unsigned according to whether
1477 the field takes a signed or unsigned value.
1479 2014-03-05 Alan Modra <amodra@gmail.com>
1481 Update copyright years.
1483 2014-03-05 Alan Modra <amodra@gmail.com>
1485 * powerpc.cc (Target_powerpc::Scan::local, global): Support
1486 R_PPC64_ADDR64_LOCAL.
1487 (Target_powerpc::Relocate::relocate): Likewise.
1489 2014-03-03 Alan Modra <amodra@gmail.com>
1491 * dwp.cc (print_version): Update copyright year to current.
1493 2014-02-10 Alan Modra <amodra@gmail.com>
1495 * po/gold.pot: Regenerate.
1497 2014-02-06 Cary Coutant <ccoutant@google.com>
1499 Fix problem where -u is ignored when a weak undef is seen.
1501 * archive.cc (Library_base::should_include_member): Reorder
1502 code to check for -u option if a weak undef has already been seen.
1503 * testsuite/Makefile.am (weak_undef_test_2): New test case.
1504 * testsuite/Makefile.in: Regenerate.
1505 * testsuite/weak_undef_file3.cc: New file.
1506 * testsuite/weak_undef_file4.cc: New file.
1507 * testsuite/weak_undef_test_2.cc: New file.
1509 2014-02-05 Cary Coutant <ccoutant@google.com>
1511 Fix issues with gold undefined symbol diagnostics.
1514 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1516 * target-reloc.h (is_strong_undefined): New function.
1517 (relocate_section): Move undef vtable symbol check from here.
1518 Check for is_strong_undefined.
1520 2014-02-05 Cary Coutant <ccoutant@google.com>
1522 Fix problems with the --dynamic-list option.
1525 * options.cc (General_options::parse_dynamic_list):
1526 Set have_dynamic_list_.
1527 (General_options::General_options): Initialize have_dynamic_list_.
1528 (General_options::finalize): Turn off -Bsymbolic and
1529 -Bsymbolic-functions if --dynamic-list provided.
1530 * options.h (General_options::have_dynamic_list): New function.
1531 (General_options::have_dynamic_list_): New data member.
1532 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1536 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1537 in --dynamic-list, mark it.
1539 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1540 (dynamic_list_2): New test case.
1541 * testsuite/Makefile.in: Regenerate.
1542 * testsuite/dynamic_list_2.cc: New file.
1543 * testsuite/dynamic_list_2.t: New file.
1544 * testsuite/dynamic_list_lib1.cc: New file.
1545 * testsuite/dynamic_list_lib2.cc: New file.
1546 * testsuite/gc_dynamic_list_test.c: New file.
1547 * testsuite/gc_dynamic_list_test.sh: New file.
1548 * testsuite/gc_dynamic_list_test.t: New file.
1550 2014-01-28 Cary Coutant <ccoutant@google.com>
1552 Add .gdb_index version 7 support.
1554 * gold/dwarf_reader.cc: include <utility> (for make_pair).
1555 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1557 (Dwarf_ranges_table::read_ranges_table): Likewise.
1558 (Dwarf_pubnames_table::read_section): Check for GNU-style
1559 sections, and for compressed debug sections.
1560 (Dwarf_pubnames_table::read_header): Compute end address of table.
1561 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
1562 for end of list by offset, not by offset == 0.
1563 (Dwarf_info_reader::do_read_string_table): Check for compressed
1565 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1566 Initialize new data members.
1567 (Dwarf_pubnames_table::next_name): return flag_byte.
1568 (Dwarf_pubnames_table::end_of_table_): New data member.
1569 (Dwarf_pubnames_table::is_gnu_style_): New data member.
1570 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1571 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1572 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1573 read skeleton type unit DIEs.
1574 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1575 (Gdb_index::do_write): Write flag_byte.
1576 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1577 (Gdb_index::Cu_vector): Store flags along with cu indexes.
1578 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1579 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1581 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
1583 * version.cc (print_version): Update copyright year to 2014.
1585 2013-12-19 Dimitry Andric <dimitry@andric.com>
1587 * stringpool.cc (Stringpool_template::reserve): Add
1588 HAVE_UNORDERED_MAP case.
1589 * stringpool.cc (Stringpool_template::print_stats): Likewise.
1591 2013-12-18 Cary Coutant <ccoutant@google.com>
1593 * configure.ac: Check for <unordered_set> and <unordered_map>.
1594 * config.in: Regenerate.
1595 * configure: Regenerate.
1596 * system.h: Use <unordered_set> and <unordered_map> if available.
1598 2013-12-10 Roland McGrath <mcgrathr@google.com>
1600 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1601 with $(INSTALL_PROGRAM_ENV).
1602 * Makefile.in: Regenerate.
1604 2013-11-22 Cary Coutant <ccoutant@google.com>
1606 * configure.ac: Add check for which library is needed for
1608 * configure: Regenerate.
1610 2013-11-22 Cary Coutant <ccoutant@google.com>
1612 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1614 * testsuite/Makefile.in: Regenerate.
1616 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
1618 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1619 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1620 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1621 (Target_x86_64<size>::Scan::local): Likewise.
1622 (Target_x86_64<size>::Scan::global): Likewise.
1623 (Target_x86_64<size>::Relocate::relocate): Likewise.
1624 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1626 (Target_x86_64<size>::Scan::check_non_pic(): Handle
1629 * testsuite/Makefile.am (check_PROGRAMS): Add
1630 exception_x86_64_bnd_test.
1631 (exception_x86_64_bnd_test_SOURCES): New macro.
1632 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1633 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1634 (exception_x86_64_bnd_test_LDADD): Likewise.
1635 (exception_x86_64_bnd_1.o): New rule.
1636 (exception_x86_64_bnd_2.o): Likewise.
1637 * testsuite/Makefile.in: Regenerated.
1639 2013-11-15 Alan Modra <amodra@gmail.com>
1641 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1643 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1644 Only call ppc64_local_entry_offset for 64-bit. Restrict
1645 symval_for_branch lookup to ELFv1.
1646 (Stub_table::add_plt_call_entry): Use unsigned int off.
1647 (Output_data_glink::Address, invalid_address): New.
1648 (Output_data_glink::add_eh_frame): Move out of line. Add
1650 (Output_data_glink::add_global_entry, find_global_entry,
1651 global_entry_address): New functions.
1652 (Output_data_glink::global_entry_stubs_, end_branch_table_,
1653 ge_size): New variables.
1654 (Output_data_glink::set_final_data_size): Add global entry
1656 (Output_data_glink::do_write): Write global entry stubs.
1657 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1658 parameter. Return true for ELFv2. Adjust callers.
1659 (Target_powerpc::Scan::local, global): Restrict opd lookup to
1660 ELFv1. Similarly for ifunc and dynamic relocation processing
1661 specific to ELFv1. Recognize that symbols are defined on
1662 their plt entries for ELFv2.
1663 (Target_powerpc::symval_for_branch): Assert if called for
1665 (Target_powerpc::Relocate::relocate): Use global entry plt
1666 stub for symbol value if such exists on ELFv2.
1667 (Target_powerpc::Relocate::relocate): Don't call
1668 symval_for_branch when ELFv2. Do adjust for local entry
1670 (Target_powerpc::do_dynsym_value): Set symbols to global entry
1672 (Target_powerpc::do_plt_address_for_global): Similarly.
1674 2013-11-14 Cary Coutant <ccoutant@google.com>
1676 Revert patch -- this did not fix the problem, and there is
1679 2013-11-14 Cary Coutant <ccoutant@google.com>
1682 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1683 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1684 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1685 updating fde_offsets_.
1686 (Eh_frame_hdr::lock_): New data member.
1688 2013-11-14 Cary Coutant <ccoutant@google.com>
1690 * dwp.cc (Dwo_file_entry): New type.
1691 (File_list): Use Dwo_file_entry.
1692 (Dwo_file::verify): New function.
1693 (Dwo_file::verify_dwo_list): New function.
1694 (Dwo_file::sized_verify_dwo_list): New function.
1695 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1697 (Dwp_options): New enum type.
1698 (dwp_options): Add --verify-only.
1701 * dwp.h (gold_info): Add declaration.
1703 2013-11-14 Cary Coutant <ccoutant@google.com>
1706 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1707 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1708 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1709 updating fde_offsets_.
1710 (Eh_frame_hdr::lock_): New data member.
1712 2013-11-06 Cary Coutant <ccoutant@google.com>
1715 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1716 before reloc sections.
1718 2013-11-04 Alan Modra <amodra@gmail.com>
1720 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1721 (Symbol::needs_dynamic_reloc): Test new flag.
1722 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1723 (Target_powerpc::Scan::get_reference_flags): Add target param.
1724 Return FUNC_DESC_ABI for 64-bit ELFv1.
1725 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1727 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1728 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1730 2013-10-31 Cary Coutant <ccoutant@google.com>
1732 Restore support for dwp v2 DWARF package file format.
1734 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1735 tu_length parameter. Adjust all callers.
1736 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1737 * dwp.cc: Include dwarf.h.
1738 (Section_bounds): New struct type.
1739 (Unit_set): New struct type.
1740 (Dwo_file::Dwo_file): Initialize new data member.
1741 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1742 Combine and rename to...
1743 (Dwo_file::read_unit_index): ...this.
1744 (Dwo_file::sized_read_compunit_index)
1745 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1746 (Dwo_file::sized_read_unit_index): ...this.
1747 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1748 parameters; add section_id parameter.
1749 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1750 (Dwo_file::add_unit_set): ...this.
1751 (Dwo_file::shndx_map_): Remove.
1752 (Dwo_file::sect_offsets_): New data member.
1753 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1754 (Dwp_output_file::add_section): Rename to...
1755 (Dwp_output_file::add_contribution): ...this.
1756 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1757 (Dwp_output_file::add_tu_set): Likewise.
1758 (Dwp_output_file::Contribution): New type.
1759 (Dwp_output_file::Section::contributions): New data member.
1760 (Dwp_output_file::Cu_or_tu_set): Remove.
1761 (Dwp_output_file::Section::Section): New ctor.
1762 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1763 (Dwp_output_file::Dwp_index::Section_table): New type.
1764 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1765 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1767 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1768 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1769 (Dwp_output_file::Dwp_index::section_table): New member function.
1770 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1771 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1772 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1773 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1774 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1775 (Dwp_output_file::Dwp_index::section_table_): New data member.
1776 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1777 (Dwp_output_file::add_output_section): New member function.
1778 (Dwp_output_file::write_new_section): New member function.
1779 (Dwp_output_file::write_contributions): New member function.
1780 (Dwp_output_file::section_id_map_): New data member.
1781 (class Dwo_id_info_reader): Remove.
1782 (class Unit_reader): New class.
1783 (get_dwarf_section_name): New function.
1784 (Dwo_file::read_executable): Adjust initializations of class data.
1785 (Dwo_file::read): Add support for v2 package file format.
1786 (Dwo_file::read_unit_index): Likewise.
1787 (Dwo_file::sized_read_unit_index): Likewise.
1788 (Dwo_file::copy_section): Likewise.
1789 (Dwo_file::add_unit_set): Likewise.
1790 (Dwp_output_file::add_output_section): Likewise.
1791 (Dwp_output_file::add_contribution): Likewise.
1792 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1794 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1796 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1798 (Dwp_output_file::initialize): Remove unused function.
1799 (Dwp_output_file::finalize): Add support for v2 package file format.
1800 (Dwp_output_file::write_index): Likewise.
1801 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1804 2013-10-31 Cary Coutant <ccoutant@google.com>
1806 * configure.ac: Fix check for -fmerge-constants.
1807 * configure.ac: Regenerate.
1809 2013-10-30 Roland McGrath <mcgrathr@google.com>
1811 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1812 Correct 9-byte nop sequence to match what the assembler generates.
1814 2013-10-30 Alan Modra <amodra@gmail.com>
1816 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1817 ppc64_local_entry_offset, ppc64_local_entry_offset,
1818 do_read_symbols): New functions.
1819 (Powerpc_relobj::e_flags_, st_other_): New vars.
1820 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1821 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1822 (Powerpc_relobj::e_flags_): New var.
1823 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1824 and adjust for ELFv2.
1825 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1826 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1827 (Powerpc_dynobj::do_find_special_sections): Likewise.
1828 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1829 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1830 to ELFv2 local entry.
1831 (Target_powerpc::do_relax): No thread safe barriers needed for
1833 (Output_data_plt_powerpc::initial_plt_entry_size_,
1834 plt_entry_size): Delete. Replace all uses with
1835 first_plt_entry_offset() and plt_entry_size().
1836 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1837 reserved_size parm. Update callers.
1838 (Output_data_plt_powerpc::entry_count): Update.
1839 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1840 and use Target_powerpc::first_plt_entry_offset().
1841 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1842 rename to plt_entry_size.
1843 (Output_data_plt_powerpc::add_ifunc_entry,
1844 add_local_ifunc_entry): Adjust reloc for ELFv2.
1845 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1846 (glink_eh_frame_fde_64v2): New.
1847 (Stub_table::plt_call_size): Support ELFv2 sizing.
1848 (Output_data_glink::add_eh_frame): Use the new FDE.
1849 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1850 (Stub_table::do_write): Write ELFv2 stubs and glink.
1851 (Target_powerpc::Relocate::relocate): Replaces nop after call
1852 with ld 2,24(1) and adjust local offset destination for ELFv2.
1854 2013-10-30 Alan Modra <amodra@gmail.com>
1856 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1857 (Target_powerpc::Scan::global, local): Likewise.
1858 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
1859 on all ppc64 @h and @ha relocs.
1861 2013-10-14 Alan Modra <amodra@gmail.com>
1863 * output.h (Output_data_got::add_constant): Tidy.
1864 (Output_data_got::add_constant_pair): New function.
1865 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1866 methods used so as to first call reserve_ent().
1868 2013-10-11 Roland McGrath <mcgrathr@google.com>
1870 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1871 add_got_entry and add_got_entry_pair.
1873 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1874 (HAVE_PUBNAMES): Likewise.
1875 * configure: Regenerate.
1877 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1878 * testsuite/Makefile.in: Regenerate.
1880 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1881 Remove const from declaration.
1882 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1883 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1884 * output.h (Output_file_header): Remove const from member target_
1885 and corresponding constructor argument.
1886 * output.cc (Output_file_header::Output_file_header): Update prototype.
1887 (Output_file_header::do_sized_write): Use this->target_ in place
1888 of parameters()->target().
1890 * testsuite/undef_symbol.cc (Foo::get_a): New method.
1892 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1893 * configure: Regenerate.
1894 * Makefile.in: Regenerate.
1895 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1896 * testsuite/merge_string_literals_2.c: Likewise.
1897 * testsuite/Makefile.am
1898 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1899 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1900 literal -fmerge-constants.
1901 * testsuite/Makefile.in: Regenerate.
1903 * i386.cc (Target_i386): Remove unused member dynbss_.
1904 * arm.cc (Target_arm): Likewise.
1905 * powerpc.cc (Target_powerpc): Likewise.
1906 * sparc.cc (Target_sparc): Likewise.
1907 * tilegx.cc (Target_tilegx): Likewise.
1908 * x86_64.cc (Target_x86_64): Likewise.
1909 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1910 type_signature_, type_offset_.
1911 * plugin.h (Plugin_hook): Remove unused member layout_.
1912 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1914 (Read_member): Remove unused members input_objects_, symtab_,
1916 (Check_library): Remove unused member symtab_.
1917 * archive.h (Lib_group): Remove unused member lib_.
1918 * archive.cc (Lib_group::Lib_group): Update initializer.
1919 * incremental.h (Incremental_binary): Remove unused member target_.
1920 (Incremental_script_entry): Removed unused member script_.
1921 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1922 * icf.h (Icf): Remove unused member num_tracked_relocs.
1924 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1925 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1927 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1929 * archive.h: Use struct rather than class for forward declaration
1930 of Read_symbols_data.
1932 2013-10-07 Cary Coutant <ccoutant@google.com>
1935 * testsuite/Makefile.am (icf_test): Fix dependencies.
1936 (icf_safe_test): Likewise.
1937 (icf_safe_so_test): Likewise.
1938 (large_symbol_alignment): Add empty _LDADD rule.
1939 * testsuite/Makefile.in: Regenerate.
1941 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
1944 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1945 relocation for R_X86_64_32 on x32.
1947 2013-08-27 Roland McGrath <mcgrathr@google.com>
1949 * output.cc (Output_segment::set_section_addresses): Take new
1950 Target* argument. If target->isolate_execinstr() and the segment
1951 is executable and starts at a target->abi_pagesize() boundary,
1952 pad its end out to a target->abi_pagesize() boundary with code fill.
1953 * output.h (Output_segment::set_section_addresses): Update decl.
1954 * layout.h (Layout::check_output_data_for_reset_values): Take new
1955 argument RELAX_OUTPUTS.
1956 (Layout): New member relax_output_list_.
1957 (Layout::add_relax_output): New method.
1958 * layout.cc (Layout::Layout): Update constructor.
1959 (Layout::reset_relax_output): New method.
1960 (Layout::clean_up_after_relaxation): Call it.
1961 (Layout::prepare_for_relaxation): Update caller.
1962 (Layout::set_segment_offsets): Update callers of set_section_addresses.
1963 Call reset_relax_output before re-processing segments for
1964 isolate_execinstr case.
1965 (Layout::write_data): Handle relax_output_list_.
1966 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1967 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1969 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1972 * object.h: Fix typos.
1974 2013-08-16 Roland McGrath <mcgrathr@google.com>
1976 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1977 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1979 2013-08-07 Cary Coutant <ccoutant@google.com>
1981 Revert support for v2 DWP files:
1983 2013-03-01 Cary Coutant <ccoutant@google.com>
1985 Add dwp support for v2 DWARF package file format.
1986 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1987 tu_length parameter. Adjust all callers.
1988 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1989 * dwp.cc: Include dwarf.h.
1990 (Section_bounds): New struct type.
1991 (Unit_set): New struct type.
1992 (Dwo_file::Dwo_file): Initialize new data member.
1993 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1994 Combine and rename to...
1995 (Dwo_file::read_unit_index): ...this.
1996 (Dwo_file::sized_read_compunit_index)
1997 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1998 (Dwo_file::sized_read_unit_index): ...this.
1999 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2000 parameters; add section_id parameter.
2001 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2002 (Dwo_file::add_unit_set): ...this.
2003 (Dwo_file::shndx_map_): Remove.
2004 (Dwo_file::sect_offsets_): New data member.
2005 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2006 (Dwp_output_file::add_section): Rename to...
2007 (Dwp_output_file::add_contribution): ...this.
2008 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2009 (Dwp_output_file::add_tu_set): Likewise.
2010 (Dwp_output_file::Contribution): New type.
2011 (Dwp_output_file::Section::contributions): New data member.
2012 (Dwp_output_file::Cu_or_tu_set): Remove.
2013 (Dwp_output_file::Section::Section): New ctor.
2014 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2015 (Dwp_output_file::Dwp_index::Section_table): New type.
2016 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2017 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2019 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2020 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2021 (Dwp_output_file::Dwp_index::section_table): New member function.
2022 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2023 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2024 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2025 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2026 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2027 (Dwp_output_file::Dwp_index::section_table_): New data member.
2028 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2029 (Dwp_output_file::add_output_section): New member function.
2030 (Dwp_output_file::write_new_section): New member function.
2031 (Dwp_output_file::write_contributions): New member function.
2032 (Dwp_output_file::section_id_map_): New data member.
2033 (class Dwo_id_info_reader): Remove.
2034 (class Unit_reader): New class.
2035 (get_dwarf_section_name): New function.
2036 (Dwo_file::read_executable): Adjust initializations of class data.
2037 (Dwo_file::read): Add support for v2 package file format.
2038 (Dwo_file::read_unit_index): Likewise.
2039 (Dwo_file::sized_read_unit_index): Likewise.
2040 (Dwo_file::copy_section): Likewise.
2041 (Dwo_file::add_unit_set): Likewise.
2042 (Dwp_output_file::add_output_section): Likewise.
2043 (Dwp_output_file::add_contribution): Likewise.
2044 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2046 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2048 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2050 (Dwp_output_file::initialize): Remove unused function.
2051 (Dwp_output_file::finalize): Add support for v2 package file format.
2052 (Dwp_output_file::write_index): Likewise.
2053 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2056 2013-07-31 Cary Coutant <ccoutant@google.com>
2058 * object.cc (Sized_relobj::do_output_section_address): New function.
2059 (Sized_relobj): Instantiate explicitly.
2060 * object.h (Object::output_section_address): New function.
2061 (Object::do_output_section_address): New function.
2062 (Sized_relobj::do_output_section_address): New function.
2063 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2065 2013-07-30 Cary Coutant <ccoutant@google.com>
2066 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2068 * parameters.cc (Parameters::entry): Return target-specific entry
2070 * target.h (Target::entry_symbol_name): New function.
2071 (Target_info::entry_symbol_name): New data member.
2073 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2074 * i386.cc (Target_i386::i386_info): Likewise.
2075 (Target_i386_nacl::i386_nacl_info): Likewise.
2076 * sparc.cc (Target_sparc::sparc_info): Likewise.
2077 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2078 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2079 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2080 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2082 2013-07-22 Sterling Augustine <saugustine@google.com>
2084 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2085 Convert parameter shndx to local variable. Add parameters symtab
2086 and symtab_size. Scan over section names. Find relocation
2087 section corresponding to current section. Create and initialize
2088 reloc_mapper_ and reloc_type_.
2089 (Dwarf_pubnames_table::read_header): Add assertion. Change
2090 unit_length to off_t. Initialize member unit_length_. Fill in field
2092 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2093 Initialize new fields unit_length_ and cu_offset_.
2094 (Dwarf_pubnames_table::read_section): Update prototype.
2095 (Dwarf_pubnames_table::cu_offset): New member function.
2096 (Dwarf_pubnames_table::subsection_size): Likewise.
2097 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2099 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2100 member functions public.
2101 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2102 Update comment. Rework logic. Move repeated parts to...
2103 (Gdb_index_info_reader::read_pubtable): ...here. New function.
2104 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2105 pubtypes_table_, and stmt_list_offset.
2106 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2107 Gdb_index::find_pubtype_offset,
2108 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2109 (Gdb_index::pubnames_read): Update prototype and rework logic.
2110 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2112 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2113 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2114 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2115 Gdb_index::map_pubtable_to_dies):
2117 (Gdb_index::pubnames_read): Update declaration.
2118 (Gdb_index::Pubname_offset_map): New type.
2119 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2120 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2121 Gdb_index::stmt_list_offset): Declare.
2122 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2123 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2124 Gdb_index::pubtypes_offset_): Remove.
2126 2013-07-19 Roland McGrath <mcgrathr@google.com>
2128 * options.h (General_options): Add -Trodata-segment option.
2129 * parameters.cc (Parameters::check_rodata_segment): New function.
2130 (Parameters::set_target_once): Call it.
2131 * parameters.h (Parameters): Declare it (private member function).
2132 * layout.cc (load_seg_unusable_for_headers): New function, broken
2133 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
2134 then validate rodata segment rather than text segment.
2135 (relaxation_loop_body): Call that.
2136 (is_text_segment): New function. Don't admit a non-executable
2137 segment if TARGET->isolate_execinstr().
2138 (set_segment_offsets): Call it. Honor -Trodata-segment option.
2140 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
2143 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2144 * nacl.h (Sniff_file::View::View): Request aligned view.
2146 2013-07-11 Cary Coutant <ccoutant@google.com>
2148 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2149 correct BRLT entry size.
2151 2013-07-03 Alan Modra <amodra@gmail.com>
2153 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2156 2013-07-01 Cary Coutant <ccoutant@google.com>
2158 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2160 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2161 (Dwarf_ranges_table::lookup_reloc): New function.
2162 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2164 (Dwarf_ranges_table::lookup_reloc): New function.
2165 (Dwarf_ranges_table::reloc_type_): New data member.
2167 2013-06-27 Jing Yu <jingyu@google.com>
2170 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2172 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2173 (Target_powerpc::do_relax): Call the above.
2175 2013-06-27 Cary Coutant <ccoutant@google.com>
2177 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2178 on garbage collected .opd section.
2180 2013-06-27 Alan Modra <amodra@gmail.com>
2182 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2184 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2185 (Target_powerpc::do_function_location): Likewise for loc->shndx.
2187 2013-06-14 Cary Coutant <ccoutant@google.com>
2189 * resolve.cc (Symbol::override_base): Don't override st_type
2190 from plugin placeholder symbols.
2191 (Symbol_table::resolve): Likewise.
2192 (Symbol_table::should_override): Don't complain about TLS mismatch
2193 if the TO symbol is a plugin placeholder.
2194 * testsuite/Makefile.am (plugin_test_tls): New test.
2195 * testsuite/Makefile.in: Regenerate.
2196 * testsuite/plugin_test_tls.sh: New test script.
2197 * testsuite/two_file_test_2_tls.cc: New test source.
2198 * testsuite/two_file_test_tls.cc: New test source.
2200 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
2202 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2203 the maximum segment alignment is larger than the page size.
2204 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2205 correctly aligns the symbols with large alignemnt.
2206 * testsuite/Makefile.in: Regenerate.
2207 * testsuite/large_symbol_alignment.cc: New file.
2209 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
2210 Sriraman Tallam <tmsriram@google.com>
2212 * options.h (sort_section): New option.
2213 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2214 Rename from Input_section_sort_section_name_special_ordering_compare.
2215 (Input_section_sort_section_name_compare): New struct.
2216 * output.cc (Output_section::Input_section_sort_section_name_compare::
2217 operator()): New function.
2218 (Output_section::sort_attached_input_sections): Use new sort function
2219 for .text if --sort-section=name is specified.
2220 * layout.cc (Layout::make_output_section):
2221 Add sorting by name when --sort-section=name is specified.
2222 * testsuite/Makefile.am (text_section_grouping): Test option
2223 --sort-section=name.
2224 * testsuite/Makefile.in: Regenerate.
2225 * testsuite/section_sorting_name.cc: New file.
2226 * testsuite/section_sorting_name.sh: New file.
2228 2013-05-21 Cary Coutant <ccoutant@google.com>
2230 * symtab.h (Symbol::is_cxx_vtable): New function.
2231 * target-reloc.h (relocate_section): Check for vtable symbol.
2232 * testsuite/Makefile.am (missing_key_func.sh): New test case.
2233 * testsuite/Makefile.in: Regenerate.
2234 * testsuite/missing_key_func.cc: New test source.
2235 * testsuite/missing_key_func.sh: New test script.
2237 2013-05-21 Cary Coutant <ccoutant@google.com>
2239 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2240 type of enclosing symbol.
2241 (Relocate_info::location): Check symbol type when describing symbol.
2242 * object.h (Symbol_location_info): Remove unused line_number;
2243 add enclosing_symbol_type.
2244 * testsuite/debug_msg.sh: Adjust expected output.
2246 2013-05-13 Cary Coutant <ccoutant@google.com>
2248 * configure.ac: Export DEFAULT_TARGET.
2249 * configure: Regenerate.
2250 * Makefile.in: Regenerate.
2251 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2252 * testsuite/Makefile.in: Regenerate.
2253 * testsuite/debug_msg.sh: Delete duplicate tests.
2254 Don't check undef_int error message match for powerpc where the
2255 source file and line number aren't available.
2257 2013-05-10 Roland McGrath <mcgrathr@google.com>
2259 * options.h (General_options): Add --rosegment-gap option.
2260 * options.cc (finalize): --rosegment-gap implies --rosegment.
2261 * layout.cc (set_segment_offsets): Let user option override
2262 target->rosegment_gap().
2264 2013-05-10 Roland McGrath <mcgrathr@google.com>
2266 * options.h (General_options): Remove leading space from help
2267 messages for -nostdlib and --rosegment.
2269 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
2272 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2274 2013-05-03 Alan Modra <amodra@gmail.com>
2276 * merge.cc (Output_merge_string::do_add_input_section): Correct
2277 scan for number of strings. Rename vars to avoid shadowing.
2278 Include missing terminator in input_size_.
2280 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
2282 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2283 Restore empty string handling.
2285 2013-05-01 Cary Coutant <ccoutant@google.com>
2287 * stringpool.cc (Stringpool_template::new_key_offset): Fix
2288 uninitialized warning.
2290 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
2292 * output.cc (Output_section::add_merge_input_section): Allow
2293 to merge sections if the alignment is more than character size.
2294 * merge.h (Output_merge_string::Output_merge_string): Remove
2296 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2297 only not-null strings. Check the alignment of strings.
2299 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2300 alignment as the argument.
2301 (Stringpool_template<Stringpool_char>::addralign_): New class member.
2302 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2303 Align non-zero length strings according to the addralign_.
2304 (Stringpool_template<Stringpool_char>::set_string_offsets):
2305 Updating offsets according to the given alignment.
2306 * testsuite/Makefile.am (text_section_grouping): Test if string
2307 literals are getting merged.
2308 * testsuite/Makefile.in: Regenerate.
2309 * testsuite/merge_string_literals_1.c: New file.
2310 * testsuite/merge_string_literals_2.c: Ditto.
2311 * testsuite/merge_string_literals.sh: Ditto.
2313 2013-04-26 Ian Lance Taylor <iant@google.com>
2315 * target-reloc.h (relocate_section): If the reloc offset is out of
2316 range, pass VIEW as NULL to relocate.relocate.
2317 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2318 * i386.cc (Target_i386::Relocate::relocate): Likewise.
2319 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2320 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2321 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2322 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2324 2013-04-26 Geoff Pike <gpike@chromium.org>
2326 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2327 * layout.cc (Hash_task): New class.
2328 (Layout::queue_build_id_tasks): New function.
2329 (Layout::write_build_id): Handle single-thread portion of build ID
2330 computation. (In some cases, all of it is single-threaded.) Replace
2331 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2332 functionality in fewer lines of code.
2333 * layout.h (Layout::queue_build_id_tasks): New function declaration.
2334 * options.h (General_options): make "--build-id" default to tree
2335 rather than sha1. Add two new options related to --build-id=tree:
2336 --build-id-chunk-size-for-treehash and
2337 --build-id-min-file-size-for-treehash.
2338 * Makefile.am: add testing of --build-id=tree and related new options
2339 (these tests will be invoked by "make check").
2340 * Makefile.in: Regenerate.
2342 2013-04-25 Alan Modra <amodra@gmail.com>
2344 * configure.tgt: Add powerpcle and powerpc64le.
2346 2013-04-22 Alan Modra <amodra@gmail.com>
2349 * layout.cc (Layout::segment_precedes): Allow more than one
2350 segment with the same type and flags.
2352 2013-04-15 Cary Coutant <ccoutant@google.com>
2354 * layout.cc (Layout::set_relocatable_section_offsets): Don't
2355 allocate space in file for BSS sections.
2357 2013-04-15 Cary Coutant <ccoutant@google.com>
2359 * script-sections.cc (Orphan_output_section): Reset address
2360 to zero after each orphaned section for relocatable links.
2362 2013-04-15 Cary Coutant <ccoutant@google.com>
2364 * symtab.cc (Symbol_table::sized_write_globals): Subtract
2365 section starting address for relocatable link.
2366 * testsuite/Makefile.am (script_test_11): New test.
2367 * testsuite/Makefile.in: Regenerate.
2368 * testsuite/script_test_11.c: New source file.
2369 * testsuite/script_test_11.t: New linker script.
2371 2013-04-13 Alan Modra <amodra@gmail.com>
2373 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2374 owner when sections are not adjacent and exceed group size.
2375 (Target_powerpc::group_sections): Handle corner case.
2376 (Target_powerpc::Branch_info::make_stub): Handle case where
2377 stub table doesn't exist due to branches in non-exec sections.
2378 (Target_powerpc::Relocate::relocate): Likewise.
2380 2013-04-11 Alan Modra <amodra@gmail.com>
2383 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2384 .branch_lt to match bfd ld. Adjust comments throughout file.
2386 2013-04-04 Ian Lance Taylor <iant@google.com>
2389 * object.cc (do_layout_deferred_sections): Handle .eh_frame
2390 sections before checking whether they are included in the link.
2392 2013-03-29 Sriraman Tallam <tmsriram@google.com>
2394 * archive.cc (Archive::get_elf_object_for_member): Create the elf
2395 object before calling the plugin claim_file handler. Pass the elf
2396 object of the archive to the plugin. Delete the elf object if the
2397 plugin claims the file.
2399 2013-03-21 Alan Modra <amodra@gmail.com>
2401 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2402 segment when omagic.
2404 2013-03-21 Alan Modra <amodra@gmail.com>
2406 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2408 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2409 uninitialized" warning.
2411 2013-03-20 Alan Modra <amodra@gmail.com>
2413 * symtab.h (Symbol::clear_version): New function.
2414 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2415 is_needed by weak references. Clear version for symbols defined
2416 in as-needed objects that are not needed.
2418 2013-03-15 Alan Modra <amodra@gmail.com>
2420 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2421 static and public. Add report_err param. Return false for data refs.
2422 (Target_powerpc::rela_dyn_section): New overloaded function.
2423 (Target_powerpc::plt_, iplt_): Elucidate.
2424 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2425 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2426 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2427 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2428 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2429 push_branch and make_plt_entry for ifunc syms when
2430 reloc_needs_plt_for_ifunc.
2431 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2432 for ifunc unless reloc_needs_plt_for_ifunc.
2434 2013-03-15 Alan Modra <amodra@gmail.com>
2436 * gc.h (gc_process_relocs): Don't look through function descriptors.
2437 * icf.cc (get_section_contents): Do so here instead.
2439 2013-03-13 Alan Modra <amodra@gmail.com>
2441 * powerpc.cc (is_branch_reloc): Forward declare.
2442 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2443 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2444 false for 64-bit, true for 32-bit non-branch relocs.
2445 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2446 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2448 (icf_safe_test): Generate linker map file as well as nm output.
2449 (icf_safe_so_test): Likewise.
2450 * testsuite/Makefile.in: Regenerate.
2451 * testsuite/icf_test.sh: Parse linker map file to determine
2453 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2454 * testsuite/icf_safe_so_test.sh: Likewise.
2455 (X86_32_or_ARM_specific_safe_fold): Merge into..
2456 (arch_specific_safe_fold): ..this.
2457 (X86_64_specific_safe_fold): Delete unused function.
2459 2013-03-12 Alan Modra <amodra@gmail.com>
2461 * gc.h (gc_process_relocs): Look through function descriptors
2462 to determine shndx, symvalue and addend used by ICF. Tidy
2463 variable duplication.
2465 2013-03-11 Alan Modra <amodra@gmail.com>
2467 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2468 * layout.cc (Layout_task_runner::run): ..to here.
2469 * symtab.h (struct Symbol_location): Extract from..
2470 (class Symbol_table): ..here.
2471 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2472 * target.h (class Target): Add function_location and
2473 do_function_location functions.
2474 (class Sized_target): Add do_function_location.
2475 * object.h (class Sized_relobj_file): Move find_shdr..
2476 (class Object): ..to here.
2477 * object.cc: Likewise. Update to suit. Instantiate.
2478 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2479 * powerpc.cc (class Powerpc_dynobj): New.
2480 (Target_powerpc::do_function_location): New function.
2481 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2482 (Powerpc_dynobj::do_read_symbols): New function.
2483 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2485 2013-03-08 Ian Lance Taylor <iant@google.com>
2487 * options.cc (General_options::string_to_object_format): Accept
2490 2013-03-08 Alan Modra <amodra@gmail.com>
2492 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2493 pointer to Post_fde.
2494 (struct Post_fde): Move definition to here..
2495 * ehframe.cc (struct Post_fde): ..from here.
2496 (Cie::write): Don't alloc Post_fde.
2497 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2499 2013-03-07 Alan Modra <amodra@gmail.com>
2501 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2502 relocation referencing .LC0.
2503 * testsuite/discard_locals_test.sh: Remove FIXMEs.
2505 2013-03-07 Alan Modra <amodra@gmail.com>
2507 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2508 always_inline. Add assembly for powerpc to avoid GOT.
2510 2013-03-07 Alan Modra <amodra@gmail.com>
2512 * testsuite/script_test_10.sh: Don't test .bss section
2515 2013-03-06 Alan Modra <amodra@gmail.com>
2517 * powerpc.cc (class Powerpc_relobj): Move some member functions.
2518 (Target_powerpc::symval_for_branch): Add symtab param. Update
2519 all callers. Handle folded sections.
2520 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2522 (Global_symbol_visitor_opd::operator()): Likewise.
2524 2013-03-04 Alan Modra <amodra@gmail.com>
2526 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2527 * testsuite/Makefile.in: Regenerate.
2529 2013-03-01 Cary Coutant <ccoutant@google.com>
2531 Add dwp support for v2 DWARF package file format.
2532 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2533 tu_length parameter. Adjust all callers.
2534 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2535 * dwp.cc: Include dwarf.h.
2536 (Section_bounds): New struct type.
2537 (Unit_set): New struct type.
2538 (Dwo_file::Dwo_file): Initialize new data member.
2539 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2540 Combine and rename to...
2541 (Dwo_file::read_unit_index): ...this.
2542 (Dwo_file::sized_read_compunit_index)
2543 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2544 (Dwo_file::sized_read_unit_index): ...this.
2545 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2546 parameters; add section_id parameter.
2547 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2548 (Dwo_file::add_unit_set): ...this.
2549 (Dwo_file::shndx_map_): Remove.
2550 (Dwo_file::sect_offsets_): New data member.
2551 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2552 (Dwp_output_file::add_section): Rename to...
2553 (Dwp_output_file::add_contribution): ...this.
2554 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2555 (Dwp_output_file::add_tu_set): Likewise.
2556 (Dwp_output_file::Contribution): New type.
2557 (Dwp_output_file::Section::contributions): New data member.
2558 (Dwp_output_file::Cu_or_tu_set): Remove.
2559 (Dwp_output_file::Section::Section): New ctor.
2560 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2561 (Dwp_output_file::Dwp_index::Section_table): New type.
2562 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2563 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2565 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2566 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2567 (Dwp_output_file::Dwp_index::section_table): New member function.
2568 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2569 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2570 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2571 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2572 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2573 (Dwp_output_file::Dwp_index::section_table_): New data member.
2574 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2575 (Dwp_output_file::add_output_section): New member function.
2576 (Dwp_output_file::write_new_section): New member function.
2577 (Dwp_output_file::write_contributions): New member function.
2578 (Dwp_output_file::section_id_map_): New data member.
2579 (class Dwo_id_info_reader): Remove.
2580 (class Unit_reader): New class.
2581 (get_dwarf_section_name): New function.
2582 (Dwo_file::read_executable): Adjust initializations of class data.
2583 (Dwo_file::read): Add support for v2 package file format.
2584 (Dwo_file::read_unit_index): Likewise.
2585 (Dwo_file::sized_read_unit_index): Likewise.
2586 (Dwo_file::copy_section): Likewise.
2587 (Dwo_file::add_unit_set): Likewise.
2588 (Dwp_output_file::add_output_section): Likewise.
2589 (Dwp_output_file::add_contribution): Likewise.
2590 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2592 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2594 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2596 (Dwp_output_file::initialize): Remove unused function.
2597 (Dwp_output_file::finalize): Add support for v2 package file format.
2598 (Dwp_output_file::write_index): Likewise.
2599 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2602 2013-03-01 Cary Coutant <ccoutant@google.com>
2604 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2605 function into class definition in header file.
2606 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2607 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2609 (Dwarf_info_reader::check_buffer): Move here from .cc file.
2611 2013-02-28 Alan Modra <amodra@gmail.com>
2613 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2614 * target.cc (Target::do_plt_fde_location): New function.
2615 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2616 accessor function, and constructor param.
2617 (struct Post_fde, Post_fdes): Declare.
2618 (Cie::write): Add post_fdes param.
2619 * ehframe.cc (Fde::write): Use plt_fde_location.
2620 (struct Post_fde): Define.
2621 (Cie::write): Stash FDEs added post merge mapping.
2622 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2623 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
2624 (Eh_frame::do_sized_write): Arrange to write post map FDES after
2626 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2627 (Target_powerpc::has_glink): New function.
2628 (Target_powerpc::do_relax): Add eh_frame info for stubs.
2629 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2630 glink_eh_frame_fde_32, default_fde): New data.
2631 (Stub_table::eh_frame_added_): New var.
2632 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2634 (Stub_table::add_eh_frame): New function.
2635 (Output_data_glink::add_eh_frame): New function.
2636 (Target_powerpc::make_glink_section): Call add_eh_frame.
2638 2013-02-15 Ian Lance Taylor <iant@google.com>
2640 * options.h (DEFINE_uint64_alias): Define.
2641 (class General_options): Add -Ttext-segment as an alias for
2644 2013-02-15 Alan Modra <amodra@gmail.com>
2646 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2647 (Stub_table::do_write): ..here, two places.
2648 (Stub_table::plt_call_size): Use it here too.
2650 2013-02-11 Ian Lance Taylor <iant@google.com>
2652 * descriptors.cc (Descriptors::close_all): New function.
2653 * descriptors.h (class Descriptors): Declare close_all.
2654 (close_all_descriptors): New inline function.
2655 * plugin.cc: Include "descriptors.h".
2656 (Plugin_manager::cleanup): Call close_all_descriptors.
2658 2013-02-06 Alan Modra <amodra@gmail.com>
2660 * README: Update coding style link.
2662 2013-01-28 Cary Coutant <ccoutant@google.com>
2664 * dwp.cc (File_list): New typedef.
2665 (Dwo_name_info_reader): New class.
2666 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2667 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2668 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2669 (Dwo_file::read_executable): New function.
2670 (Dwo_file::read): Move common setup code to ...
2671 (Dwo_file::make_object): ... here.
2672 (dwp_options): Add --exec/-e.
2676 2013-01-24 Sriraman Tallam <tmsriram@google.com>
2678 * layout.cc (Layout::layout): Check for option text_reorder.
2679 (Layout::make_output_section): Ditto.
2680 * options.h (text_reorder): New option.
2681 * output.cc (Input_section_sort_compare): Remove special ordering
2684 Input_section_sort_section_name_special_ordering_compare::
2685 operator()): New function.
2686 (Output_section::sort_attached_input_sections): Use new sort function
2688 * output.h (Input_section_sort_section_name_special_ordering_compare):
2690 * testsuite/Makefile.am (text_section_grouping): Test option
2692 * testsuite/Makefile.in: Regenerate.
2693 * testsuite/text_section_grouping.sh: Check order of functions without
2694 default text reordering.
2696 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2698 * options.h (General_options): Change default to true for new_dtags.
2700 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2702 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2703 when enable_new_dtags is false. Only add DT_RUNPATH when
2704 enable_new_dtags is true.
2706 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
2708 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2709 used in declaration and definition consistent.
2710 (Target_powerpc::symval_for_branch): Ditto.
2712 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2714 * testsuite/plugin_final_layout.cc: Fix comment.
2716 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2718 * layout.cc (Layout::layout): Do not do default sorting for
2719 text sections when section ordering is specified.
2720 (make_output_section): Ditto.
2721 * testsuite/plugin_final_layout.cc: Name the function sections
2722 to catch reordering issues.
2724 2013-01-15 Alan Modra <amodra@gmail.com>
2726 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2729 2013-01-15 Alan Modra <amodra@gmail.com>
2731 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2732 * testsuite/Makefile.in: Regenerate.
2734 2013-01-14 Alan Modra <amodra@gmail.com>
2736 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2737 * testsuite/Makefile.in: Regenerate.
2739 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
2742 Fix mingw gold build with plugins enabled
2743 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2744 * configure.ac: Export DLOPEN_LIBS and add headers check.
2745 * plugin.cc: Handle non-dlfcn case.
2746 * Makefile.in: Regenerate.
2747 * config.in: Regenerate.
2748 * configure: Regenerate.
2749 * testsuite/Makefile.in: Regenerate.
2751 2013-01-09 Sriraman Tallam <tmsriram@google.com>
2753 * output.h (sort_attached_input_sections): Change to be public.
2754 * script-sections.cc
2755 (Output_section_definition::set_section_addresses): Sort
2756 attached input sections according to section order before linker
2757 script assigns section addresses.
2758 (Orphan_output_section::set_section_addresses): Sort
2759 attached input sections according to section order before linker
2760 script assigns section addresses.
2761 * Makefile.am (final_layout.sh): Use a simple linker script to
2762 check if section ordering still works.
2763 * Makefile.in: Regenerate.
2765 2013-01-09 Ben Cheng <bccheng@google.com>
2767 * arm.cc (Target_arm::attributes_accept_div): New function.
2768 (Target_arm::attributes_forbid_div): New function.
2769 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2770 attribute using the same new functions as what bfd/elf32_arm.c
2773 2013-01-07 Cary Coutant <ccoutant@google.com>
2776 * output.cc (Output_section::add_input_section): For incremental
2777 updates, don't track input sections that are allocated from patch
2780 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2781 Ian Lance Taylor <iant@google.com>
2784 * configure.ac (--enable-ld): Removed.
2785 (install_as_default): Set to yes only for --enable-gold=default
2787 * configure: Regenerated.
2789 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2791 * options.h (General_options): Add -fuse-ld= for GCC linker
2792 option compatibility.
2794 2013-01-04 Cary Coutant <ccoutant@google.com>
2796 * configure.ac: Fix typo restoring CXXFLAGS.
2797 * configure: Regenerate.
2799 2013-01-04 Cary Coutant <ccoutant@google.com>
2801 * testsuite/Makefile.am (CXXLINK_S): New macro.
2802 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2803 * testsuite/Makefile.in: Regenerate.
2805 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
2807 * version.cc (print_version): Update copyright year to 2013.
2809 2012-12-20 Ian Lance Taylor <iant@google.com>
2811 * layout.cc (Layout::special_ordering_of_input_section): New
2813 (Layout::layout): If input section requires special ordering, must
2814 sort input sections.
2815 (Layout::make_output_section): May sort .text input sections.
2816 (Layout::is_section_name_prefix_grouped): Remove.
2817 * layout.h (class Layout): Declare
2818 special_ordering_of_input_section. Don't declare
2819 is_section_name_prefix_grouped.
2820 * output.cc (Output_section::add_input_section): Revert last
2822 (Output_section::Input_section_sort::match_file_name): Don't crash
2823 if called on output section data.
2824 (Output_section::Input_section_sort_compare): Sort based on
2826 (Output_section::Input_section_sort_section_order_index_compare):
2828 (Output_section::sort_attached_input_sections): Likewise.
2830 2012-12-18 Sriraman Tallam <tmsriram@google.com>
2832 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2833 * layout.h (Layout::is_section_name_prefix_grouped): New function.
2834 * output.cc (Output_section::add_input_section): Check if section
2835 name contains special prefix. Keep input sections to sort such
2837 (Output_section::Input_section_sort_section_order_index_compare
2838 ::operator()): Group sections according to prefixes.
2839 (Output_section::sort_attached_input_sections): Add condition to
2840 Input_section_entry constructor call.
2841 * testsuite/Makefile.am (text_section_grouping): New test.
2842 * testsuite/Makefile.in: Regenerate.
2843 * testsuite/text_section_grouping.cc: New file.
2844 * testsuite/text_section_grouping.sh: New file.
2846 2012-12-17 Nick Clifton <nickc@redhat.com>
2848 * Makefile.am: Add copyright notice.
2851 * configure.ac: Likewise.
2852 * ftruncate.c: Likewise.
2853 * Makefile.in: Regenerate.
2855 2012-12-14 Cary Coutant <ccoutant@google.com>
2857 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2858 --no-as-needed flag.
2859 (exception_separate_shared_12_test): Likewise.
2860 (incremental_copy_test): Likewise.
2861 * testsuite/Makefile.in: Regenerate.
2863 2012-12-14 Cary Coutant <ccoutant@google.com>
2865 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2866 (Dwp_output_file::Dwp_index::enter_set): Add assert.
2868 2012-12-12 Alan Modra <amodra@gmail.com>
2870 * powerpc.cc (class Track_tls): New.
2871 (class Relocate, class Scan): Inherit Track_tls.
2872 (Target_powerpc::Scan::local, global): Track tls optimization
2873 and avoid creating plt entry for __tls_get_addr if all uses
2875 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2877 2012-12-12 Alan Modra <amodra@gmail.com>
2879 * options.h (General_options): Add --toc-sort/--no-toc-sort.
2880 Replace no_toc_optimize with toc_optimize.
2881 * output.h (Output_section::input_sections): Provide non-const variant.
2882 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2883 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2885 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2886 (class Sort_toc_sections): New.
2887 (Target_powerpc::do_finalize_sections): Sort toc sections.
2888 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2890 2012-12-10 Roland McGrath <mcgrathr@google.com>
2892 * testsuite/binary_unittest.cc (read_all): New function.
2893 (Sized_binary_test): Use it instead of ::read.
2894 * fileread.cc (do_read): Don't assume pread always reads the whole
2895 amount in a single call.
2897 2012-12-10 Alan Modra <amodra@gmail.com>
2899 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2900 Set EM_PPC64 or EM_PPC here.
2901 (Target_selector_powerpc::do_recognize): Delete.
2903 2012-12-10 Alan Modra <amodra@gmail.com>
2905 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2907 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2909 2012-12-07 Roland McGrath <mcgrathr@google.com>
2911 * testsuite/binary_unittest.cc (Sized_binary_test):
2912 Use open_descriptor rather than ::open.
2914 2012-12-07 Alan Modra <amodra@gmail.com>
2916 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2917 typedef and invalid_address constant.
2918 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2919 instantiate constants.
2921 2012-12-06 Roland McGrath <mcgrathr@google.com>
2923 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2924 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2925 * aclocal.m4: Regenerate.
2926 * configure: Regenerate.
2927 * Makefile.in: Regenerate.
2928 * testsuite/Makefile.in: Regenerate.
2930 2012-12-07 Alan Modra <amodra@gmail.com>
2932 * options.h (General_options): Add no_toc_optimize.
2933 * powerpc.cc (ok_lo_toc_insn): New function.
2934 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2936 2012-12-06 Alan Modra <amodra@gmail.com>
2938 * options.h (General_options): Add plt_align, plt_static_chain,
2939 plt_thread_safe. Update stub_group_size help text.
2940 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2941 for new plt_thread_safe_ var.
2942 (use_plt_offset): Correct comments.
2943 (Target_powerpc::do_relax): Look for thread creation symbols to
2944 determine default plt_thread_safe value. Clear plt call stubs
2945 as well as branch stubs each iteration.
2946 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2948 (l, hi, ha, write_insn): Move earlier.
2949 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2950 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2952 (Stub_table::update_size): Adjust.
2953 (Stub_table::prev_size, set_prev_size): Delete.
2954 (Stub_table::stub_align): Let --plt-align affect result.
2955 (Stub_table::plt_call_size): Calculate sizes for various stubs.
2956 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2957 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2958 (Stub_table::do_write): Support more stub variants.
2960 2012-12-04 Alan Modra <amodra@gmail.com>
2962 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2963 (Target_powerpc::do_define_standard_symbols): New function.
2965 2012-12-03 Alan Modra <amodra@gmail.com>
2967 * output.h: Formatting, whitespace.
2969 2012-12-03 Alan Modra <amodra@gmail.com>
2971 * layout.h (Layout::get_executable_sections): Declare.
2972 * layout.cc (Layout::get_executable_sections): New function.
2973 * arm.cc (Target_arm::group_sections): Use it.
2974 (Arm_output_section::group_sections): Delete now redundant test.
2975 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2976 param to handle relative relocs.
2977 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2978 (Output_data_reloc::add_absolute): Adjust.
2979 (Output_data_reloc::add_relative): New function.
2980 (Output_data::reset_data_size): New function.
2981 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2982 (Output_section::set_addralign): New function.
2983 (Output_section::checkpoint_set_addralign): New function.
2984 (Output_section::clear_section_offsets_need_adjustment): New function.
2985 (Output_section::input_sections): Make public.
2986 * powerpc.cc (class Output_data_brlt_powerpc): New.
2987 (class Stub_table, class Stub_control): New.
2988 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2989 stub_table_, set_stub_table, stub_table): New vectors and accessor
2991 (Target_powerpc::do_may_relax, do_relax, push_branch,
2992 new_stub_table, stub_tables, brlt_section, group_sections,
2993 add_branch_lookup_table, find_branch_lookup_table,
2994 write_branch_lookup_table, make_brlt_section): New functions.
2995 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2996 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2997 branch_info_): New vars.
2998 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2999 make call stubs here.
3000 (Output_data_glink): Remove all call stub handling from this class.
3001 (Target_powerpc::Scan::local, global): Save interesting branch
3002 relocs and relocs for ifunc. Adjust calls to plt entry functions.
3003 (Target_powerpc::do_finalize_sections): Only make reg save/restore
3004 functions on final link.
3005 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3006 Handle long branch destinations too.
3007 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3008 do_plt_address_for_local): Adjust lookup of plt call stubs.
3010 2012-11-30 Alan Modra <amodra@gmail.com>
3012 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3013 relocs against protected symbols when building 32-bit shared libs.
3015 2012-11-30 Alan Modra <amodra@gmail.com>
3017 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3018 param. Call got_section() to make .got. Update all callers
3019 and their callers and so on.
3021 2012-11-30 Alan Modra <amodra@gmail.com>
3023 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3024 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3025 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3026 value if it already exists.
3028 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
3031 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3033 2012-11-14 Roland McGrath <mcgrathr@google.com>
3035 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3036 than bfc instruction for data sandboxing.
3038 2012-11-08 Alan Modra <amodra@gmail.com>
3040 * po/POTFILES.in: Regenerate.
3042 2012-11-05 Alan Modra <amodra@gmail.com>
3044 * configure.ac: Apply 2012-09-10 change to config.in here.
3045 * configure: Regenerate.
3047 2012-11-05 Alan Modra <amodra@gmail.com>
3049 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3050 (struct Opd_ent): Use "Address" rather than "Offset".
3051 (Output_data_got_powerpc::got_base_offset): Return Valtype.
3052 (Target_powerpc::got_section): Make public.
3053 (Target_powerpc::scan_relocs): Move code setting symbols..
3054 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3055 Create _SDA_BASE_ only when referenced.
3057 2012-11-02 Roland McGrath <mcgrathr@google.com>
3059 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3062 2012-11-01 Roland McGrath <mcgrathr@google.com>
3064 * target.h (Sized_target::relocate_relocs): Use Elf_Off
3065 for offset_in_output_section parameter.
3066 (Sized_target::relocate_special_relocatable): Likewise.
3067 * arm.cc (Target_arm::relocate_relocs): Likewise.
3068 (Target_arm::relocate_special_relocatable): Likewise.
3069 * i386.cc (Target_i386::relocate_relocs): Likewise.
3070 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3071 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3072 * target-reloc.h (relocate_relocs): Likewise.
3073 * testsuite/testfile.cc (Target_test): Likewise.
3074 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3075 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3077 * system.h: Move inclusion of <clocale> to after <libintl.h> in
3078 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3080 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3081 parameter, which is unused in the [!F_SETFD] case.
3083 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3084 SYMNDX to off_t before comparing it to this->data_size().
3085 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3086 * incremental.cc (Output_section_incremental_inputs::do_write):
3087 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3089 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3091 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
3093 * gold.cc (Target_arm::do_adjust_elf_header): Add the
3094 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3097 2012-10-29 Cary Coutant <ccoutant@google.com>
3099 * dwp.cc (usage): Add file and exit status parameters;
3100 add --help and --version options.
3101 (print_version): New function.
3102 (main): Add --help and --version options.
3104 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3106 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3107 final_layout_sequence.txt.
3108 * testsuite/Makefile.in: Regenerated.
3110 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3112 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3113 COMPILE generated by automake.
3115 (CXXCOMPILE1): Likewise.
3116 (CXXLINK1): Likewise.
3117 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3119 (CXXCOMPILE): Likewise.
3120 (CXXLINK): Likewise.
3121 * testsuite/Makefile.in: Regenerated.
3123 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3125 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3126 on bad fwrite return.
3128 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3130 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3133 2012-10-23 Cary Coutant <ccoutant@google.com>
3135 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3136 * testsuite/Makefile.in: Regenerate.
3137 * testsuite/dwp_test.h: New source file.
3138 * testsuite/dwp_test_1.cc: New source file.
3139 * testsuite/dwp_test_1.s: New source file.
3140 * testsuite/dwp_test_1.sh: New source file.
3141 * testsuite/dwp_test_1b.cc: New source file.
3142 * testsuite/dwp_test_1b.s: New source file.
3143 * testsuite/dwp_test_2.cc: New source file.
3144 * testsuite/dwp_test_2.s: New source file.
3145 * testsuite/dwp_test_2.sh: New source file.
3146 * testsuite/dwp_test_main.cc: New source file.
3147 * testsuite/dwp_test_main.s: New source file.
3149 2012-10-23 Cary Coutant <ccoutant@google.com>
3151 * dwp.h: New header file.
3152 * dwp.cc: New source file.
3153 * gold.h: Move shared declarations to system.h.
3154 * system.h: New header file.
3155 * Makefile.am: Add dwp.
3156 * Makefile.in: Regenerate.
3158 2012-10-23 Cary Coutant <ccoutant@google.com>
3160 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3161 Dwarf_info_reader::read_from_pointer.
3162 (Dwarf_pubnames_table::read_header): Likewise.
3163 (Dwarf_pubnames_table::next_name): Likewise.
3164 (Dwarf_die::read_attributes): Likewise.
3165 (Dwarf_die::skip_attributes): Likewise.
3166 (Dwarf_info_reader::read_from_pointer): New function template.
3167 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3168 (Dwarf_pubnames_table): Likewise.
3169 (Dwarf_info_reader::read_from_pointer): New function template.
3170 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3171 Dwarf_pubnames_table ctor.
3173 2012-10-23 Cary Coutant <ccoutant@google.com>
3175 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3177 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3179 (Dwarf_info_reader::set_abbrev_shndx): New method.
3180 (Dwarf_info_reader::abbrev_shndx_): New data member.
3182 2012-10-23 Cary Coutant <ccoutant@google.com>
3184 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3185 from object, not parameters.
3186 (Dwarf_info_reader::parse): Likewise.
3187 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3188 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3189 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3192 2012-10-23 Cary Coutant <ccoutant@google.com>
3194 * fileread.cc (Input_file::Input_file): New constructor.
3195 * fileread.h (class Input_file): Add new constructor.
3197 2012-10-18 Alan Modra <amodra@gmail.com>
3200 * object.cc (Relobj::is_section_name_included): Also match
3201 .sdata personality section.
3203 2012-10-18 Alan Modra <amodra@gmail.com>
3205 * target-reloc.h (class Default_comdat_behavior): New, package up..
3206 (get_comdat_behaviour): ..this.
3207 (relocate_section): Add Relocate_comdat_behavior template arg,
3208 adjust code to suit.
3209 * arm.cc (Target_arm::relocate_section): Adjust to suit.
3210 (Target_arm::scan_reloc_section): Likewise.
3211 * i386.cc (Target_i386::relocate_section): Likewise.
3212 * sparc.cc (Target_sparc::relocate_section): Likewise.
3213 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3214 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3215 * powerpc.cc (class Relocate_comdat_behavior): New.
3216 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
3217 gold::relocate_section with new template arg.
3219 2012-10-18 Alan Modra <amodra@gmail.com>
3221 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3222 dynamic relocs for GOT_TPREL got entries, without symbol if
3224 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3225 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3226 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3228 2012-10-17 Alan Modra <amodra@gmail.com>
3231 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3233 2012-10-16 Sriraman Tallam <tmsriram@google.com>
3235 * layout.cc (Layout::include_section): Keep sections marked
3236 SHF_EXCLUDE when doing relocatable links.
3238 2012-10-16 Alan Modra <amodra@gmail.com>
3240 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3241 (Target_powerpc::do_finalize_sections): Call it.
3242 (Output_data_save_res): New class and supporting functions.
3243 (Target_powerpc::symval_for_branch): Only look up .opd entry for
3244 normal symbols defined in object files.
3246 2012-10-12 Alan Modra <amodra@gmail.com>
3248 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3249 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
3250 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3251 section if scan_opd_relocs not yet called.
3252 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3254 2012-10-12 Alan Modra <amodra@gmail.com>
3256 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3257 add_local_ifunc_entry): Revert last change.
3258 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3260 2012-10-05 Alan Modra <amodra@gmail.com>
3262 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3263 do_plt_address_for_global): New functions.
3264 (Output_data_got_powerpc::do_write): Don't segfault when linking
3266 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3267 add_local_ifunc_entry): Return true on adding entry..
3268 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3269 glink->add_entry call. Remove unused symtab param. Adjust calls.
3270 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3271 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
3272 set up symbols here.
3273 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3274 syms here. Do so even when no .iplt. Don't segfault when linking
3276 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
3277 new variants without reloc param.
3278 (Glink_sym_ent::Glink_sym_ent): Likewise.
3279 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3280 reloc when refs will resolve to plt call stub.
3281 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
3282 R_PPC_PLTREL24 to resolve locally.
3283 (Target_powerpc::Scan::global): Correct ifunc handling.
3284 (Target_powerpc::Relocate::relocate): Correct local sym glink
3285 lookup. Don't destroy "value" when we have a plt call stub,
3286 and when checking plt call validity.
3287 (Target_powerpc::do_dynsym_value): Simplify.
3289 2012-10-05 Alan Modra <amodra@gmail.com>
3291 * i386.cc (Output_data_plt_i386::address_for_global,
3292 address_for_local): Add plt offset to returned value. Adjust uses.
3293 * sparc.cc (Output_data_plt_sparc::address_for_global,
3294 address_for_local): Likewise.
3295 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3296 address_for_local): Likewise.
3297 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3298 address_for_local): Likewise.
3299 * target.h (Target::plt_address_for_global, plt_address_for_local):
3301 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3302 (Output_data_got::Got_entry::write): Nor here.
3303 * output.h: Comment fix.
3305 2012-10-02 Jiong Wang <jiwang@tilera.com>
3307 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3308 global_offset_table_ value for larget got.
3309 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3311 2012-09-29 Alan Modra <amodra@gmail.com>
3313 * powerpc.cc (Target_powerpc::iplt_): New output section.
3314 (Target_powerpc::iplt_section, make_iplt_section,
3315 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3316 (Target_powerpc::make_plt_entry): Handle ifunc syms.
3317 Target_powerpc::plt_entry_count): Count iplt entries too.
3318 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3319 reloc section in constructor. New params.
3320 (Target_powerpc::make_plt_section): Create reloc section here instead.
3321 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3323 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3324 (Output_data_glink::add_entry, find_entry): New functions to
3325 deal with local syms.
3326 (Glink_sym_ent): Add support for local syms.
3327 (Output_data_glink::do_write): Handle ifunc plt entries.
3328 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3329 (Target_powerpc::Scan::local, global): Handle ifunc syms.
3330 (Target_powerpc::Relocate::relocate): Likewise.
3331 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3333 2012-09-25 Alan Modra <amodra@gmail.com>
3335 * object.h (Sized_relobj_file::adjust_local_symbol,
3336 do_adjust_local_symbol): New functions.
3337 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3338 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3339 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3340 and irregular opd entry spacing.
3341 (Powerpc_relobj::do_read_relocs): Add opd size checks.
3342 (Global_symbol_visitor_opd): New functor.
3343 (Target_powerpc::do_finalize_sections): Omit global symbols defined
3344 on deleted opd entries.
3346 2012-09-15 Jiong Wang <jiwang@tilera.com>
3348 * tilegx.cc: New file.
3349 * Makefile.am (TARGETSOURCES): Add tilegx.cc
3350 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3351 * configure.tgt: Add entries for tilegx*.
3352 * configure.ac: Likewise.
3353 * Makefile.in: Rebuild.
3354 * configure: Likewise.
3355 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3358 2012-09-13 Alan Modra <amodra@gmail.com>
3360 * target-reloc.h (scan_relocs): Call scan.local for relocs
3361 against symbols in discarded sections. Pass is_discarded
3363 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3364 Add is_discarded param.
3365 * powerpc (Target_powerpc::Scan::local): Likewise. Use
3366 is_discarded to flag opd entry as discarded. Don't emit dyn
3367 relocs on such entries.
3368 (Target_powerpc::Scan::global): Similarly detect and handle
3370 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3371 opd_ent_. Update all uses.
3372 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3373 (Target_powerpc::relocate_section): Zero out discarded opd
3376 2012-09-12 Ian Lance Taylor <iant@google.com>
3379 * output.cc: Rename Output_data_got template parameter from size
3380 to got_size for all functions. Compile all variants of
3382 (Output_data_got::Got_entry::write): Correct use of size for
3383 symbol value. Use local_is_tls rather than casting to
3385 * object.h (class Object): Add local_is_tls and do_local_is_tls.
3386 (class Sized_relobj_file): Add do_local_is_tls.
3387 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3389 2012-09-11 Alan Modra <amodra@gmail.com>
3392 * layout.cc (Layout::set_segment_offsets): When using
3393 common-page-size alignment, ensure we are on a new max-page-size
3395 * output.cc (Output_segment::set_section_addresses): Use
3396 abi_pagesize, not common_pagesize for relro boundary.
3397 (Output_segment::set_offset): Likewise.
3399 2012-09-11 Alan Modra <amodra@gmail.com>
3401 * output.h (Output_data_got::add_global_tls, add_local_tls,
3402 add_local_tls_pair): New functions.
3403 (Output_data_got::add_local_pair_with_rel): Remove second
3404 reloc param. Expand comment.
3405 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3406 use_plt_or_tls_offset_, similarly for constructor param.
3407 (Output_data_got::Got_entry::write): Add got_index param.
3408 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3409 add_local_tls_pair): New functions.
3410 (Output_data_got::Got_entry::write): Handle tls symbols
3411 with use_plt_or_tls_offset_ set specially.
3412 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3413 (Output_data_got::do_write): Replace iterator with index, pass
3414 index to entry write function.
3415 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3416 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3417 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3419 * i386.cc (Target_i386::Scan::local): Likewise.
3420 * sparc.cc (Target_sparc::Scan::local): Likewise.
3421 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3422 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3423 do_tls_offset_for_global): New functions.
3424 (Target_powerpc::Scan::local): Correct TLS relocations and got
3426 (Target_powerpc::Scan::global): Don't emit unnecessary
3427 dynamic relocations on TLS GOT entries.
3429 2012-09-10 Matthias Klose <doko@ubuntu.com>
3431 * config.in: Disable sanity check for kfreebsd.
3433 2012-09-10 Sterling Augustine <saugustine@google.com>
3435 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3436 (Gdb_index::pubtypes_read): New parameter.
3437 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3439 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3442 2012-09-09 Alan Modra <amodra@gmail.com>
3444 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3445 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3446 * gc.h (gc_process_relocs): Call target gc_add_reference.
3447 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3448 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3449 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3451 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3452 to cater for when we don't need code offset. Update use.
3453 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3454 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3455 set_opd_valid): New functions.
3456 (Target_powerpc::do_gc_add_reference): New function.
3457 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3459 (Target_powerpc::do_gc_mark_symbol): New function.
3461 2012-09-06 Cary Coutant <ccoutant@google.com>
3463 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3464 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3465 (Dwarf_die::skip_attributes): Likewise.
3466 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3467 * testsuite/gdb_index_test.cc (inline_func_1): New function.
3469 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3471 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
3473 * testsuite/script_test_3.t: Add .got.plt output section
3475 * testsuite/script_test_4.t: Likewise.
3477 2012-09-05 Alan Modra <amodra@gmail.com>
3479 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3480 update all uses and lose "enum" when using type.
3482 2012-09-05 Alan Modra <amodra@gmail.com>
3484 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3485 * configure: Regenerate.
3486 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3487 (plugin_final_layout.stdout): Likewise.
3488 (memory_test): Set page sizes to 0x1000.
3489 * testsuite/Makefile.in: Regenerate.
3490 * testsuite/discard_locals_test.sh: Add FIXME comment.
3491 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3492 * testsuite/pr14265.t: Add .got output section statement.
3493 * testsuite/script_test_2.t: Likewise.
3494 * testsuite/script_test_3.t: Likewise.
3495 * testsuite/script_test_4.t: Likewise.
3496 * testsuite/script_test_5.t: Likewise.
3497 * testsuite/script_test_6.t: Likewise.
3498 * testsuite/script_test_7.t: Likewise.
3499 * testsuite/script_test_9.t: Likewise.
3501 2012-09-05 Alan Modra <amodra@gmail.com>
3503 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3504 (Powerpc_relocate_functions::Status): New typedef.
3505 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3506 (Target_powerpc::Scan::local): Handle REL64.
3507 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3508 for REL32 and REL64.
3509 (Target_powerpc::symval_for_branch): New function, extracted from..
3510 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
3511 checks. Report overflow errors.
3513 2012-09-05 Alan Modra <amodra@gmail.com>
3515 * object.h (Sized_relobj_file::emit_relocs): Delete.
3516 (Sized_relobj_file::emit_relocs_reltype): Delete.
3517 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3518 relocate_relocs for --emit-relocs.
3519 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3520 * output.h: Update comment.
3521 (Output_segment::first_section): New function.
3522 (Output_segment::first_section_load_address): Use first_section.
3523 * output.cc (Output_segment::first_section): New function extracted..
3524 (Output_segment::first_section_load_address): ..from here. Delete.
3525 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3526 * target.h (Sized_target::relocate_for_relocatable): Likewise.
3527 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3528 adjust call to target.h function.
3529 * i386.cc (Target_i386): Likewise.
3530 * sparc.cc (Target_sparc): Likewise.
3531 * x86_64.cc (Target_x86_64): Likewise.
3532 * powerpc.cc (Target_powerpc): Likewise.
3533 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
3534 first tls section has section symbol for optimised local dynamic
3536 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3537 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3539 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3540 Rename to relocate_relocs. Update error message.
3542 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
3544 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3547 2012-08-31 Alan Modra <amodra@gmail.com>
3549 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3550 (Powerpc_relobj::toc_base_offset): New stub function.
3551 (Target_powerpc): Add tp_offset, dtp_offset. Rename
3552 got_mod_index_offset to tlsld_got_offset. Update all refs.
3553 (Target_powerpc::Relocate::enum skip_tls): New.
3554 (Target_powerpc::call_tls_get_addr_): New var.
3555 (Target_powerpc::is_branch_reloc): Move to file scope.
3556 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3557 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3559 (Target_powerpc::enum Got_type): Delete old values, add new ones.
3560 (powerpc_info): Correct common_pagesize for ppc64.
3561 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3562 (Powerpc_relocate_functions): Add overflow check enums and functions.
3563 Add non-shift version of rela, rela_ua. Delete all rel public
3564 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
3565 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3566 addr16_ha3, addr14 functions.
3567 (Output_data_got_powerpc::add_constant_pair): New function.
3568 (Output_data_got_powerpc::got_base_offset): Likewise.
3569 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3570 (instruction constants): Sort, add some more.
3571 (Output_data_glink::do_write): Add and use Address typedef. Use
3572 object->toc_base_offset() stub for 64-bit.
3573 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3574 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3575 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3576 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
3577 Always treat .opd relocs as against locally defined symbol.
3578 Correct condition for RELATIVE relocs.
3579 (Target_powerpc::do_finalize_sections): Test for NULL sections.
3580 (Target_powerpc::Relocate::relocate): Use plt call stub as value
3581 for 32-bit syms with a plt entry. Correct ppc64 toc base
3582 calculations. Handle TLS relocs, and more. Add overflow
3583 checking and adjust for Powerpc_relocate_functions changes.
3584 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3585 Reinstate --emit-relocs code with FIXME.
3587 2012-08-30 Alan Modra <amodra@gmail.com>
3589 * layout.cc (Layout::set_segment_offsets): Set p_align to
3590 abi_pagesize, not common_pagesize.
3591 (Layout::relaxation_loop_body): Similarly use abi_pagesize
3592 to determine whether file header can go in segment.
3594 2012-08-30 Alan Modra <amodra@gmail.com>
3596 * output.h (Output_reloc::Output_reloc <output section>): Add
3597 is_relative param. Adjust calls.
3598 (Output_reloc::add_output_section_relative): New functions.
3599 * output.cc (Output_reloc::Output_reloc <output section>): Handle
3601 (Output_reloc::symbol_value): Handle SECTION_CODE.
3603 2012-08-24 Sriraman Tallam <tmsriram@google.com>
3605 * gold.cc (queue_middle_tasks): Call layout again when unique
3606 segments for sections is desired.
3607 * layout.cc (Layout::Layout): Initialize new members.
3608 (Layout::get_output_section_flags): New function.
3609 (Layout::choose_output_section): Call get_output_section_flags.
3610 (Layout::layout): Make output section for mapping to a unique segment.
3611 (Layout::insert_section_segment_map): New function.
3612 (Layout::attach_allocated_section_to_segment): Make unique segment for
3613 output sections marked so.
3614 (Layout::segment_precedes): Check for unique segments when sorting.
3615 * layout.h (Layout::Unique_segment_info): New struct.
3616 (Layout::Section_segment_map): New typedef.
3617 (Layout::insert_section_segment_map): New function.
3618 (Layout::get_output_section_flags): New function.
3619 (Layout::is_unique_segment_for_sections_specified): New function.
3620 (Layout::set_unique_segment_for_sections_specified): New function.
3621 (Layout::unique_segment_for_sections_specified_): New member.
3622 (Layout::section_segment_map_): New member.
3623 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3624 Rename is_gc_pass_one to is_pass_one.
3625 Rename is_gc_pass_two to is_pass_two.
3626 Rename is_gc_or_icf to is_two_pass.
3627 Check for which pass based on whether symbols data is present.
3628 Make it two pass when unique segments for sections is desired.
3629 * output.cc (Output_section::Output_section): Initialize new
3631 * output.h (Output_section::is_unique_segment): New function.
3632 (Output_section::set_is_unique_segment): New function.
3633 (Output_section::is_unique_segment_): New member.
3634 (Output_section::extra_segment_flags): New function.
3635 (Output_section::set_extra_segment_flags): New function.
3636 (Output_section::extra_segment_flags_): New member.
3637 (Output_section::segment_alignment): New function.
3638 (Output_section::set_segment_alignment): New function.
3639 (Output_section::segment_alignment_): New member.
3640 (Output_segment::Output_segment): Initialize is_unique_segment_.
3641 (Output_segment::is_unique_segment): New function.
3642 (Output_segment::set_is_unique_segment): New function.
3643 (Output_segment::is_unique_segment_): New member.
3644 * plugin.cc (allow_unique_segment_for_sections): New function.
3645 (unique_segment_for_sections): New function.
3646 (Plugin::load): Add new functions to transfer vector.
3647 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3648 * Makefile.in: Regenerate.
3649 * testsuite/plugin_final_layout.sh: Check if unique segment
3650 functionality works.
3651 * testsuite/plugin_section_order.c (onload): Check if new interfaces
3653 (allow_unique_segment_for_sections): New global.
3654 (unique_segment_for_sections): New global.
3655 (claim_file_hook): Call allow_unique_segment_for_sections.
3656 (all_symbols_read_hook): Call unique_segment_for_sections.
3658 2012-08-22 Cary Coutant <ccoutant@google.com>
3660 * layout.cc (Layout::include_section): Don't assert on GROUP
3661 sections with --emit-relocs.
3663 2012-08-21 Cary Coutant <ccoutant@google.com>
3665 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3666 if --export-dynamic-symbol names an undef symbol.
3668 2012-08-18 Alan Modra <amodra@gmail.com>
3670 * powerpc.cc: Formatting and white space.
3671 (Powerpc_relobj): Rename got2_section_ to special_.
3672 Add opd_ent_shndx_ and opd_ent_off_ vectors.
3673 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3674 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3675 (Target_powerpc): Add Address typedef and invalid_address. Use
3677 (Target_powerpc::is_branch_reloc): New function.
3678 (Powerpc_relocate_functions): Add Address typedef, use throughout.
3679 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3680 for dst_mask, value and addend.
3681 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3682 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3683 (Output_data_glink::do_write): Correct toc base. Don't try to use
3684 uint16_t for 24-bit offset. Use get_output_section_offset and
3686 (Target_powerpc::Scan::local): Handle more relocs.
3687 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3688 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3689 Plug in toc restoring insn after plt calls. Translate branches
3690 to function descriptor symbols to corresponding entry point.
3691 (Target_powerpc::relocate_for_relocatable): Check return from
3692 get_output_section_offset.
3693 * symtab.h: Comment typo.
3695 2012-08-14 Ian Lance Taylor <iant@google.com>
3697 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3698 unsupported_relocal_local to call unsupported_reloc_global.
3700 2012-08-14 Nick Clifton <nickc@redhat.com>
3703 * script-sections.cc (Sections_element::output_section_name): Add
3704 keep return parameter.
3705 (Output_section_element::match_name): Add keep return parameter.
3706 Return the value of the keep_ member.
3707 * script-sections.h (class Output_section): Update
3708 output_section_name prototype.
3709 * layout.cc (Layout::keep_input_section): New public member
3711 (Layout::choose_output_section): Pass keep parameter to
3712 output_section_name.
3713 * layout.h (class Layout): Add keep_input_section.
3714 * object.cc (Sized_relobj_file::do_layout): Check for kept input
3716 * testsuite/Makefile.am: Add a test.
3717 * testsuite/Makefile.in: Regenerate.
3718 * testsuite/pr14265.c: Source file for the test.
3719 * testsuite/pr14265.t: Linker script for the test.
3720 * testsuite/pr14265.sh: Shell script for the test.
3722 2012-08-14 Alan Modra <amodra@gmail.com>
3724 * target.h (Target::output_section_name): New function.
3725 (Target::do_output_section_name): New function.
3726 * layout.cc (Layout::choose_output_section): Call the above.
3727 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3729 2012-08-14 Alan Modra <amodra@gmail.com>
3731 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3732 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3733 for replace_constant call.
3734 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3735 (Output_data_glink::do_print_to_mapfile): New function.
3736 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3737 (Target_powerpc::Relocate::relocate): Likewise.
3739 2012-08-14 Alan Modra <amodra@gmail.com>
3741 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3742 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3743 (Output_data_glink::add_entry,find_entry): Remove shndx param.
3744 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
3745 all references to shndx_. Handle special case for R_PPC_PLTREL24
3747 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3748 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3749 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3751 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3752 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3754 2012-08-12 Alan Modra <amodra@gmail.com>
3756 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
3757 (glink insn constants): Use uint32_t.
3758 (Output_data_glink::add_entry): Use insert, not [] operator.
3760 2012-08-11 Alan Modra <amodra@gmail.com>
3762 * object.h (Sized_relobj_file::find_shdr): New function.
3763 (Sized_relobj_file::find_special_sections): New function.
3764 * object.cc (Sized_relobj_file::find_shdr): New function.
3765 (Sized_relobj_file::find_eh_frame): Use find_shdr.
3766 (Sized_relobj_file::find_special_sections): New function, split out..
3767 (Sized_relobj_file::do_read_symbols): ..from here.
3768 * output.h (Output_data_got::replace_constant): New function.
3769 (Output_data_got::num_entries): New function.
3770 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3771 (Output_data_got::got_offset): Protected rather than private.
3772 (Output_data_got::replace_got_entry): New function.
3773 * output.cc (Output_data_got::replace_got_entry): New function.
3774 * powerpc.cc (class Powerpc_relobj): New.
3775 (class Powerpc_relocate_functions): Delete all psymval variants or
3776 convert to value,addend type. Delete pcrela, pcrela_unaligned.
3777 Implement _ha functions using corresponding _hi function.
3778 (Powerpc_relobj::find_special_sections): New function.
3779 (Target_powerpc::do_make_elf_object): New function.
3780 (class Output_data_got_powerpc): New.
3781 (class Output_data_glink): New.
3782 (class Powerpc_scan_relocatable_reloc): New.
3783 Many more changes througout file.
3785 2012-08-09 Nick Clifton <nickc@redhat.com>
3787 * po/vi.po: Updated Vietnamese translation.
3789 2012-08-07 Ian Lance Taylor <iant@google.com>
3791 * layout.cc (Layout::add_target_dynamic_tags): If
3792 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3795 2012-07-30 Nick Clifton <nickc@redhat.com>
3797 * po/gold.pot: Updated template.
3798 * po/es.po: Updated Spanish translation.
3800 2012-07-18 Cary Coutant <ccoutant@google.com>
3803 * configure.ac: Add check for -gpubnames support.
3804 * configure: Regenerate.
3805 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3806 support; force -gno-pubnames.
3807 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3809 (gdb_index_test_4): New test.
3810 * testsuite/Makefile.in: Regenerate.
3811 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3812 * testsuite/gdb_index_test_2.sh: Likewise.
3813 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3814 * testsuite/gdb_index_test_4.sh: New script.
3815 * testsuite/gdb_index_test_comm.sh: New script with common code;
3816 don't look for space after colon.
3818 2012-07-16 Sriraman Tallam <tmsriram@google.com>
3820 * gold.cc (queue_middle_tasks): Update function order only after
3821 deferred objects due to plugins are processed.
3823 2012-07-11 Ian Lance Taylor <iant@google.com>
3825 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3826 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3827 (Target_arm::scan_reloc_for_stub): Likewise.
3828 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3829 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3830 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3831 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3832 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3834 2012-07-10 Dodji Seketeli <dodji@redhat.com>
3835 Ian Lance Taylor <iant@google.com>
3838 * configure.ac: Test whether std::tr1::hash<off_t> works.
3839 * gold.h: Add a specialization for std::tr1::hash<off_t> if
3841 * output.h (class Output_fill): Add virtual destructor.
3842 * configure, config.in: Rebuild.
3844 2012-06-22 Roland McGrath <mcgrathr@google.com>
3846 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3848 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
3850 * plugin.cc (Plugin::load): Handle position independent executables.
3852 2012-06-06 Cary Coutant <ccoutant@google.com>
3854 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3856 (lines_only_debug_sections): Likewise.
3857 (gdb_fast_lookup_sections): New static array.
3858 (is_gdb_debug_section): Rename formal parameter.
3859 (is_lines_only_debug_section): Likewise.
3860 (is_gdb_fast_lookup_section): New function.
3861 (Layout::include_section): Check for ".zdebug_" prefix; pass
3862 section name suffix to is_gdb_debug_section, et al.; check for
3863 fast-lookup sections when building .gdb_index.
3864 * options.h (--strip-debug-gdb): Update GDB version number.
3866 2012-06-06 Cary Coutant <ccoutant@google.com>
3868 * configure.ac: Add check for fallocate.
3869 * configure: Regenerate.
3870 * config.in: Regenerate.
3872 * options.h (class General_options): Add --mmap-output-file and
3873 --posix-fallocate options.
3874 * output.cc: (posix_fallocate): Remove; replace with...
3875 (gold_fallocate): New function.
3876 (Output_file::map_no_anonymous): Call gold_fallocate.
3877 (Output_file::map): Check --mmap-output-file option.
3879 2012-06-05 Jing Yu <jingyu@google.com>
3881 * gold.h (textdomain): Add do {} to empty while(0).
3882 (bindtextdomain): Likewise.
3884 2012-06-04 Cary Coutant <ccoutant@google.com>
3886 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3889 2012-05-25 Sriraman Tallam <tmsriram@google.com>
3891 * symtab.cc (Symbol_table::define_special_symbol):
3892 Initialize *poldsym to prevent uninitialized variable errors.
3894 2012-05-23 Cary Coutant <ccoutant@google.com>
3896 * layout.cc (Layout::section_name_mapping): Add rules to handle
3897 exact match on .data.rel.ro.local or .data.rel.ro.
3898 (Layout::output_section_name): Check for exact matches.
3900 2012-05-23 Cary Coutant <ccoutant@google.com>
3902 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3905 2012-05-22 Cary Coutant <ccoutant@google.com>
3907 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3908 object before exporting symbol.
3910 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
3912 * testsuite/tls_test.cc: Include "config.h" first.
3913 * testsuite/tls_test_c.c: Likewise.
3915 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
3916 Nick Clifton <nickc@redhat.com>
3919 * configure.in: Add check that sysdep.h has been included before
3920 any system header files.
3921 * configure: Regenerate.
3922 * config.in: Regenerate.
3924 2012-05-14 Cary Coutant <ccoutant@google.com>
3926 * layout.cc (Layout::make_output_section): Mark .tdata section
3928 * testsuite/relro_test.cc: Add a TLS variable.
3930 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
3933 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3934 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3937 2012-05-08 Cary Coutant <ccoutant@google.com>
3939 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3940 (lines_only_debug_sections): Likewise.
3942 2012-05-02 Roland McGrath <mcgrathr@google.com>
3944 * nacl.cc: New file.
3946 * Makefile.am (CCFILES, HFILES): Add them.
3947 * Makefile.in: Regenerate.
3948 * i386.cc (Output_data_plt_i386_nacl): New class.
3949 (Output_data_plt_i386_nacl_exec): New class.
3950 (Output_data_plt_i386_nacl_dyn): New class.
3951 (Target_i386_nacl): New class.
3952 (Target_selector_i386_nacl): New class.
3953 (target_selector_i386): Use it instead of Target_selector_i386.
3954 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3955 (Target_x86_64_nacl): New class.
3956 (Target_selector_x86_64_nacl): New class.
3957 (target_selector_x86_64, target_selector_x32): Use it instead of
3958 Target_selector_x86_64.
3959 * arm.cc (Output_data_plt_arm_nacl): New class.
3960 (Target_arm_nacl): New class.
3961 (Target_selector_arm_nacl): New class.
3962 (target_selector_arm, target_selector_armbe): Use it instead of
3963 Target_selector_arm.
3965 * target-select.cc (select_target): Take new Input_file* and off_t
3966 arguments, pass them on to recognize method of selector.
3967 * object.cc (make_elf_sized_object): Update caller.
3968 * parameters.cc (parameters_force_valid_target): Likewise.
3969 * incremental.cc (make_sized_incremental_binary): Likewise.
3970 * target-select.h: Update decl.
3971 (Target_selector::recognize): Take new Input_file* argument,
3972 pass it on to do_recognize.
3973 (Target_selector::do_recognize): Take new Input_file* argument.
3974 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3975 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3976 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3977 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3979 * target.h (Target::Target_info): New members isolate_execinstr
3981 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3982 * arm.cc (Target_arm::arm_info): Update initializer.
3983 * i386.cc (Target_i386::i386_info): Likewise.
3984 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3985 * sparc.cc (Target_sparc::sparc_info): Likewise.
3986 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3987 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3988 * layout.cc (Layout::attach_allocated_section_to_segment):
3989 Take new const Target* argument. If target->isolate_execinstr(), act
3991 (Layout::find_first_load_seg): Take new const Target* argument;
3992 if target->isolate_execinstr(), reject PF_X segments.
3993 (Layout::relaxation_loop_body): Update caller.
3994 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3995 reset file offset to zero when we hit LOAD_SEG, and then do a second
3996 loop over the segments before LOAD_SEG to reassign offsets after
3997 addresses have been determined. Handle target->rosegment_gap().
3998 (Layout::attach_section_to_segment): Take new const Target* argument;
3999 pass it to attach_allocated_section_to_segment.
4000 (Layout::make_output_section): Update caller.
4001 (Layout::attach_sections_to_segments): Take new const Target* argument;
4002 pass it to attach_section_to_segment.
4003 * gold.cc (queue_middle_tasks): Update caller.
4004 * layout.h (Layout): Update method decls with new arguments.
4006 * arm.cc (Target_arm::Target_arm): Take optional argument for the
4007 Target_info pointer to use.
4008 (Target_arm::do_make_data_plt): New virtual method.
4009 (Target_arm::make_data_plt): New method that calls it.
4010 (Target_arm::make_plt_entry): Use it.
4011 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4012 for the section alignment.
4013 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4015 (Output_data_plt_arm::first_plt_entry_offset): Call it.
4016 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4018 (Output_data_plt_arm::get_plt_entry_size): Call it.
4019 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4020 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4021 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4023 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4024 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4025 method instead of sizeof(plt_entry).
4026 (Output_data_plt_arm::add_entry): Likewise.
4027 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4028 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4030 (Target_arm::plt_entry_size): Likewise.
4031 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4033 (Output_data_plt_arm_standard): ... here, new class.
4034 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4035 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4036 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4038 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4039 Take additional argument for the PLT entry size.
4040 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4041 Use get_plt_entry_size method rather than plt_entry_size variable.
4042 (Output_data_plt_x86_64::reserve_slot): Likewise.
4043 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4044 (Output_data_plt_x86_64::add_entry): Likewise.
4045 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4046 (Output_data_plt_x86_64::address_for_global): Likewise.
4047 (Output_data_plt_x86_64::address_for_local): Likewise.
4048 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4049 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4050 Make method non-static.
4051 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4053 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4054 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4055 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4056 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4058 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4059 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4061 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4062 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4064 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4065 (Output_data_plt_x86_64::plt_entry_size)
4066 (Output_data_plt_x86_64::first_plt_entry)
4067 (Output_data_plt_x86_64::plt_entry)
4068 (Output_data_plt_x86_64::tlsdesc_plt_entry)
4069 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4070 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4071 (Output_data_plt_x86_64_standard): ... here, new class.
4072 (Target_x86_64::Target_x86_64): Take optional argument for the
4073 Target_info pointer to use.
4074 (Target_x86_64::do_make_data_plt): New virtual method.
4075 (Target_x86_64::make_data_plt): New method to call it.
4076 (Target_x86_64::init_got_plt_for_update): Use that.
4077 Call this->plt_->add_eh_frame method here.
4078 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4079 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4080 rather than static method.
4081 (Target_x86_64::plt_entry_size): Likewise.
4082 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4083 rather than plt_entry_size variable. Move guts of PLT filling to...
4084 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4085 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4086 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4088 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4089 additional argument for the section alignment.
4090 Don't do add_eh_frame_for_plt here.
4091 (Output_data_plt_i386::first_plt_entry_offset): Make the method
4092 non-static. Use get_plt_entry_size method rather than plt_entry_size
4094 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4096 (Output_data_plt_i386::get_plt_entry_size): Call it.
4097 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4098 (Output_data_plt_i386::add_eh_frame): New method to call it.
4099 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4101 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4102 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4104 (Output_data_plt_i386::fill_plt_entry): New method to call it.
4105 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4106 method instead of plt_entry_size.
4107 (Output_data_plt_i386::plt_entry_size)
4108 (Output_data_plt_i386::plt_eh_frame_fde_size)
4109 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4110 (Output_data_plt_i386_standard): ... here, new class.
4111 (Output_data_plt_i386_exec): New class.
4112 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4113 (Output_data_plt_i386_exec::first_plt_entry): ... here.
4114 (Output_data_plt_i386::exec_plt_entry): Move to ...
4115 (Output_data_plt_i386_exec::plt_entry): ... here.
4116 (Output_data_plt_i386_dyn): New class.
4117 (Output_data_plt_i386::first_plt_entry): Move to ...
4118 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4119 (Output_data_plt_i386::dyn_plt_entry): Move to ...
4120 (Output_data_plt_i386_dyn::plt_entry): ... here.
4121 (Target_i386::Target_i386): Take optional argument for the Target_info
4123 (Target_i386::do_make_data_plt): New virtual method.
4124 (Target_i386::make_data_plt): New method to call it.
4125 (Target_i386::make_plt_section): Use that.
4126 Call this->plt_->add_eh_frame method here.
4127 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4128 rather than plt_entry_size variable.
4129 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4130 (Output_data_plt_i386::address_for_local): Likewise.
4131 (Output_data_plt_i386::do_write): Likewise.
4132 Move guts of PLT filling to...
4133 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4134 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4135 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4136 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4138 2012-05-01 Cary Coutant <ccoutant@google.com>
4140 * dwarf_reader.cc (Dwarf_die::read_attributes)
4141 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4142 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4143 * reduced_debug_output.cc
4144 (Output_reduced_debug_info_section::get_die_end): Remove
4145 DW_FORM_GNU_ref_index. Add default case.
4147 2012-04-26 Mark Wielaard <mjw@redhat.com>
4149 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4150 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4151 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4152 DW_AT_high_pc as offset from DW_AT_low_pc.
4154 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4155 * testsuite/Makefile.in: Regenerate.
4156 * testsuite/gdb_index_test_3.c: New test source file.
4157 * testsuite/gdb_index_test_3.sh: New test source file.
4159 2012-04-25 Ian Lance Taylor <iant@google.com>
4161 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4163 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4164 as a class, not a struct.
4165 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4166 (Target_arm::apply_cortex_a8_workaround): Likewise.
4167 * gc.h: Declare Reloc_types as a struct, not a class.
4168 * object.h: Declare Symbols_data as a struct.
4169 * reloc.h: Declare Read_relocs_data as a struct.
4170 * target.h: Declare Relocate_info as a struct.
4172 2012-04-24 David S. Miller <davem@davemloft.net>
4174 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4175 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4178 2012-04-24 Cary Coutant <ccoutant@google.com>
4180 * incremental-dump.cc (find_input_containing_global): Replace
4181 magic number with symbolic constant.
4182 (dump_incremental_inputs): Update version number.
4183 * incremental.cc (Output_section_incremental_inputs): Update version
4184 number; import symbolic constants from Incremental_inputs_reader.
4185 (Incremental_inputs::create_data_sections): Align relocations
4186 section correctly for 64-bit targets.
4187 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4188 constants; add padding.
4189 (Output_section_incremental_inputs::write_header): Add assert for
4191 (Output_section_incremental_inputs::write_input_files): Add assert
4192 for input_entry_size.
4193 (Output_section_incremental_inputs::write_info_blocks): Add padding;
4194 add assert for object_info_size, input_section_entry_size,
4195 global_sym_entry_size.
4196 * incremental.h (Incremental_inputs_reader): Add symbolic constants
4197 for data structure sizes; use them.
4198 (Incremental_input_entry_reader): Import symbolic constants from
4199 Incremental_inputs_reader; use them.
4201 2012-04-23 David S. Miller <davem@davemloft.net>
4203 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4205 (Target_sparc::Target_sparc): Initialize new fields.
4206 (Target_sparc::do_make_elf_object): New function.
4207 (Target_sparc::do_adjust_elf_header): New function.
4209 2012-04-23 Cary Coutant <ccoutant@google.com>
4211 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4212 CU range table of gdb index.
4214 2012-04-20 David S. Miller <davem@davemloft.net>
4216 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4219 2012-04-16 David S. Miller <davem@davemloft.net>
4221 * sparc.cc (Target_sparc::got_address): New function.
4222 (Sparc_relocate_functions::gdop_hix22): New function.
4223 (Sparc_relocate_functions::gdop_lox10): New function.
4224 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4226 (Target_sparc::Scan::local): Likewise if the global symbol is not
4227 preemptible and is not IFUNC.
4228 (Target_sparc::Relocate::relocate): Perform GOTDATA code
4229 transformations for local and non-preemptible non-IFUNC global
4232 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4233 writing out 64-bit part of ranges.
4235 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4236 -fpic and -fpie respectively.
4237 * Makefile.in: Regenerate.
4239 * sparc.cc (class Target_sparc): Add rela_ifunc_.
4240 (Target_sparc::Target_sparc): Initialize new field.
4241 (Target_sparc::do_plt_section_for_global): New function.
4242 (Target_sparc::do_plt_section_for_local): New function.
4243 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4244 (Target_sparc::make_plt_section): New function, broken out of
4245 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
4246 (Target_sparc::make_plt_entry): Call make_plt_section.
4247 (Target_sparc::make_local_ifunc_plt_entry): New function.
4248 (Target_sparc::rela_ifunc_section): New function.
4249 (Target_sparc::plt_section): Remove const.
4250 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
4251 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4252 and ifunc_count_ fields.
4253 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4254 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4255 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4256 (Output_data_plt_sparc::rela_ifunc): New function.
4257 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4258 (Output_data_plt_sparc::has_ifunc_section): New function.
4259 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4260 (Output_data_plt_sparc::address_for_global): New function.
4261 (Output_data_plt_sparc::address_for_local): New function.
4262 (Output_data_plt_sparc::plt_index_to_offset): New function.
4263 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4265 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4267 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4268 R_SPARC_JMP_IREL to switch.
4269 (Target_sparc::Scan::check_non_pic): Likewise.
4270 (Target_sparc::Scan::local): Handle IFUNC symbols.
4271 (Target_sparc::Scan::local): Likewise.
4272 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4273 and plt_address_for_local.
4274 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4275 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4277 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4278 (class Output_data_reloc): Adjust calls to Output_reloc_type.
4279 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4280 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4282 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4283 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4285 * sparc.cc (Target_sparc::Scan::global): Likewise.
4286 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4288 2012-04-16 Cary Coutant <ccoutant@google.com>
4290 * archive.cc (Library_base::should_include_member): Check for
4291 --export-dynamic-symbol.
4292 * options.h (class General_options): Add --export-dynamic-symbol.
4293 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4294 --export-dynamic-symbol.
4295 (Symbol_table::gc_mark_undef_symbols): Likewise.
4296 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4298 2012-04-12 David S. Miller <davem@davemloft.net>
4300 * sparc.cc (Reloc::wdisp10): New relocation method.
4301 (Reloc::h34): Likewise.
4302 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4303 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4305 (Target_sparc::Scan::local): Likewise.
4306 (Target_sparc::Scan::global): Likewise.
4307 (Target_sparc::Relocate::relocate): Likewise.
4309 2012-04-09 Cary Coutant <ccoutant@google.com>
4311 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4314 2012-04-06 Ian Lance Taylor <iant@google.com>
4316 * timer.cc: #include <unistd.h>.
4318 2012-04-06 Roland McGrath <mcgrathr@google.com>
4320 * configure.in (AC_CHECK_HEADERS): Add locale.h.
4321 * config.in: Regenerate.
4322 * configure: Regenerate.
4324 2012-04-05 Nick Clifton <nickc@redhat.com>
4326 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4327 (AM_LC_MESSAGES): Add.
4328 * aclocal.m4: Regenerate.
4329 * config.in: Regenerate.
4330 * configure: Regenerate.
4332 2012-03-21 Cary Coutant <ccoutant@google.com>
4334 * Makefile.am: Add gdb-index.cc, gdb-index.h.
4335 * Makefile.in: Regenerate.
4336 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4337 (Sized_elf_reloc_mapper::symbol_section): New function.
4338 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4339 (make_elf_reloc_mapper): New function.
4340 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4341 (Dwarf_abbrev_table::do_read_abbrevs): New function.
4342 (Dwarf_abbrev_table::do_get_abbrev): New function.
4343 (Dwarf_ranges_table::read_ranges_table): New function.
4344 (Dwarf_ranges_table::read_range_list): New function.
4345 (Dwarf_pubnames_table::read_section): New function.
4346 (Dwarf_pubnames_table::read_header): New function.
4347 (Dwarf_pubnames_table::next_name): New function.
4348 (Dwarf_die::Dwarf_die): New function.
4349 (Dwarf_die::read_attributes): New function.
4350 (Dwarf_die::skip_attributes): New function.
4351 (Dwarf_die::set_name): New function.
4352 (Dwarf_die::set_linkage_name): New function.
4353 (Dwarf_die::attribute): New function.
4354 (Dwarf_die::string_attribute): New function.
4355 (Dwarf_die::int_attribute): New function.
4356 (Dwarf_die::uint_attribute): New function.
4357 (Dwarf_die::ref_attribute): New function.
4358 (Dwarf_die::child_offset): New function.
4359 (Dwarf_die::sibling_offset): New function.
4360 (Dwarf_info_reader::check_buffer): New function.
4361 (Dwarf_info_reader::parse): New function.
4362 (Dwarf_info_reader::do_parse): New function.
4363 (Dwarf_info_reader::do_read_string_table): New function.
4364 (Dwarf_info_reader::lookup_reloc): New function.
4365 (Dwarf_info_reader::get_string): New function.
4366 (Dwarf_info_reader::visit_compilation_unit): New function.
4367 (Dwarf_info_reader::visit_type_unit): New function.
4368 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4369 Sized_elf_reloc_mapper.
4370 (Sized_dwarf_line_info::symbol_section): Remove function.
4371 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4372 (Sized_dwarf_line_info::read_line_mappings): Remove object
4373 parameter, adjust callers.
4374 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4375 * dwarf_reader.h: Include <sys/types.h>.
4376 (class Track_relocs): Remove forward declaration.
4377 (class Elf_reloc_mapper): New class.
4378 (class Sized_elf_reloc_mapper): New class.
4379 (class Dwarf_abbrev_table): New class.
4380 (class Dwarf_range_list): New class.
4381 (class Dwarf_ranges_table): New class.
4382 (class Dwarf_pubnames_table): New class.
4383 (class Dwarf_die): New class.
4384 (class Dwarf_info_reader): New class.
4385 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4386 (Sized_dwarf_line_info::symbol_section): Remove member function.
4387 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4389 * gdb-index.cc: New source file.
4390 * gdb-index.h: New source file.
4391 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4392 and .debug_types sections, call Layout::add_to_gdb_index.
4393 (Sized_relobj_incr::do_section_name): Implement.
4394 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4395 return type; Implement.
4396 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4398 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4399 parameter list and return type.
4400 (Sized_incr_dynobj::do_section_contents): Likewise.
4401 * layout.cc: Include gdb-index.h.
4402 (Layout::Layout): Initialize gdb_index_data_.
4403 (Layout::init_fixed_output_section): Check for .gdb_index section.
4404 (Layout::add_to_gdb_index): New function. Instantiate.
4405 * layout.h: Add forward declaration for class Gdb_index.
4406 (Layout::add_to_gdb_index): New member function.
4407 (Layout::gdb_index_data_): New data member.
4408 * main.cc: Include gdb-index.h.
4409 (main): Print statistics for gdb index.
4410 * object.cc (Object::section_contents): Move code into
4411 do_section_contents.
4412 (need_decompressed_section): Check for sections needed when building
4414 (build_compressed_section_map): Likewise.
4415 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4417 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4418 sections; call Layout::add_to_gdb_index.
4419 (Sized_relobj_file::do_decompressed_section_contents): Call
4420 do_section_contents directly.
4421 * object.h (Object::do_section_contents): Adjust parameter list and
4423 (Object::do_decompressed_section_contents): Call do_section_contents
4425 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4427 * options.h (class General_options): Add --gdb-index option.
4428 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4429 list and return type.
4430 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4431 * reloc.h (Track_relocs::checkpoint): New function.
4432 (Track_relocs::reset): New function.
4434 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4436 * testsuite/Makefile.in: Regenerate.
4437 * testsuite/gdb_index_test.cc: New test source file.
4438 * testsuite/gdb_index_test_1.sh: New test source file.
4439 * testsuite/gdb_index_test_2.sh: New test source file.
4441 2012-03-19 Doug Kwan <dougkwan@google.com>
4443 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4444 (Target_arm::do_finalize_sections): Remove code which defines
4445 __exidx_start and __exidx_end. Make symbol table parameter
4446 anonymous as it is not used.
4447 * gold.cc (queue_middle_tasks): Call target hook to define any
4448 target-specific symbols.
4449 * target.h (Target::define_standard_symbols): New method.
4450 (Target::do_define_standard_symbols): Same.
4451 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4452 * testsuite/Makefile.in: Regenerate.
4453 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4455 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4456 relocations are generated for __exidx_start and __exidx_end.
4458 2012-03-16 Doug Kwan <dougkwan@google.com>
4460 * testsuite/Makefile.am: Disable test initpri3b.
4461 * testsuite/Makefile.in: Regenerate.
4463 2012-03-15 Doug Kwan <dougkwan@google.com>
4465 * arm.cc (Target_arm::got_section): Make .got section read-only
4468 2012-03-15 Ian Lance Taylor <iant@google.com>
4471 * layout.cc (Layout::make_output_section): Correctly mark
4472 SHT_INIT_ARRAY, et. al., as relro.
4474 2012-03-14 Doug Kwan <dougkwan@google.com>
4476 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4477 dynamic relocations for protected symbols in shared objects.
4479 2012-03-13 Ian Lance Taylor <iant@google.com>
4481 * resolve.cc (Symbol_table::resolve): When merging common symbols,
4482 keep the larger alignment.
4484 2012-03-12 Cary Coutant <ccoutant@google.com>
4486 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4487 handling of DW_LNE_define_file.
4489 2012-03-12 Cary Coutant <ccoutant@google.com>
4491 * reduced_debug_output.cc
4492 (Output_reduced_debug_info_section::get_die_end): Add new FORM
4495 2012-02-29 Cary Coutant <ccoutant@google.com>
4497 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4499 2012-02-29 Cary Coutant <ccoutant@google.com>
4501 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4502 Call Object::decompressed_section_contents.
4503 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4505 (Sized_dwarf_line_info::buffer_start_): New data member.
4506 * merge.cc (Output_merge_data::do_add_input_section): Call
4507 Object::decompressed_section_contents.
4508 (Output_merge_string::do_add_input_section): Likewise.
4509 * object.cc (need_decompressed_section): New function.
4510 (build_compressed_section_map): Decompress sections needed later.
4511 (Sized_relobj_file::do_decompressed_section_contents): New function.
4512 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4513 * object.h (Object::decompressed_section_contents): New function.
4514 (Object::discard_decompressed_sections): New function.
4515 (Object::do_decompressed_section_contents): New function.
4516 (Object::do_discard_decompressed_sections): New function.
4517 (Compressed_section_info): New type.
4518 (Compressed_section_map): Include decompressed section contents.
4519 (Sized_relobj_file::do_decompressed_section_contents): New function.
4520 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4522 2012-02-16 Cary Coutant <ccoutant@google.com>
4524 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4525 * testsuite/Makefile.in: Regenerate.
4527 2012-02-14 Cary Coutant <ccoutant@google.com>
4529 * options.cc (General_options::finalize): Disallow -pie and -static.
4531 2012-02-03 Doug Kwan <dougkwan@google.com>
4533 * arm.cc (Arm_relocate_functions::abs8,
4534 Arm_relocate_functions::abs16): Use
4535 Bits::has_signed_unsigned_overflow32.
4536 (Arm_relocate_functions::thm_abs8): Correct range of
4538 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4541 2012-02-02 Doug Kwan <dougkwan@google.com>
4543 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4544 position independent outputs, not just shared objects.
4546 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
4548 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4549 * configure: Regenerated.
4551 2012-01-27 Ian Lance Taylor <iant@google.com>
4553 * reloc.h (Bits): New class with static functions, copied from
4554 namespace utils in arm.cc.
4555 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
4558 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4560 * incremental.cc (write_info_blocks): Correct relocation offset.
4562 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4564 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4565 (Relocate::tls_gd_to_le): Likewise.
4567 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4569 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4571 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4573 * configure.ac: Check if -mcmodel=medium works.
4574 * configure: Regenerated.
4576 2012-01-24 Cary Coutant <ccoutant@google.com>
4578 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4580 (read_unsigned_LEB_128_x): ... this new function.
4581 (read_signed_LEB_128): Replaced with inline definition and ...
4582 (read_signed_LEB_128_x): ... this new function.
4583 * int_encoding.h (read_unsigned_LEB_128_x): New function.
4584 (read_unsigned_LEB_128): Add inline definition.
4585 (read_signed_LEB_128_x): New function.
4586 (read_signed_LEB_128): Add inline definition.
4587 * testsuite/Makefile.am (leb128_unittest): New unit test.
4588 * testsuite/Makefile.in: Regenerate.
4589 * testsuite/leb128_unittest.cc: New unit test.
4591 2012-01-23 Ian Lance Taylor <iant@google.com>
4594 * i386.cc (Target_i386::do_code_fill): When using a jmp
4595 instruction, pad with nop instructions.
4596 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4598 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
4600 * x86_64.cc (gc_process_relocs): Add typename on types used in
4602 (scan_relocs): Likewise.
4603 (relocate_section): Likewise.
4604 (apply_relocation): Likewise.
4606 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
4608 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4609 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4612 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
4614 * x86_64.cc: Initial support for x32.
4616 2012-01-03 Cary Coutant <ccoutant@google.com>
4618 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4619 Use abstract base class for GOT.
4620 * gold/output.h (class Output_data_got_base): New abstract base class.
4621 (class Output_data_got): Derive from new base class, adjust ctors.
4622 (Output_data_got::reserve_slot): Make virtual; rename to
4623 do_reserve_slot; Adjust callers.
4624 * gold/target.h (Sized_target::init_got_plt_for_update): Return
4625 pointer to abstract base class.
4626 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4628 2011-12-18 Ian Lance Taylor <iant@google.com>
4630 * object.h (Relobj::local_symbol_value): New function.
4631 (Relobj::local_plt_offset): New function.
4632 (Relobj::local_has_got_offset): New function.
4633 (Relobj::local_got_offset): New function.
4634 (Relobj::set_local_got_offset): New function.
4635 (Relobj::do_local_symbol_value): New pure virtual function.
4636 (Relobj::do_local_plt_offset): Likewise.
4637 (Relobj::do_local_has_got_offset): Likewise.
4638 (Relobj::do_local_got_offset): Likewise.
4639 (Relobj::do_set_local_got_offset): Likewise.
4640 (Sized_relobj::do_local_has_got_offset): Rename from
4641 local_has_got_offset.
4642 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4643 (Sized_relobj::do_set_local_got_offset): Rename from
4644 set_local_got_offset.
4645 (Sized_relobj_file::do_local_plt_offset): Rename from
4647 (Sized_relobj_file::do_local_symbol_value): New function.
4648 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4650 * output.cc (Output_data_got::Got_entry::write): Change object to
4651 Relobj. Use local_symbol_value.
4652 (Output_data_got::add_global_with_rel): Change rel_dyn to
4653 Output_data_reloc_generic*. Use add_global_generic.
4654 (Output_data_got::add_global_with_rela): Remove. Change all
4655 callers to use add_global_with_rel.
4656 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4657 Output_data_reloc_generic*. Use add_global_generic.
4658 (Output_data_got::add_global_pair_with_rela): Remove. Change all
4659 callers to use add_global_pair_with_rel.
4660 (Output_data_got::add_local): Change object to Relobj*.
4661 (Output_data_got::add_local_plt): Likewise.
4662 (Output_data_got::add_local_with_rel): Change object to Relobj*,
4663 change rel_dyn to Output_data_reloc_generic*. Use
4665 (Output_data_got::add_local_with_rela): Remove. Change all
4666 callers to use all_local_with_rel.
4667 (Output_data_got::add_local_pair_with_rel): Change object to
4668 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
4669 add_output_section_generic.
4670 (Output_data_got::add_local_pair_with_rela): Remove. Change all
4671 callers to use add_local_pair_with_rel.
4672 (Output_data_got::reserve_local): Change object to Relobj*.
4673 * output.h: (class Output_data_reloc_generic): Add pure virtual
4674 declarations for add_global_generic, add_local_generic,
4675 add_output_section_generic.
4676 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4677 functions for Output_data_reloc_generic. Update declarations for
4678 changes listed in output.cc.
4679 (class Output_data_got): Change template parameter to got_size.
4680 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
4681 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4683 (Sized_relobj_incr::do_local_plt_offset): New function.
4684 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4687 2011-12-17 Cary Coutant <ccoutant@google.com>
4689 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4690 * resolve.cc (Symbol_table::resolve): Likewise.
4691 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4693 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4695 2011-12-16 Ian Lance Taylor <iant@google.com>
4697 * output.h (Output_data_reloc_generic::add): Only call
4698 add_dynamic_reloc if this is a dynamic reloc section.
4700 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
4703 * target-reloc.h (apply_relocation): Replace <64, false> with
4706 2011-11-25 Nick Clifton <nickc@redhat.com>
4708 * po/it.po: New Italian translation.
4710 2011-11-17 Sterling Augustine <saugustine@google.com>
4712 * script.cc (script_include_directive): Implement.
4713 (read_script_file): New local variables name and search_path. Update
4714 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4715 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4716 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4718 2011-11-11 Sterling Augustine <saugustine@google.com>
4720 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4721 (file_or_sections_cmd): Likewise.
4723 2011-11-11 Doug Kwan <dougkwan@google.com>
4725 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4726 if --just-symbols is given.
4728 2011-11-10 Doug Kwan <dougkwan@google.com>
4731 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4732 when processing data relocs.
4733 * reloc.h (Relocate_functions::rel_unaligned): New method.
4734 (Relocate_functions::pcrel_unaligned): Ditto.
4735 (Relocate_functions::rel32_unaligned): Ditto.
4736 (Relocate_functions::pcrel32_unaligned): Ditto.
4738 2011-11-09 Doug Kwan <dougkwan@google.com>
4741 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4742 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4743 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4744 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4745 (Relocate_functions::rel_unaligned): New.
4746 (Relocate_functions::rel32_unaligned): New.
4747 * target-reloc.h (relocate_for_relocatable): Add code to handle
4748 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4749 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4750 arm_unaligned_reloc_r): New targets.
4751 * testsuite/Makefile.in: Regenerate.
4752 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4755 2011-11-02 Ian Lance Taylor <iant@google.com>
4757 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
4759 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4760 * options.cc (General_options::finalize): Use library search path
4761 from configure script if specified. If not native and no sysroot,
4762 only search TOOLLIBDIR.
4763 * options.h (Search_directory::Search_directory): Change name to
4765 (General_options::add_to_library_path_with_sysroot): Change arg to
4767 * configure, Makefile.in, config.in: Rebuild.
4769 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4771 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4772 we are working around the ARM1176 Erratum.
4773 * options.h (General_options::fix_arm1176): Add option.
4774 * testsuite/Makefile.am: Add testcases, and keep current ones
4776 * testsuite/Makefile.in: Regenerate.
4777 * testsuite/arm_fix_1176.s: New file.
4778 * testsuite/arm_fix_1176.sh: Likewise.
4780 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4782 * arm.cc (Target_arm::Target_arm): Remove initialisation of
4784 (Target_arm::may_use_blx): Remove method.
4785 (Target_arm::set_may_use_blx): Likewise.
4786 (Target_arm::may_use_v4t_interworking): New method.
4787 (Target_arm::may_use_v5t_interworking): Likewise.
4788 (Target_arm::may_use_blx_): Remove member variable.
4789 (Arm_relocate_functions::arm_branch_common): Check for v5T
4791 (Arm_relocate_functions::thumb_branch_common): Likewise.
4792 (Reloc_stub::stub_type_for_reloc): Likewise.
4793 (Target_arm::do_finalize_sections): Correct interworking checks.
4794 * testsuite/Makefile.am: Add new tests.
4795 * testsuite/Makefile.in: Regenerate.
4796 * testsuite/arm_farcall_arm_arm.s: New test.
4797 * testsuite/arm_farcall_arm_arm.sh: Likewise.
4798 * testsuite/arm_farcall_arm_thumb.s: Likewise.
4799 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4800 * testsuite/arm_farcall_thumb_arm.s: Likewise.
4801 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4802 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4803 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4805 2011-10-31 Cary Coutant <ccoutant@google.com>
4808 * expression.cc (Expression::eval_with_dot): Add
4809 is_section_dot_assignment parameter.
4810 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
4811 absolute and assigning to dot within a section.
4812 * script-sections.cc
4813 (Output_section_element_assignment::set_section_addresses): Pass
4814 dot_section to set_if_absolute.
4815 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4816 as is_section_dot_assignment flag to eval_with_dot.
4817 (Output_section_element_dot_assignment::set_section_addresses):
4819 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4820 parameter. Also set value if relative to dot_section; set the
4821 symbol's output_section.
4822 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4823 parameter. Adjust all callers.
4824 (Expression::eval_maybe_dot): Likewise.
4825 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4827 * testsuite/script_test_2.t: Test assignment of an absolute value
4828 to dot within an output section element.
4830 2011-10-31 Cary Coutant <ccoutant@google.com>
4832 * options.h (class General_options): Add --[no-]gnu-unique options.
4833 * symtab.cc (Symbol_table::sized_write_globals): Convert
4834 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4836 2011-10-31 Cary Coutant <ccoutant@google.com>
4839 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4840 unnecessary assertion.
4841 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4843 2011-10-31 Sriraman Tallam <tmsriram@google.com>
4845 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4847 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4849 Change to just keep the section associated with symbol.
4850 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4851 they are externally visible and --export-dynamic is turned on.
4852 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4854 2011-10-19 Ian Lance Taylor <iant@google.com>
4857 * script-sections.cc
4858 (Output_section_element_dot_assignment::needs_output_section): New
4861 2011-10-19 Ian Lance Taylor <iant@google.com>
4864 * layout.cc (Layout::segment_precedes): Don't assert failure if a
4865 --section-start option was seen.
4866 * options.h (General_options::any_section_start): New function.
4868 2011-10-18 David S. Miller <davem@davemloft.net>
4871 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4872 member to track relocation locations that have moved during TLS
4873 reloc optimizations.
4874 (Target_sparc::Relocate::Relocate): Initialize to NULL.
4875 (Target_sparc::Relocate::relocate): Adjust view down by 4
4876 bytes if it matches reloc_adjust_addr_.
4877 (Target_sparc::Relocate::relocate_tls): Always move the
4878 __tls_get_addr call delay slot instruction forward 4 bytes when
4879 performing relaxation.
4881 2011-10-18 Cary Coutant <ccoutant@google.com>
4883 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4884 (Output_file::map_no_anonymous): Check for non-zero
4885 return code from posix_fallocate.
4887 2011-10-17 Cary Coutant <ccoutant@google.com>
4890 * plugin.cc (is_visible_from_outside): Check for symbols
4891 referenced from dynamic objects.
4892 * resolve.cc (Symbol_table::resolve): Don't count references
4893 from dynamic objects as references from real ELF files.
4894 * testsuite/plugin_test_2.sh: Adjust expected result.
4896 2011-10-17 Cary Coutant <ccoutant@google.com>
4898 * gold.cc: Include timer.h.
4899 (queue_middle_tasks): Stamp time.
4900 (queue_final_tasks): Likewise.
4901 * main.cc (main): Store timer in parameters. Print timers
4903 * parameters.cc (Parameters::Parameters): Initialize timer_.
4904 (Parameters::set_timer): New function.
4905 (set_parameters_timer): New function.
4906 * parameters.h (Parameters::set_timer): New function.
4907 (Parameters::timer): New function.
4908 (Parameters::timer_): New data member.
4909 (set_parameters_timer): New function.
4910 * timer.cc (Timer::stamp): New function.
4911 (Timer::get_pass_time): New function.
4912 * timer.h (Timer::stamp): New function.
4913 (Timer::get_pass_time): New function.
4914 (Timer::pass_times_): New data member.
4916 2011-10-17 Cary Coutant <ccoutant@google.com>
4918 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4919 task for members of lib groups.
4921 2011-10-17 Cary Coutant <ccoutant@google.com>
4924 * fileread.cc (File_read::find_view): Add assert.
4925 (File_read::make_view): Move bounds check (replace with assert)...
4926 (File_read::find_or_make_view): ... to here.
4928 2011-10-12 Cary Coutant <ccoutant@google.com>
4930 * output.cc (Output_file::open_base_file): Handle case where
4931 ::read returns less than requested size.
4933 2011-10-10 Cary Coutant <ccoutant@google.com>
4935 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4936 Initialize defined_count_.
4937 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4938 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4939 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4940 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4941 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4942 * incremental.h (Sized_relobj_incr::defined_count_): New data
4944 (Sized_incr_dynobj::defined_count_): New data member.
4945 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4946 Return zeroes instead of internal error.
4948 2011-10-10 Cary Coutant <ccoutant@google.com>
4951 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4952 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4953 * output.h (class Output_reloc): Add use_plt_offset flag.
4954 (Output_reloc::type_): Adjust size of bit field.
4955 (Output_reloc::use_plt_offset_): New bit field.
4956 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4957 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4958 flag. Adjust all callers.
4959 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4960 creating RELATIVE relocations.
4962 2011-10-10 Nick Clifton <nickc@redhat.com>
4964 * po/es.po: Updated Spanish translation.
4965 * po/fi.po: Updated Finnish translation.
4967 2011-10-03 Diego Novillo <dnovillo@google.com>
4969 * options.cc (parse_uint): Fix dereference of RETVAL.
4971 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4973 * layout.h (section_order_map_): New member.
4974 (get_section_order_map): New member function.
4975 * output.cc (Output_section::add_input_section): Check for patterns
4976 only when --section-ordering-file is specified.
4977 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4978 output_sections have been formed.
4979 * layout.cc (Layout_Layout): Initialize section_order_map_.
4980 * plugin.cc (update_section_order): Store order in order_map. Do not
4982 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4983 * testsuite/Makefile.in: Regenerate.
4984 * testsuite/plugin_section_order.c: New file.
4985 * testsuite/plugin_final_layout.cc: New file.
4986 * testsuite/plugin_final_layout.sh: New file.
4988 2011-09-29 Cary Coutant <ccoutant@google.com>
4990 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4992 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4993 symbols during incremental update.
4994 (Symbol_table::add_from_dynobj): Likewise.
4996 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4997 Ian Lance Taylor <iant@google.com>
4999 * symtab.cc (Symbol_table::define_special_symbol): Always
5000 canonicalize version string.
5002 2011-09-26 Cary Coutant <ccoutant@google.com>
5004 * gold.cc (queue_initial_tasks): Move option checks ...
5005 * options.cc (General_options::finalize): ... to here. Disable
5006 some options; make others fatal.
5008 2011-09-26 Cary Coutant <ccoutant@google.com>
5011 * plugin.cc (get_symbols_v2): New function.
5012 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5013 (is_referenced_from_outside): New function.
5014 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5015 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5016 (get_symbols): Pass version parameter.
5017 (get_symbols_v2): New function.
5018 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5020 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5021 (onload): Add LDPT_GET_SYMBOLS_V2.
5022 (all_symbols_read_hook): Use get_symbols_v2; check for
5023 LDPR_PREVAILING_DEF_IRONLY_EXP.
5024 * testsuite/plugin_test_3.sh: Update expected results.
5026 2011-09-23 Simon Baldwin <simonb@google.com>
5028 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5029 configuration options.
5030 * configure: Regenerate.
5031 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5032 * Makefile.in: Regenerate.
5033 * testsuite/Makefile.in: Regenerate.
5035 2011-09-19 Sriraman Tallam <tmsriram@google.com>
5037 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5039 2011-09-19 Cary Coutant <ccoutant@google.com>
5041 * incremental.cc (can_incremental_update): Fix typo in comment.
5042 * incremental.h (can_incremental_update): Likewise.
5044 2011-09-18 Cary Coutant <ccoutant@google.com>
5046 * incremental.cc (can_incremental_update): New function.
5047 * incremental.h (can_incremental_update): New function.
5048 * layout.cc (Layout::init_fixed_output_section): Call it.
5049 (Layout::make_output_section): Don't allow patch space in .eh_frame.
5050 * object.cc (Sized_relobj_file::do_layout): Call
5051 can_incremental_update.
5053 2011-09-13 Cary Coutant <ccoutant@google.com>
5055 * configure.ac: Check for glibc support for gnu_indirect_function
5056 support with static linking, setting automake conditional
5058 * Makefile.in: Regenerate.
5059 * configure: Regenerate.
5061 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5062 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5064 * testsuite/Makefile.in: Regenerate.
5066 2011-09-13 Cary Coutant <ccoutant@google.com>
5068 * incremental.cc (Sized_relobj_incr::do_layout): Call
5069 report_comdat_group for kept comdat sections.
5070 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5071 * testsuite/Makefile.in: Regenerate.
5072 * testsuite/incr_comdat_test_1.cc: New source file.
5073 * testsuite/incr_comdat_test_2_v1.cc: New source file.
5074 * testsuite/incr_comdat_test_2_v2.cc: New source file.
5075 * testsuite/incr_comdat_test_2_v3.cc: New source file.
5077 2011-09-13 Ian Lance Taylor <iant@google.com>
5079 * object.cc (Sized_relobj_file::do_layout): Remove unused local
5080 variable external_symbols_offset.
5082 2011-09-12 Ian Lance Taylor <iant@google.com>
5084 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5085 triggered if object has no symbols.
5087 2011-09-09 David S. Miller <davem@davemloft.net>
5089 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5090 (Output_fill_debug_line::do_write): Likewise.
5092 2011-08-29 Cary Coutant <ccoutant@google.com>
5094 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5095 casts to match formatting specs.
5096 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5098 2011-08-26 Cary Coutant <ccoutant@google.com>
5100 * layout.cc (Free_list::allocate): Provide guarantee of minimum
5101 remaining hole size when allocating.
5102 (Layout::make_output_section): Set fill methods for debug sections.
5103 * layout.h (Free_list::Free_list_node): Move from private to
5105 (Free_list::set_min_hole_size): New function.
5106 (Free_list::begin, Free_list::end): New functions.
5107 (Free_list::min_hole_): New data member.
5108 * output.cc: Include dwarf.h.
5109 (Output_fill_debug_info::do_minimum_hole_size): New function.
5110 (Output_fill_debug_info::do_write): New function.
5111 (Output_fill_debug_line::do_minimum_hole_size): New function.
5112 (Output_fill_debug_line::do_write): New function.
5113 (Output_section::Output_section): Initialize new data member.
5114 (Output_section::set_final_data_size): Ensure patch space is larger
5115 than minimum hole size.
5116 (Output_section::do_write): Fill holes in debug sections.
5117 * output.h (Output_fill): New class.
5118 (Output_fill_debug_info): New class.
5119 (Output_fill_debug_line): New class.
5120 (Output_section::set_free_space_fill): New function.
5121 (Output_section::free_space_fill_): New data member.
5122 * testsuite/Makefile.am (incremental_test_3): Add
5123 --incremental-patch option.
5124 (incremental_test_4): Likewise.
5125 (incremental_test_5): Likewise.
5126 (incremental_test_6): Likewise.
5127 (incremental_copy_test): Likewise.
5128 (incremental_common_test_1): Likewise.
5129 * testsuite/Makefile.in: Regenerate.
5131 2011-08-26 Nick Clifton <nickc@redhat.com>
5133 * po/es.po: Updated Spanish translation.
5135 2011-08-01 Cary Coutant <ccoutant@google.com>
5137 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5138 * gold/testsuite/Makefile.in: Regenerate.
5139 * gold/testsuite/justsyms_exec.c: New source file.
5140 * gold/testsuite/justsyms_lib.c: New source file.
5142 2011-08-01 Cary Coutant <ccoutant@google.com>
5144 * layout.cc (Layout::set_segment_offsets): Don't realign text
5145 segment if -Ttext was specified.
5146 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5148 * object.h (Sized_relobj_file::e_type): New function.
5149 (Sized_relobj_file::e_type_): New data member.
5150 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5151 base address for ET_EXEC files.
5152 * target.cc (Target::do_make_elf_object_implementation): Allow
5153 ET_EXEC files with --just-symbols option.
5155 2011-07-28 Cary Coutant <ccoutant@google.com>
5157 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5158 Add thread_number parameter.
5159 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5160 * workqueue-threads.cc
5161 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5162 current thread if its thread number is greater than desired thread
5164 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5165 Add thread_number parameter.
5166 (Workqueue::should_cancel_thread): Likewise.
5167 (Workqueue::find_runnable_or_wait): Pass thread_number to
5168 should_cancel_thread.
5169 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5172 2011-07-22 Sriraman Tallam <tmsriram@google.com>
5174 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5175 only after checking if it cannot be forced local.
5176 * symtab.h (is_externally_visible): Check if the symbol is not forced
5179 2011-07-15 Ian Lance Taylor <iant@google.com>
5181 * options.h (class General_options): Add --print-output-format.
5182 Move -EL next to -EB, for better --help output.
5183 * target-select.cc: Include <cstdio>, "options.h", and
5185 (Target_selector::do_target_bfd_name): New function.
5186 (print_output_format): New function.
5187 * target-select.h (class Target_selector): Update declarations.
5188 (Target_selector::target_bfd_name): New function.
5189 (print_output_format): Declare.
5190 * main.cc: Include "target-select.h".
5191 (main): Handle --print-output-format.
5192 * gold.cc: Include "target-select.h".
5193 (queue_initial_tasks): Handle --print-output-format when there are
5195 * parameters.cc (parameters_force_valid_target): Give a better
5196 error message if -EB/-EL does not match target.
5197 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5200 2011-07-15 Ian Lance Taylor <iant@google.com>
5202 * i386.cc (class Output_data_plt_i386): Add layout_ field.
5203 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5204 (Output_data_plt_i386::do_write): Write address of .dynamic
5205 section to first entry in .got.plt section.
5206 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5207 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5209 (Output_data_plt_x86_64::do_write): Write address of .dynamic
5210 section to first entry in .got.plt section.
5211 * layout.h (Layout::dynamic_section): New function.
5213 2011-07-13 Sriraman Tallam <tmsriram@google.com>
5215 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5217 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5218 input_section_position_, and input_section_glob_.
5219 (read_layout_from_file): Call function section_ordering_specified.
5220 * layout.h (is_section_ordering_specified): New function.
5221 (section_ordering_specified): New function.
5222 (section_ordering_specified_): New boolean member.
5223 * main.cc(main): Call load_plugins after layout object is defined.
5224 * output.cc (Output_section::add_input_section): Use
5225 function section_ordering_specified to check if section ordering is
5227 * output.cc (Output_section::add_relaxed_input_section): Use
5228 function section_ordering_specified to check if section ordering is
5230 (Output_section::update_section_layout): New function.
5231 (Output_section::sort_attached_input_sections): Check if input section
5233 * output.h (Output_section::update_section_layout): New function.
5234 * plugin.cc (get_section_count): New function.
5235 (get_section_type): New function.
5236 (get_section_name): New function.
5237 (get_section_contents): New function.
5238 (update_section_order): New function.
5239 (allow_section_ordering): New function.
5240 (Plugin::load): Add the new interfaces to the transfer vector.
5241 (Plugin_manager::load_plugins): New parameter.
5242 (Plugin_manager::all_symbols_read): New parameter.
5243 (Plugin_manager::claim_file): New parameter. Save the elf object for
5245 (Plugin_manager::get_elf_object): New function.
5246 (Plugin_manager::get_view): Change to directly use the bool to check
5247 if get_view is called from claim_file_hook.
5248 * plugin.h (input_objects): New function
5249 (Plugin__manager::load_plugins): New parameter.
5250 (Plugin_manager::claim_file): New parameter.
5251 (Plugin_manager::get_elf_object): New function.
5252 (Plugin_manager::in_claim_file_handler): New function.
5253 (Plugin_manager::in_claim_file_handler_): New member.
5254 (layout): New function.
5255 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5256 handler with an extra parameter. Make the elf object before calling
5258 * testsuite/plugin_test.c (get_section_count): New function pointer.
5259 (get_section_type): New function pointer.
5260 (get_section_name): New function pointer.
5261 (get_section_contents): New function pointer.
5262 (update_section_order): New function pointer.
5263 (allow_section_ordering): New function pointer.
5264 (onload): Check if the new interfaces exist.
5266 2011-07-13 Ian Lance Taylor <iant@google.com>
5268 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5270 * x86_64.cc (Target_x86_64::got_section): Likewise.
5271 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5272 (relro_now_test_SOURCES): New variable.
5273 (relro_now_test_DEPENDENCIES): New variable.
5274 (relro_now_test_LDFLAGS): New variable.
5275 (relro_now_test_LDADD): New variable.
5276 (relro_now_test.so): New target.
5277 * testsuite/Makefile.in: Rebuild.
5279 2011-07-12 Ian Lance Taylor <iant@google.com>
5282 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5283 GLOB_DAT relocation rather than a RELATIVE relocation for a
5284 protected symbol when creating a shared library.
5285 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5286 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5287 * testsuite/protected_main_1.cc (main): Test that protected
5288 function has same address.
5290 2011-07-11 Ian Lance Taylor <iant@google.com>
5293 * options.h (class General_options): Add -Bgroup.
5294 * options.cc (General_options::finalize): If -Bgroup is set,
5295 default to --unresolved-symbols=report-all.
5296 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5297 * target-reloc.h (issue_undefined_symbol_error): Handle
5298 --unresolved-symbols=report-all.
5300 2011-07-08 Ian Lance Taylor <iant@google.com>
5303 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5304 if linker script discards key sections.
5305 (Layout::create_dynamic_symtab): Likewise.
5306 (Layout::assign_local_dynsym_offsets): Likewise.
5307 (Layout::sized_create_version_sections): Likewise.
5308 (Layout::create_interp): Likewise.
5309 (Layout::finish_dynamic_section): Likewise.
5310 (Layout::set_dynamic_symbol_size): Likewise.
5312 2011-07-08 Ian Lance Taylor <iant@google.com>
5315 * options.h (class General_options): Add --unresolved-symbols.
5316 * target-reloc.h (issue_undefined_symbol_error): Check
5317 --unresolved-symbols. Add comments.
5319 2011-07-08 Ian Lance Taylor <iant@google.com>
5321 * testsuite/odr_violation2.cc (Ordering::operator()): Make
5322 expression more complex.
5324 2011-07-08 Ian Lance Taylor <iant@google.com>
5327 * target-reloc.h (issue_undefined_symbol_error): New inline
5328 function, broken out of relocate_section.
5329 (relocate_section): Call issue_undefined_symbol_error.
5330 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5331 there is no TLS segment if we are about to issue an undefined
5333 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5335 2011-07-08 Ian Lance Taylor <iant@google.com>
5338 * resolve.cc (Symbol_table::should_override): Add fromtype
5339 parameter. Change all callers. Give error when linking together
5340 TLS and non-TLS symbol.
5341 (Symbol_table::should_override_with_special): Add fromtype
5342 parameter. Change all callers.
5343 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5344 there is no TLS segment if we have reported some errors.
5345 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5347 2011-07-08 Ian Lance Taylor <iant@google.com>
5350 * target.h (Target::plt_address_for_global): New function.
5351 (Target::plt_address_for_local): New function.
5352 (Target::plt_section_for_global): Remove.
5353 (Target::plt_section_for_local): Remove.
5354 (Target::do_plt_address_for_global): New virtual function.
5355 (Target::do_plt_address_for_local): New virtual function.
5356 (Target::do_plt_section_for_global): Remove.
5357 (Target::do_plt_section_for_local): Remove.
5358 (Target::register_global_plt_entry): Add Symbol_table and Layout
5360 * output.cc (Output_data_got::Got_entry::write): Use
5361 plt_address_for_global and plt_address_for_local.
5362 * layout.cc (Layout::add_target_dynamic_tags): Use size and
5363 address of output section.
5364 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5365 got_irelative_, and irelative_count_ fields. Update
5367 (Output_data_plt_i386::has_irelative_section): New function.
5368 (Output_data_plt_i386::entry_count): Add irelative_count_.
5369 (Output_data_plt_i386::set_final_data_size): Likewise.
5370 (class Target_i386): Add got_irelative_ and rel_irelative_
5371 fields. Update declarations.
5372 (Target_i386::Target_i386): Initialize new fields.
5373 (Target_i386::do_plt_address_for_global): New function replacing
5374 do_plt_section_for_global.
5375 (Target_i386::do_plt_address_for_local): New function replacing
5376 do_plt_section_for_local.
5377 (Target_i386::got_section): Create got_irelative_.
5378 (Target_i386::rel_irelative_section): New function.
5379 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5380 fields. Don't define __rel_iplt_{start,end}.
5381 (Output_data_plt_i386::add_entry): Add symtab and layout
5382 parameters. Change all callers. Use different PLT and GOT for
5384 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5385 layout parameters. Change all callers. Use different PLT and
5387 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5388 (Output_data_plt_i386::rel_irelative): New function.
5389 (Output_data_plt_i386::address_for_global): New function.
5390 (Output_data_plt_i386::address_for_local): New function.
5391 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
5392 IRELATIVE GOT when changing IFUNC GOT entries.
5393 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5395 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5396 if we didn't create an IRELATIVE GOT.
5397 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5398 plt_address_for_local.
5399 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5400 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5401 got_irelative_, and irelative_count_ fields. Update
5403 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5404 Initialize new fields. Remove symtab parameter. Change all
5406 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5408 (Output_data_plt_x86_64::has_irelative_section): New function.
5409 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5410 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5411 fields. Update declarations.
5412 (Target_x86_64::Target_x86_64): Initialize new fields.
5413 (Target_x86_64::do_plt_address_for_global): New function replacing
5414 do_plt_section_for_global.
5415 (Target_x86_64::do_plt_address_for_local): New function replacing
5416 do_plt_section_for_local.
5417 (Target_x86_64::got_section): Create got_irelative_.
5418 (Target_x86_64::rela_irelative_section): New function.
5419 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5420 all callers. Don't create __rel_iplt_{start,end}.
5421 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5422 parameters. Change all callers. Use different PLT and GOT for
5424 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5425 layout parameters. Change all callers. Use different PLT and
5427 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5428 parameters. Change all callers. Use different PLT and GOT for
5430 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5431 (Output_data_plt_x86_64::rela_irelative): New function.
5432 (Output_data_plt_x86_64::address_for_global): New function.
5433 (Output_data_plt_x86_64::address_for_local): New function.
5434 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5435 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5436 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5437 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5439 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5441 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5442 symbols if we didn't create an IRELATIVE GOT.
5443 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5444 plt_address_for_local.
5445 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5446 * testsuite/ifuncvar1.c: New test file.
5447 * testsuite/ifuncvar2.c: New test file.
5448 * testsuite/ifuncvar3.c: New test file.
5449 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5450 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5451 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5452 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5453 * testsuite/Makefile.in: Rebuild.
5455 2011-07-07 Cary Coutant <ccoutant@google.com>
5457 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5458 (two_file_test_1_ndebug.o): Likewise.
5459 (two_file_test_1b_ndebug.o): Likewise.
5460 (two_file_test_2_ndebug.o): Likewise.
5461 (two_file_test_main_ndebug.o): Likewise.
5462 (incremental_test_2): Link with no-debug versions.
5464 2011-07-06 Cary Coutant <ccoutant@google.com>
5466 * gold/incremental.cc
5467 (Output_section_incremental_inputs::write_info_blocks): Check for
5468 hidden and internal symbols.
5470 2011-07-06 Cary Coutant <ccoutant@google.com>
5472 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5473 Check disposition for startup file.
5474 (Incremental_inputs::report_command_line): Ignore
5475 --incremental-startup-unchanged option.
5476 * options.cc (General_options::parse_incremental_startup_unchanged):
5478 (General_options::General_options): Initialize new data member.
5479 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5480 (General_options): Add --incremental-startup-unchanged option.
5481 (General_options::incremental_startup_disposition): New function.
5482 (General_options::incremental_startup_disposition_): New data member.
5484 2011-07-06 Cary Coutant <ccoutant@google.com>
5486 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5487 input file index to Script_info ctor.
5488 (Sized_incremental_binary::do_file_has_changed): Find the
5489 command-line argument for files named in scripts.
5490 * incremental.h (Script_info::Script_info): New ctor
5491 with input file index.
5492 (Script_info::input_file_index): New function.
5493 (Script_info::input_file_index_): New data member.
5494 (Incremental_binary::get_library): Add const.
5495 (Incremental_binary::get_script_info): Add const.
5496 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5497 * testsuite/Makefile.am (incremental_test_5): New test case.
5498 (incremental_test_6): New test case.
5499 * testsuite/Makefile.in: Regenerate.
5501 2011-07-06 Cary Coutant <ccoutant@google.com>
5503 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5504 debug output when command lines differ.
5506 2011-07-06 Cary Coutant <ccoutant@google.com>
5508 * incremental.cc (Incremental_inputs::report_command_line): Ignore
5509 --incremental-patch option.
5510 * layout.cc (Free_list::allocate): Extend allocation beyond original
5512 (Layout::make_output_section): Mark sections that should get
5514 * options.cc (parse_percent): New function.
5515 * options.h (parse_percent): New function.
5516 (DEFINE_percent): New macro.
5517 (General_options): Add --incremental-patch option.
5518 * output.cc (Output_section::Output_section): Initialize new data
5520 (Output_section::add_input_section): Print section name when out
5522 (Output_section::add_output_section_data): Likewise.
5523 (Output_section::set_final_data_size): Add patch space when
5524 doing --incremental-full.
5525 (Output_section::do_reset_address_and_file_offset): Remove patch
5527 (Output_segment::set_section_list_addresses): Print debug output
5528 only if --incremental-update.
5529 * output.h (Output_section::set_is_patch_space_allowed): New function.
5530 (Output_section::is_patch_space_allowed_): New data member.
5531 (Output_section::patch_space_): New data member.
5532 * parameters.cc (Parameters::incremental_full): New function.
5533 * parameters.h (Parameters::incremental_full): New function
5534 * testsuite/Makefile.am (incremental_test_2): Add test for
5535 --incremental-patch option.
5536 * testsuite/Makefile.in: Regenerate.
5537 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5538 (t18): Remove function body.
5540 2011-07-05 Doug Kwan <dougkwan@google.com>
5543 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5544 Arm_Address type for relocation result.
5545 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
5547 (Arm_relocate_functions::abs32): Use unaligned access.
5548 (Arm_relocate_functions::rel32): Ditto.
5549 (Arm_relocate_functions::prel31): Ditto.
5550 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5551 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5552 static data relocations.
5553 * testsuite/Makefile.in: Regnerate.
5554 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5556 2011-07-05 Ian Lance Taylor <iant@google.com>
5559 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5560 symbols if necessary.
5561 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5563 2011-07-05 Ian Lance Taylor <iant@google.com>
5566 * resolve.cc (Symbol::override_base_with_special): Simply override
5567 version with special symbol version, ignoring previous version.
5569 2011-07-05 Ian Lance Taylor <iant@google.com>
5571 * object.cc (Sized_relobj_file::include_section_group): Add
5572 information to comment about signature location.
5574 2011-07-02 Ian Lance Taylor <iant@google.com>
5577 * options.h (class General_options): Add -f and -F.
5578 * options.cc (General_options::finalize): Fatal error if -f/-F
5579 are used without -shared.
5580 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5582 2011-07-02 Ian Lance Taylor <iant@google.com>
5584 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5586 2011-07-01 Ian Lance Taylor <iant@google.com>
5590 * resolve.cc (Symbol::override_base_with_special): Don't override
5591 the version if the overriding symbol has a different name.
5592 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
5593 all callers. If we give an error about an undefined version,
5594 define the base version if necessary.
5595 * dynobj.h (class Versions): Update declaration.
5596 * testsuite/weak_alias_test_5.cc: New file.
5597 * testsuite/weak_alias_test.script: New file.
5598 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5599 and versioned_alias have the right value, and call t2.
5600 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5601 weak_alias_test_5.so.
5602 (weak_alias_test_LDADD): Likewise.
5603 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5604 * testsuite/Makefile.in: Rebuild.
5606 2011-07-01 Ian Lance Taylor <iant@google.com>
5609 * options.h (class General_options): Support -z notext.
5610 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5612 (two_file_shared_nonpic.so): Likewise.
5613 (two_file_shared_mixed.so): Likewise.
5614 (two_file_shared_mixed_1.so): Likewise.
5615 (weak_undef_lib_nonpic.so): Likewise.
5616 (alt/weak_undef_lib_nonpic.so): Likewise.
5617 (tls_test_shared_nonpic.so): Likewise.
5618 * testsuite/Makefile.in: Rebuild.
5620 2011-07-01 Ian Lance Taylor <iant@google.com>
5623 * configure.ac: Test whether static linking works, setting
5624 the automake conditional HAVE_STATIC.
5625 * testsuite/Makefile.am: Disable tests using -static if
5626 HAVE_STATIC is not true.
5627 * configure, testsuite/Makefile.in: Rebuild.
5629 2011-07-01 Ian Lance Taylor <iant@google.com>
5632 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5633 Assert if we see DW_EH_PE_indirect.
5634 * target.h (Target::ehframe_datarel_base): New function.
5635 (Target::do_ehframe_datarel_base): New target function.
5636 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5637 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5640 2011-07-01 Ian Lance Taylor <iant@google.com>
5643 * options.h (class General_options): Add
5644 --ld-generated-unwind-info.
5645 * ehframe.cc (Fde::write): Add address parameter. Change all
5646 callers. If associated with PLT, fill in address and size.
5647 (Cie::set_output_offset): Only add merge mapping if there is an
5649 (Cie::write): Add address parameter. Change all callers.
5650 (Eh_frame::add_ehframe_for_plt): New function.
5651 * ehframe.h (class Fde): Update declarations. Move shndx_ and
5652 input_offset_ fields into union u_, with new plt field.
5653 (Fde::Fde): Adjust for new union field.
5654 (Fde::Fde) [Output_data version]: New constructor.
5655 (Fde::add_mapping): Only add merge mapping if there is an object.
5656 (class Cie): Update declarations.
5657 (class Eh_frame): Declare add_ehframe_for_plt.
5658 * layout.cc (Layout::layout_eh_frame): Break out code into
5659 make_eh_frame_section, and call it.
5660 (Layout::make_eh_frame_section): New function.
5661 (Layout::add_eh_frame_for_plt): New function.
5662 * layout.h (class Layout): Update declarations.
5663 * merge.cc (Merge_map::add_mapping): Add assertion.
5664 * i386.cc: Include "dwarf.h".
5665 (class Output_data_plt_i386): Make first_plt_entry,
5666 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
5667 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5668 and plt_eh_frame_fde.
5669 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5670 boundary. Call add_eh_frame_for_plt if appropriate.
5671 * x86_64.cc: Include "dwarf.h".
5672 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
5673 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
5674 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5675 and plt_eh_frame_fde.
5676 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5679 2011-06-29 Ian Lance Taylor <iant@google.com>
5682 * object.cc (Sized_relobj_file::layout_section): Change shdr
5683 parameter to be const.
5684 (Sized_relobj_file::layout_eh_frame_section): New function, broken
5686 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5687 appropriate. Call layout_eh_frame_section.
5688 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5690 * object.h (class Sized_relobj_file): Update declarations.
5692 2011-06-29 Ian Lance Taylor <iant@google.com>
5695 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5697 (Lex::gather_token): Accept trailing M/m/K/k for integers.
5699 2011-06-29 Ian Lance Taylor <iant@google.com>
5702 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5704 * layout.cc (Layout::layout_eh_frame): Likewise.
5706 2011-06-29 Ian Lance Taylor <iant@google.com>
5709 * layout.cc (Layout::symtab_section_shndx): New function.
5710 * layout.h (class Layout): Declare symtab_section_shndx.
5711 * output.cc (Output_section::write_header): Call it.
5713 2011-06-29 Ian Lance Taylor <iant@google.com>
5716 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5717 symbols which are not used in a relocation.
5719 2011-06-28 Ian Lance Taylor <iant@google.com>
5722 * layout.cc (Layout::segment_precedes): Don't crash if a linker
5723 script create indistinguishable segments.
5724 (Layout::set_segment_offsets): Use stable_sort when sorting
5725 segments. Pass this to Compare_segments constructor.
5726 * layout.h (class Layout): Make segment_precedes non-static.
5727 (class Compare_segments): Change from struct to class. Add
5728 layout_ field. Add constructor.
5729 * script-sections.cc
5730 (Script_sections::attach_sections_using_phdrs_clause): Rename
5731 local orphan to is_orphan. Don't report failure to put empty
5732 section in segment. On attachment failure, report name of
5733 section, and attach to first PT_LOAD segment.
5735 2011-06-28 Ian Lance Taylor <iant@google.com>
5738 * target-select.cc (Target_selector::Target_selector): Add
5739 emulation parameter. Change all callers.
5740 (select_target_by_bfd_name): Rename from select_target_by_name.
5742 (select_target_by_emulation): New function.
5743 (supported_emulation_names): New function.
5744 * target-select.h (class Target_selector): Add emulation_ field.
5745 Update declarations.
5746 (Target_selector::recognize_by_bfd_name): Rename from
5747 recognize_by_name. Change all callers.
5748 (Target_selector::supported_bfd_names): Rename from
5749 supported_names. Change all callers.
5750 (Target_selector::recognize_by_emulation): New function.
5751 (Target_selector::supported_emulations): New function.
5752 (Target_selector::emulation): New function.
5753 (Target_selector::do_recognize_by_bfd_name): Rename from
5754 do_recognize_by_name. Change all callers.
5755 (Target_selector::do_supported_bfd_names): Rename from
5756 do_supported_names. Change all callers.
5757 (Target_selector::do_recognize_by_emulation): New function.
5758 (Target_selector::do_supported_emulations): New function.
5759 (select_target_by_bfd_name): Change name in declaration.
5760 (select_target_by_emulation): Declare.
5761 (supported_emulation_names): Declare.
5762 * parameters.cc (parameters_force_valid_target): Try to find
5763 target based on emulation from -m option.
5764 * options.h (class General_options): Change doc string for -m.
5765 * options.cc (help): Print emulations.
5766 (General_options::parse_V): Likewise.
5767 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5768 Add emulation parameter. Change all callers.
5770 2011-06-28 Ian Lance Taylor <iant@google.com>
5772 * target.h (class Target): Add osabi_ field.
5773 (Target::osabi): New function.
5774 (Target::set_osabi): New function.
5775 (Target::Target): Initialize osabi_.
5776 (Target::do_adjust_elf_header): Make pure virtual.
5777 (Sized_target::do_adjust_elf_header): Declare.
5778 * target.cc (Sized_target::do_adjust_elf_header): New function.
5779 (class Sized_target): Instantiate all versions.
5780 * freebsd.h (class Target_freebsd): Remove.
5781 (Target_selector_freebsd::do_recognize): Call set_osabi on
5783 (Target_selector_freebsd::do_recognize_by_name): Likewise.
5784 (Target_selector_freebsd::set_osabi): Remove.
5785 * i386.cc (class Target_i386): Inherit from Sized_target rather
5786 than Target_freebsd.
5787 * x86_64.cc (class Target_x86_64): Likewise.
5789 2011-06-28 Ian Lance Taylor <iant@google.com>
5791 * target.h (Target::can_check_for_function_pointers): Rewrite.
5793 (Target::can_icf_inline_merge_sections): Likewise.
5794 (Target::section_may_have_icf_unsafe_poineters): Likewise.
5795 (Target::Target_info): Add can_icf_inline_merge_sections field.
5796 (Target::do_can_check_for_function_pointers): New virtual
5798 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5799 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5800 from can_check_for_function_pointers, move in file.
5801 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5802 section_may_have_icf_unsafe_poineters, move in file.
5803 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5804 * i386.cc (Target_i386::do_can_check_for_function_pointers):
5805 Rename from can_check_for_function_pointers, move in file.
5806 (Target_i386::can_icf_inline_merge_sections): Remove.
5807 (Target_i386::i386_info): Initialize
5808 can_icf_inline_merge_sections.
5809 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5810 Initialize can_icf_inline_merge_sections.
5811 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5812 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5813 Rename from can_check_for_function_pointers, move in file.
5814 (Target_x86_64::can_icf_inline_merge_sections): Remove.
5815 (Target_x86_64::x86_64_info): Initialize
5816 can_icf_inline_merge_sections.
5817 * testsuite/testfile.cc (Target_test::test_target_info):
5819 * icf.cc (get_section_contents): Correct formatting.
5821 2011-06-27 Ian Lance Taylor <iant@google.com>
5823 * symtab.cc (Symbol::versioned_name): New function.
5824 (Symbol_table::add_to_final_symtab): Use versioned_name when
5826 (Symbol_table::sized_write_symbol): Likewise.
5827 * symtab.h (class Symbol): Declare versioned_name.
5828 * stringpool.h (class Stringpool_template): Add variant of add
5829 which takes a std::basic_string.
5830 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5831 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5832 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5833 (ver_test_12.o): New target.
5834 * testsuite/Makefile.in: Rebuild.
5836 2011-06-27 Doug Kwan <dougkwan@google.com>
5838 * arm.cc (Arm_relocate_functions::thm_jump8,
5839 Arm_relocate_functions::thm_jump11): Use a wider signed
5840 type to compute offset.
5841 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5843 * testsuite/Makefile.in: Regenerate.
5844 * testsuite/arm_branch_in_range.sh: Check test results of
5845 arm_thm_jump11 and arm_thm_jump8.
5846 * testsuite/arm_thm_jump11.s: New test source file.
5847 * testsuite/arm_thm_jump11.t: New linker script.
5848 * testsuite/arm_thm_jump8.s: New test source file.
5849 * testsuite/arm_thm_jump8.t: New linker script.
5851 2011-06-24 Ian Lance Taylor <iant@google.com>
5853 * layout.cc: Include "object.h".
5854 (ctors_sections_in_init_array): New static variable.
5855 (Layout::is_ctors_in_init_array): New function.
5856 (Layout::layout): Add entry to ctors_sections_in_init_array if
5858 * layout.h (class Layout): Declare is_ctors_in_init_array.
5859 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5860 is_ctors_reverse_view is set.
5861 (Sized_relobj_file::write_sections): Add layout parameter. Change
5862 all callers. Set is_ctors_reverse_view field of View_size.
5863 (Sized_relobj_file::reverse_words): New function.
5864 * object.h (Sized_relobj_file::View_size): Add
5865 is_ctors_reverse_view field.
5866 (class Sized_relobj_file): Update declarations.
5867 * testsuite/initpri3.c: New test.
5868 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5870 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5871 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5872 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5873 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5874 * testsuite/Makefile.in: Rebuild.
5876 2011-06-24 Cary Coutant <ccoutant@google.com>
5878 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5879 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5880 (debug_msg_cdebug.err): New targets.
5881 * testsuite/Makefile.in: Regenerate.
5882 * testsuite/debug_msg.sh: Check output of link with compressed debug.
5883 Fix checks for link with shared library.
5885 2011-06-24 Doug Kwan <dougkwan@google.com>
5887 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5888 skip empty text sections.
5889 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5891 2011-06-22 Ian Lance Taylor <iant@google.com>
5894 * options.h (class General_options): Add --ctors-in-init-array.
5895 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5896 friends as SHT_PROGBITS for merging sections.
5897 (Layout::layout): Remove special handling of .init_array and
5898 friends. Don't sort if doing relocatable link. Sort for .ctors
5899 and .dtors if ctors_in_init_array.
5900 (Layout::make_output_section): Force correct section types for
5901 .init_array and friends. Don't sort if doing relocatable link,
5902 Don't sort .ctors and .dtors if ctors_in_init_array.
5903 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5904 (Layout::output_section_name): Add relobj parameter. Change all
5905 callers. Handle .ctors. and .dtors. in code rather than table.
5906 Handle .ctors and .dtors if ctors_in_init_array.
5907 (Layout::match_file_name): New function, moved from output.cc.
5908 * layout.h (class Layout): Update declarations.
5909 * output.cc: Include "layout.h".
5910 (Input_section_sort_entry::get_priority): New function.
5911 (Input_section_sort_entry::match_file_name): Just call
5912 Layout::match_file_name.
5913 (Output_section::Input_section_sort_init_fini_compare::operator()):
5914 Handle .ctors and .dtors. Sort by explicit priority rather than
5916 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5917 * testsuite/initpri2.c: New test.
5918 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5919 (check_PROGRAMS): Add initpri2.
5920 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5921 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5922 * configure, testsuite/Makefile.in: Rebuild.
5924 2011-06-19 Ian Lance Taylor <iant@google.com>
5927 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5928 .interp section to a PT_INTERP segment even if we have seen a
5929 --dynamic-linker option. Don't do it if we have seen a PHDRS
5930 clause in a linker script.
5931 (Layout::finalize): Don't create a .interp section if we've
5932 already create a PT_INTERP segment.
5933 (Layout::create_interp): Always call choose_output_section (revert
5934 patch of 2011-06-17). Don't create PT_INTERP segment.
5935 * script-sections.cc
5936 (Script_sections::create_note_and_tls_segments): Add a .interp
5937 section to a PT_INTERP segment even if we have seen a
5938 --dynamic-linker option.
5940 2011-06-18 Ian Lance Taylor <iant@google.com>
5942 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5943 merely because a non-PT_LOAD segment has a dynamic reloc.
5945 2011-06-18 Ian Lance Taylor <iant@google.com>
5947 * layout.cc (Layout::finish_dynamic_section): Don't create
5948 DT_FLAGS entry if not needed.
5950 2011-06-18 Ian Lance Taylor <iant@google.com>
5953 * layout.cc (Layout::layout_eh_frame): Correct handling of
5954 writable .eh_frame section.
5956 2011-06-17 Ian Lance Taylor <iant@google.com>
5959 * resolve.cc (Symbol_table::resolve): Don't give an error if a
5960 symbol is redefined with the exact same object and value.
5962 2011-06-17 Ian Lance Taylor <iant@google.com>
5965 * layout.h (class Layout): Add interp_segment_ field.
5966 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5967 (Layout::attach_allocated_section_to_segment): If making shared
5968 library, put .interp section in PT_INTERP segment.
5969 (Layout::finalize): Also call create_interp if -dynamic-linker
5971 (Layout::create_interp): Assert that there is no PT_INTERP
5972 segment. If not using a SECTIONS clause, use make_output_section.
5973 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5974 * script-sections.cc
5975 (Script_sections::create_note_and_tls_segments): If making shared
5976 library, put .interp section in PT_INTERP segment.
5978 2011-06-17 Ian Lance Taylor <iant@google.com>
5980 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5981 when making a shared library.
5983 2011-06-17 Ian Lance Taylor <iant@google.com>
5985 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5986 parameter. Change all callers. Don't issue warning about PC32
5987 against locally defined symbol.
5989 2011-06-16 Ian Lance Taylor <iant@google.com>
5991 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5992 occurs in same object.
5994 2011-06-14 Alan Modra <amodra@gmail.com>
5996 * po/POTFILES.in: Regenerate.
5998 2011-06-09 Ian Lance Taylor <iant@google.com>
6000 * script-sections.cc
6001 (Orphan_output_section::set_section_addresses): For a relocatable
6002 link set address to 0.
6004 2011-06-09 Cary Coutant <ccoutant@google.com>
6007 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6008 used with --compress-debug-sections.
6009 * gold/object.cc (Sized_relobj_file::do_layout): Report
6010 uncompressed size of compressed input sections.
6012 2011-06-08 Cary Coutant <ccoutant@google.com>
6015 * testsuite/two_file_test_2_v1.cc: Change initialization of
6016 v2 to keep it in .data.
6018 2011-06-07 Cary Coutant <ccoutant@google.com>
6020 * common.cc (Symbol_table::do_allocate_commons_list): Call
6022 * errors.cc (Errors::fatal): Adjust call to gold_exit.
6023 (Errors::fallback): New function.
6024 (gold_fallback): New function.
6025 * errors.h (Errors::fallback): New function.
6026 * gold.cc (gold_exit): Change status parameter to enum; adjust
6028 (queue_initial_tasks): Call gold_fallback.
6029 * gold.h: Include cstdlib.
6030 (Exit_status): New enum type.
6031 (gold_exit): Change status parameter to enum.
6032 (gold_fallback): New function.
6033 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6034 (Layout::create_symtab_sections): Likewise.
6035 (Layout::create_shdrs): Likewise.
6036 * main.cc (main): Adjust call to gold_exit.
6037 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6038 (Output_data_got::add_got_entry_pair): Likewise.
6039 (Output_section::add_input_section): Likewise.
6040 (Output_section::add_output_section_data): Likewise.
6041 (Output_segment::set_section_list_addresses): Likewise.
6042 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6044 2011-06-07 Cary Coutant <ccoutant@google.com>
6046 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6047 for incremental links.
6048 * output.cc (Output_segment::set_section_list_addresses): Remove
6049 FIXME and test for TLS or BSS.
6051 2011-06-07 Cary Coutant <ccoutant@google.com>
6053 * testsuite/Makefile.am: Add incremental_copy_test,
6054 incremental_common_test_1.
6055 * testsuite/Makefile.in: Regenerate.
6056 * testsuite/common_test_1_v1.c: New source file.
6057 * testsuite/common_test_1_v2.c: New source file.
6058 * testsuite/copy_test_v1.cc: New source file.
6060 2011-06-07 Cary Coutant <ccoutant@google.com>
6062 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6063 update, allocate common from bss section's free list.
6064 * incremental-dump.cc (dump_incremental_inputs): Print flag for
6065 linker-defined symbols.
6066 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6067 Skip GOT and PLT entries that are no longer referenced.
6068 (Output_section_incremental_inputs::write_info_blocks): Mark
6069 linker-defined symbols.
6070 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6071 * output.cc (Output_section::allocate): New function.
6072 * output.h (Output_section::allocate): New function.
6073 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6074 linker-defined symbols.
6075 (Symbol::override_base_with_special): Copy is_predefined_ flag.
6076 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6077 (Symbol::init_base_output_data): Likewise.
6078 (Symbol::init_base_output_segment): Likewise.
6079 (Symbol::init_base_constant): Likewise.
6080 (Sized_symbol::init_output_data): Likewise.
6081 (Sized_symbol::init_output_segment): Likewise.
6082 (Sized_symbol::init_constant): Likewise.
6083 (Symbol_table::do_define_in_output_data): Likewise.
6084 (Symbol_table::do_define_in_output_segment): Likewise.
6085 (Symbol_table::do_define_as_constant): Likewise.
6086 * symtab.h (Symbol::is_predefined): New function.
6087 (Symbol::init_base_output_data): Add is_predefined parameter.
6088 (Symbol::init_base_output_segment): Likewise.
6089 (Symbol::init_base_constant): Likewise.
6090 (Symbol::is_predefined_): New data member.
6091 (Sized_symbol::init_output_data): Add is_predefined parameter.
6092 (Sized_symbol::init_output_segment): Likewise.
6093 (Sized_symbol::init_constant): Likewise.
6094 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6096 2011-06-07 Cary Coutant <ccoutant@google.com>
6098 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6099 instead of emit_copy_reloc.
6100 (Copy_relocs::emit_copy_reloc): Refactor.
6101 (Copy_relocs::make_copy_reloc): New function.
6102 (Copy_relocs::add_copy_reloc): Remove.
6103 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6105 (Copy_relocs::make_copy_reloc): New function.
6106 (Copy_relocs::add_copy_reloc): Remove.
6107 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6108 unchanged input files.
6109 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6110 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6111 Reserve BSS space for COPY relocations.
6112 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6113 (Output_section_incremental_inputs::write_info_blocks): Record
6114 whether a symbol is copied from a shared object.
6115 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6116 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6117 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6118 (Incremental_input_entry_reader::get_output_symbol_index): Add
6120 (Incremental_binary::emit_copy_relocs): New function.
6121 (Incremental_binary::do_emit_copy_relocs): New function.
6122 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6124 (Sized_incremental_binary::add_copy_reloc): New function.
6125 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6126 (Sized_incremental_binary::Copy_reloc): New struct.
6127 (Sized_incremental_binary::Copy_relocs): New typedef.
6128 (Sized_incremental_binary::copy_relocs_): New data member.
6129 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6130 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6131 * target.h (Sized_target::emit_copy_reloc): New function.
6132 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6134 2011-06-02 Cary Coutant <ccoutant@google.com>
6137 * gold/archive.cc (Archive::Archive): Initialize new data member.
6138 (Archive::include_all_members): Return if archive has already been
6140 * gold/archive.h (Archive::include_all_members_): New data member.
6142 2011-06-02 Nick Clifton <nickc@redhat.com>
6144 * dynobj.h: Fix spelling mistake in comment.
6145 * output.cc: Likewise.
6147 2011-05-31 Doug Kwan <dougkwan@google.com>
6151 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6152 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6153 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
6154 redundant arm_exidx_test.so.
6155 * testsuite/Makefile.in: Regenerate.
6156 (check_SCRIPTS): Add pr12826.sh
6157 (check_DATA): Add pr12826.stdout
6158 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6159 * testsuite/pr12826.sh: New file.
6160 * testsuite/pr12826_1.s: Ditto.
6161 * testsuite/pr12826_1.s: Ditto.
6163 2011-05-30 Ian Lance Taylor <iant@google.com>
6165 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6168 2011-05-29 Ian Lance Taylor <iant@google.com>
6171 * testsuite/Makefile.am: Use different file name for two_file_test
6172 temporary file for each incremental test.
6173 * testsuite/Makefile.in: Rebuild.
6175 2011-05-29 Ian Lance Taylor <iant@google.com>
6177 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6178 binary input file is empty.
6180 2011-05-27 Ian Lance Taylor <iant@google.com>
6182 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6183 (ver_test_9.so): Likewise.
6184 * testsuite/Makefile.in: Rebuild.
6186 2011-05-26 Cary Coutant <ccoutant@google.com>
6188 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6189 * incremental.cc (Incremental_inputs::report_input_section): Fix
6190 comment, indentation.
6191 (Incremental_inputs::report_comdat_group): New function.
6192 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6193 of data for incremental input file entry.
6194 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6195 group count, COMDAT group signatures.
6196 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6197 an unchanged input file.
6198 * incremental.h (Incremental_object_entry::Incremental_object_entry):
6199 Initialize new data member.
6200 (Incremental_object_entry::add_comdat_group): New function.
6201 (Incremental_object_entry::get_comdat_group_count): New function.
6202 (Incremental_object_entry::get_comdat_signature_key): New function.
6203 (Incremental_object_entry::groups_): New data member.
6204 (Incremental_inputs::report_comdat_group): New function.
6205 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6206 data for incremental input file entry.
6207 (Incremental_input_entry_reader::get_comdat_group_count): New function.
6208 (Incremental_input_entry_reader::get_input_section): Adjust size of
6209 data for incremental input file entry.
6210 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6211 (Incremental_input_entry_reader::get_comdat_group_signature): New
6213 * object.cc (Sized_relobj::include_section_group): Report kept
6214 COMDAT groups for incremental links.
6216 2011-05-24 David Meyer <pdox@google.com>
6218 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6219 with name parameter. Add found_name parameter.
6220 * fileread.cc (Input_file::find_file): Adjust code accordingly.
6221 * dirsearch.h (class Dirsearch): Update declaration.
6223 2011-05-24 Ian Lance Taylor <iant@google.com>
6225 * archive.cc (Library_base::should_include_member): Pull in object
6226 from archive if it defines the entry symbol.
6227 * parameters.cc (Parameters::entry): New function.
6228 * parameters.h (class Parameters): Declare entry.
6229 * output.h (class Output_file_header): Remove entry_ field.
6230 * output.cc (Output_file_header::Output_file_header): Remove entry
6231 parameter. Change all callers.
6232 (Output_file_header::entry): Use parameters->entry.
6233 * gold.cc (queue_middle_tasks): Likewise.
6234 * plugin.cc (Plugin_hook::run): Likewise.
6236 2011-05-24 Cary Coutant <ccoutant@google.com>
6238 * gold.cc (queue_initial_tasks): Pass incremental base filename
6239 to Output_file::open_base_file; don't print error message.
6240 * incremental-dump.cc (main): Adjust call to
6241 Output_file::open_for_modification.
6242 * incremental-dump.cc (main): Likewise.
6243 * incremental.cc (Incremental_inputs::report_command_line):
6244 Ignore --incremental-base option when comparing command lines.
6245 Ignore parameter when given as separate argument.
6246 * options.h (class General_options): Add --incremental-base.
6247 * output.cc (Output_file::Output_file):
6248 (Output_file::open_base_file): Add base_name and writable parameters;
6249 read base file into new file; print error message here.
6250 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6252 * output.h (Output_file::open_for_modification): Rename to...
6253 (Output_file::open_base_file): ...this; add base_name and
6254 writable parameters; adjust all callers.
6255 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6257 * testsuite/Makefile.am (incremental_test_4): Test
6259 * testsuite/Makefile.in: Regenerate.
6261 2011-05-24 Cary Coutant <ccoutant@google.com>
6263 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6265 * testsuite/Makefile.in: Regenerate.
6266 * testsuite/two_file_test_1_v1.cc: New test source file.
6267 * testsuite/two_file_test_1b_v1.cc: New test source file.
6268 * testsuite/two_file_test_2_v1.cc: New test source file.
6270 2011-05-24 Cary Coutant <ccoutant@google.com>
6272 * dynobj.h (Dynobj::do_dynobj): New function.
6273 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6274 flag and soname for shared objects.
6275 * incremental.cc (Incremental_inputs::report_object): Make
6276 either Incremental_object_entry or Incremental_dynobj_entry; add
6277 soname to string table.
6278 (Incremental_inputs::report_input_section): Add assertion.
6279 (Output_section_incremental_inputs::set_final_data_size): Adjust
6280 type of input file entry for shared libraries; adjust size of
6281 shared library info entry.
6282 (Output_section_incremental_inputs::write_input_files): Write
6283 as_needed flag for shared libraries.
6284 (Output_section_incremental_inputs::write_info_blocks): Adjust type
6285 of input file entry for shared libraries; write soname.
6286 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6287 soname from incremental info.
6288 * incremental.h (enum Incremental_input_flags): Add
6289 INCREMENTAL_INPUT_AS_NEEDED.
6290 (Incremental_input_entry::Incremental_input_entry): Initialize new
6292 (Incremental_input_entry::set_as_needed): New function.
6293 (Incremental_input_entry::as_needed): New function.
6294 (Incremental_input_entry::do_dynobj_entry): New function.
6295 (Incremental_input_entry::as_needed_): New data member.
6296 (Incremental_object_entry::Incremental_object_entry): Don't check
6298 (Incremental_object_entry::do_type): Likewise.
6299 (class Incremental_dynobj_entry): New class.
6300 (Incremental_input_entry_reader::as_needed): New function.
6301 (Incremental_input_entry_reader::get_soname): New function.
6302 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6303 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6304 size of shared library info entry.
6305 * layout.cc (Layout::finish_dynamic_section): Don't test for
6306 incremental link when adding DT_NEEDED entries.
6307 * object.h (Object::Object): Initialize new data member.
6308 (Object::dynobj): New function.
6309 (Object::set_as_needed): New function.
6310 (Object::as_needed): New function.
6311 (Object::do_dynobj): New function.
6312 (Object::as_needed_): New data member.
6314 2011-05-24 Cary Coutant <ccoutant@google.com>
6316 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6317 info; adjust display of GOT entries.
6318 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6319 vector of input objects; remove file_status_.
6320 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6321 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6322 got_plt reader; call target hooks to reserve GOT entries.
6323 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6324 of input file info header and GOT info entry.
6325 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6327 (Got_plt_view_info::got_descriptor): Remove.
6328 (Got_plt_view_info::sym_index): New data member.
6329 (Got_plt_view_info::input_index): New data member.
6330 (Local_got_offset_visitor::visit): Write input file index.
6331 (Global_got_offset_visitor::visit): Write 0 for input file index.
6332 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6333 with sym_index and input_index.
6334 (Output_section_incremental_inputs::write_got_plt): Adjust size of
6335 incremental info GOT entry; replace got_descriptor with input_index.
6336 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6337 map from input file index to object.
6338 (Sized_relobj_incr::do_layout): Replace direct data member reference
6339 with accessor function.
6340 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6341 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6342 Adjust size of input file info header.
6343 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6344 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6345 (Incremental_input_entry_reader::get_input_section): Adjust size of
6346 input file info header.
6347 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6348 of incremental info GOT entry.
6349 (Incremental_got_plt_reader::get_got_desc): Remove.
6350 (Incremental_got_plt_reader::get_got_symndx): New function.
6351 (Incremental_got_plt_reader::get_got_input_index): New function.
6352 (Sized_incremental_binary::Sized_incremental_binary): Remove
6353 file_status_; add input_objects_.
6354 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6355 (Sized_incremental_binary::set_file_is_unchanged): Remove.
6356 (Sized_incremental_binary::file_is_unchanged): Remove.
6357 (Sized_incremental_binary::set_input_object): New function.
6358 (Sized_incremental_binary::input_object): New function.
6359 (Sized_incremental_binary::file_status_): Remove.
6360 (Sized_incremental_binary::input_objects_): New data member.
6361 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6363 (Sized_relobj_incr::invalid_address): Move to base class.
6364 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6366 (Sized_relobj_incr::do_output_section_offset): Likewise.
6367 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6368 (Sized_relobj_incr::section_offsets_): Likewise.
6369 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6371 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6372 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6373 with accessor function.
6374 (Sized_relobj_file::do_layout): Likewise.
6375 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6376 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6377 (Sized_relobj_file::compute_final_local_value): Replace refs to
6378 section_offsets_ with accessor function.
6379 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6380 * object.h (Relobj::Relobj): Initialize new data members.
6381 (Relobj::add_dyn_reloc): New function.
6382 (Relobj::first_dyn_reloc): New function.
6383 (Relobj::dyn_reloc_count): New function.
6384 (Relobj::first_dyn_reloc_): New data member.
6385 (Relobj::dyn_reloc_count_): New data member.
6386 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6388 (Sized_relobj::Address): New typedef.
6389 (Sized_relobj::invalid_address): Move here from child class.
6390 (Sized_relobj::Sized_relobj): Initialize new data members.
6391 (Sized_relobj::sized_relobj): New function.
6392 (Sized_relobj::is_output_section_offset_invalid): Move here from
6394 (Sized_relobj::get_output_section_offset): Likewise.
6395 (Sized_relobj::local_has_got_offset): Likewise.
6396 (Sized_relobj::local_got_offset): Likewise.
6397 (Sized_relobj::set_local_got_offset): Likewise.
6398 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6399 (Sized_relobj::clear_got_offsets): New function.
6400 (Sized_relobj::section_offsets): Move here from child class.
6401 (Sized_relobj::do_output_section_offset): Likewise.
6402 (Sized_relobj::do_set_section_offset): Likewise.
6403 (Sized_relobj::Local_got_offsets): Likewise.
6404 (Sized_relobj::local_got_offsets_): Likewise.
6405 (Sized_relobj::section_offsets_): Likewise.
6406 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6408 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6410 (Sized_relobj_file::sized_relobj): New function
6411 (Sized_relobj_file::local_has_got_offset): Move to base class.
6412 (Sized_relobj_file::local_got_offset): Likewise.
6413 (Sized_relobj_file::set_local_got_offset): Likewise.
6414 (Sized_relobj_file::get_output_section_offset): Likewise.
6415 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6416 (Sized_relobj_file::do_output_section_offset): Likewise.
6417 (Sized_relobj_file::do_set_section_offset): Likewise.
6418 (Sized_relobj_file::Local_got_offsets): Likewise.
6419 (Sized_relobj_file::local_got_offsets_): Likewise.
6420 (Sized_relobj_file::section_offsets_): Likewise.
6421 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6423 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6424 (Output_reloc::get_symbol_index): Likewise.
6425 (Output_reloc::local_section_offset): Likewise.
6426 (Output_reloc::get_address): Likewise.
6427 (Output_reloc::symbol_value): Likewise.
6428 (Output_data_got::reserve_slot): Move to class definition.
6429 (Output_data_got::reserve_local): New function.
6430 (Output_data_got::reserve_slot_for_global): Remove.
6431 (Output_data_got::reserve_global): New function.
6432 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6433 (all constructors, two instantiations).
6434 (Output_reloc::get_relobj): New function (two instantiations).
6435 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6436 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6437 (Output_data_reloc::add_global): Adjust type of relobj.
6438 (Output_data_reloc::add_global_relative): Likewise.
6439 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6440 (Output_data_reloc::add_local): Likewise.
6441 (Output_data_reloc::add_local_relative): Likewise.
6442 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6443 (Output_data_reloc::add_local_section): Likewise.
6444 (Output_data_reloc::add_output_section): Likewise.
6445 (Output_data_reloc::add_absolute): Likewise.
6446 (Output_data_reloc::add_target_specific): Likewise.
6447 (Output_data_got::reserve_slot): Move definition here.
6448 (Output_data_got::reserve_local): New function.
6449 (Output_data_got::reserve_global): New function.
6450 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6451 section_offsets_ with accessor function.
6452 (Sized_relobj_file::write_sections): Likewise.
6453 (Sized_relobj_file::do_relocate_sections): Likewise.
6454 * target.h (Sized_target::reserve_local_got_entry): New function.
6455 (Sized_target::reserve_global_got_entry): New function.
6456 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6457 (Target_x86_64::reserve_global_got_entry): New function.
6458 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6460 2011-05-23 Cary Coutant <ccoutant@google.com>
6462 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6463 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6464 bit when checking got_type.
6465 * incremental.cc (Sized_incremental_binary::setup_readers):
6466 Store symbol table and string table locations; initialize bit vector
6467 of file status flags.
6468 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6470 (Sized_incremental_binary::do_process_got_plt): New function.
6471 (Sized_incremental_binary::get_symtab_view): Use stored locations.
6472 (Output_section_incremental_inputs::set_final_data_size): Record
6473 file index for each input file.
6474 (Output_section_incremental_inputs::write_got_plt): Store file index
6475 instead of input entry offset for each GOT entry.
6477 (Incremental_input_entry::Incremental_input_entry): Initialize new
6479 (Incremental_input_entry::set_offset): Store file index.
6480 (Incremental_input_entry::get_file_index): New function.
6481 (Incremental_input_entry::file_index_): New data member.
6482 (Incremental_binary::process_got_plt): New function.
6483 (Incremental_binary::do_process_got_plt): New function.
6484 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6486 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6487 (Sized_incremental_binary::set_file_is_unchanged): New function.
6488 (Sized_incremental_binary::file_is_unchanged): New function.
6489 (Sized_incremental_binary::do_process_got_plt): New function.
6490 (Sized_incremental_binary::file_status_): New data member.
6491 (Sized_incremental_binary::main_symtab_loc_): New data member.
6492 (Sized_incremental_binary::main_strtab_loc_): New data member.
6493 * output.cc (Output_data_got::Got_entry::write): Add case
6495 (Output_data_got::add_global): Call add_got_entry.
6496 (Output_data_got::add_global_plt): Likewise.
6497 (Output_data_got::add_global_with_rel): Likewise.
6498 (Output_data_got::add_global_with_rela): Likewise.
6499 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6500 (Output_data_got::add_global_pair_with_rela): Likewise.
6501 (Output_data_got::add_local): Call add_got_entry.
6502 (Output_data_got::add_local_plt): Likewise.
6503 (Output_data_got::add_local_with_rel): Likewise.
6504 (Output_data_got::add_local_with_rela): Likewise.
6505 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6506 (Output_data_got::add_local_pair_with_rela): Likewise.
6507 (Output_data_got::reserve_slot): New function.
6508 (Output_data_got::reserve_slot_for_global): New function.
6509 (Output_data_got::add_got_entry): New function.
6510 (Output_data_got::add_got_entry_pair): New function.
6511 (Output_section::add_output_section_data): Edit FIXME.
6513 (Output_section_data_build::Output_section_data_build): New
6514 constructor with size parameter.
6515 (Output_data_space::Output_data_space): Likewise.
6516 (Output_data_got::Output_data_got): Initialize new data member; new
6517 constructor with size parameter.
6518 (Output_data_got::add_constant): Call add_got_entry.
6519 (Output_data_got::reserve_slot): New function.
6520 (Output_data_got::reserve_slot_for_global): New function.
6521 (class Output_data_got::Got_entry): Add RESERVED_CODE.
6522 (Output_data_got::add_got_entry): New function.
6523 (Output_data_got::add_got_entry_pair): New function.
6524 (Output_data_got::free_list_): New data member.
6525 * target.h (Sized_target::init_got_plt_for_update): New function.
6526 (Sized_target::register_global_plt_entry): New function.
6527 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6528 Initialize new data member; call init; add constructor with PLT count.
6529 (Output_data_plt_x86_64::init): New function.
6530 (Output_data_plt_x86_64::add_relocation): New function.
6531 (Output_data_plt_x86_64::reserve_slot): New function.
6532 (Output_data_plt_x86_64::free_list_): New data member.
6533 (Target_x86_64::init_got_plt_for_update): New function.
6534 (Target_x86_64::register_global_plt_entry): New function.
6535 (Output_data_plt_x86_64::add_entry): Allocate from free list for
6536 incremental updates.
6537 (Output_data_plt_x86_64::add_relocation): New function.
6538 * testsuite/object_unittest.cc (Object_test): Set default options.
6540 2011-05-16 Ian Lance Taylor <iant@google.com>
6542 * options.h (class General_options): Make -i a synonym for -r.
6544 2011-05-16 Ian Lance Taylor <iant@google.com>
6546 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6548 2011-05-10 Cary Coutant <ccoutant@google.com>
6550 * object.cc (Sized_relobj::do_count_local_symbols): Check for
6553 2011-05-06 Ian Lance Taylor <iant@google.com>
6555 * layout.cc (Layout::layout): If the output section flags change,
6556 update the ordering.
6558 2011-04-25 Cary Coutant <ccoutant@google.com>
6560 * incremental-dump.cc (dump_incremental_inputs): Print local
6561 symbol info for each input file.
6563 (Output_section_incremental_inputs::set_final_data_size): Add local
6564 symbol info to input file entries in incremental info.
6565 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6566 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6567 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6568 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6570 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6571 (Sized_incr_relobj::do_relocate): Write the local symbols.
6572 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6573 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6574 Adjust size of input file header.
6575 (Incremental_inputs_reader::get_local_symbol_offset): New function.
6576 (Incremental_inputs_reader::get_local_symbol_count): New function.
6577 (Incremental_inputs_reader::get_input_section): Adjust size of input
6579 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6580 (Sized_incr_relobj::This): New typedef.
6581 (Sized_incr_relobj::sym_size): New const data member.
6582 (Sized_incr_relobj::Local_symbol): New struct.
6583 (Sized_incr_relobj::do_output_local_symbol_count): New function.
6584 (Sized_incr_relobj::do_local_symbol_offset): New function.
6585 (Sized_incr_relobj::local_symbol_count_): New data member.
6586 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6587 (Sized_incr_relobj::local_symbol_index_): New data member.
6588 (Sized_incr_relobj::local_symbol_offset_): New data member.
6589 (Sized_incr_relobj::local_dynsym_offset_): New data member.
6590 (Sized_incr_relobj::local_symbols_): New data member.
6591 * object.h (Relobj::output_local_symbol_count): New function.
6592 (Relobj::local_symbol_offset): New function.
6593 (Relobj::do_output_local_symbol_count): New function.
6594 (Relobj::do_local_symbol_offset): New function.
6595 (Sized_relobj::do_output_local_symbol_count): New function.
6596 (Sized_relobj::do_local_symbol_offset): New function.
6598 2011-04-22 Vladimir Simonov <sv@sw.ru>
6600 * descriptors.cc (set_close_on_exec): New function.
6601 (Descriptors::open): Use set_close_on_exec.
6602 * output.cc (S_ISLNK): Define if not defined.
6604 2011-04-22 Cary Coutant <ccoutant@google.com>
6606 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6608 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6609 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6610 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6612 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6613 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6614 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6616 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6618 (Incremental_binary::apply_incremental_relocs): New function.
6619 (Incremental_binary::do_apply_incremental_relocs): New function.
6620 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6622 (Sized_incremental_binary::add_global_symbol): New function.
6623 (Sized_incremental_binary::global_symbol): New function.
6624 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6625 (Sized_incremental_binary::symbol_map_): New data member.
6626 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6627 * target.h (Sized_target::apply_relocation): New function.
6628 * target-reloc.h (apply_relocation): New function.
6629 * x86_64.cc (Target_x86_64::apply_relocation): New function.
6631 2011-04-22 Doug Kwan <dougkwan@google.com>
6633 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6634 flag of a SHT_ARM_EXIDX section.
6635 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6636 * testsuite/Makefile.in: Regenerate.
6637 * testsuite/arm_exidx_test.s: New file.
6638 * testsuite/arm_exidx_test.sh: Same.
6640 2011-04-20 Cary Coutant <ccoutant@google.com>
6643 * archive.h (Incremental_archive_entry::Archive_member):
6644 Initialize arg_serial_ (second constructor).
6646 2011-04-17 Ian Lance Taylor <iant@google.com>
6648 * object.cc (Relocate_info::location): Simplify location string.
6649 * errors.cc (Errors::error_at_location): Don't print program
6651 (Errors::warning_at_location): Likewise.
6652 (Errors::undefined_symbol): Likewise.
6653 * testsuite/debug_msg.sh: Update accordingly.
6655 2011-04-14 Cary Coutant <ccoutant@google.com>
6657 * gold/layout.cc (Layout::symtab_section_offset): New function.
6658 * gold/layout.h (Layout::symtab_section_offset): New function.
6659 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6661 2011-04-12 Ian Lance Taylor <iant@google.com>
6663 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
6664 with MREMAP_MAYMOVE.
6665 * output.h (class Output_file): Add map_is_allocated_ field.
6666 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
6667 not available, provide stubs. If mremap is not available, #define
6669 (MREMAP_MAYMOVE): Define if not defined.
6670 (Output_file::Output_file): Initialize map_is_allocated_.
6671 (Output_file::resize): Check map_is_allocated_.
6672 (Output_file::map_anonymous): If mmap fails, use malloc.
6673 (Output_file::unmap): Don't do anything for an anonymous map.
6674 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
6675 is not available, provide stubs.
6676 (File_read::View::~View): Use free rather than delete[].
6677 (File_read::make_view): Use malloc rather than new[]. If mmap
6679 (File_read::find_or_make_view): Use malloc rather than new[].
6680 * gold.h: Remove HAVE_REMAP code.
6681 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
6682 exists. Rename mremap to gold_mremap. If mmap is not available
6684 * configure, config.in: Rebuild.
6686 2011-04-11 Ian Lance Taylor <iant@google.com>
6688 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6689 initialize local variable v.
6691 2011-04-11 Cary Coutant <ccoutant@google.com>
6693 * archive.cc (Archive::include_member): Adjust call to
6695 (Add_archive_symbols::run): Track argument serial numbers.
6696 (Lib_group::include_member): Likewise.
6697 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6698 * archive.h (Incremental_archive_entry::Archive_member):
6699 Initialize arg_serial_.
6700 (Archive_member::arg_serial_): New data member.
6701 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6702 (Sized_dynobj::do_add_symbols): Track symbols when doing an
6704 (Sized_dynobj::do_for_all_local_got_entries): New function.
6705 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6707 * fileread.cc (get_mtime): New function.
6708 * fileread.h (get_mtime): New function.
6709 * gold.cc (queue_initial_tasks): Check for incremental update.
6710 (process_incremental_input): New function.
6711 (queue_middle_tasks): Don't force valid target for incremental
6713 * incremental-dump.cc (find_input_containing_global): Adjust
6714 size of symbol info entry.
6715 (dump_incremental_inputs): Dump argument serial number and
6716 in_system_directory flag; bias shndx by 1; print symbol names
6717 when dumping per-file symbol lists; use new symbol info readers.
6719 (Output_section_incremental_inputs:update_data_size): New function.
6720 (Sized_incremental_binary::setup_readers): Setup input readers
6721 for each input file; build maps for files added from libraries
6723 (Sized_incremental_binary::check_input_args): New function.
6724 (Sized_incremental_binary::do_check_inputs): Build map of argument
6725 serial numbers to input arguments.
6726 (Sized_incremental_binary::do_file_has_changed): Rename
6727 do_file_is_unchanged to this; compare file modification times.
6728 (Sized_incremental_binary::do_init_layout): New function.
6729 (Sized_incremental_binary::do_reserve_layout): New function.
6730 (Sized_incremental_binary::do_get_input_reader): Remove.
6731 (Sized_incremental_binary::get_symtab_view): New function.
6732 (Incremental_checker::can_incrementally_link_output_file): Remove.
6733 (Incremental_inputs::report_command_line): Exclude --debug options.
6734 (Incremental_inputs::report_archive_begin): Add parameter; track
6735 argument serial numbers; don't put input file entry for archive
6736 before archive members.
6737 (Incremental_inputs::report_archive_end): Put input file entry
6738 for archive after archive members.
6739 (Incremental_inputs::report_object): Add parameter; track argument
6740 serial numbers and in_system_directory flag.
6741 (Incremental_inputs::report_script): Add parameter; track argument
6743 (Output_section_incremental_inputs::set_final_data_size): Adjust
6744 size of symbol info entry; check for forwarding symbols.
6745 (Output_section_incremental_inputs::write_input_files): Write
6746 in_system_directory flag and argument serial number.
6747 (Output_section_incremental_inputs::write_info_blocks): Map section
6748 indices between incremental info and original input file; store
6749 input section index for each symbol.
6750 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6751 change operator() to visit().
6752 (class Global_got_offset_visitor): Likewise.
6753 (class Global_symbol_visitor_got_plt):
6754 (Output_section_incremental_inputs::write_got_plt): Use new visitor
6756 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6757 (Sized_incr_relobj::do_read_symbols): New function.
6758 (Sized_incr_relobj::do_layout): New function.
6759 (Sized_incr_relobj::do_layout_deferred_sections): New function.
6760 (Sized_incr_relobj::do_add_symbols): New function.
6761 (Sized_incr_relobj::do_should_include_member): New function.
6762 (Sized_incr_relobj::do_for_all_global_symbols): New function.
6763 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6764 (Sized_incr_relobj::do_section_size): New function.
6765 (Sized_incr_relobj::do_section_name): New function.
6766 (Sized_incr_relobj::do_section_contents): New function.
6767 (Sized_incr_relobj::do_section_flags): New function.
6768 (Sized_incr_relobj::do_section_entsize): New function.
6769 (Sized_incr_relobj::do_section_address): New function.
6770 (Sized_incr_relobj::do_section_type): New function.
6771 (Sized_incr_relobj::do_section_link): New function.
6772 (Sized_incr_relobj::do_section_info): New function.
6773 (Sized_incr_relobj::do_section_addralign): New function.
6774 (Sized_incr_relobj::do_initialize_xindex): New function.
6775 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6776 (Sized_incr_relobj::do_read_relocs): New function.
6777 (Sized_incr_relobj::do_gc_process_relocs): New function.
6778 (Sized_incr_relobj::do_scan_relocs): New function.
6779 (Sized_incr_relobj::do_count_local_symbols): New function.
6780 (Sized_incr_relobj::do_finalize_local_symbols): New function.
6781 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6782 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6783 (Sized_incr_relobj::do_relocate): New function.
6784 (Sized_incr_relobj::do_set_section_offset): New function.
6785 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6786 (Sized_incr_dynobj::do_read_symbols): New function.
6787 (Sized_incr_dynobj::do_layout): New function.
6788 (Sized_incr_dynobj::do_add_symbols): New function.
6789 (Sized_incr_dynobj::do_should_include_member): New function.
6790 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6791 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6792 (Sized_incr_dynobj::do_section_size): New function.
6793 (Sized_incr_dynobj::do_section_name): New function.
6794 (Sized_incr_dynobj::do_section_contents): New function.
6795 (Sized_incr_dynobj::do_section_flags): New function.
6796 (Sized_incr_dynobj::do_section_entsize): New function.
6797 (Sized_incr_dynobj::do_section_address): New function.
6798 (Sized_incr_dynobj::do_section_type): New function.
6799 (Sized_incr_dynobj::do_section_link): New function.
6800 (Sized_incr_dynobj::do_section_info): New function.
6801 (Sized_incr_dynobj::do_section_addralign): New function.
6802 (Sized_incr_dynobj::do_initialize_xindex): New function.
6803 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6804 (make_sized_incremental_object): New function.
6805 (Incremental_library::copy_unused_symbols): New function.
6806 (Incremental_library::do_for_all_unused_symbols): New function.
6807 * incremental.h (enum Incremental_input_flags): New type.
6808 (class Incremental_checker): Remove.
6809 (Incremental_input_entry::Incremental_input_entry): Add argument
6811 (Incremental_input_entry::arg_serial): New function.
6812 (Incremental_input_entry::set_is_in_system_directory): New function.
6813 (Incremental_input_entry::is_in_system_directory): New function.
6814 (Incremental_input_entry::arg_serial_): New data member.
6815 (Incremental_input_entry::is_in_system_directory_): New data member.
6816 (class Script_info): Move here from script.h.
6817 (Script_info::Script_info): Add filename parameter.
6818 (Script_info::filename): New function.
6819 (Script_info::filename_): New data member.
6820 (Incremental_script_entry::Incremental_script_entry): Add argument
6822 (Incremental_object_entry::Incremental_object_entry): Likewise.
6823 (Incremental_object_entry::add_input_section): Build list of input
6824 sections with map to original shndx.
6825 (Incremental_object_entry::get_input_section_index): New function.
6826 (Incremental_object_entry::shndx_): New data member.
6827 (Incremental_object_entry::name_key_): Rename; adjust all refs.
6828 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6829 (Incremental_archive_entry::Incremental_archive_entry): Add argument
6831 (Incremental_inputs::report_archive_begin): Likewise.
6832 (Incremental_inputs::report_object): Likewise.
6833 (Incremental_inputs::report_script): Likewise.
6834 (class Incremental_global_symbol_reader): New class.
6835 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6836 and store flags and input file type.
6837 (Incremental_input_entry_reader::arg_serial): New function.
6838 (Incremental_input_entry_reader::type): Extract type from flags.
6839 (Incremental_input_entry_reader::is_in_system_directory): New function.
6840 (Incremental_input_entry_reader::get_input_section_count): Call
6841 accessor function for type.
6842 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6843 function for type; adjust size of global symbol entry.
6844 (Incremental_input_entry_reader::get_global_symbol_count): Call
6845 accessor function for type.
6846 (Incremental_input_entry_reader::get_object_count): Likewise.
6847 (Incremental_input_entry_reader::get_object_offset): Likewise.
6848 (Incremental_input_entry_reader::get_member_count): Likewise.
6849 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6850 (Incremental_input_entry_reader::get_member_offset): Likewise.
6851 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6852 (Incremental_input_entry_reader::Global_symbol_info): Remove.
6853 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6854 (Incremental_input_entry_reader::get_global_symbol_reader): New
6856 (Incremental_input_entry_reader::get_output_symbol_index): New
6858 (Incremental_input_entry_reader::type_): Remove.
6859 (Incremental_input_entry_reader::flags_): New data member.
6860 (Incremental_inputs_reader::input_file_offset): New function.
6861 (Incremental_inputs_reader::input_file_index): New function.
6862 (Incremental_inputs_reader::input_file): Call input_file_offset.
6863 (Incremental_inputs_reader::input_file_at_offset): New function.
6864 (Incremental_relocs_reader::get_r_type): Reformat.
6865 (Incremental_relocs_reader::get_r_shndx): Reformat.
6866 (Incremental_relocs_reader::get_r_offset): Reformat.
6867 (Incremental_relocs_reader::data): New function.
6868 (Incremental_binary::Incremental_binary): Initialize new data members.
6869 (Incremental_binary::check_inputs): Add cmdline parameter.
6870 (Incremental_binary::file_is_unchanged): Remove.
6871 (Input_reader::arg_serial): New function.
6872 (Input_reader::get_unused_symbol_count): New function.
6873 (Input_reader::get_unused_symbol): New function.
6874 (Input_reader::do_arg_serial): New function.
6875 (Input_reader::do_get_unused_symbol_count): New function.
6876 (Input_reader::do_get_unused_symbol): New function.
6877 (Incremental_binary::input_file_count): New function.
6878 (Incremental_binary::get_input_reader): Change signature to use
6879 index instead of filename.
6880 (Incremental_binary::file_has_changed): New function.
6881 (Incremental_binary::get_input_argument): New function.
6882 (Incremental_binary::get_library): New function.
6883 (Incremental_binary::get_script_info): New function.
6884 (Incremental_binary::init_layout): New function.
6885 (Incremental_binary::reserve_layout): New function.
6886 (Incremental_binary::output_file): New function.
6887 (Incremental_binary::do_check_inputs): New function.
6888 (Incremental_binary::do_file_is_unchanged): Remove.
6889 (Incremental_binary::do_file_has_changed): New function.
6890 (Incremental_binary::do_init_layout): New function.
6891 (Incremental_binary::do_reserve_layout): New function.
6892 (Incremental_binary::do_input_file_count): New function.
6893 (Incremental_binary::do_get_input_reader): Change signature.
6894 (Incremental_binary::input_args_map_): New data member.
6895 (Incremental_binary::library_map_): New data member.
6896 (Incremental_binary::script_map_): New data member.
6897 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6899 (Sized_incremental_binary::output_section): New function.
6900 (Sized_incremental_binary::inputs_reader): Add const.
6901 (Sized_incremental_binary::symtab_reader): Add const.
6902 (Sized_incremental_binary::relocs_reader): Add const.
6903 (Sized_incremental_binary::got_plt_reader): Add const.
6904 (Sized_incremental_binary::get_symtab_view): New function.
6905 (Sized_incremental_binary::Inputs_reader): New typedef.
6906 (Sized_incremental_binary::Input_entry_reader): New typedef.
6907 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6908 (Sized_incremental_binary::do_file_is_unchanged): Remove.
6909 (Sized_incremental_binary::do_file_has_changed): New function.
6910 (Sized_incremental_binary::do_init_layout): New function.
6911 (Sized_incremental_binary::do_reserve_layout): New function.
6912 (Sized_input_reader::Inputs_reader): Remove.
6913 (Sized_input_reader::Input_entry_reader): Remove.
6914 (Sized_input_reader::do_arg_serial): New function.
6915 (Sized_input_reader::do_get_unused_symbol_count): New function.
6916 (Sized_input_reader::do_get_unused_symbol): New function.
6917 (Sized_incremental_binary::do_input_file_count): New function.
6918 (Sized_incremental_binary::do_get_input_reader): Change signature;
6919 use index instead of filename.
6920 (Sized_incremental_binary::section_map_): New data member.
6921 (Sized_incremental_binary::input_entry_readers_): New data member.
6922 (class Sized_incr_relobj): New class.
6923 (class Sized_incr_dynobj): New class.
6924 (make_sized_incremental_object): New function.
6925 (class Incremental_library): New class.
6926 * layout.cc (Free_list::num_lists): New static data member.
6927 (Free_list::num_nodes): New static data member.
6928 (Free_list::num_removes): New static data member.
6929 (Free_list::num_remove_visits): New static data member.
6930 (Free_list::num_allocates): New static data member.
6931 (Free_list::num_allocate_visits): New static data member.
6932 (Free_list::init): New function.
6933 (Free_list::remove): New function.
6934 (Free_list::allocate): New function.
6935 (Free_list::dump): New function.
6936 (Free_list::print_stats): New function.
6937 (Layout_task_runner::run): Resize output file for incremental updates.
6938 (Layout::Layout): Initialize new data members.
6939 (Layout::set_incremental_base): New function.
6940 (Layout::init_fixed_output_section): New function.
6941 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6942 incremental updates.
6943 (Layout::create_gold_note): Do not create gold note section for
6944 incremental updates.
6945 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6946 for incremental updates.
6947 (Layout::set_section_offsets): For incremental updates, allocate space
6949 (Layout::create_symtab_sections): Layout with offsets relative to
6950 start of section; for incremental updates, allocate space from free
6952 (Layout::create_shdrs): For incremental updates, allocate space from
6954 (Layout::finish_dynamic_section): For incremental updates, do not
6955 check --as-needed (fixed in subsequent patch).
6956 * layout.h (class Free_list): New class.
6957 (Layout::set_incremental_base): New function.
6958 (Layout::incremental_base): New function.
6959 (Layout::init_fixed_output_section): New function.
6960 (Layout::allocate): New function.
6961 (Layout::incremental_base_): New data member.
6962 (Layout::free_list_): New data member.
6963 * main.cc (main): Print Free_list statistics.
6964 * object.cc (Relobj::finalize_incremental_relocs): Add
6965 clear_counts parameter; clear counts only when clear_counts is set.
6966 (Sized_relobj::Sized_relobj): Initialize new base class.
6967 (Sized_relobj::do_layout): Don't report special sections.
6968 (Sized_relobj::do_for_all_local_got_entries): New function.
6969 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6970 symtab_off to all symbol table offsets.
6971 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6972 * object.h (class Got_offset_list): Move to top of file.
6973 (Object::Object): Allow case where input_file == NULL.
6974 (Object::~Object): Likewise.
6975 (Object::input_file): Assert that input_file != NULL.
6976 (Object::lock): Allow case where input_file == NULL.
6977 (Object::unlock): Likewise.
6978 (Object::is_locked): Likewise.
6979 (Object::token): Likewise.
6980 (Object::release): Likewise.
6981 (Object::is_incremental): New function.
6982 (Object::get_mtime): New function.
6983 (Object::for_all_local_got_entries): New function.
6984 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6985 (Object::set_is_in_system_directory): New function.
6986 (Object::is_in_system_directory): New function.
6987 (Object::do_is_incremental): New function.
6988 (Object::do_get_mtime): New function.
6989 (Object::do_for_all_local_got_entries): New function.
6990 (Object::is_in_system_directory_): New data member.
6991 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6992 (class Sized_relobj_base): New class.
6993 (class Sized_relobj): Derive from Sized_relobj_base.
6994 (class Sized_relobj::Symbols): Redeclare from base class.
6995 (class Sized_relobj::local_got_offset_list): Remove.
6996 (class Sized_relobj::Output_sections): Redeclare from base class.
6997 (class Sized_relobj::do_for_all_local_got_entries): New function.
6998 (class Sized_relobj::write_local_symbols): Add offset parameter.
6999 (class Sized_relobj::local_symbol_offset_): Update comment.
7000 (class Sized_relobj::local_dynsym_offset_): Update comment.
7001 * options.cc (Input_arguments::add_file): Remove const.
7002 * options.h (Input_file_argument::Input_file_argument):
7003 Initialize arg_serial_ (all constructors).
7004 (Input_file_argument::set_arg_serial): New function.
7005 (Input_file_argument::arg_serial): New function.
7006 (Input_file_argument::arg_serial_): New data member.
7007 (Input_arguments::Input_arguments): Initialize file_count_.
7008 (Input_arguments::add_file): Remove const.
7009 (Input_arguments::number_of_input_files): New function.
7010 (Input_arguments::file_count_): New data member.
7011 (Command_line::number_of_input_files): Call
7012 Input_arguments::number_of_input_files.
7013 * output.cc (Output_segment_headers::Output_segment_headers):
7015 (Output_section::Input_section::current_data_size): New function.
7016 (Output_section::Output_section): Initialize new data members.
7017 (Output_section::add_input_section): Don't do merge sections for
7018 an incremental link; allocate space from free list for an
7020 (Output_section::add_output_section_data): Allocate space from
7021 free list for an incremental update.
7022 (Output_section::update_data_size): New function.
7023 (Output_section::set_fixed_layout): New function.
7024 (Output_section::reserve): New function.
7025 (Output_segment::set_section_addresses): Remove const.
7026 (Output_segment::set_section_list_addresses): Remove const; allocate
7027 space from free list for an incremental update.
7028 (Output_segment::set_offset): Adjust size of RELRO segment for an
7030 * output.h (Output_data::current_data_size): Move here from
7032 (Output_data::pre_finalize_data_size): New function.
7033 (Output_data::update_data_size): New function.
7034 (Output_section_headers::update_data_size): new function.
7035 (Output_section_data_build::current_data_size): Move to Output_data.
7036 (Output_data_strtab::update_data_size): New function.
7037 (Output_section::current_data_size): Move to Output_data.
7038 (Output_section::set_fixed_layout): New function.
7039 (Output_section::has_fixed_layout): New function.
7040 (Output_section::reserve): New function.
7041 (Output_section::update_data_size): New function.
7042 (Output_section::has_fixed_layout_): New data member.
7043 (Output_section::free_list_): New data member.
7044 (Output_segment::set_section_addresses): Remove const.
7045 (Output_segment::set_section_list_addresses): Remove const.
7046 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7048 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7050 * readsyms.cc (Read_symbols::do_read_symbols): Add library
7051 parameter when calling Add_symbols constructor; store argument
7052 serial number for members of a lib group.
7053 (Add_symbols::locks): Allow case where token == NULL.
7054 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7055 (Read_member::~Read_member): New function.
7056 (Read_member::is_runnable): New function.
7057 (Read_member::locks): New function.
7058 (Read_member::run): New function.
7059 (Check_script::~Check_script): New function.
7060 (Check_script::is_runnable): New function.
7061 (Check_script::locks): New function.
7062 (Check_script::run): New function.
7063 (Check_library::~Check_library): New function.
7064 (Check_library::is_runnable): New function.
7065 (Check_library::locks): New function.
7066 (Check_library::run): New function.
7067 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7068 (Add_symbols::library_): New data member.
7069 (class Read_member): New class.
7070 (class Check_script): New class.
7071 (class Check_library): New class.
7072 * reloc.cc (Read_relocs::is_runnable): Allow case where
7074 (Read_relocs::locks): Likewise.
7075 (Scan_relocs::locks): Likewise.
7076 (Relocate_task::locks): Likewise.
7077 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7079 (Sized_relobj::incremental_relocs_scan): Fix comment.
7080 (Sized_relobj::do_relocate): Pass output file offset to
7081 write_local_symbols.
7082 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7083 from class declaration.
7084 * script.cc (read_input_script): Allocate Script_info; pass
7085 argument serial number to report_script.
7086 * script.h (class Script_info): Move to incremental.h.
7087 * symtab.cc (Symbol_table::add_from_incrobj): New function.
7088 * symtab.h (Symbol_table::add_from_incrobj): New function.
7089 (Symbol_table::set_file_offset): New function.
7091 2011-04-05 Cary Coutant <ccoutant@google.com>
7093 * incremental-dump.cc (dump_incremental_inputs): Change signature
7094 to take a Sized_incremental_binary; change caller. Use readers
7095 in Sized_incremental_binary.
7097 (Sized_incremental_binary::find_incremental_inputs_sections):
7098 Rename do_find_incremental_inputs_sections to this.
7099 (Sized_incremental_binary::setup_readers): New function.
7100 (Sized_incremental_binary::do_check_inputs): Check
7101 has_incremental_info_ flag; move setup code to setup_readers;
7103 (Sized_incremental_binary::do_file_is_unchanged): New function.
7104 (Sized_incremental_binary::do_get_input_reader): New function.
7105 * incremental.h (class Incremental_binary): Move to end of file.
7106 (Incremental_binary::file_is_unchanged): New function.
7107 (Incremental_binary::do_file_is_unchanged): New function.
7108 (Incremental_binary::Input_reader): New class.
7109 (Incremental_binary::get_input_reader): New function.
7110 (class Sized_incremental_binary): Move to end of file.
7111 (Sized_incremental_binary::Sized_incremental_binary): Setup the
7112 input section reader classes.
7113 (Sized_incremental_binary::has_incremental_info): New function.
7114 (Sized_incremental_binary::inputs_reader): New function.
7115 (Sized_incremental_binary::symtab_reader): New function.
7116 (Sized_incremental_binary::relocs_reader): New function.
7117 (Sized_incremental_binary::got_plt_reader): New function.
7118 (Sized_incremental_binary::do_file_is_unchanged): New function.
7119 (Sized_incremental_binary::Sized_input_reader): New class.
7120 (Sized_incremental_binary::get_input_reader): New function.
7121 (Sized_incremental_binary::find_incremental_inputs_sections):
7122 Rename do_find_incremental_inputs_sections to this.
7123 (Sized_incremental_binary::setup_readers): New function.
7124 (Sized_incremental_binary::has_incremental_info_): New data member.
7125 (Sized_incremental_binary::inputs_reader_): New data member.
7126 (Sized_incremental_binary::symtab_reader_): New data member.
7127 (Sized_incremental_binary::relocs_reader_): New data member.
7128 (Sized_incremental_binary::got_plt_reader_): New data member.
7129 (Sized_incremental_binary::current_input_file_): New data member.
7131 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
7134 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7137 2011-03-30 Cary Coutant <ccoutant@google.com>
7139 * archive.cc (Archive::include_member): Adjust call to report_object.
7140 (Add_archive_symbols::run): Add script_info to call to
7141 report_archive_begin.
7142 (Lib_group::include_member): Adjust call to report_object.
7143 (Add_lib_group_symbols::run): Adjust call to report_object.
7144 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7145 blocks. Add object count for script input files.
7146 * incremental.cc (Incremental_inputs::report_archive_begin): Add
7147 script_info parameter; change all callers.
7148 (Incremental_inputs::report_object): Add script_info parameter;
7150 (Incremental_inputs::report_script): Store backpointer to
7151 incremental info entry.
7152 (Output_section_incremental_inputs::set_final_data_size): Record
7153 additional information for scripts.
7154 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7155 * incremental.h (Incremental_script_entry::add_object): New function.
7156 (Incremental_script_entry::get_object_count): New function.
7157 (Incremental_script_entry::get_object): New function.
7158 (Incremental_script_entry::objects_): New data member; adjust
7160 (Incremental_inputs::report_archive_begin): Add script_info parameter.
7161 (Incremental_inputs::report_object): Add script_info parameter.
7162 (Incremental_inputs_reader::get_object_count): New function.
7163 (Incremental_inputs_reader::get_object_offset): New function.
7164 * options.cc (Input_arguments::add_file): Return reference to
7166 * options.h (Input_argument::set_script_info): New function.
7167 (Input_argument::script_info): New function.
7168 (Input_argument::script_info_): New data member; adjust all
7170 (Input_file_group::add_file): Return reference to new input argument.
7171 (Input_file_lib::add_file): Likewise.
7172 (Input_arguments::add_file): Likewise.
7173 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7174 * script.cc (Parser_closure::Parser_closure): Add script_info
7175 parameter; adjust all callers.
7176 (Parser_closure::script_info): New function.
7177 (Parser_closure::script_info_): New data member.
7178 (read_input_script): Report scripts earlier to incremental info.
7179 (script_add_file): Set script_info in Input_argument.
7180 (script_add_library): Likewise.
7181 * script.h (Script_options::Script_info): Rewrite class.
7183 2011-03-29 Cary Coutant <ccoutant@google.com>
7185 * archive.cc (Library_base::should_include_member): Move
7186 method here from class Archive.
7187 (Archive::Archive): Initialize base class.
7188 (Archive::should_include_member): Move to base class.
7189 (Archive::do_for_all_unused_symbols): New function.
7190 (Add_archive_symbols::run): Remove redundant access to
7192 (Lib_group::Lib_group): Initialize base class.
7193 (Lib_group::do_filename): New function.
7194 (Lib_group::include_member): Pass pointer to Lib_group to
7196 (Lib_group::do_for_all_unused_symbols): New function.
7197 (Add_lib_group_symbols::run): Report archive information for
7199 * archive.h (class Library_base): New base class.
7200 (class Archive): Derive from Library_base.
7201 (Archive::filename): Move to base class.
7202 (Archive::set_incremental_info): Likewise.
7203 (Archive::incremental_info): Likewise.
7204 (Archive::Should_include): Likewise.
7205 (Archive::should_include_member): Likewise.
7206 (Archive::Armap_entry): Remove.
7207 (Archive::Unused_symbol_iterator): Remove.
7208 (Archive::unused_symbols_begin): Remove.
7209 (Archive::unused_symbols_end): Remove.
7210 (Archive::do_filename): New function.
7211 (Archive::do_get_mtime): New function.
7212 (Archive::do_for_all_unused_symbols): New function.
7213 (Archive::task_): Move to base class.
7214 (Archive::incremental_info_): Likewise.
7215 (class Lib_group): Derive from Library_base.
7216 (Lib_group::do_filename): New function.
7217 (Lib_group::do_get_mtime): New function.
7218 (Lib_group::do_for_all_unused_symbols): New function.
7219 (Lib_group::task_): Move to base class.
7220 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7222 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7224 * incremental.cc (Incremental_inputs::report_archive_begin):
7225 Use Library_base; call library's get_mtime; add incremental inputs
7226 entry before members.
7227 (class Unused_symbol_visitor): New class.
7228 (Incremental_inputs::report_archive_end): Use Library_base; use
7229 visitor class to record unused symbols; don't add incremental inputs
7230 entry after members.
7231 (Incremental_inputs::report_object): Use Library_base.
7233 (Incremental_archive_entry::Incremental_archive_entry): Remove
7234 unused Archive parameter.
7235 (Incremental_inputs::report_archive_begin): Use Library_base.
7236 (Incremental_inputs::report_archive_end): Likewise.
7237 (Incremental_inputs::report_object): Likewise.
7238 * object.cc (Sized_relobj::do_for_all_global_symbols): New
7240 * object.h (Object::for_all_global_symbols): New function.
7241 (Object::do_for_all_global_symbols): New function.
7242 (Sized_relobj::do_for_all_global_symbols): New function.
7243 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
7245 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
7248 2011-03-27 Ian Lance Taylor <iant@google.com>
7250 * archive.cc (Archive::interpret_header): Return -1 if something
7251 goes wrong. Change callers accordingly.
7253 2011-03-25 Cary Coutant <ccoutant@google.com>
7255 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7256 * testsuite/Makefile.in: Regenerate.
7258 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
7260 * plugin.cc (get_view): New.
7261 (Plugin::load): Pass get_view to the plugin.
7262 (Plugin_manager::get_view): New.
7264 2011-03-21 Ian Lance Taylor <iant@google.com>
7266 * testsuite/final_layout.sh: Rewrite to not use dc.
7267 * testsuite/relro_test.sh: Fail if dc is not present.
7269 2011-03-21 Sriraman Tallam <tmsriram@google.com>
7271 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7273 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7274 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7276 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7277 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7279 2011-03-14 Ian Lance Taylor <iant@google.com>
7281 * script-sections.cc (Sort_output_sections::script_compare):
7282 Rename from is_before, change return type.
7283 (Sort_output_sections::operator()): Adjust accordingly.
7285 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
7288 * testsuite/odr_violation2.cc: Add comment to make all error line
7289 numbers double digits.
7290 * testsuite/debug_msg.sh: Adjust expected errors.
7292 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
7294 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7295 but mark earlier ones as non-canonical
7296 (offset_to_iterator): Update search target and example
7297 (do_addr2line): Return extra lines in a vector*
7298 (format_file_lineno): Extract from do_addr2line
7299 (one_addr2line): Add vector* out-param
7300 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7301 when a lineno entry appeared last for its instruction
7302 (Dwarf_line_info): Add vector* out-param
7303 * object.cc (Relocate_info): Pass NULL for the vector* out-param
7304 * symtab.cc (Odr_violation_compare): Include the lineno in the
7306 (linenos_from_loc): New. Combine the canonical line for an
7307 address with its other lines.
7308 (True_if_intersect): New. Helper functor to make
7309 std::set_intersection a query.
7310 (detect_odr_violations): Compare sets of lines instead of just
7311 one line for each function. This became less deterministic, but
7312 has fewer false positives.
7313 * symtab.h: Declarations.
7314 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7315 mix an optimized and non-optimized object in the same binary
7316 (odr_violation2.so): Same.
7317 * testsuite/Makefile.in: Regenerate from Makefile.am.
7318 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7319 * testsuite/debug_msg.sh: Update line numbers and add
7321 * testsuite/odr_violation1.cc: Use OdrDerived, in a
7322 non-optimized context.
7323 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7324 isn't inlined, and use OdrDerived in an optimized context.
7325 * testsuite/odr_header1.h: Defines OdrDerived, where
7326 optimization will change the
7327 first-instruction-in-the-destructor's file and line number.
7328 * testsuite/odr_header2.h: Defines OdrBase.
7330 2011-03-09 Ian Lance Taylor <iant@google.com>
7332 * fileread.cc (File_read::clear_views): Don't delete the whole
7335 2011-03-08 Ian Lance Taylor <iant@google.com>
7338 * fileread.cc: #include <climits>.
7339 (GOLD_IOV_MAX): Define.
7340 (File_read::read_multiple): Limit number of entries by iov_max.
7341 * fileread.h (class File_read): Always set max_readv_entries to
7344 2011-03-07 Ian Lance Taylor <iant@google.com>
7347 * options.h (class General_options): Add -dy and -dn.
7349 2011-03-02 Cary Coutant <ccoutant@google.com>
7351 * testsuite/script_test_9.t: Add TLS segment.
7353 2011-03-02 Simon Baldwin <simonb@google.com>
7355 * configure.ac: Add check for gnu_indirect_function support in
7356 the toolchain building binutils.
7357 * configure: Rebuild.
7359 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
7361 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7362 plugin only symbols.
7363 (Symbol_table::sized_finalize_symbol) Mark symbol only present
7364 in plugin files as not needed in the symbol table.
7366 2011-02-11 Sriraman Tallam <tmsriram@google.com>
7368 * output.cc (Output_section::add_input_section): Delay fill
7369 generation for section ordering.
7371 2011-02-09 Ian Lance Taylor <iant@google.com>
7374 * object.h (class Sized_relobj): Remove clear_local_symbols.
7375 * reloc.cc (Sized_relobj::do_relocate): Don't call
7376 clear_local_symbols.
7378 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
7380 * plugin.cc (is_visible_from_outside): Return true for symbols
7383 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
7385 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7388 2011-02-02 Sriraman Tallam <tmsriram@google.com>
7390 * icf.h (is_section_foldable_candidate): Change type of parameter
7392 * icf.cc (Icf::find_identical_sections): Change type of local variable
7393 section_name to be std::string.
7394 (is_function_ctor_or_dtor): Change type of parameter to std::string.
7396 2011-01-25 Ian Lance Taylor <iant@google.com>
7398 * script.cc (script_add_extern): Rewrite to use
7399 add_symbol_reference.
7401 2011-01-25 Doug Kwan <dougkwan@google.com>
7403 * icf.cc (get_section_contents): Always lock section's object.
7405 2011-01-24 Ian Lance Taylor <iant@google.com>
7407 * options.h (class General_options): Accept
7408 --no-detect-odr-violations.
7410 2011-01-24 Ian Lance Taylor <iant@google.com>
7412 * version.cc (version_string): Bump to 1.11.
7414 2011-01-24 Ian Lance Taylor <iant@google.com>
7416 * plugin.cc (class Plugin_rescan): Define new class.
7417 (Plugin_manager::claim_file): Set any_claimed_.
7418 (Plugin_manager::save_archive): New function.
7419 (Plugin_manager::save_input_group): New function.
7420 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7422 (Plugin_manager::new_undefined_symbol): New function.
7423 (Plugin_manager::rescan): New function.
7424 (Plugin_manager::rescannable_defines): New function.
7425 (Plugin_manager::add_input_file): Set any_added_.
7426 * plugin.h (class Plugin_manager): define new fields rescannable_,
7427 undefined_symbols_, any_claimed_, and any_added_. Declare
7428 Plugin_rescan as friend. Declare new functions.
7429 (Plugin_manager::Rescannable): Define type.
7430 (Plugin_manager::Rescannable_list): Define type.
7431 (Plugin_manager::Undefined_symbol_list): Define type.
7432 (Plugin_manager::Plugin_manager): Initialize new fields.
7433 * archive.cc (Archive::defines_symbol): New function.
7434 (Add_archive_symbols::run): Pass archive to plugins if any.
7435 * archive.h (class Archive): Declare defines_symbol.
7436 * readsyms.cc (Input_group::~Input_group): New function.
7437 (Finish_group::run): Pass input_group to plugins if any.
7438 * readsyms.h (class Input_group): Declare destructor.
7439 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7442 2011-01-10 Ian Lance Taylor <iant@google.com>
7444 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7446 (Layout::set_segment_offsets): Reset increase_relro before calling
7447 set_section_addresses a second time.
7449 2011-01-04 Cary Coutant <ccoutant@google.com>
7451 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7452 sections before NOBITS sections.
7454 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
7456 * version.cc (print_version): Update copyright to 2011.
7458 2010-12-23 Cary Coutant <ccoutant@google.com>
7460 * output.h (Output_data_reloc::add_output_section): Pass OD instead
7461 of OS to this->add. Add OD parameter to second form of the function.
7463 2010-12-20 Ian Lance Taylor <iant@google.com>
7465 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7466 second of two consecutive entries with same offset.
7468 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7470 * testsuite/Makefile.am (ifuncmain2static_LDADD)
7471 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7472 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7473 to avoid unneeded links against $(LDADD).
7474 * testsuite/Makefile.in: Regenerate.
7476 2010-12-15 Ian Lance Taylor <iant@google.com>
7479 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7480 for R_X86_64_32 and R_X86_64_PC32.
7481 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7482 ver_matching_def_pic.o.
7483 (ver_matching_def_pic.o): New target.
7485 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7487 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7488 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7489 Move definition before File_read::View member definitions.
7490 (File_read::View::~View): Initialize and hold lock before
7491 updating current_mapped_bytes.
7493 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7495 * dwarf_reader.cc: Remove outdated comment.
7496 * gold-threads.cc: Fix typo in error message.
7497 * archive.cc: Fix typos in comments.
7498 * archive.h: Likewise.
7499 * arm-reloc-property.cc: Likewise.
7500 * arm-reloc-property.h: Likewise.
7501 * arm-reloc.def: Likewise.
7503 * attributes.h: Likewise.
7504 * cref.cc: Likewise.
7505 * ehframe.cc: Likewise.
7506 * fileread.h: Likewise.
7508 * i386.cc: Likewise.
7510 * incremental.h: Likewise.
7511 * int_encoding.cc: Likewise.
7512 * layout.h: Likewise.
7513 * main.cc: Likewise.
7514 * merge.h: Likewise.
7515 * object.cc: Likewise.
7516 * object.h: Likewise.
7517 * options.cc: Likewise.
7518 * readsyms.cc: Likewise.
7519 * reduced_debug_output.cc: Likewise.
7520 * reloc.cc: Likewise.
7521 * script-sections.cc: Likewise.
7522 * sparc.cc: Likewise.
7523 * symtab.h: Likewise.
7524 * target-reloc.h: Likewise.
7525 * target.cc: Likewise.
7526 * target.h: Likewise.
7527 * timer.cc: Likewise.
7528 * timer.h: Likewise.
7529 * x86_64.cc: Likewise.
7531 2010-12-09 Cary Coutant <ccoutant@google.com>
7533 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7535 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7536 parameter; change all callers.
7537 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7538 * options.h (warn_execstack): New option.
7540 2010-12-07 Doug Kwan <dougkwan@google.com>
7542 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7543 like function call relocations.
7545 2010-12-07 Ian Lance Taylor <iant@google.com>
7547 * archive.cc (Archive::get_elf_object_for_member): Permit
7548 punconfigured to be NULL.
7549 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7550 (Archive::include_member): Pass NULL to get_elf_object_for_member
7551 if we searched for the archive and this is the first included
7554 2010-12-01 Ian Lance Taylor <iant@google.com>
7556 * dwarf_reader.h (class Sized_dwarf_line_info): Add
7557 track_relocs_type_ field.
7558 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7559 Set track_relocs_type_.
7560 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7561 contents when using RELA relocs.
7562 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7564 * reloc.cc (Track_relocs::next_addend): New function.
7565 * reloc.h (class Track_relocs): Declare next_addend.
7567 2010-12-01 Ian Lance Taylor <iant@google.com>
7569 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7572 2010-12-01 Ian Lance Taylor <iant@google.com>
7574 * README: Update compilers known to work and fail.
7576 2010-11-23 Matthias Klose <doko@ubuntu.com>
7578 * configure.in: For --enable-gold, handle value `default' instead of
7579 `both*'. Always install ld as ld.bfd, install as ld if gold is
7581 * configure: Regenerate.
7583 2010-11-18 Doug Kwan <dougkwan@google.com>
7585 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7586 and right_alignment to be zero. Store result alignment only if it is
7587 greater than existing alignment.
7589 2010-11-16 Cary Coutant <ccoutant@google.com>
7592 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7593 Check for ".zdebug_line".
7595 2010-11-16 Doug Kwan <dougkwan@google.com>
7596 Cary Coutant <ccoutant@google.com>
7598 * output.h (Output_segment::set_section_addresses): Pass increase_relro
7599 by reference; adjust all callers.
7600 * output.cc (Output_segment::set_section_addresses): Adjust references
7601 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7603 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7604 end at page boundary.
7606 2010-11-16 Cary Coutant <ccoutant@google.com>
7609 * layout.cc (Layout::choose_output_section): Transform names of
7610 compressed sections even when using a script with a SECTIONS clause.
7611 (Layout::output_section_name): Remove code to transform
7612 compressed debug section names.
7613 * output.cc (Output_section::add_input_section): Use uncompressed
7614 section size when tracking input sections.
7616 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
7618 * symtab.h (Symbol::NON_PIC_REF): Remove.
7619 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7620 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
7621 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7622 (Symbol::use_plt_offset): Take a flags argument and pass it
7623 directly to needs_dynamic_reloc. Restrict check for undefined
7624 weak symbols to function calls.
7625 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7626 (Target_arm::Scan::global): Use it.
7627 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7628 (Target_arm::Relocate::relocate): Likewise.
7629 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7630 parameter with an r_type parameter. Use get_reference_flags
7632 (Target_arm::Relocate::relocate): Update accordingly.
7633 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7634 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7635 (Target_i386::Scan::global): Likewise.
7636 (Target_i386::Relocate::relocate): Likewise.
7637 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7638 parameter with an r_type parameter. Use get_reference_flags
7640 (Target_i386::Relocate::relocate): Update accordingly.
7641 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7642 (Target_powerpc::Scan::global): Use it.
7643 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7644 (Target_powerpc::Relocate::relocate): Likewise.
7645 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7646 (Target_sparc::Scan::global): Use it.
7647 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7648 (Target_sparc::Relocate::relocate): Likewise.
7649 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7650 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7651 (Target_x86_64::Scan::global): Likewise.
7652 (Target_x86_64::Relocate::relocate): Likewise.
7654 2010-11-08 Doug Kwan <dougkwan@google.com>
7655 Cary Coutant <ccoutant@google.com>
7657 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7658 (Arm_exidx_merge_section::section_contents_): New data member.
7659 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7660 (Arm_input_section::~Arm_input_section): De-allocate memory.
7661 (Arm_input_section::original_contents_): New data member.
7662 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7663 in parameters instead of calling Object::section_contents without
7665 (Arm_output_section::group_section): New parameter TASK. Pass it
7666 to callees that need locking objects.
7667 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
7668 to lock EXIDX input sections. Fix a formatting issue. Call
7669 Arm_exidx_merged_section::build_contents to create merged section
7671 (Arm_output_section::create_stub_group): New parameter TASK. Use it
7672 to lock object of stub table owner.
7673 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7674 TEXT_SIZE to initialize data member TEXT_SIZE_.
7675 (Arm_exidx_input_section::addralign): Fix typo in comment.
7676 (Arm_exidx_input_section::text_size): New method.
7677 (Target_arm::do_relax): New parameter TASK. Pass it to callees
7678 that require locking objects. Lock objects before scanning for stubs
7679 and updating local symbols.
7680 (Arm_input_section<big_endian>::init): Copy contents of original
7682 (Arm_input_section<big_endian>::do_write): Use saved contents of
7683 original input section instead of calling Object::section_contents
7685 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7686 size without calling Object::section_size().
7687 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7688 for size. Allocate a buffer for merged EXIDX entries.
7689 (Arm_exidx_merged_section::build_contents): New method.
7690 (Arm_exidx_merged_section::do_write): Move merge section contents
7691 building code to Arm_exidx_merged_section::build_contetns. Write
7692 out contetns in buffer instead of building it on the fly.
7693 (Arm_relobj::make_exidx_input_section): Also pass text section size
7694 to Arm_exidx_input_section constructor.
7695 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
7696 (Arm_dynobj::do_read_symbols): Fix memory leak.
7697 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7698 * target.h: (class Task): Add forward declaration.
7699 (Target::relax): Add new parameter TASK and pass it to
7701 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
7703 2010-11-05 Cary Coutant <ccoutant@google.com>
7706 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7707 object when reading from the file.
7708 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7710 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7711 when reading section contents.
7712 (get_section_contents): Likewise.
7713 (icf::find_identical_sections): Likewise.
7714 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7715 object when reading from the file.
7716 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7717 the object when doing deferred section layout.
7719 2010-11-03 Nick Clifton <nickc@redhat.com>
7722 * script.h (class Symbol_assignment: name): New member. Returns
7723 the name of the symbol.
7724 * scrfipt.cc (Script_options::is_pending_assignment): New member.
7725 Returns true if the given symbol name is on the list of
7726 assignments wating to be processed.
7727 * archive.cc (should_incldue_member): If the symbol is undefined,
7728 check to see if it is on the list of symbols pending assignment.
7730 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
7732 * script-sections.cc (Script_sections::find_memory_region): Check
7733 for a NULL output section pointer.
7735 2010-10-29 Doug Kwan <dougkwan@google.com>
7737 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7738 Output_section::add_relaxed_input_section.
7739 * output.cc (Output_section::add_relaxed_input_section): Add new
7740 arguments LAYOUT and NAME. Set section order index.
7741 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7742 Copy section order index.
7743 * output.h (Output_section::add_relaxed_input_section): Add new
7744 arguments LAYOUT and NAME.
7746 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7748 * testsuite/Makefile.am: Move gcctestdir/ld rule to
7749 NATIVE_OR_CROSS_LINKER.
7750 * testsuite/Makefile.in: Regenerate.
7752 2010-10-20 Doug Kwan <dougkwan@google.com>
7754 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7755 without SHF_LINK_ORDER flags.
7756 * layout.cc (Layout::choose_output_section): Do not filter
7757 SHF_LINK_ORDER flag in a relocatable link.
7759 2010-10-17 Cary Coutant <ccoutant@google.com>
7761 * output.h (Output_segment::set_section_addresses): Change function
7762 signature. Update all callers.
7763 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7765 (Output_segment::set_section_addresses): Align after last TLS
7766 section. Add padding before last relro section instead of after.
7768 2010-10-17 Doug Kwan <dougkwan@google.com>
7770 * gold/arm.cc (Target_arm::got_section): Use correct order and set
7771 GOT output section to be writable.
7773 2010-10-14 Cary Coutant <ccoutant@google.com>
7775 * debug.h (DEBUG_INCREMENTAL): New flag.
7776 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7777 * gold.cc (queue_initial_tasks): Check parameters for incremental link
7779 * incremental.cc (report_command_line): Ignore all forms of
7781 * layout.cc (Layout::Layout): Check parameters for incremental link
7783 * options.cc (General_options::parse_incremental): New function.
7784 (General_options::parse_no_incremental): New function.
7785 (General_options::parse_incremental_full): New function.
7786 (General_options::parse_incremental_update): New function.
7787 (General_options::incremental_mode_): New data member.
7788 (General_options::finalize): Check incremental_mode_.
7789 * options.h (General_options): Update help text for --incremental.
7790 Add --no-incremental, --incremental-full, --incremental-update.
7791 (General_options::Incremental_mode): New enum type.
7792 (General_options::incremental_mode): New function.
7793 (General_options::incremental_mode_): New data member.
7794 * parameters.cc (Parameters::incremental_mode_): New data member.
7795 (Parameters::set_options): Set incremental_mode_.
7796 (Parameters::set_incremental_full): New function.
7797 (Parameters::incremental): New function.
7798 (Parameters::incremental_update): New function.
7799 (set_parameters_incremental_full): New function.
7800 * parameters.h (Parameters::set_incremental_full): New function.
7801 (Parameters::incremental): New function.
7802 (Parameters::incremental_update): New function.
7803 (Parameters::incremental_mode_): New data member.
7804 (set_parameters_incremental_full): New function.
7805 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7806 incremental link mode.
7807 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7808 (Sized_relobj::do_relocate_sections): Likewise.
7809 * testsuite/Makefile.am (incremental_test): Use --incremental-full
7811 * testsuite/Makefile.in: Regenerate.
7812 * testsuite/incremental_test.sh: Filter all forms of --incremental.
7814 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7816 * script-sections.h (class Script_sections): Make
7817 Sections_elements typedef public.
7818 * script-sections.cc (class Sort_output_sections): Add elements_
7819 field. Add constructor which sets it; change all callers.
7820 (Sort_output_sections::is_before): New function.
7821 (Sort_output_sections::operator()): Call is_before.
7822 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7824 * testsuite/script_test_10.sh: New test. Test script section
7826 * testsuite/script_test_10.t: Likewise.
7827 * testsuite/script_test_10.s: Likewise.
7828 * testsuite/Makefile.am: Wrap the cross linker tests and the
7829 common tests into NATIVE_OR_CROSS_LINKER.
7830 (check_SCRIPTS): Add script_test_10.sh.
7831 (check_DATA): Add script_test_10.stdout.
7832 (script_test_10.o, script_test_10): New targets.
7833 (script_test_10.stdout): New target.
7834 * configure, testsuite/Makefile.in: Regenerate.
7836 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7838 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7839 error for the deprecated relocations.
7840 (Target_arm::Scan::global): Likewise.
7841 (Target_arm::Relocate::relocate): Likewise.
7843 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
7845 * fileread.cc (Input_file::find_file): Initialize *found_name
7846 and *namep when using the fallback search for case 4.
7848 2010-10-11 Cary Coutant <ccoutant@google.com>
7850 * options.h (class General_options): Redefine -z lazy as an alias for
7851 the negation of -z now.
7853 2010-10-11 Ian Lance Taylor <iant@google.com>
7855 * resolve.cc (symbol_to_bits): Report the value of the unsupported
7858 2010-10-06 Nick Clifton <nickc@redhat.com>
7860 * script-sections.cc(class Memory_region): Remove
7861 current_lma_offset_ field. Rename current_vma_offset_ to
7862 current_offset_. Add last_section_ field.
7863 (Memory_region::get_current_vma_address): Rename to
7864 get_current_address.
7865 (Memory_region::get_current_lma_address): Delete.
7866 (Memory_region::increment_vma_offset): Rename to
7868 (Memory_region::increment_lma_offset): Delete.
7869 (Memory_region::attributes_compatible): New method. Returns
7870 true if the provided section is compatible with the region.
7871 (Memory_region::get_last_section): New method. Returns the last
7872 section to use the region.
7873 (Memory_region::set_last_section): New method. Stores the last
7874 section to use the region.
7875 (Script_sections::block_in_region): New method. Returns true if
7876 a block of memory is contained within a region.
7877 (Script_sections::find_memory_region): New method. Locates a
7878 memory region to be used to set a VMA or LMA address.
7879 (Output_section_definition::set_section_addresses): Add code to
7880 check for addresses set by memory regions.
7881 (Output_segment::set_section_addresses): Remove memory region
7883 (Script_sections::create_segment): Add a warning if a header
7884 segment is created outside of any region.
7885 * script-sections.h (class Script_sections): Add prototypes for
7886 find_memory_region and block_in_region methods.
7887 * testsuite/memory_test.s: Use .long instead of .word.
7888 * testsuite/memory_test.t: Add some more output sections.
7889 * testsuite/memory_test.sh: Update expected output.
7891 2010-10-02 Doug Kwan <dougkwan@google.com>
7893 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7894 defintion to symtab.h
7895 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7896 declaration to defintion.
7898 2010-10-01 Nick Clifton <nickc@redhat.com>
7900 * expression.cc (eval): Replace dummy argument with NULL.
7901 (eval_maybe_dot): Check for a NULL result section pointer.
7902 (Symbol_expression::value): Likewise.
7903 (Dot_expression::value): Likewise.
7904 (BINARY_EXPRESSION): Likewise.
7905 (Max_expression::value): Likewise.
7906 (Min_expression::value): Likewise.
7907 (Absolute_expression::value): Likewise.
7908 (Addr_expression::value_from_output_section): Likewise.
7909 (Loaddddr_expression::value_from_output_section): Likewise.
7910 (Segment_start_expression::value): Likewise.
7911 * script-sections.cc
7912 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7914 (Sections_elememt_dot_assignment::set_section_addresses):
7916 (Output_data_expression::do_write_to_buffer): Likewise.
7917 (Output_section_definition::finalize_symbols): Likewise.
7918 (Output_section_definition::set_section_addresses): Likewise.
7920 2010-09-30 Doug Kwan <dougkwan@google.com>
7922 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7924 2010-09-28 Sriraman Tallam <tmsriram@google.com>
7926 * target.h (Target::can_icf_inline_merge_sections): New virtual
7928 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7930 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7932 * icf.cc (get_section_contents): Inline merge sections only when
7935 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7937 * configure: Regenerate.
7939 2010-09-17 Ian Lance Taylor <iant@google.com>
7941 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7942 * testsuite/Makefile.am (memory_test.o): New target.
7943 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7945 * testsuite/Makefile.in: Rebuild.
7947 2010-09-17 Doug Kwan <dougkwan@google.com>
7949 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7950 defintion if relocation uses GOT entries of the symbol.
7951 * testsuite/icf_safe_test.sh: Fix test.
7952 * testsuite/icf_safe_so_test.sh: Fix test.
7954 2010-09-16 Cary Coutant <ccoutant@google.com>
7956 * script_sections.cc (class Memory_region): Remove "NULL" from
7957 vector initializations.
7959 2010-09-15 Cary Coutant <ccoutant@google.com>
7961 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7962 Resolve forwarding symbols.
7964 2010-09-15 Doug Kwan <dougkwan@google.com>
7966 * gold/testsuite/script_test_3.t: Add ARM special sections.
7967 * gold/testsuite/script_test_4.t: Same.
7968 * gold/testsuite/script_test_5.t: Same.
7969 * gold/testsuite/script_test_6.t: Same.
7970 * gold/testsuite/script_test_7.t: Same.
7971 * gold/testsuite/script_test_7.t: Same.
7972 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7974 2010-09-14 Cary Coutant <ccoutant@google.com>
7976 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7977 (Target_x86_64::Relocate::relocate_tls): Replace check for
7978 saw_tls_block_reloc_ with test for executable section.
7980 2010-09-12 Cary Coutant <ccoutant@google.com>
7982 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7983 position-independent executables to shared libraries need dynamic
7985 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7986 position-independent executables.
7987 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7988 * testsuite/Makefile.in: Regenerate.
7990 2010-09-10 Nick Clifton <nickc@redhat.com>
7993 * testsuite/memory_test.t: Discard any sections that are not
7996 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7999 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8000 "This::" to work around a bug in gcc 4.2.
8002 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8004 2010-09-09 Rafael Espindola <espindola@google.com>
8006 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8007 sections with different PF_X flags in the same segment.
8008 (Layout::find_first_load_seg): Search all segments to find the first
8010 * options.h (rosegment): New.
8012 2010-09-08 Rafael Espindola <espindola@google.com>
8014 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8016 2010-09-08 Doug Kwan <dougkwan@google.com>
8018 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8019 (Arm_relobj::do_relocate_sections): Add new parameter for output
8020 file to match the parent.
8021 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8022 of local symbols instead of input values. Update code to track
8023 changes in gold::relocate_section.
8024 * object.cc (Sized_relobj::compute_final_local_value): New methods.
8025 (Sized_relobj::compute_final_local_value_internal): New methods.
8026 (Sized_relobj::do_finalize_local_symbols): Move code from loop
8027 body into private version of Sized_relobj::compute_final_local_value.
8028 Call the inline method.
8029 * object.h (Symbol_value::Symbol_value): Define destructor. Free
8030 merged symbol value if there is one.
8031 (Symbol_value::has_output_value): New method defintiion.
8032 (Sized_relobj::Compute_final_local_value_status): New enum type.
8033 (Sized_relobj::compute_final_local_value): New methods.
8034 (Sized_relobj::compute_final_local_value_internal): New methods.
8035 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8036 and arm_cortex_a8.sh.
8037 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8038 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8040 * Makefile.in: Regenerate.
8041 * testsuite/arm_bl_out_of_range.s: Update test.
8042 * testsuite/thumb_bl_out_of_range.s: Ditto.
8043 * testsuite/thumb_blx_out_of_range.s: Ditto.
8044 * testsuite/arm_branch_out_of_range.sh: New file.
8045 * testsuite/arm_cortex_a8.sh: Ditto.
8046 * testsuite/arm_cortex_a8_b.s: Ditto.
8047 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8048 * testsuite/arm_cortex_a8_b_local.s: Ditto.
8049 * testsuite/arm_cortex_a8_bl.s: Ditto.
8050 * testsuite/arm_cortex_a8_blx.s: Ditto.
8051 * testsuite/arm_cortex_a8_local.s: Ditto.
8052 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8053 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8055 2010-09-08 Rafael Espindola <espindola@google.com>
8057 * Makefile.am (memory_test.stdout): Run readelf with -W.
8058 * Makefile.in: Regenerate.
8059 * testsuite/memory_test.sh: Make the regexps accept both 32 and
8062 2010-09-08 Rafael Espindola <espindola@google.com>
8064 * script-sections.cc (Script_sections::add_memory_region): Convert
8065 field precision to int.
8066 * script.cc (script_set_section_region, script_set_section_region):
8067 Convert field precision to int.
8069 2010-09-08 Rafael Espindola <espindola@google.com>
8071 * arm.cc (do_finalize_sections): Create the __exidx_start and
8072 __exdix_end symbols even when the section is missing.
8074 2010-09-08 Nick Clifton <nickc@redhat.com>
8076 * README: Remove claim that MEMORY is not supported.
8077 * expression.cc (script_exp_function_origin)
8078 (script_exp_function_length): Move from here to ...
8079 * script.cc: ... here.
8080 (script_set_section_region, script_add_memory)
8081 (script_parse_memory_attr, script_include_directive): New
8083 * script-sections.cc
8084 (class Memory_region): New class.
8085 (class Output_section_definition): Add set_memory_region,
8086 set_section_vma, set_section_lma and get_section_name methods.
8087 (class Script_Sections): Add add_memory_region,
8088 find_memory_region, find_memory_region_origin,
8089 find_memory_region_length and set_memory_region methods.
8090 Have set_section_addresses method walk the list of set memory
8092 Extend the print methos to display memory regions.
8093 * script-sections.h: Add prototypes for new methods.
8094 Add enum for MEMORY region attributes.
8095 * yyscript.y: Add support for parsing MEMORY regions.
8096 * script-c.h: Add prototypes for new functions.
8097 * testsuite/Makefile.am: Add test of MEMORY region functionality.
8098 * testsuite/Makefile.in: Regenerate.
8099 * testsuite/memory_test.sh: New script.
8100 * testsuite/memory_test.s: New assembler source file.
8101 * testsuite/memory_test.t: New linker script.
8103 2010-08-27 Doug Kwan <dougkwan@google.com>
8105 * gold/resolve.cc (Symbol_table::should_override): Let a weak
8106 reference override an existing dynamic weak reference.
8107 * testsuite/Makefile.am: Add new test dyn_weak_ref.
8108 * testsuite/Makefile.in: Regenerate.
8109 * testsuite/dyn_weak_ref.sh: New file.
8110 * testsuite/dyn_weak_ref_1.c: Ditto.
8111 * testsuite/dyn_weak_ref_2.c: Ditto.
8113 2010-08-27 Ian Lance Taylor <iant@google.com>
8115 * incremental.h (class Incremental_input_entry): Add virtual
8118 2010-08-27 Ian Lance Taylor <iant@google.com>
8120 * testsuite/start_lib_test_3.c: Mark t3 as used.
8122 2010-08-27 Nick Clifton <nickc@redhat.com>
8124 * options.cc (version_script): Fix small typo in previous
8127 2010-08-25 Nick Clifton <nickc@redhat.com>
8129 * archive.cc: Formatting fixes: Remove whitespace between
8130 typename and following asterisk. Remove whitespace between
8131 function name and opening parenthesis.
8132 * archive.h: Likewise.
8134 * attributes.cc: Likewise.
8135 * attributes.h: Likewise.
8136 * common.cc: Likewise.
8137 * copy-relocs.cc: Likewise.
8138 * dirsearch.h: Likewise.
8139 * dynobj.cc: Likewise.
8140 * ehframe.cc: Likewise.
8141 * ehframe.h: Likewise.
8142 * expression.cc: Likewise.
8143 * fileread.cc: Likewise.
8144 * fileread.h: Likewise.
8146 * gold-threads.cc: Likewise.
8147 * gold.cc: Likewise.
8148 * i386.cc: Likewise.
8150 * incremental-dump.cc: Likewise.
8151 * incremental.cc: Likewise.
8152 * layout.cc: Likewise.
8153 * layout.h: Likewise.
8154 * main.cc: Likewise.
8155 * merge.cc: Likewise.
8156 * merge.h: Likewise.
8157 * object.cc: Likewise.
8158 * object.h: Likewise.
8159 * options.cc: Likewise.
8160 * options.h: Likewise.
8161 * output.cc: Likewise.
8162 * output.h: Likewise.
8163 * plugin.cc: Likewise.
8164 * plugin.h: Likewise.
8165 * powerpc.cc: Likewise.
8166 * reloc.cc: Likewise.
8167 * script-c.h: Likewise.
8168 * script-sections.cc: Likewise.
8169 * script.cc: Likewise.
8170 * stringpool.cc: Likewise.
8171 * symtab.cc: Likewise.
8172 * symtab.h: Likewise.
8173 * target.cc: Likewise.
8174 * timer.cc: Likewise.
8175 * timer.h: Likewise.
8176 * version.cc: Likewise.
8177 * x86_64.cc: Likewise.
8179 2010-08-24 Nick Clifton <nickc@redhat.com>
8182 * layout.cc (segment_precedes): Sort segments by their physical
8183 addresses, if they have been set.
8185 2010-08-23 Cary Coutant <ccoutant@google.com>
8187 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8189 (Lib_group::include_member): Unlock object after deleting its
8191 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8194 2010-08-19 Neil Vachharajani <nvachhar@google.com>
8195 Cary Coutant <ccoutant@google.com>
8197 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8198 constructor, and set_blocker.
8199 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8201 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8202 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8203 * testsuite/Makefile.am (start_lib_test): New test case.
8204 * testsuite/Makefile.in: Regenerate.
8205 * testsuite/start_lib_test_main.c: New file.
8206 * testsuite/start_lib_test_1.c: New file.
8207 * testsuite/start_lib_test_2.c: New file.
8208 * testsuite/start_lib_test_3.c: New file.
8210 2010-08-19 Ian Lance Taylor <iant@google.com>
8212 * Makefile.in: Rebuild with automake 1.11.1.
8213 * aclocal.m4: Likewise.
8214 * testsuite/Makefile.in: Likewise.
8216 2010-08-19 Ian Lance Taylor <iant@google.com>
8219 * i386.cc (class Output_data_plt_i386): Update declarations.
8220 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
8221 local_ifuncs_ fields.
8222 (Target_i386::do_plt_section_for_global): New function.
8223 (Target_i386::do_plt_section_for_local): New function.
8224 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8225 parameter; change all callers. Initialize global_ifuncs_ and
8226 local_ifuncs_. If doing a static link define __rel_iplt_start and
8228 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8229 (Output_data_plt_i386::add_local_ifunc_entry): New function.
8230 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8232 (Target_i386::make_plt_section): New function, broken out of
8233 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
8234 (Target_i386::make_plt_entry): Call make_plt_section.
8235 (Target_i386::make_local_ifunc_plt_entry): New function.
8236 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8237 (Target_i386::Scan::local): Handle IFUNC symbols. Add
8238 R_386_IRELATIVE to switch.
8239 (Target_i386::Scan::global): Likewise.
8240 (Target_i386::Relocate::relocate): Likewise.
8241 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8243 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8244 (Target_x86_64::do_plt_section_for_global): New function.
8245 (Target_x86_64::do_plt_section_for_local): New function.
8246 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8247 parameter; change all callers. If doing a static link define
8248 __rela_iplt_start and __rela_iplt_end.
8249 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8250 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8251 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8253 (Target_x86_64::make_local_ifunc_plt_entry): New function.
8254 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8256 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8257 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
8258 R_X86_64_IRELATIVE to switch.
8259 (Target_x86_64::Scan::global): Likewise.
8260 (Target_x86_64::Relocate::relocate): Likewise.
8261 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8263 * target.h (class Target): Add plt_section_for_global and
8264 plt_section_for_local functions. Add do_plt_section_for_global
8265 and do_plt_section_for_local virtual functions.
8266 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
8267 clarifying comments.
8268 (Symbol::use_plt_offset): Handle IFUNC symbol.
8269 * object.cc (Sized_relobj::Sized_relobj): Initialize
8271 (Sized_relobj::local_has_plt_offset): New function.
8272 (Sized_relobj::local_plt_offset): New function.
8273 (Sized_relobj::set_local_plt_offset): New function.
8274 (Sized_relobj::do_count): Handle IFUNC symbol.
8275 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
8276 a bit away from input_shndx_ field. Add set_is_func_symbol and
8277 is_ifunc_symbol functions.
8278 (class Sized_relobj): Update declarations. Remove Tls_got_entry
8279 and Local_tls_got_offsets. Define Local_plt_offsets. Add
8280 local_plt_offsets_ field.
8281 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8282 * output.h (class Output_section_data): Add non-const
8283 output_section function.
8284 (class Output_data_got): Update declarations.
8285 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8286 Add use_plt_offset parameter to global and local constructors.
8287 Change all callers. Change local_sym_index_ field to 31 bits.
8288 Change GSYM_CODE and CONSTANT_CODE accordingly.
8289 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8290 doing a static link don't set sh_link field.
8291 (Output_data_got::Got_entry::write): Use PLT offset if
8293 (Output_data_got::add_global_plt): New function.
8294 (Output_data_got::add_local_plt): New function.
8295 * target-reloc.h (relocate_section): Handle IFUNC symbol.
8296 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8297 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8298 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8299 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8301 * testsuite/ifunc-sel.h: New file.
8302 * testsuite/ifuncmain1.c: New file.
8303 * testsuite/ifuncmain1vis.c: New file.
8304 * testsuite/ifuncmod1.c: New file.
8305 * testsuite/ifuncdep2.c: New file.
8306 * testsuite/ifuncmain2.c: New file.
8307 * testsuite/ifuncmain3.c: New file.
8308 * testsuite/ifuncmod3.c: New file.
8309 * testsuite/ifuncmain4.c: New file.
8310 * testsuite/ifuncmain5.c: New file.
8311 * testsuite/ifuncmod5.c: New file.
8312 * testsuite/ifuncmain6pie.c: New file.
8313 * testsuite/ifuncmod6.c: New file.
8314 * testsuite/ifuncmain7.c: New file.
8315 * configure, testsuite/Makefile.in: Rebuild.
8317 2010-08-18 Ian Lance Taylor <iant@google.com>
8320 (Output_section_incremental_inputs::write_input_files): Add cast
8321 to avoid signed/unsigned comparison warning.
8322 (Output_section_incremental_inputs::write_info_blocks): Likewise.
8324 2010-08-12 Cary Coutant <ccoutant@google.com>
8326 * common.cc (Sort_commons::operator()): Remove unnecessary code.
8328 2010-08-13 Ian Lance Taylor <iant@google.com>
8330 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8332 2010-08-12 Cary Coutant <ccoutant@google.com>
8333 Doug Kwan <dougkwan@google.com>
8335 * resolve.cc (Symbol_table::should_override): When a weak dynamic
8336 defintion overrides non-weak undef, remember that the original undef
8338 * symtab.cc (Symbol_table::sized_write_global): For undef without
8339 an original weak binding, set binding to global in output.
8340 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8341 * testsuite/Makefile.in: Regenerate.
8342 * testsuite/strong_ref_weak_def.sh: New file.
8343 * testsuite/strong_ref_weak_def_1.c: Ditto.
8344 * testsuite/strong_ref_weak_def_2.c: Ditto.
8346 2010-08-12 Cary Coutant <ccoutant@google.com>
8348 * testsuite/incremental_test.sh: Rewrite.
8349 * testsuite/incremental_test_1.c: Rewrite.
8350 * testsuite/incremental_test_2.c: Rewrite.
8352 2010-08-12 Cary Coutant <ccoutant@google.com>
8354 * arm.cc (Target_arm::got_size): Add const.
8355 (Target_arm::got_entry_count): New function.
8356 (Target_arm::plt_entry_count): New function.
8357 (Target_arm::first_plt_entry_offset): New function.
8358 (Target_arm::plt_entry_size): New function.
8359 (Output_data_plt_arm::entry_count): New function.
8360 (Output_data_plt_arm::first_plt_entry_offset): New function.
8361 (Output_data_plt_arm::get_plt_entry_size): New function.
8362 * i386.cc (Target_i386::got_size): Add const.
8363 (Target_i386::got_entry_count): New function.
8364 (Target_i386::plt_entry_count): New function.
8365 (Target_i386::first_plt_entry_offset): New function.
8366 (Target_i386::plt_entry_size): New function.
8367 (Output_data_plt_i386::entry_count): New function.
8368 (Output_data_plt_i386::first_plt_entry_offset): New function.
8369 (Output_data_plt_i386::get_plt_entry_size): New function.
8370 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8371 find_incremental_inputs_sections. Dump incremental_got_plt section.
8372 * incremental.cc: Include target.h.
8373 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8374 parameter. Adjust all callers. Find incremental_got_plt section.
8375 (Incremental_inputs::create_data_sections): Create incremental_got_plt
8377 (Output_section_incremental_inputs::set_final_data_size): Calculate
8378 size of incremental_got_plt section.
8379 (Output_section_incremental_inputs::do_write): Write the
8380 incremental_got_plt section.
8381 (Got_plt_view_info): New struct.
8382 (Local_got_offset_visitor): New class.
8383 (Global_got_offset_visitor): New class.
8384 (Global_symbol_visitor_got_plt): New class.
8385 (Output_section_incremental_inputs::write_got_plt): New function.
8386 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8387 Add parameter. Adjust all callers.
8388 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8389 (Incremental_inputs::got_plt_section): New function.
8390 (Incremental_inputs::got_plt_section_): New data member.
8391 (Incremental_got_plt_reader): New class.
8392 * layout.cc (Layout::create_incremental_info_sections): Add the
8393 incremental_got_plt section.
8394 * object.h (Got_offset_list::get_list): New function.
8395 (Got offset_list::for_all_got_offsets): New function.
8396 (Sized_relobj::local_got_offset_list): New function.
8397 * powerpc.cc (Target_powerpc::got_size): Add const.
8398 (Target_powerpc::got_entry_count): New function.
8399 (Target_powerpc::plt_entry_count): New function.
8400 (Target_powerpc::first_plt_entry_offset): New function.
8401 (Target_powerpc::plt_entry_size): New function.
8402 (Output_data_plt_powerpc::entry_count): New function.
8403 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8404 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8405 * sparc.cc (Target_sparc::got_size): Add const.
8406 (Target_sparc::got_entry_count): New function.
8407 (Target_sparc::plt_entry_count): New function.
8408 (Target_sparc::first_plt_entry_offset): New function.
8409 (Target_sparc::plt_entry_size): New function.
8410 (Output_data_plt_sparc::entry_count): New function.
8411 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8412 (Output_data_plt_sparc::get_plt_entry_size): New function.
8413 * symtab.h (Symbol::got_offset_list): New function.
8414 (Symbol_table::for_all_symbols): New function.
8415 * target.h (Sized_target::got_entry_count): New function.
8416 (Sized_target::plt_entry_count): New function.
8417 (Sized_target::plt_entry_size): New function.
8418 * x86_64.cc (Target_x86_64::got_size): Add const.
8419 (Target_x86_64::got_entry_count): New function.
8420 (Target_x86_64::plt_entry_count): New function.
8421 (Target_x86_64::first_plt_entry_offset): New function.
8422 (Target_x86_64::plt_entry_size): New function.
8423 (Output_data_plt_x86_64::entry_count): New function.
8424 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8425 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8427 2010-08-12 Cary Coutant <ccoutant@google.com>
8429 * archive.cc: Include incremental.h.
8430 (Archive::Archive): Initialize incremental_info_.
8431 (Archive::include_member): Record archive members in incremental info.
8432 (Add_archive_symbols::run): Record begin and end of an archive in
8434 (Lib_group::include_member): Record objects in incremental info.
8435 * archive.h (Incremental_archive_entry): Forward declaration.
8436 (Archive::set_incremental_info): New member function.
8437 (Archive::incremental_info): New member function.
8438 (Archive::Unused_symbol_iterator): New class.
8439 (Archive::unused_symbols_begin): New member function.
8440 (Archive::unused_symbols_end): New member function.
8441 (Archive::incremental_info_): New data member.
8442 * incremental-dump.cc (find_input_containing_global): New function.
8443 (dump_incremental_inputs): Dump new incremental info sections.
8444 * incremental.cc: Include symtab.h.
8445 (Output_section_incremental_inputs): New class.
8446 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8447 new incremental info sections.
8448 (Sized_incremental_binary::do_check_inputs): Likewise.
8449 (Incremental_inputs::report_archive): Remove.
8450 (Incremental_inputs::report_archive_begin): New function.
8451 (Incremental_inputs::report_archive_end): New function.
8452 (Incremental_inputs::report_object): New function.
8453 (Incremental_inputs::finalize_inputs): Remove.
8454 (Incremental_inputs::report_input_section): New function.
8455 (Incremental_inputs::report_script): Rewrite.
8456 (Incremental_inputs::finalize): Do nothing but finalize string table.
8457 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8458 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8459 (Incremental_inputs::create_data_sections): New function.
8460 (Incremental_inputs::relocs_entsize): New function.
8461 (Output_section_incremental_inputs::set_final_data_size): New function.
8462 (Output_section_incremental_inputs::do_write): New function.
8463 (Output_section_incremental_inputs::write_header): New function.
8464 (Output_section_incremental_inputs::write_input_files): New function.
8465 (Output_section_incremental_inputs::write_info_blocks): New function.
8466 (Output_section_incremental_inputs::write_symtab): New function.
8467 * incremental.h (Incremental_script_entry): Forward declaration.
8468 (Incremental_object_entry): Forward declaration.
8469 (Incremental_archive_entry): Forward declaration.
8470 (Incremental_inputs): Forward declaration.
8471 (Incremental_inputs_header_data): Remove.
8472 (Incremental_inputs_header): Remove.
8473 (Incremental_inputs_header_write): Remove.
8474 (Incremental_inputs_entry_data): Remove.
8475 (Incremental_inputs_entry): Remove.
8476 (Incremental_inputs_entry_write): Remove.
8477 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8478 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8479 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8480 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8482 (Incremental_input_entry): New class.
8483 (Incremental_script_entry): New class.
8484 (Incremental_object_entry): New class.
8485 (Incremental_archive_entry): New class.
8486 (Incremental_inputs::Incremental_inputs): Initialize new data members.
8487 (Incremental_inputs::report_inputs): Remove.
8488 (Incremental_inputs::report_archive): Remove.
8489 (Incremental_inputs::report_archive_begin): New function.
8490 (Incremental_inputs::report_archive_end): New function.
8491 (Incremental_inputs::report_object): Change prototype.
8492 (Incremental_inputs::report_input_section): New function.
8493 (Incremental_inputs::report_script): Change prototype.
8494 (Incremental_inputs::get_reloc_count): New function.
8495 (Incremental_inputs::set_reloc_count): New function.
8496 (Incremental_inputs::create_data_sections): New function.
8497 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8498 (Incremental_inputs::inputs_section): New function.
8499 (Incremental_inputs::symtab_section): New function.
8500 (Incremental_inputs::relocs_section): New function.
8501 (Incremental_inputs::get_stringpool): Add const.
8502 (Incremental_inputs::command_line): Add const.
8503 (Incremental_inputs::inputs): Remove.
8504 (Incremental_inputs::command_line_key): New function.
8505 (Incremental_inputs::input_file_count): New function.
8506 (Incremental_inputs::input_files): New function.
8507 (Incremental_inputs::relocs_entsize): New function.
8508 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8509 (Incremental_inputs::finalize_inputs): Remove.
8510 (Incremental_inputs::Input_info): Remove.
8511 (Incremental_inputs::lock_): Remove.
8512 (Incremental_inputs::inputs_): Change type.
8513 (Incremental_inputs::inputs_map_): Remove.
8514 (Incremental_inputs::current_object_entry_): New data member.
8515 (Incremental_inputs::inputs_section_): New data member.
8516 (Incremental_inputs::symtab_section_): New data member.
8517 (Incremental_inputs::relocs_section_): New data member.
8518 (Incremental_inputs::reloc_count_): New data member.
8519 (Incremental_inputs_reader): New class.
8520 (Incremental_symtab_reader): New class.
8521 (Incremental_relocs_reader): New class.
8522 * layout.cc (Layout::finalize): Move finalization of incremental info
8523 and creation of incremental info sections to follow finalization of
8524 symbol table. Set offsets for postprocessing sections.
8525 (Layout::create_incremental_info_sections): Call
8526 Incremental_inputs::create_data_sections. Add incremental symtab
8527 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
8528 sections to layout after input sections.
8529 * layout.h (struct Timespec): Forward declaration.
8530 (Layout::incremental_inputs): Add const.
8531 (Layout::create_incremental_info_sections): Add parameter.
8532 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8533 * object.cc: Include incremental.h.
8534 (Relobj::finalize_incremental_relocs): New function.
8535 (Sized_relobj::do_layout): Record input sections in incremental info.
8536 * object.h (Object::output_section): New function.
8537 (Object::output_section_offset): Moved from Relobj.
8538 (Object::get_incremental_reloc_base): New function.
8539 (Object::get_incremental_reloc_count): New function.
8540 (Object::do_output_section): New function.
8541 (Object::do_output_section_offset): Moved from Relobj.
8542 (Object::do_get_incremental_reloc_base): New function.
8543 (Object::do_get_incremental_reloc_count): New function.
8544 (Object::Object): Initialize new data members.
8545 (Relobj::output_section): Renamed do_output_section and moved to
8547 (Relobj::output_section_offset): Moved to Object.
8548 (Relobj::do_get_incremental_reloc_base): New function.
8549 (Relobj::do_get_incremental_reloc_count): New function.
8550 (Relobj::allocate_incremental_reloc_counts): New function.
8551 (Relobj::count_incremental_reloc): New function.
8552 (Relobj::finalize_incremental_relocs): New function.
8553 (Relobj::next_incremental_reloc_index): New function.
8554 (Relobj::reloc_counts_): New data member.
8555 (Relobj::reloc_bases_): New data member.
8556 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
8557 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
8558 (Sized_relobj::incremental_relocs_scan): New function.
8559 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8560 (Sized_relobj::incremental_relocs_write): New function.
8561 (Sized_relobj::incremental_relocs_write_reltype): New function.
8562 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8564 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8565 archives and object files elsewhere.
8566 (Add_symbols::run): Report object files here.
8567 (Finish_group::run): Report end of archive at end of group.
8568 * reloc.cc: Include layout.h, incremental.h.
8569 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8570 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8571 (Sized_relobj::incremental_relocs_scan): New function.
8572 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8573 (Sized_relobj::do_relocate_sections): Write incremental relocations.
8574 (Sized_relobj::incremental_relocs_write): New function.
8575 (Sized_relobj::incremental_relocs_write_reltype): New function.
8576 * script.cc (read_input_script): Rewrite test for incremental link.
8577 Change call to Incremental_inputs::report_script.
8578 * symtab.h (Symbol_table::first_global_index): New function.
8579 (Symbol_table::output_count): New function.
8581 2010-08-12 Doug Kwan <dougkwan@google.com>
8583 * arm.cc (Target_arm::merge_object_attributes): Check command line
8584 options --no-wchar-size-warning and --no-enum-size-warning.
8585 * options.h (General_options): Add ld-compatible options
8586 --no-enum-size-warning and --no-wchar-size-warning.
8588 2010-08-04 Ian Lance Taylor <iant@google.com>
8590 * x86_64.cc (Target_x86_64::Scan::local): Use
8591 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8592 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8593 (Target_x86_64::Scan::global): Likewise.
8594 (Target_x86_64::Relocate::relocate): Likewise.
8595 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8598 2010-08-03 Cary Coutant <ccoutant@google.com>
8600 * merge.cc (Output_merge_string::do_add_input_section): Count strings
8601 to reserve space in merged_strings vector. Keep total input size
8603 (Output_merge_string::do_print_merge_stats): Print total input size.
8604 * merge.h (Output_merge_string): Add input_size_ field.
8605 * stringpool.cc (Stringpool_template::string_length): Move
8606 implementations out of Stringpool_template class and place in
8608 * stringpool.h (string_length): Move out of Stringpool_template.
8610 2010-08-03 Ian Lance Taylor <iant@google.com>
8613 * layout.cc (relaxation_loop_body): If address of load segment is
8614 set, adjust address to include headers if possible.
8616 2010-08-03 Ian Lance Taylor <iant@google.com>
8618 * version.cc (version_string): Bump to 1.10.
8620 2010-08-03 Ian Lance Taylor <iant@google.com>
8623 * layout.h (enum Output_section_order): Define.
8624 (class Layout): Update declarations.
8625 * layout.cc (Layout::get_output_section): Add order parameter.
8626 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8627 is_first_non_relro parameters. Change all callers.
8628 (Layout::choose_output_section): Likewise.
8629 (Layout::add_output_section_data): Likewise.
8630 (Layout::make_output_section): Likewise. Set order.
8631 (Layout::default_section_order): New function.
8632 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8633 * output.cc (Output_section::Output_section): Initialize order_.
8634 Don't initialize deleted fields.
8635 (Output_segment::Output_segment): Don't initialize deleted
8637 (Output_segment::add_output_section_to_load): New function
8638 replacing add_output_section. Change all callers to call this or
8639 add_output_section_to_nonload.
8640 (Output_segment::add_output_section_to_nonload): New function.
8641 (Output_segment::remove_output_section): Rewrite.
8642 (Output_segment::add_initial_output_data): Likewise.
8643 (Output_segment::has_any_data_sections): Likewise.
8644 (Output_segment::is_first_section_relro): Likewise.
8645 (Output_segment::maximum_alignment): Likewise.
8646 (Output_segment::has_dynamic_reloc): New function replacing
8647 dynamic_reloc_count. Change all callers.
8648 (Output_segment::has_dynamic_reloc_list): New function replacing
8649 dynamic_reloc_count_list. Change all callers.
8650 (Output_segment::set_section_addresses): Rewrite.
8651 (Output_segment::set_offset): Rewrite.
8652 (Output_segment::find_first_and_last_list): Remove.
8653 (Output_segment::set_tls_offsets): Rewrite.
8654 (Output_segment::first_section_load_address): Likewise.
8655 (Output_segment::output_section_count): Likewise.
8656 (Output_segment::section_with_lowest_load_address): Likewise.
8657 (Output_segment::write_section_headers): Likewise.
8658 (Output_segment::print_sections_to_map): Likewise.
8659 * output.h (class Output_data): Remove dynamic_reloc_count_
8660 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
8661 (Output_data::add_dynamic_reloc): Rewrite.
8662 (Output_data::has_dynamic_reloc): New function.
8663 (Output_data::dynamic_reloc_count): Remove.
8664 (class Output_section): Add order_ field. Remvoe is_relro_local_,
8665 is_last_relro_, is_first_non_relro_, is_interp_,
8666 is_dynamic_linker_section_ fields. Add order and set_order
8667 functions. Remove is_relro_local, set_is_relro_local,
8668 is_last_relro, set_is_last_relro, is_first_non_relro,
8669 set_is_first_non_relro functions, is_interp, set_is_interp,
8670 is_dynamic_linker_section, and set_is_dynamic_linker_section
8672 (class Output_segment): Change Output_data_list from std::list to
8673 std:;vector. Add output_lists_ field. Remove output_data_ and
8674 output_bss_ fields. Update declarations.
8676 2010-08-02 Ian Lance Taylor <iant@google.com>
8678 * arm.cc (Target_arm::gc_process_relocs): Use typename.
8679 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8680 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8682 2010-08-02 Ian Lance Taylor <iant@google.com>
8685 * script.cc (Script_options::Script_options): Initialize
8686 symbol_definitions_ and symbol_references_.
8687 (Script_options::add_symbol_assignment): Update
8688 symbol_definitions_ and symbol_references_.
8689 (Script_options::add_symbol_reference): New function.
8690 (script_symbol): New function.
8691 * script.h (class Script_options): Add symbol_definitions_ and
8692 symbol_references_ fields.
8693 (Script_options::referenced_const_iterator): New type.
8694 (Script_options::referenced_begin): New function.
8695 (Script_options::referenced_end): New function.
8696 (Script_options::is_referenced): New function.
8697 (Script_options::any_unreferenced): New function.
8698 * script-c.h (script_symbol): Declare.
8699 * yyscript.y (exp): Call script_symbol.
8700 * symtab.cc: Include "script.h".
8701 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8702 Change all callers. Check symbols referenced by scripts.
8703 (Symbol_table::add_undefined_symbols_from_command_line): Add
8704 layout parameter. Change all callers.
8705 (Symbol_table::do_add_undefined_symbols_from_command_line):
8706 Likewise. Break out loop body. Check symbols referenced by
8708 (Symbol_table::add_undefined_symbol_from_command_line): New
8709 function broken out of
8710 do_add_undefined_symbols_from_command_line.
8711 * symtab.h (class Symbol_table): Update declarations.
8712 * archive.cc: Include "layout.h".
8713 (Archive::should_include_member): Add layout parameter. Change
8714 all callers. Check for symbol mentioned in expression.
8715 * archive.h (class Archive): Update declaration.
8716 * object.cc (Sized_relobj::do_should_include_member): Add layout
8718 * object.h (Object::should_include_member): Add layout parameter.
8720 (Object::do_should_include_member): Add layout parameter.
8721 (class Sized_relobj): Update declaration.
8722 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8724 * dynobj.h (class Sized_dynobj): Update declaration.
8725 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8727 * plugin.h (class Sized_pluginobj): Update declaration.
8729 2010-08-02 Ian Lance Taylor <iant@google.com>
8732 * output.cc (Output_segment::set_offset): Search for the first and
8733 last sections rather than assuming that the list is in order.
8734 (Output_segment::find_first_and_last_list): New function.
8735 * output.h (class Output_segment): Update declarations.
8736 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8737 (relro_strip_test_SOURCES): New variable.
8738 (relro_strip_test_DEPENDENCIES): New variable.
8739 (relro_strip_test_LDFLAGS): New variable.
8740 (relro_strip_test_LDADD): New variable.
8741 (relro_strip_test.so): New target.
8743 2010-08-02 Ian Lance Taylor <iant@google.com>
8745 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8746 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8747 (Target_i386::got_tlsdesc_section): New function.
8748 (Target_i386::got_section): Create space for GOT entries for
8749 TLSDESC relocations.
8750 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8752 (Target_i386::Scan::global): Likewise.
8753 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8755 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8756 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8757 (Target_x86_64::got_tlsdesc_section): New function.
8758 (Target_x86_64::got_section): Create space for GOT entries for
8759 TLSDESC relocations.
8760 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8762 (Target_x86_64::Scan::global): Likewise.
8763 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8766 2010-08-02 Ian Lance Taylor <iant@google.com>
8768 * testsuite/final_layout.sh: Use dc to convert from hex to
8771 2010-07-29 Sriraman Tallam <tmsriram@google.com>
8773 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8774 paramter to the call to gold::gc_process_relocs.
8775 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8776 paramter to the call to gold::gc_process_relocs.
8777 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8778 parameter to the call to gold::gc_process_relocs.
8779 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8780 template parameter to the call to gold::gc_process_relocs.
8781 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8782 paramter to the call to gold::gc_process_relocs.
8783 * gc.h (get_embedded_addend_size): New function.
8784 (gc_process_relocs): Save the size of the reloc for use by ICF.
8785 * icf.cc (get_section_contents): Get the addend from the text section
8786 for SHT_REL relocation sections.
8787 * icf.h (Icf::Reloc_addend_size_info): New typedef.
8788 (Icf::Reloc_info): Add new member reloc_addend_size_info.
8789 * int_encoding.h (read_from_pointer): New overloaded function.
8790 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8791 * testsuite/icf_sht_rel_addend_test.sh: New file.
8792 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8793 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8795 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8797 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8798 * Makefile.in: Regenerate.
8799 * testsuite/Makefile.in: Regenerate.
8801 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
8803 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8804 * gold/testsuite/debug_msg.cc: Likewise.
8805 * gold/testsuite/odr_violation1.cc
8806 * gold/testsuite/odr_violation2.cc
8808 2010-07-21 Cary Coutant <ccoutant@google.com>
8810 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8811 string, and length fields.
8812 (Output_merge_string::Merged_strings_list): New type.
8813 (Output_merge_string::Merged_strings_lists): New typedef.
8814 (Output_merge_string): Replace merged_strings_ with
8815 merged_strings_lists_.
8816 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8817 Merged_strings_list per input object and section. Don't store pointer
8818 to the string. Don't store length with each merged string entry.
8819 (Output_merge_string::finalize_merged_data): Loop over list of merged
8820 strings lists. Recompute length of each merged string.
8822 2010-07-15 Cary Coutant <ccoutant@google.com>
8824 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8827 2010-07-14 Ian Lance Taylor <iant@google.com>
8829 * descriptors.cc (Descriptors::open): Report correct name in error
8832 2010-07-13 Doug Kwan <dougkwan@google.com>
8834 * arm.cc (Arm_input_section::Arm_input_section): For a
8835 SHT_ARM_EXIDX section, always keeps the input sections.
8836 (Arm_input_section::set_exidx_section_link): New method.
8837 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8838 has_errors_ to false.
8839 (Arm_exidx_input_section::has_errors,
8840 Arm_exidx_input_section::set_has_errors): New methods.
8841 (Arm_exidx_input_section::has_errors_): New data member.
8842 (Arm_relobj::get_exidx_shndx_list): New method.
8843 (Arm_output_section::append_text_sections_to_list): Do not skip
8844 section without SHF_EXECINSTR.
8845 (Arm_output_section::fix_exidx_coverage): Skip input sections with
8847 (Arm_relobj::make_exidx_input_section): Add new parameter for text
8848 section header. Make error messages more verbose. Check for
8849 a non-executable section linked to an EXIDX section.
8850 (Arm_relobj::do_read_symbols): Remove error checking, which has been
8851 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
8852 check that there is no deferred EXIDX section if we exit early.
8853 Instead of not making an EXIDX section in case of an error, make one
8854 and set the has_errors flag of it.
8855 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8856 in a relocatable link.
8857 (Target_arm::do_relax): Look for the EXIDX output section instead of
8858 assuming that it is called .ARM.exidx.
8859 (Target_arm::fix_exidx_coverage): Add a new parameter for input
8860 section list. Do not check for SHF_EXECINSTR section flags but
8861 skip any input section with errors.
8862 * output.cc (Output_section::Output_section): Initialize
8863 always_keeps_input_sections_ to false.
8864 (Output_section::add_input_section): Check for
8865 always_keeps_input_sections_.
8866 * output.h (Output_section::always_keeps_input_sections,
8867 Output_section::set_always_keeps_input_sections): New methods.
8868 (Output_section::always_keeps_input_sections): New data member.
8870 2010-07-13 Rafael Espindola <espindola@google.com>
8872 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8873 * fileread.h (Input_file): Add try_extra_search_path and find_file.
8875 2010-07-13 Philip Herron <herron.philip@googlemail.com>
8876 Ian Lance Taylor <iant@google.com>
8878 * output.h (Output_section_lookup_maps::add_merge_section):
8879 Correct check of whether value was inserted.
8880 (Output_section_lookup_maps::add_merge_input_section): Likewise.
8881 (Output_section_lookup_maps::add_relaxed_input_section):
8883 * arm.cc (Target_arm::got_section): Remove used local os.
8884 * i386.cc (Target_i386::got_section): Likewise.
8885 * x86_64.cc (Target_x86_64::got_section): Likewise.
8886 * sparc.cc (Target_sparc::got_section): Likewise.
8887 (Target_sparc::relocate): Remove unused local have_got_offset.
8888 * powerpc.cc (Target_powerpc::relocate): Likewise.
8890 2010-07-13 Ian Lance Taylor <iant@google.com>
8892 * compressed_output.cc (zlib_decompress): Fix signature in
8895 * archive.cc (Archive::include_member): Unlock an external member
8896 of a thin archive. Don't bother to delete an object we know is
8899 2010-07-12 Cary Coutant <ccoutant@google.com>
8901 * compressed_output.cc (zlib_decompress): New function.
8902 (get_uncompressed_size): New function.
8903 (decompress_input_section): New function.
8904 * compressed_output.h (get_uncompressed_size): New function.
8905 (decompress_input_section): New function.
8906 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8907 Handle compressed debug sections.
8908 * layout.cc (is_compressed_debug_section): New function.
8909 (Layout::output_section_name): Map compressed section names to
8911 * layout.h (is_compressed_debug_section): New function.
8912 (is_debug_info_section): Recognize compressed debug sections.
8913 * merge.cc: Include compressed_output.h.
8914 (Output_merge_data::do_add_input_section): Handle compressed
8916 (Output_merge_string::do_add_input_section): Handle compressed
8918 * object.cc: Include compressed_output.h.
8919 (Sized_relobj::Sized_relobj): Initialize new data members.
8920 (build_compressed_section_map): New function.
8921 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8922 * object.h (Object::section_is_compressed): New method.
8923 (Object::do_section_is_compressed): New method.
8924 (Sized_relobj::Compressed_section_map): New type.
8925 (Sized_relobj::do_section_is_compressed): New method.
8926 (Sized_relobj::compressed_sections_): New data member.
8927 * output.cc (Output_section::add_input_section): Handle compressed
8929 * reloc.cc: Include compressed_output.h.
8930 (Sized_relobj::write_sections): Handle compressed debug sections.
8932 2010-07-08 Cary Coutant <ccoutant@google.com>
8934 * resolve.cc (Symbol_table::resolve): Remember whether undef was
8935 weak when resolving to a dynamic def.
8936 (Symbol_table::should_override): Add adjust_dyndef flag; set it
8937 for weak undef/dynamic def cases. Adjust callers.
8938 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8939 undef_binding_weak_.
8940 (Symbol_table::sized_write_globals): Adjust symbol binding.
8941 (Symbol_table::sized_write_symbol): Add binding parameter.
8942 * symtab.h (Symbol::set_undef_binding): New method.
8943 (Symbol::is_undef_binding_weak): New method.
8944 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8945 (Symbol_table::should_override): Add new parameter.
8946 (Symbol_table::sized_write_symbol): Add new parameter.
8948 * testsuite/weak_undef_file1.cc: Add new test case.
8949 * testsuite/weak_undef_file2.cc: Fix header comment.
8950 * testsuite/weak_undef_test.cc: Add new test case.
8952 2010-06-29 Doug Kwan <dougkwan@google.com>
8954 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8955 Initialize USE_SYMBOL_.
8956 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8958 (Arm_reloc_property::uses_symbol_): New data member declaration.
8959 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8960 uses symbol value and symbol is undefined but not weakly undefined.
8962 2010-06-28 Rafael Espindola <espindola@google.com>
8964 * plugin.cc (Plugin::load): Use dlerror.
8966 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8968 * symtab.cc (detect_odr_violations): When reporting an ODR
8969 violation, report an object where the symbol is defined.
8971 2010-06-25 Doug Kwan <dougkwan@google.com>
8973 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8974 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8976 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8977 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8978 target hook to detect function points.
8979 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8980 * icf.h (Icf::check_section_for_function_pointers): Change type of
8981 parameter SECTION_NAME to const reference to std::string. Use
8982 target hook to determine if section may have unsafe pointers.
8983 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8986 2010-06-21 Rafael Espindola <espindola@google.com>
8988 * fileread.cc (Input_file::find_fie): New
8989 (Input_file::open): Use Input_file::find_fie.
8990 * fileread.h (Input_file::find_fie): New
8991 * plugin.cc (set_extra_library_path): New.
8992 (Plugin::load): Add set_extra_library_path to the transfer vector.
8993 (Plugin_manager::set_extra_library_path): New.
8994 (Plugin_manager::add_input_file): Use the extra search path if set.
8995 (set_extra_library_path(): New.
8996 * plugin.h (Plugin_manager): Add set_extra_library_path and
8999 2010-06-19 Cary Coutant <ccoutant@google.com>
9001 * layout.cc (gdb_sections): Add .debug_types.
9002 (lines_only_debug_sections): Likewise.
9004 2010-06-18 Rafael Espindola <espindola@google.com>
9006 * plugin.cc (add_input_file,add_input_library)
9007 (Plugin_manager::add_input_file): Make filename arguments const.
9008 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9011 2010-06-16 Doug Kwan <dougkwan@google.com>
9013 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9014 .ARM.attributes section if we have not merged any input
9015 attributes sections.
9017 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9019 * arm.cc: Allow combining objects with no EABI version
9022 2010-06-15 Rafael Espindola <espindola@google.com>
9024 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9026 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9028 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9029 (struct iovec): Correct !HAVE_READV definition.
9031 2010-06-10 Cary Coutant <ccoutant@google.com>
9033 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9034 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9036 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9039 * symtab.h (Symbol::is_placeholder): New member function.
9040 * target-reloc.h (relocate_section): Check for placeholder symbols.
9042 * testsuite/Makefile.am (plugin_test_8): New test.
9043 (plugin_test_9): New test.
9044 * testsuite/Makefile.in: Regenerate.
9046 2010-06-09 Nick Clifton <nickc@redhat.com>
9048 * yyscript.y (input_list_element): Allow strings prefixed with
9049 the '-' character. Treat these as libraries.
9050 * script.cc (script_add_library): New function. Adds a library
9051 specified by "-l<name>" found in an input script.
9052 * script-c.h: Add prototype for script_add_library.
9054 2010-06-07 Doug Kwan <dougkwan@google.com>
9056 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9057 Restrict stub-group size to be within long conditional branch
9058 range when working around cortex-A8 erratum.
9060 2010-06-07 Damien Diederen <dd@crosstwine.com>
9062 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9065 2010-06-03 Sriraman Tallam <tmsriram@google.com>
9069 (Output_section::Input_section_sort_entry::compare_section_ordering):
9070 Change to return non-zero correctly.
9071 (Output_section::Input_section_sort_section_order_index_compare
9072 ::operator()): Change to fix ambiguity in comparisons.
9074 2010-06-01 Sriraman Tallam <tmsriram@google.com>
9076 * gold.h (is_wildcard_string): New function.
9077 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9078 (Layout::layout_eh_frame): Ditto.
9079 (Layout::find_section_order_index): New method.
9080 (Layout::read_layout_from_file): New method.
9081 * layout.h (Layout::find_section_order_index): New method.
9082 (Layout::read_layout_from_file): New method.
9083 (Layout::input_section_position_): New private member.
9084 (Layout::input_section_glob_): New private member.
9085 * main.cc (main): Call read_layout_from_file here.
9086 * options.h (--section-ordering-file): New option.
9087 * output.cc (Output_section::input_section_order_specified_): New
9089 (Output_section::Output_section): Initialize new member.
9090 (Output_section::add_input_section): Add new parameter.
9091 Keep input sections when --section-ordering-file is used.
9092 (Output_section::set_final_data_size): Sort input sections when
9093 section ordering file is specified.
9094 (Output_section::Input_section_sort_entry): Add new parameter.
9096 (Output_section::Input_section_sort_entry::compare_section_ordering):
9098 (Output_section::Input_section_sort_compare::operator()): Change to
9099 consider section_order_index.
9100 (Output_section::Input_section_sort_init_fini_compare::operator()):
9101 Change to consider section_order_index.
9102 (Output_section::Input_section_sort_section_order_index_compare
9103 ::operator()): New method.
9104 (Output_section::sort_attached_input_sections): Change to sort
9105 according to section order when specified.
9106 (Output_section::add_input_section<32, true>): Add new parameter.
9107 (Output_section::add_input_section<64, true>): Add new parameter.
9108 (Output_section::add_input_section<32, false>): Add new parameter.
9109 (Output_section::add_input_section<64, false>): Add new parameter.
9110 * output.h (Output_section::add_input_section): Add new parameter.
9111 (Output_section::input_section_order_specified): New
9113 (Output_section::set_input_section_order_specified): New method.
9114 (Input_section::Input_section): Initialize section_order_index_.
9115 (Input_section::section_order_index): New method.
9116 (Input_section::set_section_order_index): New method.
9117 (Input_section::section_order_index_): New member.
9118 (Input_section::Input_section_sort_section_order_index_compare): New
9120 (Output_section::input_section_order_specified_): New member.
9121 * script-sections.cc (is_wildcard_string): Delete and move modified
9123 (Output_section_element_input::Output_section_element_input): Modify
9124 call to is_wildcard_string.
9125 (Output_section_element_input::Input_section_pattern
9126 ::Input_section_pattern): Ditto.
9127 (Output_section_element_input::Output_section_element_input): Ditto.
9128 * testsuite/Makefile.am (final_layout): New test case.
9129 * testsuite/Makefile.in: Regenerate.
9130 * testsuite/final_layout.cc: New file.
9131 * testsuite/final_layout.sh: New file.
9133 2010-06-01 Rafael Espindola <espindola@google.com>
9135 * plugin.cc (Plugin::load): Pass the output name to the plugin.
9137 2010-06-01 Rafael Espindola <espindola@google.com>
9139 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9140 visibility of symbols.
9142 2010-05-27 Doug Kwan <dougkwan@google.com>
9144 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9145 from start of output section instead of address for a local symbol
9146 in a merged or relaxed section when doing a relocatable link.
9148 2010-05-26 Rafael Espindola <espindola@google.com>
9151 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9152 adding sections the garbage collector removed.
9153 * gold/testsuite/Makefile.am: Add test.
9154 * gold/testsuite/Makefile.in: Regenerate.
9155 * gold/testsuite/plugin_test_7.sh: New.
9156 * gold/testsuite/plugin_test_7_1.c: New.
9157 * gold/testsuite/plugin_test_7_2.c: New.
9159 2010-05-26 Rafael Espindola <espindola@google.com>
9161 * script-sections.cc (Output_section_definition::set_section_addresses):
9162 Check for --section-start.
9164 2010-05-26 Doug Kwan <dougkwan@google.com>
9166 * arm.cc (Arm_scan_relocatable_relocs): New class.
9167 (Target_arm::relocate_special_relocatable): New method.
9168 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9169 (Arm_relocate_functions::thumb_branch_common): Same.
9170 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9171 instead of Default_scan_relocatable_relocs.
9172 * target-reloc.h (relocate_for_relocatable): Let target handle
9173 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9174 * target.h (Sized_target::relocate_special_relocatable): New method.
9176 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9178 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9180 2010-05-23 Doug Kwan <dougkwan@google.com>
9182 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9184 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9185 with a direct branch, not a conditional branch, to a stub.
9186 * merge.cc (Output_merge_base::record_input_section): New method
9188 (Output_merge_data::do_add_input_section): Record input section if
9189 keeps-input-sections flag is set.
9190 (Output_merge_string::do_add_input_section): Ditto.
9191 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9192 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9194 (Output_merge_base::keeps_input_sections,
9195 Output_merge_base::set_keeps_input_sections,
9196 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9198 (Output_merge_base::Input_sections): New type declaration.
9199 (Output_merge_base::input_sections_begin,
9200 Output_merge_base::input_sections_end,
9201 Output_merge_base::do_set_keeps_input_sections): New method definitions.
9202 (Output_merge_base::bool keeps_input_sections_,
9203 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9204 Output_merge_base::input_sections_): New data members.
9205 (Output_merge_data::do_set_keeps_input_sections): New method
9207 (Output_merge_string::do_set_keeps_input_sections): Ditto.
9208 * output.cc (Output_section::Input_section::relobj): Move method
9209 defintion from class declaration to here and handle merge sections.
9210 (Output_section::Input_section::shndx): Ditto.
9211 (Output_section::Output_section): Remove initializations of removed
9212 data members and initialize new data member LOOKUP_MAPS_.
9213 (Output_section::add_input_section): Set keeps-input-sections flag
9214 for a newly created merge output section as appropriate. Adjust code
9215 to use Output_section_lookup_maps class.
9216 (Output_section::add_relaxed_input_section): Adjst code for lookup
9217 maps code refactoring.
9218 (Output_section::add_merge_input_section): Add a new parameter
9219 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
9220 class. If adding input section to a newly created merge output
9221 section fails, remove the new merge section.
9222 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9223 Adjust code for use of the Output_section_lookup_maps class.
9224 (Output_section::find_merge_section): Ditto.
9225 (Output_section::build_lookup_maps): New method defintion.
9226 (Output_section::find_relaxed_input_section): Adjust code to use
9227 Output_section_lookup_maps class.
9228 (Output_section::get_input_sections): Export merge sections. Adjust
9229 code to use Output_section_lookup_maps class.
9230 (Output_section:::add_script_input_section): Adjust code to use
9231 Output_section_lookup_maps class. Update lookup maps for merge
9233 (Output_section::discard_states): Use Output_section_lookup_maps.
9234 (Output_section::restore_states): Same.
9235 * output.h (Merge_section_properties): Move class defintion out of
9237 (Output_section_lookup_maps): New class.
9238 (Output_section::Input_section::is_merge_section): New method
9240 (Output_section::Input_section::relobj): Move defintion out of class
9241 defintion. Declare method only.
9242 (Output_section::Input_section::shndx): Ditto.
9243 (Output_section::Input_section::output_merge_base): New method defintion.
9244 (Output_section::Input_section::u2_.pomb): New union field.
9245 (Output_section::Merge_section_by_properties_map,
9246 Output_section::Output_section_data_by_input_section_map,
9247 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9249 (Output_section::add_merge_input_section): Add new parameter
9250 KEEPS_INPUT_SECTIONS.
9251 (Output_section::build_lookup_maps): New method declaration.
9252 (Output_section::merge_section_map_,
9253 Output_section::merge_section_by_properties_map_,
9254 Output_section::relaxed_input_section_map_,
9255 Output_section::is_relaxed_input_section_map_valid_): Remove data
9257 (Output_section::lookup_maps_): New data member.
9259 2010-05-21 Doug Kwan <dougkwan@google.com>
9262 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9263 avoid a compilation error.
9265 2010-05-19 Rafael Espindola <espindola@google.com>
9267 * script-sections.cc (Output_section_definition::allocate_to_segment):
9268 Update the phdrs_list even when the output section is NULL.
9269 * testsuite/Makefile.am: Add test.
9270 * testsuite/Makefile.in: Regenerate.
9271 * testsuite/script_test_9.cc: New.
9272 * testsuite/script_test_9.sh: New.
9273 * testsuite/script_test_9.t: New.
9275 2010-05-19 Doug Kwan <dougkwan@google.com>
9277 * arm.cc (Arm_input_section::original_size): New method.
9278 (Arm_input_section::do_addralign): Add a cast.
9279 (Arm_input_section::do_output_offset): Remove static cast.
9280 (Arm_input_section::original_addralign,
9281 Arm_input_section::original_size_): Change type to uint32_t.
9282 (Arm_input_section::init): Add safe casts for section alignment
9284 (Arm_input_section::set_final_data_size): Do not set address and
9285 offset of stub table.
9286 (Arm_output_section::fix_exidx_coverage): Change use of of
9287 Output_section::Simple_input_section to that of
9288 Output_section::Input_section.
9289 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9290 except for the first pass.
9291 * output.cc (Output_section::get_input_sections): Change type of
9292 input_sections to std::list<Input_section>.
9293 (Output_section::add_script_input_section): Rename from
9294 Output_section::add_simple_input_section. Change type of SIS
9295 parameter from Simple_input_section to Input_section.
9296 * output.h (Output_section::Simple_input_section): Remove class.
9297 (Output_section::Input_section): Change class visibility to public.
9298 (Output_section::Input_section::addralign): Use stored alignments
9299 for special input sections if set.
9300 (Output_section::Input_section::set_addralign): New method.
9301 (Output_section::get_input_sections): Change parameter type from
9302 list of Simple_input_section to list of Input_section.
9303 (Output_section::add_script_input_section): Rename from
9304 Output_section::add_simple_input_section. Change first parameter's
9305 type from Simple_input_section to Input_section and remove the
9306 second and third parameters.
9307 * script-sections.cc (Input_section::Input_section_list): Change
9308 type to list of Output_section::Input_section/
9309 (Input_section_info::Input_section_info): Change parameter type of
9310 INPUT_SECTION to Output_section::Input_section.
9311 (Input_section_info::input_section): Change return type.
9312 (Input_section_info::input_section_): Change type to
9313 Output_section::Input_section.
9314 (Output_section_element_input::set_section_addresses): Adjust code
9315 to use Output_section::Input_section instead of
9316 Output_section::Simple_input_section. Adjust code for renaming
9317 of Output_section::add_simple_input_section.
9318 (Orphan_output_section::set_section_addresses): Ditto.
9320 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9322 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9323 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9325 2010-05-18 Rafael Espindola <espindola@google.com>
9327 * options.cc (General_options::finalize): Handle -nostdlib.
9328 * options.h (nostdlib): New option.
9329 * script.cc (script_add_search_dir): Handle -nostdlib.
9331 2010-05-12 Doug Kwan <dougkwan@google.com>
9333 * arm.cc (Target_arm::do_finalize_sections): Create an empty
9334 attributes section only if there no attributes section after merging.
9335 (Target_arm::merge_object_attributes): Move value of
9336 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9337 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9338 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9339 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9340 and arm_attr_merge_7.stdout.
9341 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9342 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9343 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9344 arm_attr_merge_7b.o): New rules.
9345 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9347 * testsuite/Makefile.in: Regenerate.
9348 * testsuite/arm_attr_merge.sh: New file.
9349 * testsuite/arm_attr_merge_[67][ab].s: Same.
9351 2010-05-05 Nick Clifton <nickc@redhat.com>
9353 * po/es.po: Updated Spanish translation.
9355 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9357 * Makefile.am (install-exec-local): Properly install gold as
9358 default cross linker.
9359 * Makefile.in: Regenerated.
9361 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9362 Nick Clifton <nickc@redhat.com>
9364 * configure.ac (install_as_default): Define and set to false
9365 unless --enable-gold or --enable-gold=both/gold has been
9367 * configure: Regenerate.
9369 * Makefile.am (install-exec-local): Install the executable as
9370 'ld.gold'. If install_as_default is true then also install it as
9372 * Makefile.in: Regenerated.
9374 2010-04-24 Ian Lance Taylor <iant@google.com>
9376 * layout.cc (Layout::layout_reloc): In relocatable link don't
9377 combine reloc sections for grouped sections.
9379 2010-04-23 Sriraman Tallam <tmsriram@google.com>
9381 * gc.h (gc_process_relocs): Pass information on relocs pointing to
9382 sections that are not ordinary to icf.
9383 * icf.cc (get_section_contents): Handle relocation pointing to section
9384 with no object or shndx information.
9385 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9386 * testsuite/Makefile.in: Regenerate.
9387 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9388 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9390 2010-04-22 Ian Lance Taylor <iant@google.com>
9392 * expression.cc (Expression::Expression_eval_info): Add
9393 result_alignment_pointer field.
9394 (Expression::eval_with_dot): Add result_alignment_pointer
9395 parameter. Change all callers.
9396 (Expression::eval_maybe_dot): Likewise.
9397 (class Binary_expression): Add alignment_pointer parameter to
9398 left_value and right_value. Change all callers.
9399 (BINARY_EXPRESSION): Set result alignment.
9400 (class Trinary_expression): Add alignment_pointer parameter to
9401 arg2_value and arg3_value. Change all callers.
9402 (Trinary_cond::value): Set result alignment.
9403 (Max_expression::value, Min_expression::value): Likewise.
9404 (Align_expression::value): Likewise.
9405 * script-sections.cc (class Sections_element): Add dot_alignment
9406 parameter to set_section_addresses virtual function. Update
9408 (class Output_section_element): Likewise.
9409 (Script_sections::create_segments): Add dot_alignment parameter.
9411 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9412 (Script_sections::set_phdrs_clause_addresses): Likewise.
9413 * script-sections.h: Update declarations.
9414 * script.h: Update declarations.
9415 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9417 * testsuite/script_test_3.t: Set large alignment.
9418 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9419 segment has expected alignment.
9421 2010-04-22 Nick Clifton <nickc@redhat.com>
9423 * po/gold.pot: Updated by the Translation project.
9424 * po/vi.po: Updated Vietnamese translation.
9426 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9428 * testsuite/Makefile.am (check_PROGRAMS): Add
9429 icf_virtual_function_folding_test.
9430 * testsuite/Makefile.in: Regenerated.
9432 2010-04-15 Andrew Haley <aph@redhat.com>
9434 * options.h (merge_exidx_entries): New option.
9435 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9436 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9437 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9438 (Target_arm::merge_exidx_entries): New function.
9439 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9440 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9441 to Arm_exidx_fixup constructor.
9442 Add new arg, merge_exidx_entries.
9443 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9444 Arm_output_section::fix_exidx_coverage.
9446 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9448 * icf.cc (get_section_contents): Check for preemptible functions.
9449 Ignore addend when appropriate.
9450 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9452 (add_from_relobj): Check for section folded.
9453 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9454 * symtab.h (should_add_dynsym_entry): Add new parameter.
9455 * target-reloc.h (scan_relocs): Check for section folded.
9456 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9457 Check reloc types for function pointers in shared objects.
9458 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9460 (icf_preemptible_functions_test): New test case.
9461 (icf_string_merge_test): New test case.
9462 * testsuite.Makefile.in: Regenerate.
9463 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9464 bar_glob. Refactor code.
9465 * testsuite/icf_preemptible_functions_test.cc: New file.
9466 * testsuite/icf_preemptible_functions_test.sh: New file.
9467 * testsuite/icf_string_merge_test.cc: New file.
9468 * testsuite/icf_string_merge_test.sh: New file.
9469 * testsuite/icf_virtual_function_folding_test.cc: New file.
9470 * testsuite/icf_virtual_function_folding_test.sh: New file.
9472 2010-04-14 Doug Kwan <dougkwan@google.com>
9474 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9475 for local symbol recounting if we remove a section due to ICF.
9476 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9477 there are no regular objects in input.
9479 2010-04-13 Doug Kwan <dougkwan@google.com>
9481 * arm.cc (Arm_input_section::set_final_data_size): Compute
9482 accurate final data size instead of using current data size.
9484 2010-04-09 Doug Kwan <dougkwan@google.com>
9486 * layout.cc (Layout::choose_output_section): Handle script section
9488 (Layout::make_output_section_for_script): Add section type parameter.
9489 Handle script section types.
9490 * layout.h (Layout::make_output_section_for_script): Add section
9492 * output.cc (Output_section::Output_section): Initialize data member
9494 (Output_section::do_reset_address_and_file_offset): Do not set address
9495 to 0 if section is a NOLOAD section.
9496 * output.h (Output_section::is_noload): New method.
9497 (Output_section::set_is_noload): Ditto.
9498 (Output_section::is_noload_): New data member.
9499 * script-c.h (Script_section_type): New enum type.
9500 (struct Parser_output_section_header): Add new file section_type.
9501 * script-sections.cc (Sections_element::output_section_name): Add
9502 parameter for returning script section type.
9503 (Output_section_definition::output_section_name): Ditto.
9504 (Output_section_definition::section_type)P; New method.
9505 (Output_section_definiton::script_section_type_name): Ditto.
9506 (Output_section_definition::script_section_type_): New data member.
9507 (Output_section_definition::Output_section_definition): Initialize
9508 data member Output_section_definition::script_section_type_.
9509 (Output_section_definition::create_sections): Pass script section type
9510 to Layout::make_output_section_for_script.
9511 (Output_section_definition::output_section_name): Return script
9512 section type to caller.
9513 (Output_section_definition::set_section_address): Do not advance
9514 dot value and load address if section type is NOLOAD. Set address
9515 of NOLOAD sections regardless of section flags.
9516 (Output_section_definition::print): Print section type if it is
9517 not SCRIPT_SECTION_TYPE_NONE.
9518 (Output_section_definition::section_type): New method.
9519 (Output_section_definition::script_section_type_name): Ditto.
9520 (Script_sections::output_section_name): Add new parameter
9521 PSECTION_TYPE for returning script section type. Pass it to
9522 section elements. Handle discard sections.
9523 (Sort_output_sections::operator()): Handle NOLOAD sections.
9524 * script-sections.h (Script_sections::Section_type): New enum type.
9525 (Script_sections::output_section_name): Add a new parameter for
9526 returning script section type.
9527 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9529 * yyscript.y (union): Add new field SECTION_TYPE.
9530 (COPY, DSECT, INFO, NOLOAD): New tokens.
9531 (opt_address_and_section_type): Change type to output_section_header.
9532 (section_type): New non-terminal
9533 (section_header): Handle section type.
9534 (opt_address_and_section_type): Return section type value.
9536 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
9538 * testsuite/plugin_common_test_1.c (foo): Add prototype.
9539 * testsuite/plugin_common_test_2.c (foo): Likewise.
9541 2010-04-08 Doug Kwan <dougkwan@google.com>
9543 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9545 * output.cc (Output_section::add_merge_input_section): Simplify
9546 code and return status of Output_merge_base::add_input_section.
9547 Update merge section map only if Output_merge_base::add_input_section
9550 2010-04-07 Doug Kwan <dougkwan@google.com>
9552 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9553 if section is marked as containing instructions but has no mapping
9555 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9556 correct section index.
9557 (Arm_relobj::find_linked_text_section): Ditto.
9559 2010-04-07 Cary Coutant <ccoutant@google.com>
9561 * archive.cc (include_member): Destroy Read_symbols_data object before
9563 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9564 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9565 (Read_symbols_data::~Read_symbols_data) New destructor.
9566 (Section_relocs::Section_relocs) New constructor.
9567 (Section_relocs::~Section_relocs) New destructor.
9568 (Read_relocs_data::Read_relocs_data) New constructor.
9569 (Read_relocs_data::~Read_relocs_data) New destructor.
9570 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9571 pointers to NULL after deleting.
9573 2010-04-07 Doug Kwan <dougkwan@google.com>
9575 * arm.cc: Replace "endianity" with "endianness" in comments.
9576 (Arm_exidx_cantunwind): Ditto.
9577 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9578 (Arm_relobj::merge_flags_and_attributes): New method.
9579 (Arm_relobj::merge_flags_and_attributes_): New data member.
9580 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9581 (Arm_relobj::scan_sections_for_stubs): Ditto.
9582 (Arm_relobj::do_read_symbols): Check to see if we really want to
9583 merge processor-specific flags and attributes. Exit early if
9584 an object is empty except for section names and the undefined symbol.
9585 (Target_arm::do_finalize_sections): Move check for ELF format to
9586 Arm_relobj::do_read_symbols. Merge processor specific flags and
9587 attributes from a regular object only when we have determined that
9588 it is aapropriate. Do not create an .ARM.attributes section in
9589 output if there is no regular input object.
9590 (Target_arm::merge_processor_specific_flags): Check
9591 --warn-mismatch before printing any error.
9592 (Target_arm::merge_object_attributes): Ditto.
9593 * gold.cc (queue_middle_tasks): Handle the case in which there is
9594 no regular object in input.
9595 * options.cc (General_options::parse_EB): New method.
9596 (General_options::parse_EL): Same.
9597 (General_options::General_options): Initialize endianness_.
9598 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9600 (General_options::Endianness): New enum.
9601 (General_options::endianness): New method.
9602 (General_options::endianness_): New data member.
9603 * parameters.cc (Parameters::set_options): Check target endianness.
9604 (Parameters::set_target_once): Ditto.
9605 (Parameters::check_target_endianness): New method.
9606 (parameters_force_valid_target): If either -EL or -EB is specified,
9607 use it to define endianness of default target.
9608 * parameters.h (Parameters::check_target_endianness): New method
9610 * target.h (class Target): Change "endianity" to "endianness"
9613 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9615 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9616 * configure: Regenerate.
9617 * Makefile.in: Regenerate.
9618 * testsuite/Makefile.in: Regenerate.
9620 2010-04-06 Cary Coutant <ccoutant@google.com>
9623 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9624 prevailing definitions of common symbols.
9625 * testsuite/plugin_test_6.sh: New test case.
9626 * testsuite/plugin_common_test_1.c: New test case.
9627 * testsuite/plugin_common_test_2.c: New test case.
9628 * testsuite/Makefile.am (plugin_test_6): New test case.
9629 * testsuite/Makefile.in: Regenerate.
9631 2010-04-06 Nick Clifton <nickc@redhat.com>
9633 * po/vi.po: New Vietnamese translation.
9635 2010-03-30 Doug Kwan <dougkwan@google.com>
9637 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9639 2010-03-25 Doug Kwan <dougkwan@google.com>
9641 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9642 to avoid a conversion warning on a 32-bit host.
9644 2010-03-24 Ian Lance Taylor <iant@google.com>
9646 * testsuite/script_test_3.t: Add a TLS segment.
9647 * testsuite/Makefile.am (check_PROGRAMS): Add
9648 tls_phdrs_script_test.
9649 (tls_phdrs_script_test_SOURCES): Define.
9650 (tls_phdrs_script_test_DEPENDENCIES): Define.
9651 (tls_phdrs_script_test_LDFLAGS): Define.
9652 (tls_phdrs_script_test_LDADD): Define.
9653 * testsuite/Makefile.in: Rebuild.
9655 2010-03-23 Cary Coutant <ccoutant@google.com>
9657 * fileread.cc (find_or_make_view): Fix comment.
9659 2010-03-23 Ian Lance Taylor <iant@google.com>
9661 * script-sections.cc (class Orphan_section_placement): Define
9662 PLACE_TLS and PLACE_TLS_BSS.
9663 (Orphan_section_placement::Orphan_section_placement): Initialize
9665 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9666 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9667 (tls_script_test_SOURCES): Define.
9668 (tls_script_test_DEPENDENCIES): Define.
9669 (tls_script_test_LDFLAGS): Define.
9670 (tls_script_test_LDADD): Define.
9671 * testsuite/Makefile.in: Rebuild.
9673 2010-03-22 Doug Kwan <dougkwan@google.com>
9675 * arm.cc (Arm_relocate_functions::abs8,
9676 Arm_relocate_functions::abs16): Use correct check for overflow
9677 specified in the ARM ELF specs.
9678 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
9679 target of a BLX instruction specially.
9680 (Reloc_stub::stub_type_for_reloc): Ditto.
9681 (Relocate::relocate): Use symbolic names instead of numeric relocation
9682 codes to report error.
9683 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9685 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9686 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9687 thumb2_blx_out_of_range.stdout
9688 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9689 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9690 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9691 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9692 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9693 thumb2_blx_in_range, thumb2_blx_in_range.o,
9694 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9695 thumb2_blx_out_of_range.o): New rules.
9696 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9697 thumb2_blx_in_range and thumb2_blx_out_of_range.
9698 * testsuite/Makefile.in: Regenerate.
9699 * arm_branch_in_range.sh: Add tests for THUMB BLX.
9700 * testsuite/thumb_blx_in_range.s: New file.
9701 * testsuite/thumb_blx_out_of_range.s: New file.
9703 2010-03-22 Rafael Espindola <espindola@google.com>
9705 * archive.cc (Should_include): Move to archive.h.
9706 (should_include_member): Make it a member of Archive.
9708 (Add_lib_group_symbols): New.
9709 * archive.h: Include options.h.
9710 (Archive_member): Moved from Archive.
9711 (Should_include): Moved from archive.cc.
9713 (Add_lib_group_symbols): New.
9714 * dynobj.cc (do_should_include_member): New.
9715 * dynobj.h (do_should_include_member): New.
9716 * gold.cc (queue_initial_tasks): Update call to queue.
9717 * main.cc (main): Print lib group stats.
9718 * object.cc (do_should_include_member): New.
9719 * object.h: Include archive.h.
9720 (Object::should_include_member): New.
9721 (Object::do_should_include_member): New.
9722 (Sized_relobj::do_should_include_member): New.
9723 * options.cc (General_options::parse_start_lib): New.
9724 (General_options::parse_end_lib): New.
9725 (Input_arguments::add_file): Handle lib groups.
9726 (Input_arguments::start_group): Check we are not in a lib.
9727 (Input_arguments::start_lib): New.
9728 (Input_arguments::end_lib): New.
9729 * options.h (General_options): Add start_lib and end_lib.
9730 (Input_argument::lib_): New.
9731 (Input_argument::lib): New.
9732 (Input_argument::is_lib): New.
9733 (Input_file_lib): New.
9734 (Input_arguments::in_lib_): New.
9735 (Input_arguments::in_lib): New.
9736 (Input_arguments::start_lib): New.
9737 (Input_arguments::end_lib_): New.
9738 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9739 in unused members as preempted.
9740 (Sized_pluginobj::do_should_include_member): New.
9741 * plugin.h (Sized_pluginobj::do_should_include_member): New.
9742 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9744 (Read_symbols::do_whole_lib_group): New.
9745 (Read_symbols::do_lib_group): New.
9746 (Read_symbols::do_read_symbols): Handle lib groups.
9747 (Read_symbols::get_name): Handle lib groups.
9748 * readsyms.h (Read_symbols): Add an archive member pointer.
9749 (Read_symbols::do_whole_lib_group): New.
9750 (Read_symbols::do_lib_group): New.
9751 (Read_symbols::member_): New.
9752 * script.cc (read_input_script): Update call to queue_soon.
9754 2010-03-19 Doug Kwan <dougkwan@google.com>
9756 * arm.cc (Stub_table::Stub_table): Initialize new data members
9757 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9758 (Stub_table::add_reloc_stub): Assign stub offset and update
9759 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9760 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9762 (Stub_table::update_data_size_and_addralign): Use
9763 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9764 instead of going over all reloc stubs.
9765 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9766 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9767 Stringpool_template::offset_ to size of Stringpool_char.
9768 (Stringpool_template::new_key_offset): Remove code to initialize
9769 Stringpool_template::offset_.
9770 * stringpool.h (Stringpool_template::set_no_zero_null): Set
9771 Stringpool_template::offset_ to zero.
9773 2010-03-15 Doug Kwan <dougkwan@google.com>
9775 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9777 (Stringpool_template::new_key_offset): New method.
9778 (Stringpool_template::add_string): Assign offsets when adding new
9780 (Stringpool_template::set_string_offsets): Do not set string offsets
9781 when not optimizing.
9782 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9784 (Chunked_vector::clear): Clear size_.
9785 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9786 (Chunked_vector::size): Return size_.
9787 (Chunked_vector::push_back): Use size_ to find insert position.
9788 (Chunked_vector::size_): New data member.
9789 (Stringpool_template::set_no_zero_null): Assert string set is empty.
9790 (Stringpool_template::new_key_offset): New method declaration.
9791 (Stringpool_template::offset_): New data member.
9793 2010-03-15 Rafael Espindola <espindola@google.com>
9795 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9796 Add_symbols' constructor.
9797 * readsyms.h (Add_symbols): Remove the input_group member.
9799 2010-03-10 Ian Lance Taylor <iant@google.com>
9801 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9802 target to ask whether a reference to a symbol requires a stack
9804 * target.h (Target::is_call_to_non_split): New function.
9805 (Target::do_is_call_to_non_split): Declare virtual function.
9806 * target.cc: Include "symtab.h".
9807 (Target::do_is_call_to_non_split): New function.
9808 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9810 2010-03-10 Cary Coutant <ccoutant@google.com>
9812 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9813 (File_read::open[1]): Remove initial mapping of whole_file_view_.
9814 (File_read::open[2]): Add whole_file_view_ to list of views.
9815 (File_read::make_view): Remove test of whole_file_view_.
9816 (File_read::find_or_make_view): Create whole_file_view_ if
9818 (File_read::clear_views): Replace bool parameter with enum;
9819 adjust all callers. Don't delete views with permanent data;
9820 do delete cached views and views from archives if
9821 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
9822 if clearing the corresponding view.
9823 * fileread.h (File_read::Clear_views_mode): New enum.
9824 (File_read::View::is_permanent_view): New method.
9825 (File_read::clear_views): Replace bool parameter
9826 with enum; adjust all callers.
9827 * options.h (General_options): Change keep_files_mapped option;
9828 add map_whole_files.
9829 * readsyms.cc (Add_symbols::run): Delete sd_ object before
9831 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9834 2010-03-10 David S. Miller <davem@davemloft.net>
9836 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9838 2010-03-09 Sriraman Tallam <tmsriram@google.com>
9840 * icf.cc (get_section_contents): Add '@' marker after processing the
9843 2010-03-08 Doug Kwan <dougkwan@google.com>
9845 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9846 due to a conversion warning.
9847 (Arm_relobj::update_output_local_symbol_count): Check for local
9848 symbol with unset output index.
9850 2010-03-05 Ian Lance Taylor <iant@google.com>
9852 * options.h (class General_options): Add --spare-dynamic-tags.
9853 * output.cc (Output_data_dynamic::set_final_data_size): Implement
9854 --spare-dynamic-tags.
9856 2010-03-05 Ian Lance Taylor <iant@google.com>
9858 * incremental.cc: Include "libiberty.h".
9860 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
9862 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9863 function, is_info_ member.
9864 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9865 (Versions::Versions): Update caller.
9866 (Versions::define_base_version): Likewise.
9867 (Versions::add_def): Likewise.
9869 2010-03-03 Sriraman Tallam <tmsriram@google.com>
9871 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9872 (Scan::possible_function_pointer_reloc): New function.
9873 (Scan::local_reloc_may_be_function_pointer): Change to call
9874 possible_function_pointer_reloc.
9875 (Scan::global_reloc_may_be_function_pointer): Ditto.
9876 * icf.h (Icf::check_section_for_function_pointers): Change to reject
9877 relocations in ".data.rel.ro._ZTV" section.
9878 * testsuite/icf_safe_so_test.sh: Change to pass i386.
9879 * testsuite/icf_safe_so_test.cc: Ditto.
9880 * testsuite/icf_safe_test.cc: Ditto.
9881 * testsuite/icf_safe_test.sh: Ditto.
9883 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9884 Ian Lance Taylor <iant@google.com>
9886 * target-reloc.h (relocate_section): Check the symbol table index
9887 for -1U before setting the local symbol index.
9888 (scan_relocatable_relocs): If copying the relocation, record that
9889 the local symbol is required.
9890 * object.h (Symbol_value::is_output_symtab_index_set): New
9892 (Symbol_value::may_be_discarded_from_output_symtab): New
9894 (Symbol_value::has_output_symtab_entry): New function.
9895 (Symbol_value::needs_output_symtab_entry): Remove.
9896 (Symbol_value::output_symtab_index): Make sure the symbol index is
9898 (Symbol_value::set_output_symtab_index): Make sure the symbol
9899 index is not set. Make sure the new index is valid.
9900 (Symbol_value::set_must_have_output_symtab_entry): New function.
9901 (Symbol_value::has_output_dynsym_entry): New function.
9902 (Symbol_value::set_output_dynsym_index): Make sure the new index
9904 (Sized_relobj::set_must_have_output_symtab_entry): New function.
9905 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9906 local symbol if permitted.
9907 (Sized_relobj::do_finalize_local_symbols): Call
9908 is_output_symtab_index_set rather than needs_output_symtab_entry.
9909 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9910 rather than needs_output_symtab_entry. Call
9911 has_output_dynsym_entry rather than needs_output_dynsym_entry.
9912 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9913 is_output_symtab_index_set rather than needs_output_symtab_entry.
9914 * testsuite/discard_locals_relocatable_test.c: New file.
9915 * testsuite/discard_locals_test.sh: Test -r.
9916 * testsuite/Makefile.am (check_DATA): Add
9917 discard_locals_relocatable_test1.syms,
9918 discard_local_relocatable_test2.syms.
9919 (MOSTLYCLEANFILES): Likewise. Also add
9920 discard_locals_relocatable_test1.lout and
9921 discard_locals_relocatable_test2.out.
9922 (discard_locals_relocatable_test1.syms): New target.
9923 (discard_locals_relocatable_test.o): New target.
9924 (discard_locals_relocatable_test1.out): New target.
9925 (discard_locals_relocatable_test2.syms): New target.
9926 (discard_locals_relocatable_test2.out): New target.
9927 (various): Add missing ../ld-new dependencies.
9928 * testsuite/Makefile.in: Rebuild.
9930 2010-03-03 Nick Clifton <nickc@redhat.com>
9932 * po/fi.po: New Finnish translation.
9934 2010-03-01 Doug Kwan <dougkwan@google.com>
9936 * layout.cc (Layout::Layout): Force section types of .init_array*,
9937 .preinit_array* and .fini_array* sections.
9938 * output.cc (Output_section::Input_section_sort_entry::has_priority):
9939 Fix check of return value of std::string::find.().
9940 (Output_section::Input_section_sort_compare::operator()): Remove
9941 comment about .init_array.
9942 (Output_section::Input_section_sort_init_fini_compare::operator()):
9944 (Output_section::sort_attached_input_sections): Handle .init_array
9945 and .fini_array specially.
9946 * output.h (Output_section::Inut_section_sort_compare): Update
9948 (Output_section::Input_section_sort_init_fini_compare): New struct.
9950 2010-02-26 Doug Kwan <dougkwan@google.com>
9952 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9953 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9954 * testsuite/debug_msg.sh: Avoid matching source line number for
9955 use of global variable undef_int.
9957 2010-02-26 Doug Kwan <dougkwan@google.com>
9959 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9960 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9961 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9962 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9963 * options.cc (General_options::General_options): Initialize member
9965 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9966 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9967 and rm_no_fix_v4bx.stdout
9968 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9969 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9970 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9971 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9972 and arm_no_fix_v4bx.
9973 * Makefile.in: Regenerate.
9974 * testsuite/arm_fix_v4bx.s: New file.
9975 * testsuite/arm_fix_v4bx.sh: Ditto.
9977 2010-02-24 Doug Kwan <dougkwan@google.com>
9979 * arm.cc (Target_arm::got_section): Make the .got section the first
9980 non RELRO section in the data segment.
9981 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9982 suffixes of section names.
9984 2010-02-24 Doug Kwan <dougkwan@google.com>
9986 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9987 flags and attributes merging if an input file is a binary file.
9988 * fileread.cc (Input_file::open): Record format of original file.
9989 * fileread.h (Input_file::Format): New enum type.
9990 (Input_file::Input_file): Initialize data member format_.
9991 (Input_file::format): New method definition.
9992 (Input_file::format_):: New data member.
9994 2010-02-24 Doug Kwan <dougkwan@google.com>
9996 * arm.cc (Arm_output_data_got): New class.
9997 (ARM_TCB_SIZE): New constant
9998 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9999 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10000 If user uses a script with a SECTIONS clause, issue only a warning
10001 for a misplaced EXIDX input section. Otherwise, issue an error.
10002 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10003 garbage collection.
10004 (Target_arm::got_mode_index_entry): Handle static linking.
10005 (Target_arm::Scan::local): Ditto.
10006 (Target_arm::Scan::global): Ditto.
10007 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
10008 all incorrectly implemented relocations.
10009 (Target_arm::fix_exidx_coverage): Pass layout to
10010 Arm_output_section::fix_exidx_coverage.
10011 * layout.cc (Layout::section_name_mapping): Remove trailing dots
10012 from ".ARM.exidx." and ".ARM.extab.".
10014 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10016 * arm.cc (Target_arm::do_finalize_sections): Create attribute
10017 section if it does not already exist.
10018 * attributes.cc (Attributes_section_data::Attributes_section_data):
10019 Don't crash if size is zero.
10021 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10022 Ian Lance Taylor <iant@google.com>
10024 * gold.cc (queue_middle_tasks): If no input files were opened,
10026 * workqueue.h (Task_function::Task_function): Assert that there is
10029 2010-02-22 Doug Kwan <dougkwan@google.com>
10031 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10032 * icf.cc (get_section_contents): Cast snprintf arguments to long long
10033 types to avoid warnings due to different uint64_t implementations
10034 on different hosts.
10036 2010-02-21 Doug Kwan <dougkwan@google.com>
10038 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10039 handling of the maximum backward branch offset.
10040 (Arm_relocate_functions::thumb_branch_common): Ditto.
10041 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10042 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10043 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10044 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10045 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10046 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10047 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10048 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10049 thumb_bl_out_of_range thumb_bl_out_of_range.o,
10050 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10051 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10052 thumb2_bl_out_of_range.o): New rules.
10053 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10054 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10055 thumb2_bl_out_of_range
10056 * testsuite/Makefile.in: Regenerate.
10057 * testsuite/arm_bl_in_range.s: New file.
10058 * testsuite/arm_bl_out_of_range.s: Ditto.
10059 * testsuite/arm_branch_in_range.sh: Ditto.
10060 * testsuite/arm_branch_range.t: Ditto.
10061 * testsuite/thumb2_branch_range.t: Ditto.
10062 * testsuite/thumb_bl_in_range.s: Ditto.
10063 * testsuite/thumb_bl_out_of_range.s: Ditto.
10064 * testsuite/thumb_branch_range.t: Ditto.
10066 2010-02-20 Sriraman Tallam <tmsriram@google.com>
10068 * gc.h (gc_process_relocs): Change vectors to point to the new list.
10069 Add reloc offset information.
10070 * icf.cc (get_section_contents): Change iterators to point to the new
10071 vectors. Add reloc offset information to the contents.
10072 * icf.h (Icf::Sections_reachable_info): New typedef.
10073 (Icf::Sections_reachable_list): New typedef.
10074 (Icf::Offset_info): New typedef.
10075 (Icf::Reloc_info): New struct typedef.
10076 (Icf::Reloc_info_list): New typedef.
10077 (Icf::symbol_reloc_list): Delete method.
10078 (Icf::addend_reloc_list): Delete method.
10079 (Icf::section_reloc_list): Delete method.
10080 (Icf::reloc_info_list): New method.
10081 (Icf::reloc_info_list_): New member.
10083 2010-02-19 Doug Kwan <dougkwan@google.com>
10085 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10086 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10087 * arm.cc (Arm_relocation_functions): New forward declaration.
10088 (Target_arm::Target_arm): Initialize new data members
10089 got_mod_index_offset_ and tls_base_symbol_defined_.
10090 (Target_arm::Relocate::relocate_tls): New method.
10091 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10092 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10094 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10095 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10096 (Target_arm::got_mod_index_offset_,
10097 Target_arm::tls_base_symbol_defined_): New data members.
10098 (Target_arm::Scan::local, Target::Scan::global,
10099 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10102 2010-02-18 Doug Kwan <dougkwan@google.com>
10104 * arm.cc (Arm_relobj::find_linked_text_section): New method.
10105 (Arm_relobj::make_exidx_input_section): Pass section index of linked
10106 text section as a parameter becuase some broken tools may not set
10107 the link in section header.
10108 (Target_arm::has_got_section): New method.
10109 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10110 without any mapping symbol as data only. Remove warning.
10111 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10112 link in its section header, try to discover the link by inspecting the
10113 REL31 relocation at the beginning of the section.
10114 (Target_arm::Scan::check_non_pic): Report name of offending relocation
10116 (Target_arm::Scan::global): Treat any reference to the symbol
10117 _GLOBAL_OFFSET_TABLE_ as a GOT access.
10119 2010-02-12 Sriraman Tallam <tmsriram@google.com>
10121 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10122 (Scan::global_reloc_may_be_function_pointer): New function.
10123 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10124 (Scan::global_reloc_may_be_function_pointer): New function.
10125 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10126 (Scan::global_reloc_may_be_function_pointer): New function.
10127 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10128 (Scan::global_reloc_may_be_function_pointer): New function.
10129 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10130 (Scan::global_reloc_may_be_function_pointer): New function.
10131 (Scan::possible_function_pointer_reloc): New function.
10132 (Target_x86_64::can_check_for_function_pointers): New function.
10133 * gc.h (gc_process_relocs): Scan relocation types to determine if
10134 function pointers were taken for targets that support it.
10135 * icf.cc (Icf::find_identical_sections): Include functions for
10136 folding in safe ICF whose pointer is not taken.
10137 * icf.h (Secn_fptr_taken_set): New typedef.
10138 (fptr_section_id_): New member.
10139 (section_has_function_pointers): New function.
10140 (set_section_has_function_pointers): New function.
10141 (check_section_for_function_pointers): New function.
10142 * options.h: Fix comment for safe ICF option.
10143 * target.h (can_check_for_function_pointers): New function.
10144 * testsuite/Makefile.am: Add icf_safe_so_test test case.
10145 Modify icf_safe_test for X86-64.
10146 * testsuite/Makefile.in: Regenerate.
10147 * testsuite/icf_safe_so_test.cc: New file.
10148 * testsuite/icf_safe_so_test.sh: New file.
10149 * testsuite/icf_safe_test.cc (kept_func_3): New function.
10150 (main): Change to take pointer to function kept_func_3.
10151 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10152 folding is done correctly for X86-64.
10154 2010-02-12 David S. Miller <davem@davemloft.net>
10156 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10157 is_symbolless parameter.
10158 (Output_reloc<SHT_REL>::is_symbolless): New.
10159 (Output_reloc<SHT_REL>::is_symbolless_): New.
10160 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10161 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10162 (Output_reloc<SHT_RELA>::is_symbolless): New.
10163 (Output_data_reloc::add_global): Handle is_symbolless.
10164 (Output_data_reloc::add_global_relative): Likewise.
10165 (Output_data_reloc::add_local): Likewise.
10166 (Output_data_reloc::add_local_relative): Likewise.
10167 (Output_data_reloc::add_symbolless_global_addend): New.
10168 (Output_data_reloc::add_symbolless_local_addend): New.
10169 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10171 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10172 instead of ->is_relative_
10173 (Output_reloc::write): Likewise.
10174 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10175 (Output_reloc::write_rel): Simplify.
10177 * sparc.cc (Target_sparc::Scan::local): Use
10178 ->add_symbolless_local_addend as needed.
10179 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10180 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
10181 based upon relocation offset.
10183 2010-02-11 Doug Kwan <dougkwan@google.com>
10185 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10186 (Target_arm::Scan::global): Ditto. Also remove a comment before the
10187 beginning of function.
10188 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10189 and MOVT_ABS relocations. Those are non issued in scanning. Fix
10190 parameter is_32bit in calls to should_apply_static_reloc.
10191 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10192 (check_DATA): Add arm_abs_global.stdout.
10193 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10194 arm_abs_global.stdout): New rules.
10195 (MOSTLLYCLEANFILES): Add arm_abs_global
10196 * Makefile.in: Regenerate.
10197 * testsuite/arm_abs_global.s: New file.
10198 * testsuite/arm_abs_global.sh: Ditto.
10199 * testsuite/arm_abs_lib.s: Ditto.
10201 2010-02-11 Ian Lance Taylor <iant@google.com>
10203 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10205 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
10206 Allocate_commons_task first.
10207 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10208 task, rather than symtab_lock_.
10209 (Gc_process_relocs::~Gc_process_relocs): New function.
10210 (Gc_process_relocs::is_runnable): Check this_blocker_.
10211 (Gc_process_relocs::locks): Use next_blocker_ rather than
10213 (Scan_relocs::~Scan_relocs): New function.
10214 (Scan_relocs::is_runnable): Check this_blocker_ rather than
10216 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
10218 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10219 fields. Add this_blocker_ and next_blocker_ fields. Adjust
10220 constructor accordingly.
10221 (class Gc_process_relocs): Likewise.
10222 (class Scan_relocs): Likewise.
10223 * common.h (class Allocate_commons_task): Remove symtab_lock_
10224 field, and corresponding constructor parameter.
10225 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10227 (Allocate_commons_task::locks): Likewise.
10229 2010-02-11 Ian Lance Taylor <iant@google.com>
10231 * gold-threads.h (class Once): Define.
10232 (class Initialize_lock): Rewrite as child of Once.
10233 * gold-threads.cc (class Once_initialize): Define.
10234 (once_pointer_control): New static variable.
10235 (once_pointer, once_arg): New static variables.
10236 (c_run_once): New static function.
10237 (Once::Once, Once::run_once, Once::internal_run): New functions.
10238 (class Initialize_lock_once): Remove.
10239 (initialize_lock_control): Remove.
10240 (initialize_lock_pointer): Remove.
10241 (initialize_lock_once): Remove.
10242 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10243 (Initialize_lock::initialize): Rewrite.
10244 (Initialize_lock::do_run_once): New function.
10245 * archive.cc (Archive::interpret_header): Only clear name if it is
10247 * fileread.cc: Include "gold-threads.h"
10248 (file_counts_lock): New static variable.
10249 (file_counts_initialize_lock): Likewise.
10250 (File_read::release): Only increment counts when using --stats.
10251 Use a lock around the increment.
10252 * parameters.cc (class Set_parameters_target_once): Define.
10253 (set_parameters_target_once): New static variable.
10254 (Parameters::Parameters): Move here from parameters.h.
10255 (Parameters::set_target): Rewrite.
10256 (Parameters::set_target_once): New function.
10257 (Parameters::clear_target): Move here and rewrite.
10258 * parameters.h (class Parameters): Update declarations. Add
10259 set_parameters_target_once_ field.
10260 (Parameters::Parameters): Move to parameters.cc.
10261 (Parameters::clear_target): Likewise.
10262 * readsyms.cc (Read_symbols::do_group): Create a Start_group
10264 (Start_group::~Start_group): New function.
10265 (Start_group::is_runnable): New function.
10266 (Start_group::locks, Start_group::run): New functions.
10267 (Finish_group::run): Change saw_undefined to size_t.
10268 * readsyms.h (class Start_group): Define.
10269 (class Finish_group): Change saw_undefined_ field to size_t.
10270 (Finish_group::Finish_group): Remove saw_undefined and
10271 this_blocker parameters. Change all callers.
10272 (Finish_group::set_saw_undefined): New function.
10273 (Finish_group::set_blocker): New function.
10274 * symtab.h (class Symbol_table): Change saw_undefined to return
10275 size_t. Change saw_undefined_ field to size_t.
10276 * target-select.cc (Set_target_once::do_run_once): New function.
10277 (Target_selector::Target_selector): Initialize set_target_once_
10278 field. Don't initialize lock_ and initialize_lock_ fields.
10279 (Target_selector::instantiate_target): Rewrite.
10280 (Target_selector::set_target): New function.
10281 * target-select.h (class Set_target_once): Define.
10282 (class Target_selector): Update declarations. Make
10283 Set_target_once a friend. Remove lock_ and initialize_lock_
10284 fields. Add set_target_once_ field.
10286 2010-02-10 Ian Lance Taylor <iant@google.com>
10288 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10289 queueing any tasks.
10290 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
10291 (queue_middle_tasks): Add all blockers before queueing any tasks.
10292 (queue_final_tasks): Likewise.
10293 * token.h (Task_token::add_blockers): New function.
10294 * object.h (Input_objects::number_of_relobjs): New function.
10296 2010-02-10 Ian Lance Taylor <iant@google.com>
10298 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10299 shared, not if not position independent.
10300 * x86_64.cc (Relocate::relocate_tls): Likewise.
10301 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10302 (tls_pie_pic_test): New target.
10303 * testsuite/Makefile.in: Rebuild.
10305 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10306 (tls_test_main_pie.o, tls_test_pie.o): New targets.
10307 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10308 * testsuite/Makefile.in: Rebuild.
10310 2010-02-09 David S. Miller <davem@davemloft.net>
10312 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10313 R_SPARC_RELATIVE using ->add_local_relative().
10314 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10316 * output.h (Output_data_dynamic::add_section_size): New method
10317 that takes two Output_data objects.
10318 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10319 entry param. Handle it in initializers.
10320 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10321 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10322 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10324 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10325 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10326 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10327 for dynrel_includes_plt.
10328 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10329 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10330 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10332 (Target_sparc::do_finalize_sections): Update to pass true for
10333 dynrel_includes_plt.
10334 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10335 output before .rela.plt
10336 (Target_powerpc::do_finalize_sections): Update to pass true for
10337 dynrel_includes_plt when 32-bit.
10339 2010-02-08 Doug Kwan <dougkwan@google.com>
10341 * arm.cc (Arm_relobj::simple_input_section_output_address): New
10343 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10344 Arm_relobj::scan_section_for_cortex_a8_stubs,
10345 Arm_relobj::do_relocation_section): Instead of calling
10346 Output_section::output_address, use faster
10347 Arm_relobj::simple_input_section_output_address.
10349 2010-02-08 David S. Miller <davem@davemloft.net>
10351 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10352 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10353 relocation helper function.
10355 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10356 just like R_SPARC_GOT{10,13,22}.
10357 (Target_sparc::Scan::local): Likewise.
10358 (Target_sparc::Relocate:relocate): Likewise.
10360 2010-02-06 Ian Lance Taylor <iant@google.com>
10362 * configure.ac: Rewrite targetobjs duplicate removal code to use
10363 only shell constructs.
10364 * configure: Rebuild.
10366 2010-02-05 Doug Kwan <dougkwan@google.com>
10369 * arm.cc (Arm_relobj::section_is_scannable): New method.
10370 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10371 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10373 2010-02-04 Doug Kwan <dougkwan@google.com>
10376 * arm-reloc-property.cc (cstdio): Include.
10377 * configure.ac (targetobjs): Remove duplicates.
10378 * configure: Regenerate.
10379 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10380 big and little endian version for a given address size.
10382 2010-02-03 Doug Kwan <dougkwan@google.com>
10384 * arm-reloc-property.cc
10385 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10387 * arm-reloc-property.h
10388 (Arm_reloc_property_table::get_implemented_static_reloc_property):
10389 New method definition.
10390 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10392 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10394 (GOT_PREL): Change implemented to Y.
10395 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10396 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10397 (Arm_relocate_functions::movw_abs_nc): Remove method.
10398 (Arm_relocate_functions::movt_abs): Ditto.
10399 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10400 (Arm_relocate_functions::thm_movt_abs): Ditto.
10401 (Arm_relocate_functions::movw_rel_nc): Ditto.
10402 (Arm_relocate_functions::movw_rel): Ditto.
10403 (Arm_relocate_functions::movt_rel): Ditto.
10404 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10405 (Arm_relocate_functions:thm_movw_rel): Ditto.
10406 (Arm_relocate_functions:thm_movt_rel): Ditto.
10407 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10408 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10409 New method definitions.
10410 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10411 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10412 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10413 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10414 (Target_arm::Relocate::relocate): Check for non-static or
10415 unimplemented relocation code and exit early. Change calls to
10416 Target_arm::reloc_uses_thumb_bit and
10417 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10418 instead. Refactor code to handle similar relocations to increase
10419 code sharing. Remove check for unsupported relocation code in switch
10421 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10422 relocation property table to find out size. Change error message to
10423 print out the name of a relocation code instead of the numeric value.
10424 (Target_arm::scan_reloc_for_stub): Use relocation property table
10425 instead of calling Target_arm::reloc_uses_thumb_bit().
10427 2010-02-02 Doug Kwan <dougkwan@google.com>
10429 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10430 types of relaxed input section.
10432 2010-02-02 Doug Kwan <dougkwan@google.com>
10434 * Makefile.am (HFILES): Add arm-reloc-property.h.
10436 (TARGETSOURCES): Add arm-reloc-property.cc
10437 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10438 (libgold_a_SOURCES): $(DEFFILES)
10439 * Makefile.in: Regenerate.
10440 * arm-reloc-property.cc: New file.
10441 * arm-reloc-property.h: New file.
10442 * arm-reloc.def: New file.
10443 * arm.cc: Update comments.
10444 (arm-reloc-property.h): New included header.
10445 (arm_reloc_property_table): New global variable.
10446 (Target_arm::do_select_as_default_target): New method definition.
10447 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10448 arm-reloc-property to targ_extra_obj.
10449 * parameters.cc (set_parameters_target): Call
10450 Target::select_as_default_target().
10451 * target.h (Target::select_as_default_target): New method definition.
10452 (Target::do_select_as_default_target): Same.
10454 2010-02-01 Doug Kwan <dougkwan@google.com>
10456 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10457 first_output_text_section_.
10458 (Arm_exidx_fixup::first_output_text_section): New method definition.
10459 (Arm_exidx_fixup::first_output_text_section_): New data member.
10460 (Arm_exidx_fixup::process_exidx_section): Record the first text
10461 output section seen.
10462 (Arm_output_section::fix_exidx_coverage): Set correct linked section
10463 and entsize in output section header.
10465 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10467 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10468 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10469 (Arm_relocate_functions::thm_alu11): New Method.
10470 (Arm_relocate_functions::thm_pc8): New Method.
10471 (Arm_relocate_functions::thm_pc12): New Method.
10472 (Target_arm::Scan::local): Handle the relocations.
10473 (Target_arm::Scan::global): Likewise.
10474 (Target_arm::Relocate::relocate): Likewise.
10475 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10477 2010-01-29 Doug Kwan <dougkwan@google.com>
10479 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10480 of relocation types as ld.
10482 2010-01-29 Doug Kwan <dougkwan@google.com>
10484 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10486 (Arm_relocate_functions::thumb_branch_common): Ditto.
10487 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10488 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10489 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10490 Arm_relocate_functions::jump24): Remove.
10491 (Target_arm::Relocate::relocate): Adjust code to call
10492 Arm_relocation_functions::arm_branch_common and
10493 Arm_relocation_functions::thumb_branch_common instead of their removed
10494 wrappers. Merge switch-cases together to reduce source code size.
10496 2010-01-29 Doug Kwan <dougkwan@google.com>
10498 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10499 output_local_symbol_count_needs_update_.
10500 (Arm_relobj::output_local_symbol_count_needs_update,
10501 Arm_relobj::set_output_local_symbol_count_needs_update,
10502 Arm_relobj::update_output_local_symbol_count): New methods.
10503 (Arm_relobj::output_local_symbol_count_needs_update_): New data
10505 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10506 of pointed function as in a R_ARM_PREL31 relocation.
10507 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10508 for output local symbol count updating.
10509 (Target_arm::do_relax): Update output local symbol counts in objects
10511 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10513 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10515 * arm.cc: Added support for the ARM relocations:
10516 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10517 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10518 (Arm_relocate_functions::movw_rel_nc): Renamed (was
10520 (Arm_relocate_functions::movw_rel): New method.
10521 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10522 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10524 (Arm_relocate_functions::thm_movw_rel): New method.
10525 (Arm_relocate_functions::thm_movt_rel): Renamed (was
10527 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10529 (Target_arm::Scan::global): Likewise.
10530 (Target_arm::Relocate::relocate): Likewise.
10531 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10534 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10536 * arm.cc: Added support for ARM group relocations.
10537 (Target_arm::reloc_needs_sym_origin): New method.
10538 (Arm_relocate_functions::calc_grp_kn): New method.
10539 (Arm_relocate_functions::calc_grp_residual): New method.
10540 (Arm_relocate_functions::calc_grp_gn): New method.
10541 (Arm_relocate_functions::arm_grp_alu): New Method.
10542 (Arm_relocate_functions::arm_grp_ldr): New Method.
10543 (Arm_relocate_functions::arm_grp_ldrs): New Method.
10544 (Arm_relocate_functions::arm_grp_ldc): New Method.
10545 (Target_arm::Scan::local): Handle the ARM group relocations.
10546 (Target_arm::Scan::global): Likewise.
10547 (Target_arm::Relocate::relocate): Likewise.
10548 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10551 2010-01-26 Doug Kwan <dougkwan@google.com>
10553 * arm.cc (set): Include.
10554 (class Arm_exidx_fixup): Change type of last_input_section_ to const
10556 (Arm_output_section::Text_section_list): New type.
10557 (Arm_output_section::append_text_sections_to_list): New method.
10558 (Arm_output_section::fix_exidx_coverage): Ditto.
10559 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10560 (Arm_relobj::convert_input_section_to_relaxed_section): Use
10561 Relobj::set_section_offset() instead of
10562 Sized_relobj::invalidate_section_offset().
10563 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10564 parameter for section headers. Ignore relocation sections for
10565 unallocated sections and EXIDX sections.
10566 (Target_arm::fix_exidx_coverage): New method.
10567 (Target_arm::output_section_address_less_than): New type.
10568 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10569 linked text section instead of the EXIDX section.
10570 (Arm_output_section::create_stub_group): Add an assertion to check
10571 that this is not an EXIDX output section.
10572 (Arm_output_section::append_text_sections_to_list): New method.
10573 (Arm_output_section::fix_exidx_coverage): Ditto.
10574 (Arm_relobj::scan_sections_for_stubs): Adjust call to
10575 Arm_relobj::section_needs_reloc_stub_scanning.
10576 (Target_arm::do_relax): Fix EXIDX output section coverage in the
10578 (Target_arm::fix_exidx_coverage): New method.
10579 * object.h (Relobj::set_output_section): New method.
10580 (Sized_relobj::invalidate_section_offset): Remove method.
10581 (Sized_relobj::do_invalidate_section_offset): Remove method.
10582 (Sized_relobj::do_set_section_offset): Handle offset value -1.
10584 2010-01-25 Doug Kwan <dougkwan@google.com>
10586 * arm.cc (Arm_exidx_merged_section::do_output_offset):
10587 Fix warning due to signed and unsigned comparison on a 32-bit host.
10589 2010-01-22 Doug Kwan <dougkwan@google.com>
10591 * arm.cc (Target_arm::do_relax): Record an output section for section
10592 offset adjustment it contains any stub table that has changed.
10593 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10594 offsets in an output section if necessary.
10595 * output.cc (Output_section::Output_section): Initialize
10596 section_offsets_need_adjustments_.
10597 (Output_section::add_input_section_for_script): Renamed to
10598 Output_section::add_simple_input_section.
10599 (Output_section::save_states): Add a comment.
10600 (Output_section::discard_states): New method defintion.
10601 (Output_section::adjust_section_offsets): Same.
10602 * output.h (Output_section::add_input_section_for_script): Renamed to
10603 Output_section::add_simple_input_section.
10604 (Output_section::discard_states): New method declaration.
10605 (Output_section::adjust_section_offsets): Same.
10606 (Output_section::section_offsets_need_adjustment,
10607 Output_section::set_section_offsets_need_adjustment): New method
10609 (Output_section::section_offsets_need_adjustment_): New data member.
10610 * script-sections.cc
10611 (Output_section_element_input::set_section_address): Adjust code for
10612 renaming of Output_section::add_input_section_for_script.
10613 (Orphan_output_section::set_section_address): Same.
10615 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10617 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10618 Fix_v4bx enum values .
10619 * gold/options.h (General_options): New option definitions.
10620 (General_options::fix_v4bx): New method.
10621 (General_options::Fix_v4bx): New enum.
10622 * gold/options.cc (General_options::parse_fix_v4bx): New method.
10623 (General_options::parse_fix_v4bx_interworking): New method.
10625 2010-01-22 Doug Kwan <dougkwan@google.com>
10627 * arm.cc (Arm_exidx_fixup): New class.
10629 2010-01-21 Doug Kwan <dougkwan@google.com>
10631 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10633 (Arm_exidx_section_offset_map): New type.
10635 2010-01-21 Doug Kwan <dougkwan@google.com>
10637 * arm.cc (Arm_exidx_input_section): New class.
10638 (Arm_relobj::exidx_input_section_by_link,
10639 Arm_relobj::exidx_input_section_by_shndx,
10640 Arm_relobj::make_exidx_input_section): New methods.
10641 (read_arm_attributes_section): Remove.
10642 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10643 information about them.
10644 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10647 2010-01-20 Doug Kwan <dougkwan@google.com>
10649 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10650 Input_section_specifier to Section_id.
10651 (Target_arm::new_arm_input_section: Adjust code for change of key
10653 (Target_arm::find_arm_input_section): Ditto.
10654 * gc.h (object.h): Include for Section_id nand Section_id_hash.
10655 (Section_id): Remove.
10656 (Garbage_collection::Section_id_hash): Remove.
10657 * icf.h (object.h): Include for Section_id nand Section_id_hash.
10658 (Section_id): Remove.
10659 (Icf::Section_id_hash): Remove.
10660 * object.h (Section_id, Const_section_id, Section_id_hash,
10661 Const_section_id_hash): New type definitions.
10662 * output.cc (Output_section::add_relaxed_input_section): Change to
10663 use Const_section_id instead of Input_section_specifier as key type.
10664 (Output_section::add_merge_input_section): Ditto.
10665 (Output_section::build_relaxation_map): Change to use Section_id
10666 instead of Input_section_specifier as key type.
10667 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10669 (Output_section::convert_input_sections_to_relaxed_sections): Change
10670 to use Const_section_id instead of Input_section_specifier as key type.
10671 (Output_section::find_merge_section): Ditto.
10672 (Output_section::find_relaxed_input_section): Ditto.
10673 * output.h (Input_section_specifier): Remove class.
10674 (Output_section::Output_section_data_by_input_section_map): Change
10675 key type to Const_section_id.
10676 (Output_section::Output_relaxed_input_section_by_input_section_map):
10678 (Output_section::Relaxation_map): Change key type to Section_id.
10680 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10682 * gold/arm.cc: Added support for R_ARM_V4BX relocation
10683 (class Arm_v4bx_stub): New class.
10684 (DEF_STUBS): Updated definition to support v4_veneer_bx.
10685 (Stub_factory::make_arm_v4bx_stub): New method.
10686 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10687 (Stub_table::empty): Handle v4bx stubs.
10688 (Stub_table::add_arm_v4bx_stub): New method.
10689 (Stub_table::find_arm_v4bx_stub): New method.
10690 (Arm_relocate_functions::v4bx): New method.
10691 (Target_arm::fix_v4bx): New method.
10692 (Target_arm::Target_arm): Handle R_ARM_V4BX.
10693 (Stub_table::relocate_stubs): Likewise.
10694 (Stub_table::do_write): Likewise.
10695 (Stub_table::update_data_size_and_addralign): Likewise.
10696 (Stub_table::finalize_stubs): Likewise.
10697 (Target_arm::Scan::local): Likewise.
10698 (Target_arm::Scan::global): Likewise.
10699 (Target_arm::do_finalize_sections): Likewise.
10700 (Target_arm::Relocate::relocate): Likewise.
10701 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10703 (Target_arm::scan_reloc_for_stub): Likewise.
10704 (Target_arm::scan_reloc_section_for_stubs): Likewise.
10706 2010-01-19 Ian Lance Taylor <iant@google.com>
10708 * output.cc (Output_section_headers::do_sized_write): Write large
10709 segment count to sh_info field.
10710 (Output_file_header::do_sized_write): For large segment count,
10711 write PN_XNUM to e_phnum field.
10713 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10715 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10716 (Arm_relocate_functions::thm_jump8): New function.
10717 (Arm_relocate_functions::thm_jump11): New function.
10718 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10720 (Target_arm::Scan::global): Likewise.
10721 (Target_arm::Relocate::relocate): Likewise.
10722 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10725 2010-01-14 Doug Kwan <dougkwan@google.com>
10727 * arm.cc (map, utility): Include headers.
10728 (Target_arm::apply_cortex_a8_workaround): New method.
10729 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10730 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10731 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10732 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10733 the --[no-]fix-cortex-a8 command line options.
10734 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10735 (Target_arm::relocate_stub): Use addend in instruction template.
10736 * options.h (DEFINE_bool): Set the user-set flag.
10737 (General_options): Add --[no-]-fix-cortex options.
10738 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10739 : Update fast look-up map after conversion.
10741 2010-01-14 Sriraman Tallam <tmsriram@google.com>
10743 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10744 in the first pass of do_layout.
10746 2010-01-13 Doug Kwan <dougkwan@google.com>
10748 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10749 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10750 apparent compiler problem of not folding static constant integral
10751 data members of elfcpp::Elf_sizes<32>.
10753 2010-01-13 Doug Kwan <dougkwan@google.com>
10755 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10756 Arm_relobj::section_needs_cortex_a8_stub_scanning,
10757 Arm_relobj::scan_section_for_cortex_a8_erratum,
10758 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10759 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10760 sections to scan for relocation stubs into a new method
10761 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
10762 relocation and Cortex-A8 stub scanning.
10763 (Target_arm::do_relax): Force stubs to be after stubbed sections
10764 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
10765 the beginning of a new relaxation pass. Update a comment.
10766 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10768 2010-01-12 Ian Lance Taylor <iant@google.com>
10770 * target-reloc.h (visibility_error): New inline function.
10771 (relocate_section): Call visibility_error.
10772 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10773 (MOSTLYCLEANFILES): Likewise.
10774 (protected_4_pic.o, protected_3.err): New targets.
10775 * testsuite/protected_4.cc: New file.
10777 2010-01-12 Doug Kwan <dougkwan@google.com>
10779 * arm.cc (Cortex_a8_reloc): New class.
10780 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10781 and cortex_a8_relocs_info_.
10782 (Target_arm::fix_cortex_a8): New method definition.
10783 (Target_arm::Cortex_a8_relocs_info): New type.
10784 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10785 New data member declarations.
10786 (Target_arm::scan_reloc_for_stub): Record information about
10787 relocations for THUMB branches that might be exempted from the
10788 Cortex-A8 workaround.
10789 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10790 at the beginning of a relaxation pass.
10792 2010-01-12 Doug Kwan <dougkwan@google.com>
10794 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10795 (Arm_relobj::Mapping_symbol_position,
10796 Arm_reloj::Mapping_symbol_position_less,
10797 Arm_relobj::Mapping_symbols_info): New types.
10798 (Target_arm::is_mapping_symbol_name): New method definition.
10799 (Arm_relobj::do_count_local_symbols): Save information about mapping
10802 2010-01-11 Doug Kwan <dougkwan@google.com>
10804 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10805 Arm_relocate_functions::thumb32_branch_upper,
10806 Arm_relocate_functions::thumb32_branch_lower,
10807 Arm_relocate_functions::thumb32_cond_branch_offset,
10808 Arm_relocate_functions::thumb32_cond_branch_upper,
10809 Arm_relocate_functions::thumb32_cond_branch_lower,
10810 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10811 branch offset encoding.
10812 (Arm_relocate_functions::thumb_branch_common): Use new branch
10813 offset encoding methods to avoid code duplication.
10814 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10815 (Stub_addend_reader::operator()): Use new branch encoding method
10816 to avoid code duplication.
10818 2010-01-11 Doug Kwan <dougkwan@google.com>
10820 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10821 (Target_arm::do_finalize_sections): Define special EXIDX section
10822 symbols only if referenced.
10823 * gc.h (Garbage_collection::add_reference): New method.
10824 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10827 2010-01-11 Ian Lance Taylor <iant@google.com>
10829 * script.cc (Version_script_info::build_expression_list_lookup):
10830 Change complaing about duplicate wildcard match from error to
10833 * script.cc (class Lazy_demangler): Recreate--revert part of patch
10835 (Version_script_info::Version_script_info): Initialize globs_,
10836 default_version_, default_is_global_, and exact_. Don't
10837 initialize globals_ or locals_.
10838 (Version_script_info::build_lookup_tables): Build local symbols
10840 (Version_script_info::unquote): New function.
10841 (Version_script_info::add_exact_match): New function.
10842 (Version_script_info::build_expression_list_lookup): Remove lookup
10843 parameter. Add is_global parameter. Change all callers. Handle
10844 wildcard pattern specially. Unquote pattern. Call
10846 (Version_script_info::get_name_to_match): New function.
10847 (Version_script_info::get_symbol_version): New function.
10848 (Version_script_info::get_symbol_version_helper): Remove.
10849 (Version_script_info::check_unmatched_names): Call unquote.
10850 * script.h (class Version_script_info): Change get_symbol_version
10851 to be non-inline and add is_global parameter; change all callers.
10852 Rewrite symbol_is_local. Update declarations. Define struct
10853 Version_tree_match, Exact, Globs. Don't define struct Lookup.
10854 Remove globals_ and locals_ members. Add exact_, globs_,
10855 default_version_, is_global_.
10856 (Version_script_info::Glob): Remove pattern, add expression and
10857 is_global. Update constructor. Change all callers.
10858 * dynobj.cc (Versions::finalize): Mark the version symbol as the
10860 (Versions::symbol_section_contents): If a symbol is undefined, or
10861 defined in a dynamic object, set the version index to
10863 * symtab.cc (Symbol_table::add_from_relobj): Don't call
10865 (Symbol_table::add_from_pluginobj): Likewise.
10866 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10868 2010-01-11 Doug Kwan <dougkwan@google.com>
10870 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10871 (incremental_dump_LDADD): Add linking option for libintl.
10872 * Makefile.in: Regenerate.
10874 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
10877 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10879 * testsuite/Makefile.in: Regenerated.
10881 2010-01-10 Doug Kwan <dougkwan@google.com>
10883 * options.h (DEFINE_var): Use parentheses around argument varname__
10884 in macro body to avoid any unintended subsequent substitutions.
10886 2010-01-10 Ian Lance Taylor <iant@google.com>
10888 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10889 candidates before doing symbol resolution.
10891 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10892 ODR candidates if only one is weak.
10894 2010-01-08 Ian Lance Taylor <iant@google.com>
10896 * script.cc (Version_script_info::build_expression_list_lookup):
10897 Don't warn about ambiguous version, just record the ambiguity.
10898 (Version_script_info::get_symbol_version_helper): Give error if
10899 version is ambiguous.
10901 2010-01-08 Doug Kwan <dougkwan@google.com>
10903 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10904 prev_data_size_ and prev_addralign_. Remove initializer for
10905 deleted data member has_been_changed_.
10906 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10907 to determine if the table is empty.
10908 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10910 (Stub_table::add_reloc_stub): Define method in class definition
10911 instead of just declaring it there.
10912 (Stub_table::add_cortex_a8_stub): New method definition.
10913 (Stub_table::update_data_size_and_addralign): Ditto.
10914 (Stub_table::finalize_stubs): Ditto.
10915 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10916 (Stub_table::do_addralign_): Return address alignment in the
10917 (Stub_table::do_reset_address_and_file_offset): Define method in
10918 class definition instead of declaring it there. Set current data
10919 size to be the data size of the previous pass.
10920 (Stub_table::set_final_data_size): Use current data size as the
10922 (Stub_table::relocate_stub): Change parameter type of stub from
10923 Reloc_stub pointer to Stub pointer.
10924 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10925 (Stub_table::Cortex_a8_stub_list): New typedef.
10926 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10927 Stub_table::prev_addralign_): New data member.
10928 (Arm_relobj::Arm_relobj): Initialize data member
10929 section_has_cortex_a8_workaround_.
10930 (Arm_relobj::section_has_cortex_a8_workaround,
10931 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10933 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10935 (Target_arm::relocate_stub): Change parameter type of stub from
10936 Reloc_stub pointer to Stub pointer.
10937 (Insn_template::size, Insn_template::alignment): Handle
10938 THUMB16_SPECIAL_TYPE.
10939 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10940 Stub_table::update_data_size_and_addralign,
10941 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10943 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10944 (Stub_table::do_write): Ditto.
10945 (Target_arm::do_relax): Adjust code for changes in Stub_table.
10947 2010-01-08 Ian Lance Taylor <iant@google.com>
10950 * symtab.h (class Symbol): Remove fields is_target_special_ and
10951 has_plt_offset_. Add field is_defined_in_discarded_section_.
10952 (Symbol::is_defined_in_discarded_section): New function.
10953 (Symbol::set_is_defined_in_discarded_section): New function.
10954 (Symbol::has_plt_offset): Rewrite.
10955 (Symbol::set_plt_offset): Verify that new offset is not -1U.
10956 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10957 Don't initialize is_target_special_ or has_plt_offset_.
10958 Initialize is_defined_in_discarded_section_.
10959 (Symbol_table::add_from_relobj): If appropriate, set
10960 is_defined_in_discarded_section.
10961 * resolve.cc (Symbol::override_base_with_special): Don't test
10962 is_target_special_. Change has_plt_offset_ to has_plt_offset().
10963 * target-reloc.h (relocate_section): Do special handling for
10964 symbols defined in discarded sections for global symbols as well
10967 2010-01-08 Ian Lance Taylor <iant@google.com>
10969 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10970 the SHT_SYMTAB case.
10972 2010-01-08 Ian Lance Taylor <iant@google.com>
10974 * object.cc (Sized_relobj::do_layout): Don't get confused if
10975 layout_eh_frame returns NULL.
10977 2010-01-08 Ian Lance Taylor <iant@google.com>
10980 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10981 dynamic symbol table, use the normal symbol table.
10982 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10985 2010-01-08 Ian Lance Taylor <iant@google.com>
10988 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10991 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10993 * version.cc (print_version): Change to "Copyright 2010".
10995 2010-01-08 Ian Lance Taylor <iant@google.com>
10999 * i386.cc (class Target_i386): Change return type of plt_section
11001 (class Output_data_plt_i386): Add tls_desc_rel_ field.
11002 (Output_data_plt_i386::Output_data_plt_i386): Initialize
11003 tls_desc_rel_ field.
11004 (Output_data_plt_i386::rel_tls_desc): New function.
11005 (Target_i386::rel_tls_desc_section): New function.
11006 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11007 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11008 R_386_TLS_DESC reloc in rel_tls_desc_section.
11009 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11010 Define struct Tlsdesc_info.
11011 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11012 (Target_x86_64::do_reloc_symbol_index): New function.
11013 (Target_x86_64::add_tlsdesc_info): New function.
11014 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11015 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11016 tlsdesc_rel_ field.
11017 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
11019 (Output_data_plt_x86_64::rela_tlsdesc): New function.
11020 (Target_x86_64::rela_tlsdesc_section): New function.
11021 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11023 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11024 (Target_x86_64::do_reloc_addend): New function.
11025 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11026 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11027 declarations. Define TARGET_CODE. Add arg field to u1_ union.
11028 (Output_reloc::type): New function.
11029 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11030 (Output_reloc::is_target_specific): New function.
11031 (Output_reloc::target_arg): New function.
11032 (class Output_reloc) [SHT_RELA]: Add four new constructors for
11033 absolute relocs and target specific relocs.
11034 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11035 add_target_specific.
11036 (class Output_data_reloc) [SHT_RELA]: Likewise.
11037 * output.cc (Output_reloc::Output_reloc): Add four new versions
11038 for absolute relocs and target specific relocs.
11039 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11040 (Output_reloc::get_symbol_index): Likewise.
11041 (Output_reloc::local_section_offset): Check that local_sym_index_
11042 is not TARGET_CODE or 0.
11043 (Output_reloc::symbol_value): Likewise.
11044 (Output_reloc::write) [SHT_RELA]: Call target for target specific
11046 * target.h (class Target): Add reloc_symbol_index and reloc_addend
11047 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
11049 * layout.cc (add_target_dynamic_tags): Use output section for
11050 DT_PLTRELSZ and DT_JMPREL.
11052 2010-01-07 Ian Lance Taylor <iant@google.com>
11055 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11057 (class Output_data_reloc_generic): Define.
11058 (class Output_data_reloc_base): Change base class to
11059 Output_data_reloc_generic. Change add() method to call
11060 bump_relative_reloc_count for a relative reloc. Remove
11061 sort_relocs_ field.
11062 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11064 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11065 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
11067 * layout.h (class Layout): Update declaration.
11069 2010-01-07 Ian Lance Taylor <iant@google.com>
11071 * output.h (class Output_data): Add const version of
11072 output_section and do_output_section.
11073 (class Output_section_data): Add const version of
11075 (class Output_section): Likewise.
11076 * layout.cc (Layout::add_target_dynamic_tags): New function.
11077 * layout.h (class Layout): Update declarations.
11078 * arm.cc (Target_arm::do_finalize_sections): Use
11079 add_target_dynamic_tags.
11080 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11081 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11082 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11083 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11085 2010-01-07 Ian Lance Taylor <iant@google.com>
11088 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11091 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
11092 Ian Lance Taylor <iant@google.com>
11095 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11096 Xindex::read_symtab_xindex.
11098 2010-01-07 Doug Kwan <dougkwan@google.com>
11100 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11101 (Insn_template::thumb16_bcond_insn): New method declaration.
11102 (Insn_template): Fix spelling.
11103 (Stub::thumb16_special): New method declaration.
11104 (Stub::do_write): Define virtual method which was previously pure
11106 (Stub::do_thumb16_special): New method declaration.
11107 (Stub::do_fixed_endian_write): New template member.
11108 (Reloc_stub::do_write): Remove.
11109 (Reloc_stub::do_fixed_endian_write): Remove.
11110 (Cortex_a8_stub): New class definition.
11111 (Stub_factory::make_cortex_a8_stub): New method definition.
11112 (Stub_factory::Stub_factory): Add missing static storage class
11113 qualifier for elf32_arm_stub_a8_veneer_blx.
11115 2010-01-07 Ian Lance Taylor <iant@google.com>
11118 * options.h (class General_options): Add --warn-unresolved-symbols
11119 and --error-unresolved-symbols.
11120 * errors.cc (Errors::undefined_symbol): Implement
11121 --warn-unresolved-symbols.
11123 * options.h (class General_options): Add -z text and -z textoff.
11124 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11126 2010-01-06 Sriraman Tallam <tmsriram@google.com>
11128 * gc.h (Garbage_collection::Cident_section_map): New typedef.
11129 (Garbage_collection::cident_sections): New function.
11130 (Garbage_collection::add_cident_section): New function.
11131 (Garbage_collection::cident_sections_): New member.
11132 (gc_process_relocs): Add references to sections whose names are C
11134 * gold.h (cident_section_start_prefix): New constant.
11135 (cident_section_stop_prefix): New constant.
11136 (is_cident): New function.
11137 * layout.cc (Layout::define_section_symbols): Replace string constants
11138 with the newly defined constants.
11139 * object.cc (Sized_relobj::do_layout): Track sections whose names are
11141 * testsuite/Makefile.am: Add gc_orphan_section_test.
11142 * testsuite/Makefile.in: Regenerate.
11143 * testsuite/gc_orphan_section_test.cc: New file.
11144 * testsuite/gc_orphan_section_test.sh: New file.
11146 2010-01-06 Ian Lance Taylor <iant@google.com>
11149 * options.h (class General_options): Add --warn-shared-textrel.
11150 * layout.cc (Layout::finish_dynamic_section): Implement
11151 --warn-shared-textrel.
11154 * options.h (class General_options): Add --warn-multiple-gp.
11156 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11158 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11159 $(THREADSLIB) and $(LIBDL).
11160 * Makefile.in: Rebuild.
11162 2010-01-06 Ian Lance Taylor <iant@google.com>
11165 * options.cc (General_options::parse_section_start): New function.
11166 (General_options::section_start): New function.
11167 (General_options::General_options): Initialize all members.
11168 * options.h: Include <map>
11169 (class General_options): Add --section-start. Add section_starts_
11171 * layout.cc (Layout::attach_allocated_section_to_segment): If
11172 --section-start was used, set the address of the segment. Remove
11173 local sort_sections.
11174 (Layout::relaxation_loop_body): If the address of the load segment
11175 has been set by --section-start, don't use it.
11176 * output.h (Output_segment::update_flags_for_output_section): New
11178 * output.cc (Output_segment::add_output_section): Call
11179 update_flags_for_output_section.
11181 2010-01-05 Ian Lance Taylor <iant@google.com>
11184 * options.h (class General_options): Add --undefined-version.
11185 * script.cc (struct Version_expression): Add was_matched_by_symbol
11187 (Version_script_info::matched_symbol): New function.
11188 (Version_script_info::get_symbol_version_helper): Call
11190 (Version_script_info::check_unmatched_names): New function.
11191 * script.h (class Version_script_info): Update declarations.
11192 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11194 * options.h (class General_options): Use DEFINE_bool_alias for
11195 allow_multiple_definition.
11196 * resolve.cc (Symbol_table::should_override): Don't test
11197 allow_multiple_definition.
11200 * options.h (class General_options): Add --cref.
11201 * main.cc (main): Print cref table if --cref. Don't close mapfile
11202 until after printing cref table.
11203 * cref.cc: Include "symtab.h".
11204 (class Cref_inputs): Define Cref_table_compare and Cref_table.
11205 (Cref_table_compare::operator()): New function.
11206 (Cref_inputs::gather_cref): New function.
11207 (filecol): New static const.
11208 (Cref_inputs::print_cref): New function.
11209 (Cref::print_cref): New function.
11210 * cref.h: Include <cstdio>.
11211 (class Cref): Update declarations.
11212 * mapfile.h (Mapfile::file): New function.
11213 * object.h (class Object): Define Symbols. Declare virtual
11214 do_get_global_symbols.
11215 (Object::get_global_symbols): New function.
11216 * object.cc (Input_objects::add_object): Pass object to cref_ if
11218 (Input_objects::archive_start): Likewise.
11219 (Input_objects::archive_stop): Likewise.
11220 (Input_objects::print_cref): New function.
11221 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11222 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11224 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11226 * plugin.h (class Sized_pluginobj): Update declarations.
11228 2010-01-05 Ian Lance Taylor <iant@google.com>
11230 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11231 to is_default_version. Rename insdef to insdefault.
11232 (Symbol_table::add_from_relobj): Rename def to is_default_version
11233 and local to is_forced_local.
11234 (Symbol_table::add_from_pluginobj): Likewise.
11235 (Symbol_table::add_from_dynobj): Likewise.
11236 (Symbol_table::define_special_symbol): Rename insdef to
11239 2010-01-04 Ian Lance Taylor <iant@google.com>
11242 * options.h (class General_options): Add
11243 --allow-multiple-definition and -z muldefs.
11244 * resolve.cc (Symbol_table::should_override): Don't warn about a
11245 multiple symbol definition if --allow-multiple-definition or -z
11249 * options.h (class General_options): Add --add-needed and
11250 --copy-dt-needed-entries. Tweak --as-needed help entry.
11251 * object.cc (Input_objects::check_dynamic_dependencies): Give an
11252 error if --copy-dt-needed-entries aka --add-needed is used and
11253 would cause a change in behaviour.
11256 * options.h (class General_options): Add -G as a short version of
11257 --shared. Add no-op options -assert, -g, and -i.
11259 2010-01-04 Sriraman Tallam <tmsriram@google.com>
11261 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11262 check for .text or .gnu.linkonce.t sections.
11263 * icf.cc (Icf::find_identical_sections): Ditto.
11264 Change the detection for mangled function name within the section
11266 * icf.h (is_section_foldable_candidate): New function.
11268 2009-12-30 Ian Lance Taylor <iant@google.com>
11271 * options.h (class General_options): Permit two dashes with
11272 --retain-symbols-file.
11274 2009-12-30 Ian Lance Taylor <iant@google.com>
11277 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11278 don't put the file header and segment headers in the text
11282 * common.cc (Sort_commons::operator()): Stabilize sort when both
11284 (Symbol_table::do_allocate_commons_list): When allocating common
11285 symbols, skip a symbol which is no longer common.
11286 * symtab.h (Symbol::is_common): Test whether the symbol comes from
11287 an object before checking its type.
11288 * testsuite/common_test_2.c: New file.
11289 * testsuite/common_test_3.c: New file.
11290 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11291 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11292 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11293 (common_test_2_pic.o, common_test_2.so): New targets.
11294 (common_test_3_pic.o, common_test_3.so): New targets.
11295 * testsuite/Makefile.in: Rebuild.
11298 * script.cc (read_input_script): If we see a new SECTIONS clause,
11299 and we have added an input section, give an error.
11300 * layout.h (class Layout): Add have_added_input_section function.
11301 Add have_added_input_section_ field.
11302 * layout.cc (Layout::Layout): Initialize
11303 have_added_input_section_.
11304 (Layout::layout): Set have_added_input_section_.
11305 (Layout::layout_eh_frame): Likewise.
11307 2009-12-30 Ian Lance Taylor <iant@google.com>
11310 * options.h (class General_options): Add --sort-common option.
11311 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11312 * common.cc (Sort_common): Add sort_order parameter to
11313 constructor. Add sort_order_ field.
11314 (Sort_commons::operator): Check sort_order_.
11315 (Symbol_table::allocate_commons): Determine the sort order.
11316 (Symbol_table::do_allocate_commons): Add sort_order parameter.
11317 Change all callers.
11318 (Symbol_table::do_allocate_commons_list): Likewise.
11320 2009-12-30 Ian Lance Taylor <iant@google.com>
11323 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11324 symbols from this object, don't change the visibility of an
11326 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11328 2009-12-30 Ian Lance Taylor <iant@google.com>
11331 * script.h (class Version_script_info): Define Language enum.
11332 Update declarations. Define Glob, Exact, and Lookup types. Add
11333 new fields globals_, locals_, and is_finalized_.
11334 * script.cc: Various formatting fixes.
11335 (class Parser_closure): Change language_stack_ from a vector of
11336 std::string to one of Version_script_info::Language. Adjust all
11338 (class Lazy_demangler): Remove.
11339 (struct Version_expression): Change language from std::string to
11340 Version_script_info::Language.
11341 (Version_script_info::Version_script_info): New function.
11342 (Version_script_info::~Version_script_info): Don't call clear.
11343 (Version_script_info::finalize): New function.
11344 (Version_script_info::build_lookup_tables): New function.
11345 (Version_script_info::build_expression_list_lookup): New
11347 (Version_script_info::get_symbol_version_helper): Rewrite to use
11349 (Version_script_info::print_expression_list): Adjust to use
11350 Version_script_info::Language.
11351 (script_push_lex_into_version_mode): Check that the version script
11352 has not been finalized.
11353 (version_script_push_lang): Change language string to
11354 Version_script_info::Language.
11355 * options.cc (Command_line::version_script): New function.
11356 * options.h (class General_options): Add finalize_dynamic_list
11357 function. Change version_script from declaration to definition.
11358 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11359 * testsuite/version_script.map: Remove duplicate def of foo.
11360 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11361 version_script.map.
11362 * testsuite/Makefile.in: Rebuild.
11364 2009-12-30 Ian Lance Taylor <iant@google.com>
11367 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11368 if the input symbol index is 0, make the output symbol index 0.
11370 2009-12-30 Ian Lance Taylor <iant@google.com>
11373 * options.h (class General_options): Add -x/--discard-all.
11374 * object.cc (Sized_relobj::do_count_local_symbols): Handle
11375 --discard-all. If the local symbol needs a dynamic entry, check
11376 that before handling --discard-locals.
11378 2009-12-30 Ian Lance Taylor <iant@google.com>
11381 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11383 (Output_segment::add_output_section): Don't change the flags if
11384 the type is PT_TLS.
11387 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11388 GNU hash table if they need a dynamic value. Otherwise, don't add
11389 them if they are defined in a dynamic object or are forced local.
11391 2009-12-29 Ian Lance Taylor <iant@google.com>
11394 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11395 .gnu.hash table for a 32-bit target.
11398 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11399 regular and a dynamic object only needs a dynamic symbol table
11400 entry if it is externally visible.
11403 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11404 constructor. Add global_offset_table_ field.
11405 (Target_i386::got_section): Set global_offset_table_.
11406 (Target_i386::do_finalize_sections): Set global_offset_table_
11408 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11409 in constructor. Add global_offset_table_ field.
11410 (Target_x86_64::got_section): Set global_offset_table_.
11411 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11414 * layout.cc (Layout::Layout): Initialize increase_relro_.
11415 (Layout::get_output_section): Add is_relro, is_last_relro, and
11416 is_first_non_relro parameters. Change all callers.
11417 (Layout::choose_output_section): Likewise.
11418 (Layout::add_output_section_data): Likewise.
11419 (Layout::make_output_section): Likewise.
11420 (Layout::set_segment_offsets): Clear increase_relro when using a
11422 * layout.h (class Layout): Add increase_relro method. Add
11423 increase_relro_ field. Update declarations.
11424 * output.cc (Output_section::Output_section): Initialize
11425 is_last_relro_ and is_first_non_relro_.
11426 (Output_segment::add_output_section): Group relro sections is
11427 do_sort is true. Handle is_last_relro and is_first_non_relro.
11428 (Output_segment::maximum_alignment): Remove relro handling.
11429 (Output_segment::set_section_addresses): Add increase_relro
11430 parameter. Change all callers. Add initial alignment to align
11431 relro sections on separate page. Remove old relro handling.
11432 (Output_segment::set_section_list_addresses): Remove in_relro
11433 parameter. Change all callers.
11434 (Output_segment::set_offset): Add increase parameter. Change all
11435 callers. Remove old relro handling.
11436 * output.h (class Output_section): Add new methods: is_last_relro,
11437 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11438 Add is_last_relro_ and is_first_non_relro_ fields.
11439 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11440 Create separate .got.plt section. Call increase_relro.
11441 * x86_64.cc (Target_x86_64::got_section): Likewise.
11442 * testsuite/relro_script_test.t: Add .got.plt.
11445 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11446 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11447 (Layout::finalize): Call set_dynamic_symbol_size.
11448 (Layout::set_dynamic_symbol_size): New function.
11449 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11450 set_dynamic_symbol_size.
11453 * output.h (class Output_section): Add is_entsize_zero_ field.
11454 * output.cc (Output_section::Output_section): Initialize
11456 (Output_section::set_entsize): If two different entsizes are
11457 requested, force it to zero.
11458 (Output_section::add_input_section): Set flags for .debug_str
11459 before updating section flags. Set entsize.
11460 (Output_section::update_flags_for_input_section): Set SHF_MERGE
11461 and SHF_STRING if all input sections have those flags.
11463 2009-12-29 Rafael Espindola <espindola@google.com>
11465 * main.cc (main): Fix the sys time reporting.
11466 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11469 2009-12-29 Sriraman Tallam <tmsriram@google.com>
11471 * options.cc (General_options::parse_version): Allow -v to exit
11472 without an error if there is nothing to link.
11474 2009-12-29 Ian Lance Taylor <iant@google.com>
11476 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11477 using a version of gcc before 4.1.
11478 * configure: Rebuild.
11480 2009-12-28 Chris Demetriou <cgd@google.com>
11482 * attributes.cc (Output_attributes_section_data::do_write): Use
11483 std::vector::front rather than std::vector::data.
11485 2009-12-28 Ian Lance Taylor <iant@google.com>
11487 * symtab.h (class Symbol_table): Add enum Defined.
11488 * resolve.cc (Symbol_table::should_override): Add defined
11489 parameter. Change all callers. Test whether object is NULL
11490 before calling a method on it.
11491 (Symbol_table::report_resolve_problem): Add defined parameter.
11492 Change all callers.
11493 (Symbol_table::should_override_with_special): Likewise.
11494 * symtab.cc (Symbol_table::define_in_output_data): Add defined
11495 parameter. Change all callers.
11496 (Symbol_table::do_define_in_output_data): Likewise.
11497 (Symbol_table::define_in_output_segment): Likewise.
11498 (Symbol_table::do_define_in_output_segment): Likewise.
11499 (Symbol_table::define_as_constant): Likewise.
11500 (Symbol_table::do_define_as_constant): Likewise.
11501 * script.h (class Symbol_assignment): Add is_defsym parameter to
11502 constructor; change all callers.
11503 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11504 parameter. Change all callers. Add is_defsym_ field.
11505 (class Parser_closure): Add parsing_defsym parameter to
11506 constructor; change all callers. Add parsing_defsym accessor
11507 function. Add parsing_defsym_ field.
11509 2009-12-28 Ian Lance Taylor <iant@google.com>
11511 * gold.cc (queue_middle_tasks): Fix formatting.
11512 * object.cc (Relobj::is_section_name_included): Likewise.
11514 2009-12-23 Ian Lance Taylor <iant@google.com>
11516 * i386.cc (Target_i386::do_calls_non_split): Recognize
11517 -fsplit-stack prologue for a function with a static chain.
11518 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11519 -fsplit-stack prologue when using %r11.
11521 2009-12-21 Sriraman Tallam <tmsriram@google.com>
11523 * options.cc (General_options::parse_version): Make -v continue and do
11524 the link like GNU ld does.
11526 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
11528 * Makefile.am (CCFILES): Add timer.cc.
11529 (HFILES): Add timer.h.
11530 * configure.ac: Check for sysconf and times.
11531 * main.cc: include timer.h.
11532 (main): Use Timer instead of get_run_time.
11535 * workqueue.cc: include timer.h.
11536 (Workqueue::find_and_run_task):
11537 Report user, sys and wall time.
11538 * Makefile.in: Regenerate.
11539 * config.in: Regenerate.
11540 * configure: Regenerate.
11542 2009-12-16 Doug Kwan <dougkwan@google.com>
11544 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11546 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11547 relaxed input sections.
11548 * output.cc (Output_section::find_relaxed_input_section): Change
11549 return type to Output_relaxed_input_section pointer. Adjust code
11550 for new type of relaxed_input_section_map_.
11551 * output.h (Output_section::find_relaxed_input_section): Change
11552 return type to Output_relaxed_input_section pointer.
11553 (Output_section::Output_relaxed_input_section_by_input_section_map):
11555 (Output_section::relaxed_input_section_map_): Change type to
11556 Output_section::Output_relaxed_input_section_by_input_section_map.
11557 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11560 2009-12-15 Ian Lance Taylor <iant@google.com>
11562 * layout.cc (Layout::create_shstrtab): Only write out after input
11563 sections if we are compressing debug sections.
11565 2009-12-15 Ian Lance Taylor <iant@google.com>
11567 * archive.cc (Archive::add_symbols): Only look up a symbol without
11568 a version if there is, in fact, a version.
11570 2009-12-14 Ian Lance Taylor <iant@google.com>
11572 Revert -Wshadow changes, all changes from:
11573 2009-12-11 Doug Kwan <dougkwan@google.com>
11574 2009-12-11 Nick Clifton <nickc@redhat.com>
11575 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11577 2009-12-11 Doug Kwan <dougkwan@google.com>
11579 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11581 * attributes.cc (Object_attribute::size): Ditto.
11582 (Attributes_section_data::size): Ditto.
11583 (Attributes_section_data::Attributes_section_data): Ditto.
11584 (Output_attributes_section_data::do_write): Ditto.
11585 * attributes.h (Object_attribute::set_type): Ditto.
11586 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11588 2009-12-11 Nick Clifton <nickc@redhat.com>
11590 * archive.cc: Fix shadowed variable warnings.
11591 * arm.cc: Likewise.
11592 * compressed_output.cc: Likewise.
11593 * compressed_output.h: Likewise.
11594 * configure: Likewise.
11595 * dwarf_reader.cc: Likewise.
11596 * dynobj.cc: Likewise.
11597 * dynobj.h: Likewise.
11598 * ehframe.cc: Likewise.
11599 * ehframe.h: Likewise.
11600 * errors.cc: Likewise.
11601 * expression.cc: Likewise.
11602 * fileread.cc: Likewise.
11603 * fileread.h: Likewise.
11604 * freebsd.h: Likewise.
11605 * i386.cc: Likewise.
11606 * icf.cc: Likewise.
11607 * incremental.h: Likewise.
11608 * layout.cc: Likewise.
11609 * layout.h: Likewise.
11610 * mapfile.cc: Likewise.
11611 * merge.cc: Likewise.
11612 * merge.h: Likewise.
11613 * object.cc: Likewise.
11614 * object.h: Likewise.
11615 * options.h: Likewise.
11616 * output.cc: Likewise.
11617 * output.h: Likewise.
11618 * parameters.cc: Likewise.
11619 * plugin.cc: Likewise.
11620 * powerpc.cc: Likewise.
11621 * reduced_debug_output.cc: Likewise.
11622 * reduced_debug_output.h: Likewise.
11623 * reloc.cc: Likewise.
11624 * reloc.h: Likewise.
11625 * resolve.cc: Likewise.
11626 * script-sections.cc: Likewise.
11627 * script.cc: Likewise.
11628 * script.h: Likewise.
11629 * sparc.cc: Likewise.
11630 * symtab.cc: Likewise.
11631 * symtab.h: Likewise.
11632 * target-select.cc: Likewise.
11633 * target-select.h: Likewise.
11634 * token.h: Likewise.
11635 * workqueue.cc: Likewise.
11636 * workqueue.h: Likewise.
11637 * x86_64.cc: Likewise.
11639 2009-12-10 Doug Kwan <dougkwan@google.com>
11641 * arm.cc (attributes.h): New include.
11642 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11643 (Arm_relobj::~Arm_relobj): Delete object pointed by
11644 attributes_section_data_.
11645 (Arm_relobj::attributes_section_data): New method definition.
11646 (Arm_relobj::attributes_section_data_): New data member declaration.
11647 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11648 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11649 attributes_section_data_.
11650 (Arm_dynobj::attributes_section_data): New method definition.
11651 (Arm_dynobj::attributes_section_data_): New data member declaration.
11652 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
11653 initialization value of may_use_blx_ to false.
11654 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11655 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11656 object attributes to compute results instead of hard-coding.
11657 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11658 Target_arm::get_secondary_compatible_arch,
11659 Target_arm::set_secondary_compatible_arch
11660 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11661 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11662 New method declarations.
11663 (Target_arm::get_aeabi_object_attribute): New method definition.
11664 (Target_arm::attributes_section_data_): New data member declaration.
11665 (read_arm_attributes_section): New template definition.
11666 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11667 (Arm_dynobj::do_read_symbols): Ditto.
11668 (Target_arm::do_finalize_sections): Merge attributes sections from
11669 input. Check for BLX use after attributes section merging.
11670 Fix __exidx_start and __exidx_end visibility. Create an
11671 .ARM.attributes section if necessary.
11672 (Target_arm::get_secondary_compatible_arch,
11673 Target_arm::set_secondary_compatible_arch,
11674 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11675 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11676 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11677 New method definitions.
11679 2009-12-09 Ian Lance Taylor <iant@google.com>
11681 * plugin.cc (Plugin::load): Don't cast from void* to a function
11684 2009-12-09 Ian Lance Taylor <iant@google.com>
11686 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11687 information fields.
11689 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
11691 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11692 Replace two_file_shared_1.so with two_file_shared_2.so.
11693 * testsuite/Makefile.in: Regenerated.
11695 2009-12-08 Doug Kwan <dougkwan@google.com>
11697 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11698 (HFILES): Add attributes.h and int_encoding.h.
11699 * Makefile.in: Regenerate.
11700 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11701 function definitions to int_encoding.cc
11702 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11703 prototypes to int_encoding.h
11704 * reduced_debug_output.cc (int_encoding.h): New include.
11705 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11706 function definitions to int_encoding.cc
11707 (insert_into_vector, read_from_pointer): Move template definitions to
11709 * attributes.cc: New file.
11710 * attributes.h: New file.
11711 * int_encoding.cc: New file.
11712 * int_encoding.h: New file.
11714 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
11717 * incremental-dump.cc (dump_incremental_inputs): New.
11718 (main): Use dump_incremental_inputs.
11720 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
11723 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11724 checking elfcpp::STT_FUNC.
11725 (Target_i386::Relocate::relocate): Likewise.
11726 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11728 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11729 symbols from shared libraries into normal FUNC symbols.
11731 * symtab.h (Symbol): Add is_func and use it.
11733 2009-12-05 Doug Kwan <dougkwan@google.com>
11735 * arm.cc (Target_arm::arm_info): Initialize new fields
11736 attributes_section and attributes_vendor.
11737 * i386.cc (Target_i386::i386_info): Same.
11738 * object.cc (Sized_relobj::do_layout): Skip attribute section.
11739 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11740 fields attributes_section and attributes_vendor.
11741 * sparc.cc (Target_sparc::sparc_info): Same.
11742 * target.h (Target::attributes_section, Target::attributes_vendor,
11743 Target::is_attributes_section, Target::attribute_arg_type,
11744 Target::attributes_order): New method definitions.
11745 (Target::Target_info::attributes_section,
11746 Target::Target_info::attributes_vendor): New fields.
11747 (Target::do_attribute_arg_type, Target::do_attributes_order): New
11748 virtual method definitions.
11749 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11750 attributes_section and attributes_vendor.
11751 * testsuite/testfile.cc (Target_test::test_target_info): Same.
11753 2009-12-05 Doug Kwan <dougkwan@google.com>
11755 * arm.cc: Update comments about interworking and stub generation.
11756 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11757 considered as non-PIC.
11758 (Arm_relocate_functions::base_abs): Fix formatting.
11759 (Arm_relocate_functions::got_prel): Fix comment. Change interface
11760 of function to use GOT entry address instead of offset.
11761 (Target_arm::Scan::global): Issue an error if a symbol would need a
11762 PLT does not get one because it is untyped. Remove code to create
11763 dynamic symbols for relative branches.
11764 (Target_arm::Relocate::relocate: Use 0 instead of false since function
11765 takes unsigned integer instead of boolean.
11767 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
11769 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11770 (two_file_test_LDADD): Likewise.
11771 (common_test_1_LDADD): Likewise.
11772 (exception_test_LDADD) Likewise.
11773 (weak_test_LDADD): Likewise.
11774 (many_sections_test_LDADD): Likewise.
11775 (initpri1_LDADD): Likewise.
11776 (script_test_1_LDADD): Likewise.
11777 (script_test_2_LDADD): Likewise.
11778 (justsyms_LDADD): Likewise.
11779 (binary_test_LDADD): Likewise.
11780 (large_LDADD): Likewise.
11781 * testsuite/Makefile.in: Regenerated.
11783 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
11785 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11786 (Symbol_table::override_with_special): Likewise.
11787 (Symbol_table::add_from_object): Likewise.
11789 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11791 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11792 Don't set the data_offset twice.
11794 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11796 * testsuite/Makefile.in: Regenerate.
11798 2009-12-03 Doug Kwan <dougkwan@google.com>
11800 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11801 (Target_arm::do_finalize_sections): Add parameter for symbol table
11802 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
11803 * i386.cc (Target_i386::do_finalize_sections): Add an additional
11804 parameter for symbol table pointer.
11805 * layout.cc (Layout::finalize): Call Target::finalize_sections with
11806 an additional parameter for a pointer to symbol table.
11807 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11808 parameter for a symbol table pointer.
11809 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11810 * target.h (Target::finalize_sections, Target::do_finalize_sections):
11812 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11813 parameter for a symbol table pointer.
11815 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
11817 * incremental.cc (Incremental_inputs_header)
11818 (Incremental_inputs_header_write, Incremental_inputs_entry)
11819 (Incremental_inputs_entry_write): Move ...
11820 * incremental.h (Incremental_inputs_header)
11821 (Incremental_inputs_header_write, Incremental_inputs_entry)
11822 (Incremental_inputs_entry_write): here.
11824 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11826 * incremental.cc (make_sized_incremental_binary): Set the target.
11827 Error if it is incompatible.
11828 * output.h (Output_file): Add filename method.
11830 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11832 * incremental.cc (Incremental_inputs_entry): Remove unused argument
11833 from the get_* methods.
11835 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11837 * incremental-dump.cc (main): Check that the offeset of a script is 0.
11838 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11839 Write 0 for the data_offset of scripts.
11841 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11843 * testsuite/Makefile.am: Add the incremental_test.sh test.
11844 * testsuite/incremental_test.sh: New.
11845 * testsuite/incremental_test_1.c: New.
11846 * testsuite/incremental_test_2.c: New.
11848 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
11850 * incremental-dump.cc (main): Fix typos.
11852 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
11855 * incremental-dump.cc (main): Use llu to print 64 bit values.
11857 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
11858 H.J. Lu <hongjiu.lu@intel.com>
11860 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11862 (incremental_dump_LDADD): Likewise.
11863 * Makefile.in: Regenerated.
11865 2009-11-25 Doug Kwan <dougkwan@google.com>
11869 2009-11-25 Doug Kwan <dougkwan@google.com>
11871 * arm.cc (Target_arm::Target_arm): Move method definition
11872 outside of class definition. Add code to handle
11873 --target1-rel, --target1-abs and --target2= options.
11874 (Target_arm::get_reloc_reloc_type): Change method to be
11875 non-static and const.
11876 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11877 New data member declaration.
11878 (Target_arm::Scan::local, Target_arm::Scan::global,
11879 Target_arm::Relocate::relocate,
11880 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11881 Adjust call to Target_arm::get_real_reloc_type.
11882 (Target_arm::get_real_reloc_type): Use command line options
11883 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11884 * options.h (--target1-rel, --target1-abs, --target2): New
11887 2009-11-25 Doug Kwan <dougkwan@google.com>
11889 * arm.cc (Target_arm::Target_arm): Move method definition outside of
11890 class definition. Add code to handle --target1-rel, --target1-abs
11891 and --target2= options.
11892 (Target_arm::get_reloc_reloc_type): Change method to be non-static
11894 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11895 member declaration.
11896 (Target_arm::Scan::local, Target_arm::Scan::global,
11897 Target_arm::Relocate::relocate,
11898 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11899 call to Target_arm::get_real_reloc_type.
11900 (Target_arm::get_real_reloc_type): Use command line options to
11901 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11902 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11905 2009-11-25 Doug Kwan <dougkwan@google.com>
11907 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11908 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11909 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11911 (Arm_relocate_functions::thm_call): Replace body with a call to
11912 Arm_relocate_functions::thumb_branch_common.
11913 (Arm_relocate_functions::thm_jump24,
11914 Arm_relocate_functions::thm_xpc22): New method definitions.
11915 (Arm_relocate_functions::thumb_branch_common): New method definition.
11916 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11918 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11919 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11921 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11923 * Makefile.am: Build incremental-dump
11924 * Makefile.in: Regenerate.
11925 * incremental-dump.cc: New.
11926 * incremental.cc (Incremental_inputs_header_data,
11927 Incremental_inputs_entry_data): Move to incremental.h
11928 * incremental.h: (Incremental_inputs_header_data,
11929 Incremental_inputs_entry_data): Move from incremental.cc
11931 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11933 * incremental.cc (Incremental_inputs_header,
11934 Incremental_inputs_header_write, Incremental_inputs_entry,
11935 Incremental_inputs_entry_write): Add a typedef with the data type.
11937 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11939 * incremental.cc (Incremental_inputs_header,
11940 Incremental_inputs_header_write, Incremental_inputs_entry,
11941 Incremental_inputs_entry_write): Update comment about which
11942 type has the filed descriptions.
11944 2009-11-15 Doug Kwan <dougkwan@google.com>
11946 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11947 (Arm_relocate_functions::arm_branch_common): Change method defintion
11948 in class definition to a method declaration and update list of formal
11950 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11951 Arm_relocation_functions::jump24): Adjust call to
11952 Arm_relocate_functions::arm_branch_common. Update list of formal
11954 (Arm_relocate_functions::xpc25): New method definition.
11955 (Arm_relocate_functions::arm_branch_common): Move method defintion
11956 out from class definition. Use stubs for mode-switching and extending
11958 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11959 specially. Change code to enable use of stubs in ARM branches.
11961 2009-11-10 Doug Kwan <dougkwan@google.com>
11963 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11964 in method declaration.
11965 (Target_arm::relocate_stub): New method declaration.
11966 (Target_arm::default_target): Change to return a pointer instead of
11968 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11969 Target_arm::default_target.
11970 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11972 (Target_arm::relocate_section): Adjust view.
11973 (Target_arm::relocate_stub): New method definition.
11975 2009-11-10 Doug Kwan <dougkwan@google.com>
11977 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11979 * incremental.cc (open_incremental_binary): Initialized local
11980 variables to avoid warnings.
11981 * object.cc (make_elf_object): Ditto.
11982 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11985 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11988 * testsuite/plugin_test.c: Include "config.h".
11990 2009-11-09 Doug Kwan <dougkwan@google.com>
11992 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11993 (arm_symbol_value): Remove.
11994 (Arm_relocate_functions::arm_branch_common,
11995 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11996 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11997 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11998 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11999 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12000 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12001 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12002 Arm_relocate_functions::thm_mobw_abs_nc,
12003 Arm_relocate_functions::thm_mov_abs,
12004 Arm_relocate_functions::movw_prel_nc,
12005 Arm_relocate_functions::thm_movt_abs,
12006 Arm_relocate_functions::movt_prel,
12007 Arm_relocate_functions::thm_movw_prel_nc,
12008 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12009 (Target_arm::Relocate::relocate): Only decompose address into two
12010 parts if relocation type uses the thumb-bit and pass the actual
12011 bit instead of a flag indicating that the thumb-bit is used. Adjust
12012 calls to methods in Arm_relocate_functions for this change.
12014 2009-11-08 Ian Lance Taylor <iant@google.com>
12017 * reloc.cc: Instantiate
12018 Sized_relobj::initialize_input_to_output_maps and
12019 Sized_relobj:free_input_to_output_maps.
12021 2009-11-06 Ian Lance Taylor <iant@google.com>
12024 * defstd.cc (in_segment): Set only_if_ref true for "end".
12026 2009-11-06 Doug Kwan <dougkwan@google.com>
12028 * arm.cc (class Reloc_stub): Correct a comment.
12029 (Target_arm::Target_arm): Initialize arm_input_section_map_.
12030 (Target_arm::scan_section_for_stubs): New method declaration.
12031 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12032 Change methods from private to protected.
12033 (Target_arm::do_may_relax): New method definition.
12034 (Target_arm::do_relax, Target_arm::group_sections,
12035 Target_arm::scan_reloc_for_stub,
12036 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12037 (Target_arm::arm_input_section_map_): New data member declaration.
12038 (Target_arm::scan_reloc_for_stub,
12039 Target_arm::scan_reloc_section_for_stubs,
12040 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12041 Target_arm::do_relax): New method definitions.
12043 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
12045 * configure.ac: Check for (struct stat)::st_mtim
12046 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12047 * config.in: Regenerate.
12048 * configure: Regenerate.
12050 2009-11-05 Ian Lance Taylor <iant@google.com>
12053 * output.cc (Output_segment::add_output_section): Add missing
12056 2009-11-04 Ian Lance Taylor <iant@google.com>
12059 * object.h (class Object): Add is_needed and set_is_needed
12060 methods. Add is_needed_ field. Make bool fields into bitfields.
12061 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12062 defined in a dynamic object and referenced by a regular object,
12063 set is_needed for the dynamic object.
12064 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12065 if the file is marked with as_needed and it is not needed.
12067 2009-11-04 Ian Lance Taylor <iant@google.com>
12070 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12071 tags if data is discarded by linker script.
12072 * i386.cc (Target_i386::do_finalize_sections): Likewise.
12073 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12074 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12075 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12077 2009-11-04 Ian Lance Taylor <iant@google.com>
12079 * layout.cc (Layout::get_output_section): Add is_interp and
12080 is_dynamic_linker_section parameters. Change all callers.
12081 (Layout::choose_output_section): Likewise.
12082 (Layout::make_output_section): Likewise.
12083 (Layout::add_output_section_data): Add is_dynamic_linker_section
12084 parameter. Change all callers.
12085 * layout.h (class Layout): Update declarations.
12086 * output.h (class Output_section): Add is_interp, set_is_interp,
12087 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12088 Add is_interp_, is_dynamic_linker_section_ fields. Change
12089 generate_code_fills_at_write_ to a bitfield.
12090 * output.cc (Output_section::Output_sections): Initialize new
12092 (Output_segment::add_output_section): Add do_sort parameter.
12093 Change all callers.
12095 2009-11-03 Ian Lance Taylor <iant@google.com>
12098 * options.h (class General_options): Add --warn-common.
12099 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12100 merging two common symbols.
12101 (Symbol_table::should_override): Handle --warn-common when merging
12102 a common symbol with a defined symbol. Use report_resolve_problem
12103 for multiple definitions.
12104 (Symbol_table::report_resolve_problem): New function.
12105 * symtab.h (class Symbol_table): Declare report_resolve_problem.
12107 2009-11-03 Doug Kwan <dougkwan@google.com>
12109 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12111 (Target_arm::stub_factory): New method definition.
12112 (Target_arm::new_arm_input_section,
12113 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12114 Target_arm::reloc_uses_thumb_bit): New method declarations.
12115 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12116 New type definitions.
12117 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12118 member declarations.
12119 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12120 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12121 New method definitions.
12123 2009-11-03 Ian Lance Taylor <iant@google.com>
12125 * options.h (class General_options): Add --warn_constructors.
12127 2009-11-03 Ian Lance Taylor <iant@google.com>
12130 * defstd.cc (in_section): Add entries for __rel_iplt_start,
12131 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12133 2009-11-03 Ian Lance Taylor <iant@google.com>
12136 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12137 --msgid-bugs-address.
12138 (install-pdf): New target.
12139 (install-data_yes): Look up one directory to find mkinstalldirs.
12141 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
12143 * po/Make-in (.po.gmo): Don't generate .gmo files in source
12146 2009-10-30 Doug Kwan <dougkwan@google.com>
12148 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12150 2009-10-30 Doug Kwan <dougkwan@google.com>
12152 * arm.cc (Stub_addend_reader): New struct template definition
12153 and partial specializations.
12154 (Stub_addend_reader::operator()): New method definition for a
12155 partially specialized template.
12157 2009-10-30 Doug Kwan <dougkwan@google.com>
12159 * arm.cc (Arm_relobj::processor_specific_flags): New method
12161 (Arm_relobj::do_read_symbols): New method declaration.
12162 (Arm_relobj::processor_specific_flags_): New data member declaration.
12163 (Arm_dynobj): New class definition.
12164 (Target_arm::do_finalize_sections): Add input_objects parameter.
12165 (Target_arm::do_adjust_elf_header): New method declaration.
12166 (Target_arm::are_eabi_versions_compatible,
12167 (Target_arm::merge_processor_specific_flags): New method declaration.
12168 (Target_arm::do_make_elf_object): New overloaded method definitions
12170 (Arm_relobj::do_read_symbols): New method definition.
12171 (Arm_dynobj::do_read_symbols): Ditto.
12172 (Target_arm::do_finalize_sections): Add input_objects parameters.
12173 Merge processor-specific flags from all input objects.
12174 (Target_arm::are_eabi_versions_compatible,
12175 Target_arm::merge_processor_specific_flags,
12176 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12177 New method definitions.
12178 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12179 Input_objects pointer type parameter.
12180 * layout.cc (Layout::finalize): Pass input objects to target's.
12181 finalize_sections function.
12182 * output.cc (Output_file_header::do_sized_write): Set ELF file
12183 header's processor-specific flags.
12184 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12185 Input_objects pointer type parameter.
12186 * sparc.cc (Target_sparc::do_finalize_sections): Same.
12187 * target.h (Input_objects): New forward class declaration.
12188 (Target::processor_specific_flags,
12189 Target::are_processor_specific_flags_sect): New method definitions.
12190 (Target::finalize_sections): Add input_objects parameter.
12191 (Target::Target): Initialize processor_specific_flags_ and
12192 are_processor_specific_flags_set_.
12193 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12195 (Target::set_processor_specific_flags): New method definition.
12196 (Target::processor_specific_flags_,
12197 Target::are_processor_specific_flags_set_): New data member
12199 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12200 Input_objects pointer type parameter.
12202 2009-10-30 Doug Kwan <dougkwan@google.com>
12204 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12206 2009-10-28 Ian Lance Taylor <iant@google.com>
12208 * object.h (class Relobj): Drop options parameter from
12209 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12210 do_scan_relocs, do_relocate. Change all callers.
12211 (class Sized_relobj): Drop options parameters from
12212 do_gc_process_relocs, do_scan_relocs, do_relocate,
12213 do_relocate_sections, relocate_sections, emit_relocs_scan,
12214 emit_relocs_scan_reltype. Change all callers.
12215 (struct Relocate_info): Remove options field and all references to
12217 * reloc.h (class Read_relocs): Remove options constructor
12218 parameter and options_ field. Change all callers.
12219 (class Gc_process_relocs, class Scan_relocs): Likewise.
12220 (class Relocate_task): Likewise.
12221 * target-reloc.h (scan_relocs): Remove options parameter. Change
12223 (scan_relocatable_relocs): Likewise.
12224 * target.h (class Sized_target): Remove options parameter from
12225 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
12227 * gc.h (gc_process_relocs): Remove options parameter. Change all
12229 * arm.cc: Update functions to remove options parameters.
12230 * i386.cc: Likewise.
12231 * powerpc.cc: Likewise.
12232 * sparc.cc: Likewise.
12233 * x86_64.cc: Likewise.
12234 * testsuite/testfile.cc: Likewise.
12236 2009-10-28 Doug Kwan <dougkwan@google.com>
12238 * arm.cc (Arm_relobj): New class definition.
12239 (Arm_relobj::scan_sections_for_stubs,
12240 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12241 New method definitions.
12243 2009-10-28 Cary Coutant <ccoutant@google.com>
12245 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12246 (Plugin::cleanup_done_): New member.
12247 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12248 (Plugin_manager::cleanup_done_): Remove.
12249 (Plugin_manager::add_input_file): Edit error message.
12250 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12251 (Plugin_manager::cleanup): Remove use of cleanup_done_.
12253 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
12255 * fileread.cc: (File_read::View::~View): Use the new
12256 data_ownership_ filed.
12257 (File_read::~File_read): Dispose the new whole_file_view_.
12258 (File_read::open): Mmap the whole file if needed.
12259 (File_read::open): Use whole_file_view_ instead of contents_.
12260 (File_read::find_view): Use whole_file_view_ if applicable.
12261 (File_read::do_read): Use whole_file_view_ instead of contents_.
12262 (File_read::make_view): Use whole_file_view_ instead of contents_,
12263 update File_read::View::View call.
12264 (File_read::find_or_make_view): Update File_read::View::View
12266 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12268 (File_read::View::Data_ownership): New enum.
12269 (File_read::View::View): Replace bool mapped_ with Data_ownership
12271 (File_read::View::mapped_): Remove (replaced by data_ownership_).
12272 (File_read::View::data_ownership_): New field.
12273 (File_read::contents_): Remove (replaced by whole_file_view_).
12274 (File_read::whole_file_view_): New field.
12275 * options.h (class General_options): Add --keep-files-mapped.
12277 2009-10-27 Cary Coutant <ccoutant@google.com>
12279 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12280 * testsuite/Makefile.am (plugin_test_5): New test case.
12281 * testsuite/Makefile.in: Regenerate.
12283 2009-10-25 Doug Kwan <dougkwan@google.com>
12285 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12286 from private to protected to allow access by child class.
12287 (Sized_relobj::do_relocate_sections): New method declaration.
12288 (Sized_relobj::relocate_sections): Virtualize.
12289 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12290 Sized_relobj::relocate_sections. Instantiate template explicitly
12291 for different target sizes and endianity.
12293 2009-10-24 Doug Kwan <dougkwan@google.com>
12295 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12296 (Arm_input_section::as_arm_input_section): New method.
12297 (Arm_output_section): New class definition.
12298 (Arm_output_section::create_stub_group,
12299 Arm_output_section::group_sections): New method definitions.
12301 2009-10-22 Doug Kwan <dougkwan@google.com>
12303 * arm.cc (Arm_input_section): New class definition.
12304 (Arm_input_section::init, Arm_input_section:do_write,
12305 Arm_input_section::set_final_data_size,
12306 Arm_input_section::do_reset_address_and_file_offset): New method
12309 2009-10-21 Doug Kwan <dougkwan@google.com>
12311 * arm.cc (Stub_table, Arm_input_section): New forward class
12313 (Stub_table): New class defintion.
12314 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12315 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12316 New method definition.
12318 2009-10-21 Doug Kwan <dougkwan@google.com>
12320 * arm.cc: Update copyright comments.
12321 (Target_arm): New forward class template declaration.
12322 (Arm_address): New type.
12323 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12324 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12325 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12327 (Insn_template): Same.
12328 (DEF_STUBS): New macro.
12329 (Stub_type): New enum type.
12330 (Stub_template): New class definition.
12332 (Reloc_stub): Same.
12333 (Stub_factory): Same.
12334 (Target_arm::Target_arm): Initialize may_use_blx_ and
12335 should_force_pic_veneer_.
12336 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12337 Target_arm::should_force_pic_veneer,
12338 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12339 Target_arm::using_thumb_only, Target_arm:;default_target): New
12341 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12342 New data member declarations.
12343 (Insn_template::size, Insn_template::alignment): New method defintions.
12344 (Stub_template::Stub_template): New method definition.
12345 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12346 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12347 (Stub_factory::Stub_factory): New method definition.
12348 * gold.h (string_hash): New template.
12349 * output.h (Input_section_specifier::hash_value): Use
12351 (Input_section_specifier::string_hash): Remove.
12352 * stringpool.cc (Stringpool_template::string_hash): Use
12355 2009-10-20 Doug Kwan <dougkwan@google.com>
12357 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12358 symbols of relaxed input sections.
12359 * output.h (Output_section::find_relaxed_input_section): Make
12362 2009-10-16 Doug Kwan <dougkwan@google.com>
12364 * dynobj.cc (Versions::Versions): Initialize version_script_.
12365 Only insert base version symbol definition for a shared object
12366 if version script defines any version versions.
12367 (Versions::define_base_version): New method definition.
12368 (Versions::add_def): Check that base version is not needed.
12369 (Versions::add_need): Define base version lazily.
12370 * dynobj.h (Versions::define_base_version): New method declaration.
12371 (Versions::needs_base_version_): New data member declaration.
12372 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12373 (check_DATA): Add no_version_test.stdout.
12374 (libno_version_test.so, no_version_test.o no_version_test.stdout):
12376 * testsuite/Makefile.in: Regenerate.
12377 * testsuite/no_version_test.c: New file.
12378 * testsuite/no_version_test.sh: Ditto.
12380 2009-10-16 Doug Kwan <dougkwan@google.com>
12382 * expression.cc (class Segment_start_expression): New class definition.
12383 (Segment_start_expression::value): New method definition.
12384 (script_exp_function_segment_start): Return a new
12385 Segment_start_expression.
12386 * gold/script-c.h (script_saw_segment_start_expression): New function
12388 * script-sections.cc (Script_sections::Script_sections): Initialize
12389 SAW_SEGMENT_START_EXPRESSION_ to false.
12390 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12391 and -Tbbs options to specify section addresses if given in
12392 command line and no SEGMENT_START expression is seen in a script.
12393 * script-sections.h (Script_sections::saw_segment_start_expression,
12394 Script_sections::set_saw_segment_start_expression): New method
12396 (Script_sections::saw_segment_start_expression_): New data member
12398 * script.cc (script_saw_segment_start_expression): New function.
12399 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12400 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12401 script_test_7.sh and script_test_8.sh.
12402 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12403 script_test_8.stdout.
12404 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12405 (script_test_6, script_test_6.stdout, script_test_7,
12406 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12407 * Makefile.in: Regenerate.
12408 * testsuite/script_test_6.sh: New file.
12409 * testsuite/script_test_6.t: Same.
12410 * testsuite/script_test_7.sh: Same.
12411 * testsuite/script_test_7.t: Same.
12412 * testsuite/script_test_8.sh: Same.
12414 2009-10-16 Doug Kwan <dougkwan@google.com>
12416 * output.cc (Output_segment::set_section_list_address): Cast
12417 expressions to unsigned long long type to avoid format warnings.
12419 2009-10-15 Ian Lance Taylor <iant@google.com>
12421 * script.cc (Script_options::add_symbol_assignment): Always add a
12422 dot assignment to script_sections_.
12423 * script-sections.cc (Script_sections::add_dot_assignment):
12424 Initialize if necessary.
12426 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12427 program headers with no load segment if there is a linker script.
12429 * layout.cc (Layout::set_segment_offsets): Align the file offset
12430 to the segment aligment for -N or -n with no load segment.
12431 * output.cc (Output_segment::add_output_section): Don't crash if
12432 the first section is a TLS section.
12433 (Output_segment::set_section_list_addresses): Print an error
12434 message if the address moves backward in a linker script.
12435 * script-sections.cc
12436 (Output_section_element_input::set_section_addresses): Don't
12437 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12438 (Orphan_output_section::set_section_addresses): Likewise.
12440 2009-10-15 Doug Kwan <dougkwan@google.com>
12442 * layout.cc (Layout::finish_dynamic_section): Generate tags
12443 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12444 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12445 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12447 2009-10-14 Ian Lance Taylor <iant@google.com>
12449 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12451 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12452 data_shdr fields of relinfo.
12453 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12454 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12455 R_386_TLS_LDO_32, adjust based on section flags.
12456 (Target_i386::Relocate::fix_up_ldo): Remove.
12458 2009-10-13 Ian Lance Taylor <iant@google.com>
12460 Add support for -pie.
12461 * options.h (class General_options): Add -pie and
12463 (General_options::output_is_position_independent): Test -pie.
12464 (General_options::output_is_executable): Return true if not shared
12465 and not relocatable.
12466 (General_options::output_is_pie): Remove.
12467 * options.cc (General_options::finalize): Reject incompatible uses
12469 * gold.cc (queue_middle_tasks): A -pie link is not static.
12470 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12471 * symtab.cc (Symbol::final_value_is_known): Return false if
12472 output_is_position_independent.
12473 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12474 output_is_position_independent.
12475 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12476 output_is_position_independent.
12477 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12478 output_is_position_independent.
12479 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12481 (basic_pie_test.o, basic_pie_test): New targets.
12482 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12483 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12484 (two_file_pie_test): New target.
12485 * testsuite/Makefile.in: Rebuild.
12486 * README: Remove note saying that -pie is not supported.
12488 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
12490 * options.h (class General_options): Add -init and -fini.
12491 * layout.cc (Layout::finish_dynamic_section): Emit
12492 given init and fini functions.
12494 2009-10-13 Sriraman Tallam <tmsriram@google.com>
12496 * gc.h (gc_process_relocs): Check if icf is enabled using new
12498 * gold.cc (queue_initial_tasks): Likewise.
12499 (queue_middle_tasks): Likewise.
12500 * object.cc (do_layout): Likewise.
12501 * symtab.cc (is_section_folded): Likewise.
12502 * main.cc (main): Likewise.
12503 * reloc.cc (Read_relocs::run): Likewise.
12504 (Sized_relobj::do_scan_relocs): Likewise.
12505 * icf.cc (is_function_ctor_or_dtor): New function.
12506 (Icf::find_identical_sections): Check if function is ctor or dtor when
12507 safe icf is chosen.
12508 * options.h (General_options::icf): Change option to be an enum.
12509 (Icf_status): New enum.
12510 (icf_enabled): New method.
12511 (icf_safe_folding): New method.
12512 (set_icf_status): New method.
12513 (icf_status_): New variable.
12514 * (options.cc) (General_options::finalize): Set icf_status_.
12515 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12516 icf_test and icf_keep_unique_test to use the --icf enum flag.
12517 * testsuite/icf_safe_test.sh: New file.
12518 * testsuite/icf_safe_test.cc: New file.
12520 2009-10-12 Sriraman Tallam <tmsriram@google.com>
12522 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12523 includes to gc.h and icf.h.
12524 * arm.cc: Include gc.h.
12525 * gold.cc: Likewise.
12526 * i386.cc: Likewise.
12527 * powerpc.cc: Likewise.
12528 * sparc.cc: Likewise.
12529 * x86_64.cc: Likewise.
12530 * gc.h: Include icf.h.
12532 2009-10-11 Ian Lance Taylor <iant@google.com>
12534 * plugin.cc: Include "gold.h" before other header files.
12536 2009-10-10 Chris Demetriou <cgd@google.com>
12538 * options.h (Input_file_argument::Input_file_type): New enum.
12539 (Input_file_argument::is_lib_): Replace with...
12540 (Input_file_argument::type_): New member.
12541 (Input_file_argument::Input_file_argument): Take Input_file_type
12542 'type' rather than boolean 'is_lib' as second argument.
12543 (Input_file_argument::is_lib): Use type_.
12544 (Input_file_argument::is_searched_file): New function.
12545 (Input_file_argument::may_need_search): Handle is_searched_file.
12546 * options.cc (General_options::parse_library): Support -l:filename.
12547 (General_options::parse_just_symbols): Update for Input_file_argument
12549 (Command_line::process): Likewise.
12550 * archive.cc (Archive::get_file_and_offset): Likewise.
12551 * plugin.cc (Plugin_manager::release_input_file): Likewise.
12552 * script.cc (read_script_file, script_add_file): Likewise.
12553 * fileread.cc (Input_file::Input_file): Likewise.
12554 (Input_file::will_search_for): Handle is_searched_file.
12555 (Input_file::open): Likewise.
12556 * readsyms.cc (Read_symbols::get_name): Likewise.
12557 * testsuite/Makefile.am (searched_file_test): New test.
12558 * testsuite/Makefile.in: Regenerate.
12559 * testsuite/searched_file_test.cc: New file.
12560 * testsuite/searched_file_test_lib.cc: New file.
12562 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12563 Ian Lance Taylor <iant@google.com>
12565 * descriptor.cc: Include <cstdio> and "binary-io.h".
12566 (Descriptors::open): Open the files in binary mode always.
12567 * script.cc (Lex::get_token): Treat \r as whitespace.
12569 2009-10-09 Ian Lance Taylor <iant@google.com>
12571 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12573 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12574 Ian Lance Taylor <iant@google.com>
12576 * configure.ac: Check for readv function also.
12577 * fileread.cc (readv): Define if not HAVE_READV.
12578 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12580 * config.in: Regenerate.
12581 * configure: Regenerate.
12583 2009-10-09 Doug Kwan <dougkwan@google.com>
12585 * layout.cc (Layout::make_output_section): Call target hook to make
12586 ordinary output section.
12587 (Layout::finalize): Adjust parameter list of call the
12588 Target::may_relax().
12589 * layout.h (class Layout::section_list): New method.
12590 * merge.h (Output_merge_base::entsize): Change visibility to public.
12591 (Output_merge_base::is_string, Output_merge_base::do_is_string):
12593 (Output_merge_string::do_is_string): New method.
12594 * object.cc (Sized_relobj::do_setup): renamed from
12595 Sized_relobj::set_up.
12596 * object.h (Sized_relobj::adjust_shndx,
12597 Sized_relobj::initializ_input_to_output_maps,
12598 Sized_relobj::free_input_to_output_maps): Change visibilities to
12600 (Sized_relobj::setup): Virtualize.
12601 (Sized_relobj::do_setup): New method declaration.
12602 (Sized_relobj::invalidate_section_offset,
12603 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12604 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12605 * options.cc (parse_int): New function.
12606 * options.h (parse_int): New declaration.
12607 (DEFINE_int): New macro.
12608 (stub_group_size): New option.
12609 * output.cc (Output_section::Output_section): Initialize memebers
12610 merge_section_map_, merge_section_by_properties_map_,
12611 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12612 (Output_section::add_input_section): Handled deferred code-fill
12613 generation and remove an old comment.
12614 (Output_section::add_relaxed_input_section): New method definition.
12615 (Output_section::add_merge_input_section): Use merge section by
12616 properties map to speed to search. Update merge section maps
12618 (Output_section::build_relaxation_map): New method definition.
12619 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12621 (Output_section::relax_input_section): Renamed to
12622 Output_section::convert_input_sections_to_relaxed_sections and change
12623 interface to take a vector of pointers to relaxed sections.
12624 (Output_section::find_merge_section,
12625 Output_section::find_relaxed_input_section): New method definitions.
12626 (Output_section::is_input_address_mapped,
12627 Output_section::output_offset, Output_section::output_address):
12628 Use output section data maps to speed up searching.
12629 (Output_section::find_starting_output_address): Add comments.
12630 (Output_section::do_write,
12631 Output_section::write_to_postprocessing_buffer): Do code-fill
12632 generation as appropriate.
12633 (Output_section::get_input_sections): Invalidate relaxed input section
12635 (Output_section::restore_states): Adjust type of checkpoint .
12636 Invalidate relaxed input section map.
12637 * output.h (Output_merge_base): New class declaration.
12638 (Input_section_specifier): New class defintion.
12639 (class Output_relaxed_input_section) Change base class to
12640 Output_section_data_build.
12641 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12642 base class initializer.
12643 (Output_section::add_relaxed_input_section): New method declaration.
12644 (Output_section::Input_section): Change visibility to protected.
12645 (Output_section::Input_section::relobj,
12646 Output_section::Input_section::shndx): Handle relaxed input sections.
12647 Output_section::input_sections) Change visibility to protected. Also
12648 define overload to return a non-const pointer.
12649 (Output_section::Merge_section_properties): New class defintion.
12650 (Output_section::Merge_section_by_properties_map,
12651 Output_section::Output_section_data_by_input_section_map,
12652 Output_section::Relaxation_map): New types.
12653 (Output_section::relax_input_section): Rename method to
12654 Output_section::convert_input_sections_to_relaxed_sections and change
12655 interface to take a vector of relaxed section pointers.
12656 (Output_section::find_merge_section,
12657 Output_section::find_relaxed_input_section,
12658 Output_section::build_relaxation_map,
12659 Output_section::convert_input_sections_in_list_to_relaxed_sections):
12660 New method declarations.
12661 (Output_section::merge_section_map_
12662 Output_section::merge_section_by_properties_map_,
12663 Output_section::relaxed_input_section_map_,
12664 Output_section::is_relaxed_input_section_map_valid_,
12665 Output_section::generate_code_fills_at_write_): New data members.
12666 * script-sections.cc
12667 (Output_section_element_input::set_section_addresses): Call
12668 current_data_size and addralign methods of relaxed input sections.
12669 (Orphan_output_section::set_section_addresses): Call current_data_size
12670 and addralign methods of relaxed input sections.
12671 * symtab.cc (Symbol_table::compute_final_value): Extract template
12672 from the body of Symbol_table::sized_finalize_symbol.
12673 (Symbol_table::sized_finalized_symbol): Call
12674 Symbol_table::compute_final_value.
12675 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12676 (Symbol_table::compute_final_value): New templated method declaration.
12677 * target.cc (Target::do_make_output_section): New method defintion.
12678 * target.h (Target::make_output_section): New method declaration.
12679 (Target::relax): Add more parameters for input objects, symbol table
12680 and layout. Adjust call to do_relax.
12681 (Target::do_make_output_section): New method declaration.
12682 (Target::do_relax): Add parameters for input objects, symbol table
12685 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12687 * pread.c: Include stdio.h.
12689 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12691 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12694 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12696 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12697 Change read_shndx type to unsigned int.
12698 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12700 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12701 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12702 Change read_shndx type to unsigned int.
12703 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12705 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12706 * layout.cc (Layout::create_symtab_sections): Cast the result of
12707 local_symcount * symsize to off_t in the gold_assert.
12709 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12711 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12712 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12714 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12715 (Arm_relocate_functions::thm_abs5): New function.
12716 (Arm_relocate_functions::abs12): New function.
12717 (Arm_relocate_functions::abs16): New function.
12718 (Arm_relocate_functions::base_abs): New function.
12719 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12720 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
12721 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12723 (Scan::global): Likewise.
12724 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12725 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12726 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12727 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12730 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12732 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12733 (Arm_relocate_functions::movt_prel): New function.
12734 (Arm_relocate_functions::thm_movw_prel_nc): New function.
12735 (Arm_relocate_functions::thm_movt_prel): New function.
12736 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12737 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12738 (Scan::global, Relocate::relocate): Likewise.
12739 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12741 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12743 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12744 Incremental_checker.
12745 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12747 (class Incremental_inputs_header): New class.
12748 (Incremental_inputs_header_writer): Edit comment.
12749 (Incremental_inputs_entry): New class.
12750 (Incremental_inputs_entry_writer): Edit comment.
12751 (Sized_incremental_binary::do_find_incremental_inputs_section):
12752 Add *strtab_shndx parameter, fill it.
12753 (Sized_incremental_binary::do_check_inputs): New method.
12754 (Incremental_checker::can_incrementally_link_output_file): Use
12755 Sized_incremental_binary::check_inputs.
12756 (Incremental_inputs::report_command_line): Save command line in
12759 (Incremental_binary::find_incremental_inputs_section): New
12761 (Incremental_binary::do_find_incremental_inputs_section): Add
12762 strtab_shndx parameter.
12763 (Incremental_binary::do_check_inputs): New pure virtual method.
12764 (Sized_incremental_binary::do_check_inputs): Declare.
12765 (Incremental_checker::Incremental_checker): Add incremental_inputs
12766 parameter, use it to initialize incremental_inputs_.
12767 (Incremental_checker::incremental_inputs_): New field.
12768 (Incremental_checker::command_line): New method.
12769 (Incremental_checker::inputs): New method.
12770 (Incremental_checker::command_line_): New field.
12772 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12774 * incremental.cc: Include <cstdarg> and "target-select.h".
12775 (vexplain_no_incremental): New function.
12776 (explain_no_incremental): New function.
12777 (Incremental_binary::error): New method.
12778 (Sized_incremental_binary::do_find_incremental_inputs_section): New
12780 (make_sized_incremental_binary): New function.
12781 (open_incremental_binary): New function.
12782 (can_incrementally_link_file): Add checks if output is ELF and has
12784 * incremental.h: Include "elfcpp_file.h" and "output.h".
12785 (Incremental_binary): New class.
12786 (Sized_incremental_binary): New class.
12787 (open_incremental_binary): Declare.
12788 * object.cc (is_elf_object): Use
12789 elfcpp::Elf_recognizer::is_elf_file.
12790 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12791 * output.h (Output_file::filesize): New method.
12793 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12795 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12797 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12798 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12800 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12802 (Arm_relocate_functions::movw_abs_nc): New function.
12803 (Arm_relocate_functions::movt_abs): New function.
12804 (Arm_relocate_functions::thm_movw_abs_nc): New function.
12805 (Arm_relocate_functions::thm_movt_abs): New function.
12806 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12807 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12808 (Scan::global): Likewise.
12809 (Relocate::relocate): Likewise.
12810 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12812 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12814 * arm.cc (Arm_relocate_functions::got_prel) New function.
12815 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12816 (Relocate::relocate): Likewise.
12817 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12819 2009-10-06 Ian Lance Taylor <iant@google.com>
12821 * options.h (class General_options): Define
12822 split_stack_adjust_size parameter.
12823 * object.h (class Object): Add uses_split_stack_ and
12824 has_no_split_stack_ fields. Add uses_split_stack and
12825 has_no_split_stack accessor functions. Declare
12826 handle_split_stack_section.
12827 (class Reloc_symbol_changes): Define.
12828 (class Sized_relobj): Define Function_offsets. Declare
12829 split_stack_adjust, split_stack_adjust_reltype, and
12831 * object.cc (Object::handle_split_stack_section): New function.
12832 (Sized_relobj::do_layout): Call handle_split_stack_section.
12833 * dynobj.cc (Sized_dynobj::do_layout): Call
12834 handle_split_stack_section.
12835 * reloc.cc (Sized_relobj::relocate_sections): Call
12836 split_stack_adjust for executable sections in split_stack
12837 objects. Pass reloc_map to relocate_section.
12838 (Sized_relobj::split_stack_adjust): New function.
12839 (Sized_relobj::split_stack_adjust_reltype): New function.
12840 (Sized_relobj::find_functions): New function.
12841 * target-reloc.h: Include "object.h".
12842 (relocate_section): Add reloc_symbol_changes parameter. Change
12844 * target.h (class Target): Add calls_non_split method. Declare
12845 do_calls_non_split virtual method. Declare match_view and
12847 * target.cc: Include "elfcpp.h".
12848 (Target::do_calls_non_split): New function.
12849 (Target::match_view): New function.
12850 (Target::set_view_to_nop): New function.
12851 * gold.cc (queue_middle_tasks): Give an error if mixing
12852 split-stack and non-split-stack objects with -r.
12853 * i386.cc (Target_i386::relocate_section): Add
12854 reloc_symbol_changes parameter.
12855 (Target_i386::do_calls_non_split): New function.
12856 * x86_64.cc (Target_x86_64::relocate_section): Add
12857 reloc_symbol_changes parameter.
12858 (Target_x86_64::do_calls_non_split): New function.
12859 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12861 * powerpc.cc (Target_powerpc::relocate_section): Add
12862 reloc_symbol_changes parameter.
12863 * sparc.cc (Target_sparc::relocate_section): Add
12864 reloc_symbol_changes parameter.
12865 * configure.ac: Call AM_CONDITIONAL for the default target.
12866 * configure: Rebuild.
12867 * testsuite/Makefile.am (TEST_AS): New variable.
12868 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12869 (check_DATA): Add split_i386 and split_x86_64 files.
12870 (SPLIT_DEFSYMS): Define.
12871 (split_i386_[1234n].o): New targets.
12872 (split_i386_[124]): New targets.
12873 (split_i386_[1234r].stdout): New targets.
12874 (split_x86_64_[1234n].o): New targets.
12875 (split_x86_64_[124]): New targets.
12876 (split_x86_64_[1234r].stdout): New targets.
12877 (MOSTLYCLEANFILES): Add new executables.
12878 * testsuite/split_i386.sh: New file.
12879 * testsuite/split_x86_64.sh: New file.
12880 * testsuite/split_i386_1.s: New file.
12881 * testsuite/split_i386_2.s: New file.
12882 * testsuite/split_i386_3.s: New file.
12883 * testsuite/split_i386_4.s: New file.
12884 * testsuite/split_i386_n.s: New file.
12885 * testsuite/split_x86_64_1.s: New file.
12886 * testsuite/split_x86_64_2.s: New file.
12887 * testsuite/split_x86_64_3.s: New file.
12888 * testsuite/split_x86_64_4.s: New file.
12889 * testsuite/split_x86_64_n.s: New file.
12890 * testsuite/testfile.cc (Target_test): Update relocation_section
12892 * testsuite/Makefile.in: Rebuild.
12894 2009-10-06 Ian Lance Taylor <iant@google.com>
12896 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12897 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12898 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
12899 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12900 the address on ldo_addrs_.
12901 (Target_i386::Relocate::fix_up_ldo): New function.
12903 2009-10-06 Rafael Espindola <espindola@google.com>
12905 * plugin.cc (add_input_library): New.
12906 (Plugin::load): Add add_input_library to tv.
12907 (Plugin_manager::add_input_file): Add the is_lib argument.
12908 (add_input_file): Update call to Plugin_manager::add_input_file.
12909 (add_input_library): New.
12910 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12912 2009-09-30 Doug Kwan <dougkwan@google.com>
12914 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12915 symbol and call Symbol::may_need_copy_reloc to determine if
12916 a copy reloc is needed.
12917 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12918 nocopyreloc is given in command line.
12919 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12920 given in command line.
12921 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12922 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12923 of the removed Target_i386::may_need_copy_reloc.
12924 * options.h (copyreloc): New option with default value false.
12925 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12926 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12927 instead of the removed Target_powerpc::may_need_copy_reloc.
12928 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12929 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12930 instead of the removed Target_sparc::may_need_copy_reloc.
12931 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12932 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12933 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12934 instead of the removed Target_x86_64::may_need_copy_reloc.
12936 2009-09-30 Ian Lance Taylor <iant@google.com>
12938 * object.h (class Object): Remove target_ field, and target,
12939 sized_target, and set_target methods.
12940 (Object::sized_target): Remove.
12941 (class Sized_relobj): Update declarations. Remove sized_target.
12942 * object.cc (Sized_relobj::setup): Remove target parameter.
12943 Change all callers.
12944 (Input_objects::add_object): Don't do anything with the target.
12945 (make_elf_sized_object): Add punconfigured parameter. Change all
12946 callers. Set or test parameter target.
12947 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12948 Change all callers.
12949 * parameters.cc (Parameters::set_target): Change parameter type to
12951 (Parameters::default_target): Remove.
12952 (set_parameters_target): Change parameter type to be non-const.
12953 (parameters_force_valid_target): New function.
12954 (parameters_clear_target): New function.
12955 * parameters.h (class Parameters): Update declarations. Remove
12956 default_target method. Add sized_target and clear_target
12957 methods. Change target_ to be non-const.
12958 (set_parameters_target): Update declaration.
12959 (parameters_force_valid_target): Declare.
12960 (parameters_clear_target): Declare.
12961 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12962 as NULL if we aren't searching.
12963 (Add_symbols::run): Don't check for compatible target.
12964 * fileread.cc (Input_file::open_binary): Call
12965 parameters_force_valid_target.
12966 * gold.cc (queue_middle_tasks): Likewise.
12967 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12968 set_target on object.
12969 * dynobj.h (class Sized_dynobj): Update declarations.
12970 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12971 make_elf_object returns NULL.
12972 (Archive::include_member): Don't check whether object target is
12974 * output.cc (Output_section::add_input_section): Get target from
12976 (Output_section::relax_input_section): Likewise.
12977 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12979 (Sized_relobj::do_scan_relocs): Likewise.
12980 (Sized_relobj::relocate_sections): Likewise.
12981 * resolve.cc (Symbol_table::resolve): Likewise.
12982 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12983 parameter. Change all callers.
12984 (Symbol_table::add_from_object): Get target from parameters.
12985 (Symbol_table::add_from_relobj): Don't check object target.
12986 (Symbol_table::add_from_dynobj): Likewise.
12987 (Symbol_table::define_special_symbol): Get target from
12989 * symtab.h (class Symbol_table): Update declaration.
12990 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12991 parameter. Change all callers. Clear parameter target.
12992 (Binary_test): Test target here.
12993 * testsuite/object_unittest.cc (gold_testsuite): Remove
12994 target_test_pointer parameter. Change all callers.
12995 (Object_test): Test target here.
12997 2009-09-26 Ian Lance Taylor <iant@google.com>
12999 * testsuite/initpri1.c: Don't try to use constructor priorities if
13000 compiling with gcc before 4.3.
13002 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
13004 * testsuite/retain_symbols_file_test.sh (check_present): Change
13005 output file name to retain_symbols_file_test.stdout.
13006 (check_absent): Likewise.
13008 2009-09-18 Craig Silverstein <csilvers@google.com>
13010 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13011 * options.cc: Include <cerrno> and <fstream>.
13012 (General_options::finalize): Parse -retain-symbols-file tag.
13013 * options.h: New flag.
13014 (General_options): New method should_retain_symbol, new
13015 variable symbols_to_retain.
13016 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13017 should_retain_symbol map.
13018 * testsuite/Makefile.am (retain_symbols_file_test): New test.
13019 * testsuite/Makefile.in: Regenerate.
13020 * testsuite/retain_symbols_file_test.sh: New file.
13022 2009-09-18 Nick Clifton <nickc@redhat.com>
13024 * po/es.po: Updated Spanish translation.
13026 2009-09-17 Doug Kwan <dougkwan@google.com>
13028 * debug.h (DEBUG_RELAXATION): New constant.
13029 (DEBUG_ALL): Add DEBUG_RELAXATION.
13030 (debug_string_to_enum): Add relaxation debug option.
13032 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13033 Layout::Relaxation_debug_check::read_sections,
13034 Layout::Relaxation_debug_check::read_sections): New method definitions.
13035 (Layout::Layout): Initialize data members
13036 record_output_section_data_from_scrips_,
13037 script_output_section_data_list_ and relaxation_debug_check_.
13038 (Layout::save_segments, Layout::restore_segments,
13039 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13040 Layout::relaxation_loop_body): New method definitions.
13041 (Layout::finalize): Support relaxation. Move section layout code to
13042 Layout::relaxation_loop_body.
13043 (Layout::set_asection_address_from_script): Move code for orphan
13044 section placement out.
13045 (Layout::place_orphan_sections_in_script): New method definition.
13046 * layout.h (Output_segment_headers, Output_file_header):
13047 New forward class declarations.
13048 (Layout::~Layout): Define.
13049 (Layout::new_output_section_data_from_script): New method definition.
13050 (Layout::place_orphan_sections_in_script): New method declaration.
13051 (Layout::Segment_states): New type declaration.
13052 (Layout::save_segments, Layout::restore_segments,
13053 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13054 Layout::relaxation_loop_body): New method declarations.
13055 (Layout::Output_section_data_list): New type declaration.
13056 (Layout::Relaxation_debug_check): New class definition.
13057 (Layout::record_output_section_data_from_script_,
13058 Layout::script_output_section_data_list_, Layout::segment_states_,
13059 Layout::relaxation_debug_check_): New data members.
13060 * output.cc: (Output_section_headers::do_size): New method definition.
13061 (Output_section_headers::Output_section_headers): Move size
13062 computation to Output_section_headers::do_size.
13063 (Output_segment_headers::do_size): New method definition.
13064 (Output_file_header::Output_file_header): Move size computation to
13065 Output_file_header::do_size and call it.
13066 (Output_file_header::do_size): New method definition.
13067 (Output_data_group::Output_data_group): Adjust call to
13068 Output_section_data.
13069 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13070 (Output_symtab_xindex::do_write): Add array bound check.
13071 (Output_section::Input_section::print_to_mapfile): Handle
13072 RELAXED_INPUT_SECTION_CODE.
13073 (Output_section::Output_section): Initialize data member checkpoint_.
13074 (Output_section::~Output_section): Delete checkpoint object pointed
13076 (Output_section::add_input_section): Always add an Input_section if
13078 (Output_section::add_merge_input_section): Add assert.
13079 (Output_section::relax_input_section): New method definition.
13080 (Output_section::set_final_data_size): Set load address to zero for
13081 an unallocated section.
13082 (Output_section::do_address_and_file_offset_have_reset_values):
13083 New method definition.
13084 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13085 Handle relaxed input section.
13086 (Output_section::sort_attached_input_sections): Checkpoint input
13087 section list lazily.
13088 (Output_section::get_input_sections): Change type of input_sections to
13089 list of Simple_input_section pointers. Checkpoint input section list
13090 lazily. Also handle relaxed input sections.
13091 (Output_section::add_input_section_for_script): Take a reference to
13092 a Simple_input_section object instead of Relobj pointer and section
13093 index as parameter. Handle relaxed input sections.
13094 (Output_section::save_states, Output_section::restore_states): New
13095 method definitions.
13096 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13097 (Output_data::is_data_size_fixed): New method definition.
13098 (Output_data::reset_addresss_and_file_offset): Do not reset data size
13100 (Output_data::address_and_file_offset_have_reset_values): New method
13102 (Output_data::do_address_and_file_offset_have_reset_values): New method
13104 (Output_data::set_data_size): Check that data size is not fixed.
13105 (Output_data::fix_data_size): New method definition.
13106 (Output_data::is_data_size_fixed_): New data member.
13107 (Output_section_headers::set_final_data_size): New method definition.
13108 (Output_section_headers::do_size): New method declaration.
13109 (Output_segment_headers::set_final_data_size): New method definition.
13110 (Output_segment_headers::do_size): New method declaration.
13111 (Output_file_header::set_final_data_size)::New method definition.
13112 (Output_file_header::do_size)::New method declaration.
13113 (Output_section_data::Output_section_data): Add new parameter
13114 is_data_size_fixed and use it to fix data size.
13115 (Output_data_const::Output_data_const): Adjust call to base class
13116 constructor and fix data size.
13117 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13118 base class constructor and fix data size.
13119 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13120 base class constructor and fix data size.
13121 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13122 class constructor and fix data size.
13123 (Output_data_group::set_final_data_size): New method definition.
13124 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13125 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13126 class constructor and fix data size.
13127 (Output_relaxed_input_section): New class definition.
13128 (Output_section::Simple_input_section): New class definition.
13129 (Output_section::get_input_sections): Adjust parameter list.
13130 (Output_section::add_input_section_for_script): Same.
13131 (Output_section::save_states, Output_section::restore_states,
13132 Output_section::do_address_and_file_offset_have_reset_values,
13133 (Output_section::Input_section::Input_section): Handle
13134 RELAXED_INPUT_SECTION_CODE. Add new overload for
13135 Output_relaxed_input_section.
13136 (Output_section::Input_section::is_input_section,
13137 Output_section::Input_section::set_output_section): Handle relaxed
13139 (Output_section::Input_section::is_relaxed_input_section,
13140 Output_section::Input_section::output_section_data,
13141 Output_section::Input_section::relaxed_input_section): New method
13143 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13145 (Output_section::Input_section::u1_): Update comments.
13146 (Output_section::Input_section::u2_): Add new union member poris.
13147 (Output_section::Checkpoint_output_section): New classs definition.
13148 (Output_section::relax_input_section): New method declaration.
13149 (Output_section::checkpoint_): New data member.
13150 (Output_segment): Update comments.
13151 (Output_segment::Output_segment): Un-privatize copy constructor.
13152 (Output_segment::operator=): Un-privatize.
13153 * script-sections.cc (Output_section_element::Input_section_list):
13154 Change element type to Output_section::Simple_input_section.
13155 (Output_section_element_dot_assignment::set_section_addresses):
13156 Register output section data for relaxation clean up.
13157 (Output_data_exression::Output_data_expression): Adjust call to base
13158 constructor to fix data size.
13159 (Output_section_element_data::set_section_addresses): Register
13160 Output_data_expression object for relaxation clean up.
13161 (struct Input_section_info): Replace Relobj pointer and section index
13162 pair with Output_section::Simple_input_section and Convert struct to a
13164 (Input_section_sorter::operator()): Adjust access to
13165 Input_section_info data member to use accessors.
13166 (Output_section_element_input::set_section_addresses): Use layout
13167 parameter. Adjust code to use Output_section::Simple_input_section
13168 and Input_secction_info classes. Register filler for relaxation
13170 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13171 and section index pair with Output_section::Simple_input_section
13172 class. Adjust code accordingly.
13173 (Phdrs_element::release_segment): New method definition.
13174 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13176 (Script_sections::release_segments): New method definition.
13177 * gold/script-sections.h (Script_sections::release_segments): New
13178 method declaration.
13179 * gold/target.h (Target::may_relax, Target::relax,
13180 Target::do_may_relax, Target::do_relax): New method definitions.
13182 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13184 * arm.cc (has_signed_unsigned_overflow): New function.
13185 (Arm_relocate_functions::abs8): New function.
13186 (Target_arm::Scan::local): Handle R_ARM_ABS8.
13187 (Target_arm::Scan::global): Likewise.
13188 (Target_arm::relocate::relocate): Likewise.
13189 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13192 2009-09-16 Cary Coutant <ccoutant@google.com>
13194 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13195 * testsuite/Makefile.in: Regenerate.
13197 2009-09-11 Nick Clifton <nickc@redhat.com>
13199 * po/gold.pot: Updated by the Translation project.
13201 2009-09-08 Cary Coutant <ccoutant@google.com>
13203 * output.cc (Output_file::open): Add execute permission to empty file.
13204 * testsuite/Makefile.am (permission_test): New test.
13205 * testsuite/Makefile.in: Regenerate.
13207 2009-09-02 Ian Lance Taylor <iant@google.com>
13209 * output.cc (Output_file::resize): Call map_no_anonymous rather
13212 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
13214 * gold.cc: Include "incremental.h".
13215 (queue_initial_tasks): Call Incremental_checker methods.
13216 * incremental.cc: Include "output.h".
13217 (Incremental_checker::can_incrementally_link_output_file): New
13219 * incremental.h (Incremental_checker): New class.
13221 * output.cc (Output_file::open_for_modification): New method.
13222 (Output_file::map_anonymous): Changed return type to bool. Record
13223 map in base_ field.
13224 (Output_file::map_no_anonymous): New method, broken out of map.
13225 (Output_file::map): Use map_no_anonymous and map_anonymous.
13226 * output.h (class Output_file): Update declarations.
13228 2009-08-24 Cary Coutant <ccoutant@google.com>
13230 * options.h (Command_line::Pre_options): New class.
13231 (Command_line::pre_options): New member.
13232 * options.cc (gold::options::ready_to_register): New variable.
13233 (One_option::register_option): Do nothing if not registering options.
13234 Assert if same short option registered twice.
13235 (General_options::General_options): Turn off option registration when
13237 (Command_line::Pre_options::Pre_options): New constructor.
13239 2009-08-24 Cary Coutant <ccoutant@google.com>
13241 * options.h (General_options::no_keep_memory): Remove incorrect
13244 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13246 * Makefile.am (am__skiplex, am__skipyacc): New.
13247 * Makefile.in: Regenerate.
13249 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13251 * Makefile.am (AM_CPPFLAGS): Renamed from ...
13252 (INCLUDES): ... this.
13253 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13254 (AM_CPPFLAGS): Renamed from ...
13255 (INCLUDE): ... this.
13256 * Makefile.in, testsuite/Makefile.in: Regenerate.
13258 * Makefile.in: Regenerate.
13259 * aclocal.m4: Likewise.
13260 * config.in: Likewise.
13261 * configure: Likewise.
13262 * testsuite/Makefile.in: Likewise.
13264 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13265 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13266 * Makefile.in: Regenerate.
13267 * testsuite/Makefile.in: Regenerate.
13269 2009-08-19 Cary Coutant <ccoutant@google.com>
13271 * resolve.cc (Symbol_table::resolve): Don't complain about defined
13272 symbols in shared libraries overridden by hidden or internal symbols
13273 in the main program.
13275 2009-08-19 Chris Demetriou <cgd@google.com>
13277 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13278 checking source file names in error messages.
13280 2009-08-18 Doug Kwan <dougkwan@google.com>
13282 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13283 an elcpp::Ehdr as parameter. Adjust call to set_target.
13284 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13285 an elfcpp::Ehdr as parameter.
13286 * object.cc (Object::set_target): Remove the version that looks up
13287 a target and sets it.
13288 (Sized_relobj::setup): Take a Target object instead of
13289 an elfcpp::Ehdr as parameter. Adjust call to set_target.
13290 (make_elf_sized_object): Find target and ask target to
13291 make an ELF object.
13292 * object.h: (Object::set_target): Remove the version that looks up
13293 a target and sets it.
13294 (Sized_relobj::setup): Take a Target object instead of
13295 an elfcpp:Ehdr as parameter.
13296 * target.cc: Include dynobj.h.
13297 (Target::do_make_elf_object_implementation): New.
13298 (Target::do_make_elf_object): New.
13299 * target.h (Target::make_elf_object): New template declaration.
13300 (Target::do_make_elf_object): New method declarations.
13301 (Target::do_make_elf_object_implementation): New template declaration.
13303 2009-08-14 Ian Lance Taylor <iant@google.com>
13305 * gold.h (FUNCTION_NAME): Define.
13306 (gold_unreachable): Use FUNCTION_NAME.
13308 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13310 * icf.cc (Icf::find_identical_sections): Issue a warning when a
13311 symbol in the --keep-unique list is not found.
13313 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13315 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13316 been maked as --keep-unique.
13317 (Icf::unfold_section): New function.
13318 * icf.h (Icf::unfold_section): New function.
13319 * options.h (General_options::keep_unique): New option.
13320 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13321 * testsuite/Makefile.in: Regenerate.
13322 * testsuite/icf_keep_unique_test.sh: New file.
13323 * testsuite/icf_keep_unique_test.cc: New file.
13325 2009-08-12 Cary Coutant <ccoutant@google.com>
13328 * resolve.cc (Symbol_table::resolve): Check for references from
13329 dynamic objects to hidden and internal symbols.
13330 * testsuite/Makefile.am (hidden_test.sh): New test.
13331 * testsuite/Makefile.in: Regenerate.
13332 * testsuite/hidden_test.sh: New script.
13333 * testsuite/hidden_test_1.c: New test source.
13334 * testsuite/hidden_test_main.c: New test source.
13336 2009-08-11 Doug Kwan <dougkwan@google.com>
13338 * arm.cc: Update comments.
13339 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13340 segment to locate the .ARM.exidx section if present.
13342 2009-08-09 Doug Kwan <dougkwan@google.com>
13344 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13347 2009-08-07 Sriraman Tallam <tmsriram@google.com>
13348 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13351 2009-08-06 Sriraman Tallam <tmsriram@google.com>
13353 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13354 valid tls_segment only for non-debug-section relocations.
13355 * testsuite/Makefile.am: Add gc_tls_test.
13356 * testsuite/Makefile.in: Regenerate.
13357 * testsuite/gc_tls_test.cc: New file.
13358 * testsuite/gc_tls_test.sh: New file.
13360 2009-08-05 Sriraman Tallam <tmsriram@google.com>
13362 * icf.cc: New file.
13364 * Makefile.am (CCFILES): Add icf.cc.
13365 (HFILES): Add icf.h
13366 * Makefile.in: Regenerate.
13367 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13368 * gc.h (gc_process_relocs): Populate lists used by icf to contain
13369 section, symbol and addend information for the relocs.
13370 * gold.cc (queue_middle_tasks): Call identical code folding.
13371 * gold.h: Add defines for multimap.
13372 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13373 to the call of finalize_local_symbols.
13374 * main.cc (main): Create object of class Icf.
13375 * object.cc (Sized_relobj::do_layout): Allow this function to be
13376 called twice during icf.
13377 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13378 to sections marked as identical by icf.
13379 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13381 (Sized_relobj::do_section_entsize): New function.
13382 * object.h (Object::section_entsize): New function.
13383 (Object::do_section_entsize): New pure virtual function.
13384 (Relobj::finalize_local_symbols): Add new parameter.
13385 (Relobj::do_section_entsize): New function.
13386 * options.h (General_options::icf): New option.
13387 (General_options::icf_iterations): New option.
13388 (General_options::print_icf_sections): New option.
13389 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13390 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13391 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13393 * symtab.cc (Symbol_table::is_section_folded): New function.
13394 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
13395 to sections marked as identical by icf.
13396 * symtab.h (Symbol_table::set_icf): New function.
13397 (Symbol_table::icf): New function.
13398 (Symbol_table::is_section_folded): New function.
13399 (Symbol_table::icf_): New data member.
13400 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13401 * testsuite/Makefile.am: Add commands to build icf_test.
13402 * testsuite/Makefile.in: Regenerate.
13403 * testsuite/icf_test.sh: New file.
13404 * testsuite/icf_test.cc: New file.
13406 2009-07-24 Chris Demetriou <cgd@google.com>
13408 * layout.cc (is_compressible_debug_section): Fix incorrect
13409 comment about compressed section names.
13411 2009-07-20 Ian Lance Taylor <ian@airs.com>
13414 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13416 2009-07-16 Ian Lance Taylor <iant@google.com>
13419 * layout.h: #include <map>.
13420 (class Kept_section): Change from struct to class. Add accessors
13421 and setters. Add section size to Comdat_group mapping. Change
13422 Comdat_group to std::map. Add is_comdat_ field. Add
13423 linkonce_size field in union.
13424 (class Layout): Update declaration of find_or_add_kept_section.
13425 Don't declare find_kept_object.
13426 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13427 parameter. Add object, shndx, is_comdat, and is_group_name
13428 parameters. Change all callers. Adjust for new Kept_section.
13429 (Layout::find_kept_object): Remove.
13430 * object.cc (Sized_relobj::include_section_group): Update use of
13431 Kept_section. Rename secnum to shndx. Only record
13432 Kept_comdat_section if sections are the same size.
13433 (Sized_relobj::include_linkonce_section): Update use of
13434 Kept_section. Only record Kept_comdat_section if sections are the
13435 same size. Set size of linkonce section.
13436 (Sized_relobj::map_to_kept_section): Update call to
13437 get_kept_comdat_section.
13438 * object.h (class Sized_relobj): Rename fields in
13439 Kept_comdat_section to drop trailing underscores; change object
13440 field to Relobj*. Change Kept_comdat_section_table to store
13441 struct rather than pointer.
13442 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13443 Add kept_object and kept_shndx parameters. Change all callers.
13444 (Sized_relobj::get_kept_comdat_section): Change return type to
13445 bool. Add kept_object and kept_shndx parameters. Change all
13447 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13448 Layout::find_or_add_kept_section.
13450 2009-07-09 Ian Lance Taylor <iant@google.com>
13452 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13453 Reserve space in the hash table.
13455 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
13457 * fileread.cc (File_read::get_mtime): New method.
13458 * fileread.h (Timespec): New structure.
13459 (File_read::get_mtime): New method.
13460 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13461 Renamed from timestamp_nsec.
13462 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13464 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13466 (Incremental_inputs::report_archive): Save mtime; style fix.
13467 (Incremental_inputs::report_obejct): Save mtime; style fix.
13468 (Incremental_inputs::report_script): Save mtime; style fix.
13469 (Incremental_inputs::finalize_inputs): Style fix.
13470 (Incremental_inputs::finalize): Style fix.
13471 (Incremental_inputs::create_input_section_data): Store inputs
13473 * incremental.h (Incremental_inputs::report_script): Add mtime
13475 (Incremental_inputs::Input_info::Input_info): Intialize only one
13477 (Incremental_inputs::Input_info::archive): Move to nameless
13479 (Incremental_inputs::Input_info::obejct): Move to nameless union.
13480 (Incremental_inputs::Input_info::script): Move to nameless union.
13481 (Incremental_inputs::mtime): New field.
13482 * script.cc (read_input_script): Pass file mtime to
13484 * script.h (Script_info::inputs): Style fix.
13486 2009-07-01 Ian Lance Taylor <ian@airs.com>
13488 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13491 2009-06-24 Ian Lance Taylor <iant@google.com>
13494 * layout.cc (Layout::choose_output_section): If we find an
13495 existing section, update the flags.
13496 (Layout::create_notes): New function, broken out of
13498 (Layout::finalize): Don't create note sections.
13499 (Layout::create_note): Don't crash if linker script discards
13501 (Layout::create_gold_note): Likewise.
13502 (Layout::create_build_id): Likewise. Don't set
13503 after_input_sections on the section.
13504 (Layout::create_executable_stack_info): Remove target parameter.
13506 * layout.h (class Layout): Declare create_notes. Update
13507 declaration of create_executable_stack_info.
13508 * gold.cc (queue_middle_tasks): Call create_notes.
13509 * output.cc (Output_section::update_flags_for_input_section): Move
13510 here from output.h. If SHF_ALLOC flag is newly set, mark address
13512 * output.h (Output_data::mark_address_invalid): New function.
13513 (class Output_section): Only declare, not define,
13514 update_flags_for_input_section. Remove set_flags.
13516 2009-06-24 Ian Lance Taylor <iant@google.com>
13518 * script-sections.cc (Output_section_definition::
13519 set_section_addresses): Rename shadowing local load_address to
13522 2009-06-24 Ian Lance Taylor <iant@google.com>
13525 * reloc.cc (relocate_sections): Skip empty relocation sections.
13527 2009-06-23 Ian Lance Taylor <iant@google.com>
13530 * layout.cc (Layout::create_note): Use choose_output_section
13531 rather than make_output_section.
13533 2009-06-23 Ian Lance Taylor <iant@google.com>
13536 * options.cc (General_options::parse_V): Set printed_version_.
13537 (General_options::General_options): Initialize printed_version_.
13538 * options.h (class General_options): Add printed_version_ field.
13539 * gold.cc (queue_initial_tasks): If there are no input files,
13540 don't give a fatal error if we printed the version information.
13541 (queue_middle_tasks): If using -r with a shared object, give a
13542 fatal error rather than an ordinary error.
13544 2009-06-23 Ian Lance Taylor <iant@google.com>
13547 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13548 (Layout::make_output_section): Set have_stabstr_section_ if we see
13549 a .stab*str section.
13550 (Layout::finalize): Call link_stabs_sections.
13551 (Layout::link_stabs_sections): New file.
13552 * layout.h (class Layout): Add have_stabstr_section_ field.
13553 Declare link_stabs_sections.
13555 2009-06-23 Doug Kwan <dougkwan@google.com>
13557 * Makefile.am (libgold_a_LIBADD): New.
13558 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13559 * Makefile.in: Regenerate.
13560 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13561 * configure: Regenerate.
13562 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13563 * fileread.cc: Include sys/state.h
13564 * gold.h: Declare memmem and strndup if found missing.
13565 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13567 2009-06-23 Ian Lance Taylor <iant@google.com>
13569 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13570 * configure: Rebuild.
13572 2009-06-23 Ian Lance Taylor <iant@google.com>
13575 * object.cc (Object::section_contents): Don't try to get a view if
13576 the section has length zero.
13577 (Object::handle_gnu_warning_section): If the section is empty, use
13578 the name of the section as the warning.
13580 2009-06-23 Ian Lance Taylor <iant@google.com>
13583 * stringpool.h (class Stringpool_template): Add optimize_ field.
13584 (Stringpool_template::set_optimize): New function.
13585 * stringpool.cc (Stringpool_template::Stringpool_template):
13586 Initialize optimize_ field.
13587 (Stringpool_template::set_string_offsets): Test local optimize
13588 fild rather than parameter.
13589 * layout.cc (Layout::Layout): Call set_optimize on the section
13592 2009-06-22 Ian Lance Taylor <iant@google.com>
13595 * yyscript.y: Parse TARGET.
13596 * script.cc (script_set_target): New function.
13597 * script-c.h (script_set_target): Declare.
13598 * options.cc (General_options::string_to_object_format): Rename
13599 from string_to_object_format in anonymous namespace. Change
13601 * options.h (class General_options): Declare
13602 string_to_object_format.
13604 2009-06-22 Ian Lance Taylor <iant@google.com>
13606 * script-sections.cc (Script_sections::create_segments): Don't put
13607 program headers in a PT_LOAD segment if -n or -N.
13609 2009-06-22 Ian Lance Taylor <iant@google.com>
13612 * options.h (class General_options): Add -z lazy and -z now. Sort
13613 -z options into alphabetical order.
13614 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13616 2009-06-21 Ian Lance Taylor <iant@google.com>
13618 * layout.cc (Layout::make_output_section): Call
13619 Target::new_output_section.
13620 (Layout::attach_allocated_section_to_segment): Put large section
13621 sections in a separate load segment with the large segment flag
13623 (Layout::segment_precedes): Sort large data segments after other
13625 (align_file_offset): New static function.
13626 (Layout::set_segment_offsets): Use align_file_offset.
13627 * output.h (class Output_section): Add is_small_section_ and
13628 is_large_section_ fields.
13629 (Output_section::is_small_section): New function.
13630 (Output_section::set_is_small_section): New function.
13631 (Output_section::is_large_section): New function.
13632 (Output_section::set_is_large_section): New function.
13633 (Output_section::is_large_data_section): New function.
13634 (class Output_segment): Add is_large_data_segment_ field.
13635 (Output_segment::is_large_data_segment): New function.
13636 (Output_segment::set_is_large_data_segment): New function.
13637 * output.cc (Output_section::Output_section): Initialize new
13639 (Output_segment::Output_segment): Likewise.
13640 (Output_segment::add_output_section): Add assertion that large
13641 data sections always go in large data segments. Force small data
13642 sections to the end of the list of data sections. Force small BSS
13643 sections to the start of the list of BSS sections. For large BSS
13644 sections to the end of the list of BSS sections.
13645 * symtab.h (class Symbol): Declare is_common_shndx.
13646 (Symbol::is_defined): Check Symbol::is_common_shndx.
13647 (Symbol::is_common): Likewise.
13648 (class Symbol_table): Define enum Commons_section_type. Update
13649 declarations. Add small_commons_ and large_commons_ fields.
13650 * symtab.cc (Symbol::is_common_shndx): New function.
13651 (Symbol_table::Symbol_table): Initialize new fields.
13652 (Symbol_table::add_from_object): Put small and large common
13653 symbols in the right list.
13654 (Symbol_table::sized_finalized_symbol): Check
13655 Symbol::is_common_shndx.
13656 (Symbol_table::sized_write_globals): Likewise.
13657 * common.cc (Symbol_table::do_allocate_commons): Allocate new
13658 common symbol lists. Don't call do_allocate_commons_list if the
13660 (Symbol_table::do_allocate_commons_list): Remove is_tls
13661 parameter. Add comons_section_type parameter. Change all
13662 callers. Handle small and large common symbols.
13663 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13664 Symbol::is_common_shndx.
13665 * resolve.cc (symbol_to_bits): Likewise.
13666 * target.h (Target::small_common_shndx): New function.
13667 (Target::small_common_section_flags): New function.
13668 (Target::large_common_shndx): New function.
13669 (Target::large_common_section_flags): New function.
13670 (Target::new_output_section): New function.
13671 (Target::Target_info): Add small_common_shndx, large_common_shndx,
13672 small_common_section_flags, and large_common_section_flags
13674 (Target::do_new_output_section): New virtual function.
13675 * arm.cc (Target_arm::arm_info): Initialize new fields.
13676 * i386.cc (Target_i386::i386_info): Likewise.
13677 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13679 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13680 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13681 (Target_x86_64::do_new_output_section): New function.
13682 * configure.ac: Define conditional MCMODEL_MEDIUM.
13683 * testsuite/Makefile.am (check_PROGRAMS): Add large.
13684 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13685 (large_LDFLAGS): Define.
13686 * testsuite/large.c: New file.
13687 * testsuite/testfile.cc (Target_test::test_target_info):
13688 Initialize new fields.
13689 * configure, testsuite/Makefile.in: Rebuild.
13691 2009-06-05 Doug Kwan <dougkwan@google.com>
13693 * Makefile.am (CCFILES): Add target.cc.
13694 * Makefile.in: Regenerate.
13695 * i386.cc (class Target_i386): Define new virtual method to
13696 override do_is_local_label_name in parent.
13697 * object.cc (Sized_relobj::do_count_local_symbols): Discard
13698 local symbols if --discard-locals or -X is given.
13699 * options.h (class General_options): Declare new options
13700 '--discard-locals' and '-X' for discarding locals.
13701 * target.h (class Target): Define new methods is_local_label_name.
13702 Declare new virtual method do_is_local_label_name.
13703 * target.cc: New file.
13704 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13705 (check_SCRIPTS): Add discard_locals_test.sh.
13706 (check_DATA): Add discard_local_tests.syms.
13707 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13708 (discard_local_tests.syms, discard_locals_test.o): New make rules.
13709 * testsuite/Makefile.in: Regenerate.
13710 * testsuite/discard_locals_test.c: New file.
13711 * testsuite/discard_locals_test.sh: Same.
13713 2009-06-05 Doug Kwan <dougkwan@google.com>
13715 * object.cc (Sized_relobj::Sized_relobj): Initialize
13716 discarded_eh_frame_shndx_ to -1U.
13717 (Sized_relobj::do_layout): Record index of a discard .eh_frame
13719 (Sized_relobj::do_count_local_symbols): Skip local symbols in
13720 a discarded .eh_frame section.
13721 (Sized_relobj::do_finalize_local_symbols): Ditto.
13722 * object.h (class Sized_relobj): Declare new member
13723 discarded_eh_frame_shndx_.
13724 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13725 (local_labels_test.o, local_labels_test): New rules.
13726 * testsuite/Makefile.in: Regenerate.
13728 2009-06-04 Doug Kwan <dougkwan@google.com>
13730 * layout.cc (Layout::section_name_mapping): Add mapping for
13731 special ARM sections.
13733 2009-06-03 Doug Kwan <dougkwan@google.com>
13735 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13736 (utils::has_overflow): Same.
13738 2009-06-03 Ian Lance Taylor <iant@google.com>
13740 * layout.cc (Layout::section_name_mapping): New array, replacing
13741 Layout::linkonce_mapping.
13742 (Layout::section_name_mapping_count): New variable, replacing
13743 Layout::linkonce_mapping_count.
13744 (Layout::linkonce_output_name): Remove.
13745 (Layout::output_section_name): Rewrite.
13746 * layout.h (class Layout): Rename Linkonce_mapping to
13747 Section_name_mapping, linkonce_mapping to section_name_mapping,
13748 linkonce_mapping_count to section_name_mapping_count. Don't
13749 declare linkonce_output_name.
13751 2009-06-03 Doug Kwan <dougkwan@google.com>
13753 * gold/arm.cc (namespace utils): New.
13754 (Target_arm::reloc_is_non_pic): Define new method.
13755 (class Arm_relocate_functions): New.
13756 (Target_arm::Relocate::relocate): Handle relocation types used by
13759 2009-06-03 Ian Lance Taylor <iant@google.com>
13761 * arm.cc (Target_arm::scan::global): Use || instead of |.
13763 2009-06-02 Doug Kwan <dougkwan@google.com>
13765 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
13766 issued_non_pic_error_.
13767 (class Target_arm::Scan): Declare new method check_non_pic.
13768 Define new method symbol_needs_plt_entry.
13769 Declare new data member issued_non_pic_error_.
13770 (class Target_arm::Relocate): Declare new method
13771 should_apply_static_reloc.
13772 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13773 (Target_arm::Scan::check_non_pic): Define new method.
13774 (Target_arm::Scan::local): Handle a small subset of reloc types used
13776 (Target_arm::Scan::local): Same.
13777 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13779 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
13781 * incremental.cc (Incremental_inputs::report_command_line): Filter
13782 out --incremental-* options.
13784 2009-05-29 Doug Kwan <dougkwan@google.com>
13786 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13788 (class Target_arm): Update comment.
13789 (Target_arm::Target_arm): Initialize new data members GOT_,
13790 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13791 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13792 and Target_arm::rel_dyn_section.
13793 Declare new_enum Target_arm::Got_type.
13794 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13796 Update commments for member do_dynsym_value.
13797 (Target_arm::got_size, Target_arm::plt_section,
13798 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13799 new methods inside class defintion.
13800 (Target_arm::got_section): Define new method.
13801 (Target_arm::rel_dyn_section): Same.
13802 (Output_data_plt_arm): New template class.
13803 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13804 (Output_data_plt_arm:do_adjust_output_section): Define new method.
13805 (Output_data_plt_arm::add_entry): Same.
13806 (Output_data_plt_arm::first_plt_entry): Define new
13807 static data member for PLT instruction template.
13808 (Output_data_plt_arm::plt_entry): Same.
13809 (Output_data_plt_arm::do_write): Define new method.
13810 (Target_arm::make_plt_entry): Same.
13811 (Target_arm::do_finalize_sections): Same.
13812 (Target_arm::do_dynsym_value): Same.
13814 2009-05-28 Doug Kwan <dougkwan@google.com>
13816 * Makefile.am (TARGETSOURCES): Add arm.cc.
13817 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13818 * Makefile.in: Regenerate.
13819 * arm.cc: New file.
13820 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13822 2009-05-26 Doug Kwan <dougkwan@google.com>
13824 * options.cc (General_options::parse_exclude_libs). Fix a comment.
13825 (General_options::check_excluded_libs): Strip off directories in
13826 archive name before matching like GNU ld does.
13827 * testsuite/Makefile.am (MOSTLYCLEANFILES,
13828 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13829 (exclude_libs_test_LDFLAGS): Add linker option
13830 -Wl,--exclude-libs,libexclude_libs_test_3
13831 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13832 an explicit archive without using -l.
13833 (alt/libexclude_libs_test_3.a): New make rule.
13834 * testsuite/Makefile.in: Regenerate.
13835 * testsuite/exclude_libs_test.c : Declare lib3_default().
13837 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13838 * exclude_libs_test_3.c: New file.
13840 2009-05-26 Nick Clifton <nickc@redhat.com>
13842 * po/id.po: New Indonesian translation.
13843 * po/gold.pot: Updated template file.
13845 2009-05-22 Sriraman Tallam <tmsriram@google.com>
13847 * testsuite/Makefile.am: Add -ffunction-sections to compile
13848 gc_comdat_test files. Add -Wl,--gc-sections to build
13850 * testsuite/Makefile.in: Regenerate.
13851 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13853 2009-05-21 Sriraman Tallam <tmsriram@google.com>
13855 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13856 kept comdat section was garbage collected.
13857 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13858 * testsuite/Makefile.in: Regenerate.
13859 * testsuite/gc_comdat_test.sh: New file.
13860 * testsuite/gc_comdat_test_1.cc: New file.
13861 * testsuite/gc_comdat_test_2.cc: New file.
13863 2009-05-19 Doug Kwan <dougkwan@google.com>
13865 * archive.cc (Archive::Archive): Move constructor from archive.h
13866 to here. Initialize no_export_.
13867 (Archive::get_elf_object_for_member): Set no_export flag of object.
13868 * archive.h (Archive::Archive): Move constructor body to
13870 (Archive::no_export): New method.
13871 (Archive::no_export_): New field.
13872 * object.h (Object::Object): Initialize no_export_ to false.
13873 (Object::no_export, Object::set_no_export): New methods.
13874 (Object::no_export_): New field.
13875 * options.cc (General_options::parse_exclude_libs): New method.
13876 (General_options::check_excluded_libs) Same.
13877 * options.h (exclude_libs): New option.
13878 (General_options::check_excluded_libs): New method declaration.
13879 (General_options::excluded_libs_): New field.
13880 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13881 default or protected visibility if an object has no-export flag set.
13882 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13883 (check_SCRIPTS): Add exclude_libs_test.sh.
13884 (check_DATA): Add exclude_libs_test.syms.
13885 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13886 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13887 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13888 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13889 (exclude_libs_test.syms, libexclude_libs_test_1.a,
13890 libexclude_libs_test_2.a): New rules.
13891 * testsuite/Makefile.in: Regenerate.
13892 * testsuite/exclude_libs_test.c: New file.
13893 * testsuite/exclude_libs_test.sh: Ditto.
13894 * testsuite/exclude_libs_test_1.c: Ditto.
13895 * testsuite/exclude_libs_test_2.c: Ditto.
13897 2009-05-15 Ian Lance Taylor <iant@google.com>
13899 * configure.ac: Check for declarations for cases where libiberty.h
13900 checks HAVE_DECL_xxx.
13901 * configure, config.in: Rebuild.
13903 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
13905 * gold.h (Incremental_argument_list): Remove (invalid) forward
13907 * incremental.cc (Incremental_inputs::report_achive): New method.
13908 (Incremental_inputs::report_object): New method.
13909 (Incremental_inputs::report_script): New method.
13910 (Incremental_inputs::finalize_inputs): New method.
13911 (Incremental_inputs::finalize): Call finalize_inputs().
13912 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13913 Create inputs entries.
13914 * incremental.h (Incremental_input_type): New enum.
13915 (Incremental_inputs::Incremental_input): Initialize new fields.
13916 (Incremental_inputs::report_inputs): New method.
13917 (Incremental_inputs::report_achive): New method.
13918 (Incremental_inputs::report_object): New method.
13919 (Incremental_inputs::report_script): New method.
13920 (Incremental_inputs::finalize_inputs): New method.
13921 (Incremental_inputs::Input_info): New struct.
13922 (Incremental_inputs::Input_info_map): New typedef.
13923 (Incremental_inputs::lock_): New field.
13924 (Incremental_inputs::Inputs_): New field.
13925 (Incremental_inputs::Inputs_map): New field.
13926 * main.cc (main): Call Incremental_input::report_inputs.
13927 * options.h (Input_argument_list): Typedef moved from
13929 (Input_file_group::Files): Remove, use ::Input_argument_list.
13930 (Input_file_group::Input_argument_list): Remove, use
13931 ::Input_argument_list.
13932 * plugin.cc (Plugin_manager::add_input_file): Add error in
13934 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13936 * script.cc (read_input_script): Call
13937 Incremental_input::report_script.
13938 * script.h (Script_info): New class.
13940 2009-04-27 Ian Lance Taylor <iant@google.com>
13942 * x86_64.cc (do_adjust_output_section): Set entsize to
13945 2009-04-23 Elliott Hughes <enh@google.com>
13947 * output.cc (Output_file::close): After short writes, continue
13948 writing from the correct offset in the buffer being written.
13950 2009-04-23 Chris Demetriou <cgd@google.com>
13952 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13953 * configure: Regenerate.
13954 * config.in: Regenerate.
13955 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13956 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13958 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
13960 * incremental.cc (Incremental_inputs_header_data): Renamed from
13961 Incremental_input_header_data.
13962 (Incremental_inputs_header_data::data_size): New field.
13963 (Incremental_inputs_header_data::put_input_file_count): Renamed
13964 from input_file_count.
13965 (Incremental_inputs_header_data::put_command_line_offset): Renamed
13966 from command_line_offset.
13967 (Incremental_inputs_header_data::put_reserved): Renamed from
13969 (Incremental_inputs_entry_data): Renamed from
13970 Incremental_input_entry_data.
13971 (Incremental_inputs_entry_data::data_size): New field.
13972 (Incremental_inputs::report_command_line): New method.
13973 (Incremental_inputs::finalize): New method.
13974 (Incremental_inputs::create_incremental_inputs_data): New method.
13975 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13976 * incremental.h: New file.
13977 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13978 (Layout::finalize): Create incremental inputs section in
13979 incremental builds.
13980 (Layout::create_incremental_info_sections): New method.
13981 * layout.h (Layout::incremental_inputs): New method.
13982 (Layout::create_incremental_info_sections): New method.
13983 (Layout::incremental_inputs_): New field.
13984 * main.cc (main): Notify Incremental_input of the command line.
13986 2009-04-01 Ian Lance Taylor <iant@google.com>
13987 Mikolaj Zalewski <mikolajz@google.com>
13989 * gold.h (reserve_unordered_map): Define, three versions, one for
13990 each version of Unordered_map.
13991 * layout.cc (Layout::Layout): Remove options parameter. Add
13992 number_of_input_files parameter. Don't initialize options_.
13993 Initialize number_of_input_files_ and resized_signatures_. Move
13994 sections_are_attached_.
13995 (Layout::layout_group): Reserve space for group_signatures_.
13996 (Layout::find_or_add_kept_section): Change name parameter to be a
13997 reference. Resize signatures_ map when it gets large enough.
13998 (Layout::layout_eh_frame): Use parameters->options() instead of
14000 (Layout::make_output_section): Likewise.
14001 (Layout::attach_allocated_section_to_segment): Likewise.
14002 (Layout::finalize, Layout::create_executable_stack): Likewise.
14003 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14004 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14005 * layout.h (class Layout): Update declarations. Remove options_
14006 field. Add number_of_input_files_ and resized_signatures_
14007 fields. Move sections_are_attached_ field.
14008 * main.cc (main): Pass number of input files to Layout
14009 constructor. Don't pass options.
14011 2009-03-30 Ian Lance Taylor <iant@google.com>
14013 * ffsll.c (ffsll): Correct implementation.
14015 2009-03-27 Ian Lance Taylor <iant@google.com>
14017 * ffsll.c: New file.
14018 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14019 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14020 * ftruncate.c (ftruncate): Declare before definition.
14021 * mremap.c (mremap): Likewise.
14022 * pread.c (pread): Likewise.
14023 * configure, Makefile.in, config.in: Rebuild.
14025 * mremap.c: New file.
14026 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14027 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14028 (mremap): Declare if HAVE_MREMAP is not defined.
14029 * configure, Makefile.in, config.in: Rebuild.
14031 2009-03-27 Cary Coutant <ccoutant@google.com>
14033 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14034 position independent.
14035 * sparc.cc (Target_sparc::check_non_pic): Likewise.
14036 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14038 2009-03-24 Cary Coutant <ccoutant@google.com>
14040 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14042 (needs_dynamic_reloc): Likewise.
14044 2009-03-24 Ian Lance Taylor <iant@google.com>
14046 * yyscript.y (file_cmd): Recognize EXTERN.
14047 (extern_name_list, extern_name_list_body): New nonterminals.
14048 * script.cc (script_add_extern): Define.
14049 * script-c.h (script_add_extern): Declare.
14051 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
14053 * object.cc (is_elf_object): Define.
14054 * object.h (is_elf_object): Declare.
14055 * archive.cc (Archive::get_elf_object_for_member): Call
14057 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14059 2009-03-24 Elliott Hughes <enh@google.com>
14061 * output.cc (Output_file::map_anonymous): Define.
14062 (Output_file::map): Use map_anonymous. If the regular mmap fails,
14063 try an anonymous one. Report the size if the mmap fails.
14064 * output.h (class Output_file): Declare map_anonymous.
14066 2009-03-24 Ian Lance Taylor <iant@google.com>
14068 * target-select.cc (instantiate_target): Don't acquire the lock if
14069 the instantiated_target_ field has already been set.
14071 2009-03-23 Ian Lance Taylor <iant@google.com>
14073 * gold-threads.h (class Initialize_lock): Define.
14074 * gold-threads.cc (class Initialize_lock_once): Define.
14075 (initialize_lock_control): New static variable.
14076 (initialize_lock_pointer): New static variable.
14077 (initialize_lock_once): New static function.
14078 (Initialize_lock::Initialize_lock): Define.
14079 (Initialize_lock::initialize): Define.
14080 * target-select.h: Include "gold-threads.h".
14081 (class Target_selector): Add lock_ and initialize_lock_ fields.
14082 Don't define instantiate_target, just declare it.
14083 * target-select.cc (Target_selector::Target_selector): Initialize
14085 (Target_selector::instantiate_target): Define.
14086 * descriptors.h: Include "gold-threads.h".
14087 (class Descriptors): Add initialize_lock_ field.
14088 * descriptors.cc (Descriptors::Descriptors): Initialize new
14090 (Descriptors::open): Use initialize_lock_ field
14091 * errors.h (class Errors): Add initialize_lock_ field.
14092 * errors.cc (Errors::Errors): Initialize new field.
14093 (Errors::initialize_lock): Use initialize_lock_ field.
14094 * powerpc.cc (class Target_selector_powerpc): Remove
14095 instantiated_target_ field. In do_recognize call
14096 instantiate_target rather than do_instantiate_target. In
14097 do_instantiate_target just allocate a new target.
14098 * sparc.cc (class Target_selector_sparc): Likewise.
14100 * freebsd.h: New file.
14101 * i386.cc: Include "freebsd.h".
14102 (Target_i386): Derive from Target_freebsd rather than
14104 (Target_selector_i386): Derive from Target_selector_freebsd rather
14105 than Target_selector.
14106 * x86_64.cc: Include "freebsd.h".
14107 (Target_x86_64): Derive from Target_freebsd rather than
14109 (Target_selector_x86_64): Derive from Target_selector_freebsd
14110 rather than Target_selector.
14111 * target.h (class Target): Add adjust_elf_header and
14112 do_adjust_elf_header.
14113 * output.cc (Output_file_header:: do_sized_write): Call target
14114 adjust_elf_header routine.
14115 * configure.tgt: Set targ_osabi.
14116 * configure.ac: Define GOLD_DEFAULT_OSABI.
14117 * parameters.cc (Parameters::default_target): Pass
14118 GOLD_DEFAULT_OSABI to select_target.
14119 * target-select.h (class Target_selector): Make instantiate_target
14120 protected rather than private.
14121 * Makefile.am (HFILES): Add freebsd.h.
14122 * configure, Makefile.in, config.in: Rebuild.
14124 * merge.cc (do_add_input_section): Correct pend value. Change
14125 message about last entry not being null terminated from error to
14128 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
14130 * incremental.cc: New file.
14131 * Makefile.am (CCFILES): Add incremental.cc.
14132 * Makefile.in: Rebuild.
14134 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
14136 * layout.cc (Layout::output_section_name): Preserve names
14137 of '.note.' sections.
14139 2009-03-19 Ian Lance Taylor <iant@google.com>
14141 * descriptors.cc (Descriptors::open): Check that the options are
14142 valid before using them.
14144 2009-03-18 Ian Lance Taylor <iant@google.com>
14146 * script-sections.h: Include <list>.
14147 (class Script_sections): Change Sections_elements from std::vector
14148 to std::list. Typedef public Elements_iterator. Add
14149 orphan_section_placement_, data_segment_align_start_, and
14150 saw_data_segment_align_ fields. Remove data_segment_align_index_
14152 * script-sections.cc (class Orphan_section_placement): New class.
14153 (class Sections_element): Add virtual functions is_relro and
14154 orphan_section_init. Remove virtual function place_orphan_here.
14155 (class Output_section_definition): Add is_relro and
14156 orphan_section_init. Remove place_orphan_here.
14157 (class Orphan_output_section): Likewise.
14158 (Script_sections::Script_sections): Update for field changes.
14159 (Script_sections::data_segment_align): Set saw_data_segment_align_
14160 and data_segment_align_start_, not data_segment_align_index.
14161 (Script_sections::data_segment_relro_end): Check
14162 saw_data_segment_align_. Use data_segment_align_start_ rather
14163 than data_segment_align_index_.
14164 (Script_sections::place_orphan): Rewrite to use
14165 Orphan_section_placement.
14167 2009-03-17 Ian Lance Taylor <iant@google.com>
14169 * archive.cc (Archive::add_symbols): Check for a version attached
14170 to the symbol name in the archive map.
14171 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14172 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14173 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14174 (ver_test_11.a): New target.
14175 * testsuite/Makefile.in: Rebuild.
14177 * configure.ac: Check for chsize and posix_fallocate. Replace
14179 * ftruncate.c: New file, from gnulib.
14180 * output.cc (posix_fallocate): Define dummy version if not
14181 HAVE_POSIX_FALLOCATE.
14182 (Output_file::map): Call posix_fallocate rather than lseek and
14184 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14185 * configure, Makefile.in, config.in: Rebuild.
14187 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
14189 * layout.h (Layout::create_note): Add section_name parameter.
14190 * layout.cc (Layout::create_note): Likewise.
14191 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14193 2009-03-17 Ian Lance Taylor <iant@google.com>
14195 * descriptors.cc: Include "options.h".
14196 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14197 (Descriptors::open): Always use O_CLOEXEC when opening a new
14198 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
14199 then set FD_CLOEXEC.
14201 * sparc.cc (class Target_sparc): Add has_got_section.
14202 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14203 make sure we have a GOT section.
14205 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14206 (Target_sparc::Scan::local): Likewise.
14207 (Target_sparc::Scan::global): Likewise.
14208 (Target_sparc::Relocate::relocate): Likewise.
14209 (Target_sparc::Relocate::relocate_tls): Likewise.
14211 * symtab.cc (Symbol_table::define_default_version): New function,
14212 broken out of add_from_object.
14213 (Symbol_table::add_from_object): Call define_default_version.
14214 (Symbol_table::define_special_symbol): Add resolve_oldsym
14215 parameter. Change all callers. If the version for a symbol comes
14216 from a version script, resolve it with the symbol with the same
14217 name with no version. Also add the symbol without a version if
14219 (do_define_in_output_data): If resolving with oldsym, don't delete
14221 (do_define_in_output_segment): Likewise.
14222 (do_define_as_constant): Likewise.
14223 * symtab.h (class Symbol_table): Update declarations.
14225 2009-03-13 Ian Lance Taylor <iant@google.com>
14227 * readsyms.cc (Read_symbols::incompatible_warning): New function.
14228 (Read_symbols::requeue): New function.
14229 (Read_symbols::do_read_symbols): If make_elf_object fails because
14230 the target type is not configured, and the file was searched for,
14231 issue a warning and retry with the next directory.
14232 (Add_symbols::run): If the file has an incompatible format, and
14233 it was searched for, requeue the Read_symbols task. On error,
14234 release the object.
14235 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
14236 dirindex parameter to constructor. Change all callers. Declare
14237 incompatible_warning and requeue.
14238 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14239 input_argument_ and input_group_ fields. Add them to
14240 constructor. Change all callers.
14241 (class Read_script): Add dirindex_ field. Add it to constructor.
14242 Change all callers.
14243 * archive.cc (Archive::setup): Remove input_objects parameter.
14244 Change all callers.
14245 (Archive::get_file_and_offset): Likewise.
14246 (Archive::read_all_symbols): Likewise.
14247 (Archive::read_symbols): Likewise.
14248 (Archive::get_elf_object_for_member): Remove input_objects
14249 parameter. Add punconfigured parameter. Change all callers.
14250 (Archive::add_symbols): Change return type to bool. Check return
14251 value of include_member.
14252 (Archive::include_all_members): Likewise.
14253 (Archive::include_member): Change return type to bool. Return
14254 false if first included object has incompatible target. Set
14255 included_member_ field.
14256 (Add_archive_symbols::run): If add_symbols returns false, requeue
14258 * archive.h (class Archive): Add included_member_ field.
14259 Initialize it in constructor. Add input_file and searched_for
14260 methods. Update declarations.
14261 (class Add_archive_symbols): Add dirpath_, dirindex_, and
14262 input_argument_ fields. Add them to constructor. Change all
14264 * script.cc: Include "target-select.h".
14265 (class Parser_closure): Add skip_on_incompatible_target_ and
14266 found_incompatible_target_ fields. Add
14267 skip_on_incompatible_target parameter to constructor. Change all
14268 callers. Add methods skip_on_incompatible_target,
14269 clear_skip_on_incompatible_target, found_incompatible_target, and
14270 set_found_incompatible_target.
14271 (read_input_script): Add dirindex parameter. Change all callers.
14272 If parser finds an incompatible target, requeue Read_symbols
14274 (script_set_symbol): Clear skip_on_incompatible_target in
14276 (script_add_assertion, script_parse_option): Likewise.
14277 (script_start_sections, script_add_phdr): Likewise.
14278 (script_check_output_format): New function.
14279 * script.h (read_input_script): Update declaration.
14280 * script-c.h (script_check_output_format): Declare.
14281 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14282 (ignore_cmd): Remove OUTPUT_FORMAT.
14283 * fileread.cc (Input_file::Input_file): Add explicit this.
14284 (Input_file::will_search_for): New function.
14285 (Input_file::open): Add pindex parameter. Change all callers.
14286 * fileread.h (class Input_file): Add input_file_argument method.
14287 Declare will_search_for. Update declarations.
14288 * object.cc (make_elf_object): Add punconfigured parameter.
14289 Change all callers.
14290 * object.h (class Object): Make input_file public. Add
14291 searched_for method.
14292 (make_elf_object): Update declaration.
14293 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
14295 * dirsearch.h (class Dirsearch): Update declaration.
14296 * options.h (class General_options): Add --warn-search-mismatch.
14297 * parameters.cc (Parameters::is_compatible_target): New function.
14298 * parameters.h (class Parameters): Declare is_compatible_target.
14299 * workqueue.cc (Workqueue::add_blocker): New function.
14300 * workqueue.h (class Workqueue): Declare add_blocker.
14302 * fileread.cc (Input_file::open): Remove options parameter.
14303 Change all callers.
14304 (Input_file::open_binary): Likewise.
14305 * script.cc (read_input_script): Likewise.
14306 * readsyms.h (class Read_symbols): Remove options_ field. Remove
14307 options parameter from constructor. Change all callers.
14308 (class Read_script): Likewise.
14309 * fileread.h (class Input_file): Update declarations.
14310 * script.h (read_input_script): Update declaration.
14312 2009-03-10 Nick Clifton <nickc@redhat.com>
14314 * po/es.po: New Spanish translation.
14316 2009-03-06 Cary Coutant <ccoutant@google.com>
14318 * options.cc (parse_short_option): Keep dash_z from registering itself.
14320 2009-03-03 Ian Lance Taylor <iant@google.com>
14323 * target-reloc.h (relocate_section): Pass output_section to
14325 * i386.cc (Target_i386::should_apply_static_reloc): Add
14326 output_section parameter. Change all callers.
14327 (Target_i386::Relocate::relocate): Add output_section parameter.
14328 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14329 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14330 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14331 * testsuite/two_file_shared.sh: New script.
14332 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14333 (check_DATA): Add two_file_shared.dbg.
14334 (two_file_shared.dbg): New target.
14335 * testsuite/Makefile.in: Rebuild.
14337 2009-03-01 Ian Lance Taylor <iant@google.com>
14339 * configure.ac: Check for byteswap.h.
14340 * configure: Rebuild.
14341 * config.in: Rebuild.
14343 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
14345 * layout.cc (Layout::find_or_add_kept_section): New function.
14346 (Layout::add_comdat): Removed.
14347 * layout.h (struct Kept_section): Move out of class Layout.
14348 Remove trailing underscores from field names. Add group_sections
14349 field. Rename group_ field to is_group. Change all uses.
14350 (class Layout): Declare find_or_add_kept_section, not add_comdat.
14351 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14352 comdat_groups_ field.
14353 (Sized_relobj::include_section_group): Use
14354 find_or_add_kept_section and Kept_section::group_sections.
14355 (Sized_relobj::include_linkonce_section): Likewise.
14356 * object.cc (class Sized_relobj): Don't define Comdat_group or
14357 Comdat_group_table. Remove find_comdat_group and
14358 add_comdat_group. Remove comdat_groups_ field.
14359 * plugin.cc (include_comdat_group): Use
14360 Layout::find_or_add_kept_section.
14362 2009-02-28 Ian Lance Taylor <iant@google.com>
14364 * README: --gc-sections and map files are now supported. Document
14365 some build requirements.
14368 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14369 relocatable link set the value of the section symbol to zero.
14370 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14371 relocatable link don't include the section address in the local
14374 2009-02-27 Ian Lance Taylor <iant@google.com>
14377 * options.h (class Search_directory): Add is_system_directory.
14378 (class General_options): Declare is_in_system_directory.
14379 * options.cc (get_relative_sysroot): Make static.
14380 (get_default_sysroot): Make static.
14381 (General_optoins::is_in_system_directory): New function.
14382 * fileread.cc (Input_file::is_in_system_directory): New function.
14383 * fileread.h (class Input_file): Declare is_in_system_directory.
14384 * object.h (class Object): Add is_in_system_directory.
14385 (class Input_objects): Remove system_library_directory_ field.
14386 * object.cc (Input_objects::add_object): Don't set
14387 system_library_directory_.
14388 (input_objects::found_in_system_library_directory): Remove.
14389 * symtab.cc (Symbol_table::write_globals): Remove input_objects
14390 parameter. Change all callers.
14391 (Symbol_table::sized_write_globals): Likewise.
14392 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14393 Call Object::is_in_system_directory.
14394 * symtab.h (class Symbol_table): Update declarations.
14397 * descriptors.h (Open_descriptor): Add is_on_stack field.
14398 * descriptors.cc (Descriptors::open): If the descriptor is on the
14399 top of the stack, remove it. Initialize is_on_stack field.
14400 (Descriptors::release): Only add pod to stack if it is not on the
14402 (Descriptors::close_some_descriptor): Clear stack_next and
14403 is_on_stack fields.
14406 * output.cc (Output_section::find_starting_output_address): Rename
14407 from starting_output_address; add PADDR parameter; change return
14409 * output.h (class Output_section): Declare
14410 find_starting_output_address instead of starting_output_address.
14411 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14412 section symbol for which we can't find a merge section.
14415 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14416 hidden or internal, force the symbol to be local.
14417 * resolve.cc (Symbol::override_visibility): Define.
14418 (Symbol::override_base): Use override_visibility.
14419 (Symbol_table::resolve): Likewise.
14420 (Symbol::override_base_with_special): Likewise.
14421 (Symbol_table::override_with_special): If the visibility is hidden
14422 or internal, force the symbol to be local.
14423 * symtab.h (class Symbol): Add set_visibility and
14424 override_visibility.
14425 * testsuite/ver_test_1.sh: New file.
14426 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14427 (check_DATA): Add ver_test_1.syms.
14428 (ver_test_1.syms): New target.
14429 * testsuite/Makefile.in: Rebuild.
14431 2009-02-25 Cary Coutant <ccoutant@google.com>
14433 * layout.cc (Layout::choose_output_section): Don't rename sections
14434 when using a linker script that has a SECTIONS clause.
14435 * Makefile.in: Regenerate.
14437 * testsuite/Makefile.am (script_test_5.sh): New test case.
14438 * testsuite/Makefile.in: Regenerate.
14439 * testsuite/script_test_5.cc: New file.
14440 * testsuite/script_test_5.sh: New file.
14441 * testsuite/script_test_5.t: New file.
14443 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14445 * archive.cc (Archive::include_member): Update calls to add_symbols.
14446 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14447 the Layout argument.
14448 * dynobj.h (do_add_symbols): Add the Layout argument.
14449 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14451 * object.h (Object::add_symbols): Add the Layout argument.
14452 (Object::do_add_symbols): Add the Layout argument.
14453 (Sized_relobj::do_add_symbols): Add the Layout argument.
14454 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14455 Unify the two versions.
14456 (Add_plugin_symbols): Remove.
14457 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14458 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14459 (Add_plugin_symbols): Remove.
14460 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14461 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14462 (Add_symbols::run): Make it work with Pulginobj.
14464 2009-02-06 Ian Lance Taylor <iant@google.com>
14466 * object.cc (Sized_relobj::do_layout): Make info message start
14467 with lower case letter.
14469 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
14471 * binary.cc: Fix file comment.
14473 * options.h (enum Incremental_disposition): Define.
14474 (class General_options): Add new options: --incremental,
14475 --incremental_changed, --incremental_unchanged,
14476 --incremental_unknown. Add incremental_disposition_ and
14477 implicit_incremental_ fields.
14478 (General_options::incremental_disposition): New function.
14479 (class Position_dependent_options): Add incremental_disposition
14481 (Position_dependent_options::copy_from_options): Set incremental
14483 * options.cc (General_options::parse_incremental_changed): New
14485 (General_options::parse_incremental_unchanged): New function.
14486 (General_options::parse_incremental_unknown): New function.
14487 (General_options::General_options): Initialize new fields
14488 incremental_disposition_ and implicit_incremental_.
14489 (General_options::finalize): Check for uasge of --incremental-*
14490 without --incremental.
14492 2009-02-06 Chris Demetriou <cgd@google.com>
14494 * gold.h (gold_undefined_symbol): Change to take only a Symbol
14495 pointer and to report location as the file name associated with
14497 (gold_undefined_symbol_at_location): New function to replace the
14498 old gold_undefined_symbol functionality.
14499 * target-reloc.h (relocate_section): Update to use
14500 gold_undefined_symbol_at_location.
14501 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14502 Call gold_undefined_symbol function rather than gold_error.
14503 * errors.h (Errors::undefined_symbol): Take location as a
14504 string, rather than calculating it from a relocation.
14505 * errors.cc (Errors::fatal): Print "fatal error:" before the
14507 (Errors::error, Errors::error_at_location): Print "error: "
14508 before the formatted message.
14509 (Errors::undefined_symbol): Take location as a string, rather
14510 than calculating it from a relocation.
14511 (gold_undefined_symbol_at_location): New function akin to
14512 old gold_undefined_symbol, calculates location from relocation.
14513 (gold_undefined_symbol): Change to take only a Symbol pointer
14514 and to report location as the file name associated with the symbol.
14515 * testsuite/debug_msg.sh: Update for changed error messages.
14516 * testsuite/undef_symbol.sh: Likewise.
14518 2009-02-04 Duncan Sands <baldrick@free.fr>
14521 * reduced_debug_output.h
14522 (Output_reduced_debug_abbrev_section::failed): Use format for
14524 (Output_reduced_debug_info_section::faild): Likewise.
14526 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
14528 * script.cc (Lazy_demangler): New class.
14529 (Version_script_info::get_symbol_version_helper): Demangle a
14532 2009-01-29 Cary Coutant <ccoutant@google.com>
14534 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14536 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14538 2009-01-28 Ian Lance Taylor <iant@google.com>
14540 * version.cc (version_string): Bump to 1.9.
14542 * gold.h: Include <cstring> and <stdint.h>.
14543 * version.cc: Include <cstdio>.
14544 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14546 * reduced_debug_output.cc (insert_into_vector): Rename from
14547 Insert_into_vector; change all callers. Use Swap_unaligned to
14548 avoid aliasing issue; remove union since it is unnecessary.
14550 2009-01-27 Sriraman Tallam <tmsriram@google.com>
14552 * Makefile.am (CCFILES): Add gc.cc.
14553 (HFILES): Add gc.h.
14554 * Makefile.in: Regenerate.
14555 * gold.cc (Gc_runner): New class.
14556 (queue_initial_tasks): Call garbage collection related tasks
14557 when corresponding options are invoked.
14558 (queue_middle_gc_tasks): New function.
14559 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14560 processed early before laying out sections during garbage collection.
14561 * gold.h (queue_middle_gc_tasks): New function.
14562 (is_prefix_of): Move from "layout.cc".
14563 * i386.cc (Target_i386::gc_process_relocs): New function.
14564 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14565 * main.cc (main): Create object of class "Garbage_collection".
14566 * object.cc (Relobj::copy_symbols_data): New function.
14567 (Relobj::is_section_name_included): New function.
14568 (Sized_relobj::do_layout): Allow this function to be called twice
14569 during garbage collection and defer layout of section during the
14571 * object.h (Relobj::get_symbols_data): New function.
14572 (Relobj::is_section_name_included): New function.
14573 (Relobj::copy_symbols_data): New function.
14574 (Relobj::set_symbols_data): New function.
14575 (Relobj::get_relocs_data): New function.
14576 (Relobj::set_relocs_data): New function.
14577 (Relobj::is_output_section_offset_invalid): New pure virtual function.
14578 (Relobj::gc_process_relocs): New function.
14579 (Relobj::do_gc_process_relocs): New pure virtual function.
14580 (Relobj::sd_): New data member.
14581 (Sized_relobj::is_output_section_offset_invalid): New function.
14582 (Sized_relobj::do_gc_process_relocs): New function.
14583 * options.h (General_options::gc_sections): Modify to not be a no-op.
14584 (General_options::print_gc_sections): New option.
14585 * plugin.cc (Plugin_finish::run): Remove function call to
14586 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
14587 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14588 * reloc.cc (Read_relocs::run): Add task to process relocs and
14589 determine unreferenced sections when doing garbage collection.
14590 (Gc_process_relocs): New class.
14591 (Sized_relobj::do_gc_process_relocs): New function.
14592 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14593 sections that are garbage collected.
14594 * reloc.h (Gc_process_relocs): New class.
14595 * sparc.cc (Target_sparc::gc_process_relocs): New function.
14596 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14597 symbols whose corresponding sections are garbage collected.
14598 (Symbol_table::Symbol_table): Add new parameter for the garbage
14600 (Symbol_table::gc_mark_undef_symbols): New function.
14601 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14602 (Symbol_table::gc_mark_dyn_syms): New function.
14603 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14605 (Symbol_table::add_from_object): Likewise.
14606 (Symbol_table::add_from_relobj): When building shared objects, do not
14607 treat externally visible symbols as garbage.
14608 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14609 table information for static and relocatable links.
14610 * symtab.h (Symbol_table::set_gc): New function.
14611 (Symbol_table::gc): New function.
14612 (Symbol_table::gc_mark_undef_symbols): New function.
14613 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14614 (Symbol_table::gc_mark_dyn_syms): New function.
14615 (Symbol_table::gc_): New data member.
14616 * target.h (Sized_target::gc_process_relocs): New pure virtual
14618 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14619 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14621 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
14623 * options.h (General_options::gc_sections): Define as a no-op for now.
14624 (General_options::no_keep_memory): Ditto.
14625 (General_options::Bshareable): Define.
14626 * options.cc (General_options::finalize): Honor -Bshareable.
14628 2009-01-20 Andreas Schwab <schwab@suse.de>
14630 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14631 read the value in the contents, since we don't use it. Use the
14632 template endianness when writing.
14633 (Relocate::relocate): Use it for R_PPC_REL16_HA.
14635 2009-01-19 Andreas Schwab <schwab@suse.de>
14637 * configure.tgt (powerpc64-*): Fix targ_obj.
14639 2009-01-15 Ian Lance Taylor <iant@google.com>
14641 * object.cc (Sized_relobj::write_local_symbols): Don't write out
14642 local symbols when stripping all symbols.
14644 2009-01-14 Cary Coutant <ccoutant@google.com>
14646 * output.cc (Output_reloc): Add explicit instantiations.
14648 2009-01-14 Cary Coutant <ccoutant@google.com>
14650 * archive.cc (Archive::get_elf_object_for_member): Remove call
14651 to File_read::claim_for_plugin.
14652 * descriptors.cc (Descriptors::open): Remove reference to
14654 (Descriptors::claim_for_plugin): Remove.
14655 * descriptors.h (Descriptors::claim_for_plugin): Remove.
14656 (Descriptors::is_claimed): Remove.
14657 (claim_descriptor_for_plugin): Remove.
14658 * fileread.cc (File_read::claim_for_plugin): Remove.
14659 * fileread.h (File_read::claim_for_plugin): Remove.
14660 (File_read::descriptor): Reopen descriptor if necessary.
14661 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
14662 (Plugin_manager::all_symbols_read): Add task parameter. Change
14664 (Plugin_manager::get_input_file): New function.
14665 (Plugin_manager::release_input_file): New function.
14666 (Pluginobj::Pluginobj): Add filesize parameter and initialize
14667 corresponding data member.
14668 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14669 and pass to base constructor. Change all callers.
14670 (get_input_file, release_input_file): New functions.
14671 (make_sized_plugin_object): Add filesize parameter. Change all callers.
14672 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14673 (Plugin_manager::all_symbols_read): Add task parameter.
14674 (Plugin_manager::get_input_file): New function.
14675 (Plugin_manager::release_input_file): New function.
14676 (Plugin_manager::task_): New data member.
14677 (Pluginobj::Pluginobj): Add filesize parameter.
14678 (Pluginobj::filename): New function.
14679 (Pluginobj::descriptor): New function.
14680 (Pluginobj::filesize): New function.
14681 (Pluginobj::filesize_): New data member.
14682 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14683 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14684 File_read::claim_for_plugin; use Object::unlock to unlock the file.
14686 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14687 with archive libraries.
14688 * testsuite/Makefile.in: Regenerate.
14689 * testsuite/plugin_test.c (struct sym_info): New type.
14690 (get_input_file, release_input_file): New static variables.
14691 (onload): Capture new transfer vector entries.
14692 (claim_file_hook): Stop reading at end of file according to filesize.
14693 Factor out parsing of readelf output into separate function.
14694 (all_symbols_read_hook): Exercise get_input_file and release_input_file
14695 APIs and get the source file name from the symbol table. Convert
14696 source file name to corresponding object file name. Print info
14697 message when adding new input files.
14698 (parse_readelf_line): New function.
14699 * testsuite/plugin_test_1.sh: Add checks for new info messages.
14700 * testsuite/plugin_test_2.sh: Likewise.
14701 * testsuite/plugin_test_3.sh: Likewise.
14702 * testsuite/plugin_test_4.sh: New test case.
14704 2009-01-07 Ian Lance Taylor <iant@google.com>
14706 * version.cc (version_string): Bump to 1.8.
14708 2008-12-23 Cary Coutant <ccoutant@google.com>
14710 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14711 * plugin.cc (Plugin_manager::finish): Rename as
14712 layout_deferred_objects. Move cleanup to separate function.
14713 (Plugin_manager::cleanup): New function.
14714 (Plugin_finish::run): Call layout_deferred_objects and cleanup
14716 * plugin.h (Plugin_manager::finish): Rename as
14717 layout_deferred_objects.
14718 (Plugin_manager::cleanup): New function.
14719 (Plugin_manager::cleanup_done): New field.
14721 2008-12-23 Cary Coutant <ccoutant@google.com>
14723 * plugin.cc (is_visible_from_outside): New function.
14724 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14725 so we don't return "IR only" status for exported symbols or -r links.
14727 * testsuite/Makefile.am (plugin_test_3): New test case.
14728 * testsuite/Makefile.in: Regenerate.
14729 * testsuite/plugin_test_3.sh: New file.
14731 2008-12-22 Cary Coutant <ccoutant@google.com>
14733 * object.cc (Sized_relobj::layout_section): New function.
14734 (Sized_relobj::do_layout): Defer layout of input sections until after
14735 plugin has provided replacement files.
14736 (Sized_relobj::do_layout_deferred_sections): New function.
14737 * object.h (Relobj::set_section_offset): Remove virtual keyword.
14738 (Relobj::layout_deferred_sections): New function.
14739 (Relobj::do_layout_deferred_sections): New function.
14740 (Sized_relobj::do_layout_deferred_sections): New function.
14741 (Sized_relobj::layout_section): New function.
14742 (Sized_relobj::Deferred_layout): New structure.
14743 (Sized_relobj::deferred_layout_): New field.
14744 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14745 Change all callers. Layout deferred sections.
14746 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
14748 (Plugin_hook::run): Move code from do_plugin_hook inline.
14749 (Plugin_hook::do_plugin_hook): Remove.
14750 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14751 (Plugin_manager::finish): Renamed, was cleanup.
14752 (Plugin_manager::should_defer_layout): New function.
14753 (Plugin_manager::add_deferred_layout_object): New function.
14754 (Plugin_manager::Deferred_layout_list): New type.
14755 (Plugin_manager::deferred_layout_objects_): New field.
14756 (Plugin_hook::do_plugin_hook): Remove.
14758 2008-12-17 Ian Lance Taylor <iant@google.com>
14760 * options.h (class General_options): Add --no case for
14763 2008-12-16 Cary Coutant <ccoutant@google.com>
14765 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14767 (Plugin_manager::claim_file): Create plugin object even if
14768 plugin did not call the add_symbols callback.
14769 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14770 asking for more symbols than were added.
14771 * testsuite/Makefile.am (plugin_test_1): Add test case with
14773 (empty.syms): New target.
14774 * testsuite/Makefile.in: Regenerate.
14775 * testsuite/plugin_test.c (claim_file_hook): Add new debug
14776 message. Don't call add_symbols if no globals.
14777 (all_symbols_read_hook): Don't provide replacement for empty
14780 2008-12-12 Ian Lance Taylor <iant@google.com>
14782 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14783 r_type == 0 for a local symbol with r_sym == 0.
14784 (scan_relocatable_relocs): Pass r_sym to
14785 local_non_section_strategy.
14786 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14789 * configure.ac: Update test for TLS descriptors: they are
14790 supported as of glibc 2.9.
14791 * configure: Rebuild.
14793 2008-12-11 Ian Lance Taylor <iant@google.com>
14796 * target-reloc.h (Default_scan_relocatable_relocs): For each
14797 function, map r_type == 0 to RELOC_DISCARD.
14799 2008-12-10 Cary Coutant <ccoutant@google.com>
14801 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14802 object to override a kept COMDAT group from a plugin object.
14804 2008-12-09 Ian Lance Taylor <iant@google.com>
14807 * yyscript.y (file_cmd): Handle INPUT.
14809 * testsuite/initpri1.c: Change all declarations to be full
14810 prototypes by adding void, to avoid compiler warnings.
14812 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
14814 * options.cc (General_options::parse_plugin_opt): New.
14815 (General_options::add_plugin): The argument now is just the filename.
14816 (General_options::add_plugin_option): New.
14817 * options.h (plugin_opt): New.
14818 (add_plugin): Change argument name.
14819 (add_plugin_option): New.
14820 * plugin.cc (Plugin::load): Don't parse the plugin option.
14821 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14822 (Plugin::add_option): New.
14823 (Plugin::args_): Change type.
14824 (Plugin::filename_): New.
14825 (Plugin_manager::add_plugin_option): New.
14826 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14827 * testsuite/Makefile.in: Regenerate.
14829 2008-12-05 Cary Coutant <ccoutant@google.com>
14831 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14832 Handle --strip-lto-sections option.
14833 * options.h (strip_lto_sections): New option.
14835 2008-12-01 Cary Coutant <ccoutant@google.com>
14837 * plugin.cc (ld_plugin_message): Change format parameter to const.
14838 Fix mismatch between new[] and delete.
14840 2008-11-14 Cary Coutant <ccoutant@google.com>
14842 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14845 2008-11-05 Craig Silverstein <csilvers@google.com>
14847 * options.cc (General_options::parse_dynamic_list): New function.
14848 * options.h (General_options): New flags dynamic_list,
14849 dynamic_list_data, dynamic_list_cpp_new, and
14850 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
14851 (General_options::in_dynamic_list): New function.
14852 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14853 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14854 (Lex::can_continue_name): Likewise.
14856 (read_script_file): New parameter script_options.
14857 (read_dynamic_list): New function.
14858 (Script_options::define_dynamic_list): New function.
14859 (dynamic_list_keyword_parsecodes): New variable.
14860 (dynamic_list_keywords): New variable.
14861 * script.h (Script_options::define_dynamic_list): New function
14863 (read_dynamic_list): New function prototype.
14864 * symtab.cc (strprefix): New macro.
14865 (Symbol::should_add_dynsym_entry): Support dynamic_list,
14866 dynamic_list_data, dynamic_list_cpp_new, and
14867 dynamic_list_cpp_typeinfo.
14868 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14869 (dynamic_list_expr): New rule.
14870 (dynamic_list_nodes): Likewise.
14871 (dynamic_list_node): Likewise.
14872 * testsuite/Makefile.am (dynamic_list): New test.
14873 * testsuite/Makefile.in: Regenerated.
14874 * testsuite/dynamic_list.t: New file.
14875 * testsuite/dynamic_list.sh: New file.
14877 2008-11-05 Craig Silverstein <csilvers@google.com>
14879 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14880 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14881 (t11_last): Likewise.
14882 * testsuite/ver_test_6.c (main): Likewise.
14884 2008-10-07 Cary Coutant <ccoutant@google.com>
14886 * options.c (General_options::finalize): Add check for -static and
14888 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14891 2008-10-02 Cary Coutant <ccoutant@google.com>
14893 * plugin.cc (make_sized_plugin_object): Fix conditional
14894 compilation to work when not all targets are enabled.
14896 2008-09-29 Cary Coutant <ccoutant@google.com>
14898 * archive.cc (Archive::get_file_and_offset): Use filename instead
14899 of name to get library path.
14900 (Archive::include_member): Unlock external member of a thin archive.
14902 * testsuite/Makefile.am (TEST_AR): New variable.
14903 (thin_archive_test_1): New test.
14904 (thin_archive_test_2): New test.
14905 * testsuite/Makefile.in: Regenerate.
14906 * testsuite/thin_archive_main.cc: New file.
14907 * testsuite/thin_archive_test_1.cc: New file.
14908 * testsuite/thin_archive_test_2.cc: New file.
14909 * testsuite/thin_archive_test_3.cc: New file.
14910 * testsuite/thin_archive_test_4.cc: New file.
14912 2008-09-29 Cary Coutant <ccoutant@google.com>
14914 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14915 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14917 (Sized_relobj::do_finalize_local_symbols): Likewise.
14918 (Sized_relobj::map_to_kept_section): Likewise.
14919 * object.h (Sized_relobj::invalid_address): New constant.
14920 (Sized_relobj::do_output_section_offset): Check for invalid_address
14922 * output.cc (Output_reloc::local_section_offset): Use constant
14923 invalid_address instead of -1U.
14924 (Output_reloc::get_address): Likewise.
14925 (Output_section::output_address): Change -1U to -1ULL.
14926 * output.h (Output_reloc::invalid_address): New constant.
14927 * reloc.cc (Sized_relobj::write_sections): Use constant
14928 invalid_address instead of -1U.
14929 (Sized_relobj::relocate_sections): Likewise.
14930 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14931 values for merge sections.
14932 * target-reloc.h (relocate_for_relocatable): Use constant
14933 invalid_address instead of -1U.
14935 2008-09-19 Cary Coutant <ccoutant@google.com>
14937 Add plugin functionality for link-time optimization (LTO).
14938 * configure.ac (plugins): Add --enable-plugins option.
14939 * configure: Regenerate.
14940 * config.in: Regenerate.
14941 * Makefile.am (LIBDL): New variable.
14942 (CCFILES): Add plugin.cc.
14943 (HFILES): Add plugin.h.
14944 (ldadd_var): Add LIBDL.
14945 * Makefile.in: Regenerate.
14947 * archive.cc: Include "plugin.h".
14948 (Archive::setup): Don't preread archive symbols when using a plugin.
14949 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
14950 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14952 (Archive::include_member): Add symbols from plugin objects.
14953 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14954 * descriptors.cc (Descriptors::open): Check for file descriptors
14955 abandoned by plugins.
14956 (Descriptors::claim_for_plugin): New function.
14957 * descriptors.h (Descriptors::claim_for_plugin): New function.
14958 (Open_descriptor::is_claimed): New field.
14959 (claim_descriptor_for_plugin): New function.
14960 * fileread.cc (File_read::claim_for_plugin): New function.
14961 * fileread.h (File_read::claim_for_plugin): New function.
14962 (File_read::descriptor): New function.
14963 * gold.cc: Include "plugin.h".
14964 (queue_initial_tasks): Add task to call plugin hooks for generating
14966 * main.cc: Include "plugin.h".
14967 (main): Load plugin libraries.
14968 * object.h (Pluginobj): Declare.
14969 (Object::pluginobj): New function.
14970 (Object::do_pluginobj): New function.
14971 (Object::set_target): New function.
14972 * options.cc: Include "plugin.h".
14973 (General_options::parse_plugin): New function.
14974 (General_options::General_options): Initialize plugins_ field.
14975 (General_options::add_plugin): New function.
14976 * options.h (Plugin_manager): Declare.
14977 (General_options): Add --plugin option.
14978 (General_options::has_plugins): New function.
14979 (General_options::plugins): New function.
14980 (General_options::add_plugin): New function.
14981 (General_options::plugins_): New field.
14982 * plugin.cc: New file.
14983 * plugin.h: New file.
14984 * readsyms.cc: Include "plugin.h".
14985 (Read_symbols::do_read_symbols): Check for archive before checking
14986 for ELF file. Call plugin hooks to claim files.
14987 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14988 from a real object file; force override when processing replacement
14990 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14991 (Symbol::init_base_object): Likewise.
14992 (Symbol::init_base_output_data): Likewise.
14993 (Symbol::init_base_output_segment): Likewise.
14994 (Symbol::init_base_constant): Likewise.
14995 (Symbol::init_base_undefined): Likewise.
14996 (Symbol::output_section): Assert that object is not a plugin.
14997 (Symbol_table::add_from_pluginobj): New function.
14998 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15000 (Symbol_table::sized_write_globals): Likewise.
15001 (Symbol_table::add_from_pluginobj): Instantiate template.
15002 * symtab.h (Sized_pluginobj): Declare.
15003 (Symbol::in_real_elf): New function.
15004 (Symbol::set_in_real_elf): New function.
15005 (Symbol::in_real_elf_): New field.
15006 (Symbol_table::add_from_pluginobj): New function.
15008 * testsuite/Makefile.am (AM_CFLAGS): New variable.
15009 (LIBDL): New variable.
15010 (LDADD): Add LIBDL.
15011 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15012 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15013 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15014 (MOSTLYCLEANFILES): Likewise.
15015 * testsuite/Makefile.in: Regenerate.
15016 * testsuite/plugin_test.c: New file.
15017 * testsuite/plugin_test_1.sh: New file.
15018 * testsuite/plugin_test_2.sh: New file.
15020 2008-09-16 Ian Lance Taylor <iant@google.com>
15022 * target-reloc.h (relocate_section): Check whether a symbol is
15023 defined by the ABI before reporting an undefined symbol error.
15024 * target.h (Target::is_defined_by_abi): Make parameter const.
15025 (Target::do_is_defined_by_abi): Likewise.
15026 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15027 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15028 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15029 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15030 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15031 * testsuite/Makefile.in: Rebuild.
15033 * fileread.cc (make_view): Add casts to avoid warning.
15035 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15037 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15038 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15040 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15042 * options.h (General_options::output_is_executable): New.
15043 (General_options::output_is_pie): New.
15044 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15045 for shared libraries.
15046 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15048 2008-09-11 Chris Demetriou <cgd@google.com>
15050 * options.h (origin): New -z option.
15051 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15052 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15055 2008-09-05 Cary Coutant <ccoutant@google.com>
15057 * fileread.cc (File_read::make_view): Add check for attempt to map
15058 beyond end of file.
15060 2008-09-05 Cary Coutant <ccoutant@google.com>
15062 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15063 explicit instantiations.
15065 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
15068 * options.cc (General_options::finalize): Allow undefined symbols
15069 in shlibs if linking -shared.
15072 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15073 symbols as not needing a dynsym entry.
15075 2008-08-20 Craig Silverstein <csilvers@google.com>
15077 * fileread.cc (File_read::open): Do not lock the file unless it
15078 was successfully opened.
15080 2008-08-14 Cary Coutant <ccoutant@google.com>
15082 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15083 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15084 * testsuite/tls_test.cc (struct int128): 128-bit struct
15085 for testing TLS relocs with non-zero addend.
15086 (v12): New TLS variable.
15088 (t_last): Add check for v12.
15089 * testsuite/tls_test.h (t12): New function.
15090 * testsuite/tls_test_main.cc (thread_routine): Call new test.
15092 2008-08-13 Ian Lance Taylor <iant@google.com>
15094 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15095 set tls_segment_ or relro_segment_.
15096 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15098 * output.h (Output_section::clear_is_relro): New function.
15099 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15100 sections specially even when output_data_ is empty.
15101 (Output_segment::maximum_alignment): When first section is relro,
15102 only force alignment for PT_LOAD segments.
15103 * script.cc (script_data_segment_align): New function.
15104 (script_data_segment_relro_end): New function.
15105 * script-c.h (script_data_segment_align): Declare.
15106 (script_data_segment_relro_end): Declare.
15107 * script-sections.h (class Script_sections): Declare
15108 data_segment_align and data_segment_relro_end. Add fields
15109 segment_align_index_ and saw_relro_end_.
15110 * script-sections.cc (class Sections_element): Add set_is_relro
15111 virtual function. Add new bool* parameter to place_orphan_here.
15112 Add get_output_section virtual function.
15113 (class Output_section_definition): Add set_is_relro. Add new
15114 bool* parameter to place_orphan_here. Add get_output_section.
15115 Add is_relro_ field.
15116 (Output_section_definition::Output_section_definition): Initialize
15117 evaluated_address_, evaluated_load_address, evaluated_addralign_,
15118 and is_relro_ fields.
15119 (Output_section_definition::place_orphan_here): Add is_relro
15121 (Output_section_definition::set_section_addresses): Set relro for
15123 (Output_section_definition::alternate_constraint): Likewise.
15124 (class Orphan_output_section): Add new bool* parameter to
15125 place_orphan_here. Add get_output_section.
15126 (Orphan_output_section::place_orphan_here): Add is_relro
15128 (Script_sections::Script_sections): Initialize
15129 data_segment_align_index_ and saw_relro_end_.
15130 (Script_sections::data_segment_align): New function.
15131 (Script_sections::data_segment_relro_end): New function.
15132 (Script_sections::place_orphan): Set or clear is_relro.
15133 (Script_sections::set_section_addresses): Force alignment of first
15135 * yyscript.y (exp): Call script_data_segment_align and
15136 script_data_segment_relro_end.
15137 * testsuite/relro_script_test.t: New file.
15138 * testsuite/relro_test.cc (using_script): Declare.
15139 (t1, t2): Test using_script.
15140 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15141 (relro_script_test_SOURCES): Define.
15142 (relro_script_test_DEPENDENCIES): Define.
15143 (relro_script_test_LDFLAGS): Define.
15144 (relro_script_test_LDADD): Define.
15145 (relro_script_test.so): New target.
15146 * testsuite/Makefile.in: Rebuild.
15148 2008-08-06 Cary Coutant <ccoutant@google.com>
15150 * archive.cc (Archive::total_archives, Archive::total_members)
15151 (Archive::total_members_loaded): New variables.
15152 (Archive::setup): Add parameter. Add option to preread
15154 (Archive::read_armap): Add counter.
15155 (Archive::get_file_and_offset): New function.
15156 (Archive::get_elf_object_for_member): New function.
15157 (Archive::read_all_symbols): New function.
15158 (Archive::read_symbols): New function.
15159 (Archive::add_symbols): Add counters.
15160 (Archive::include_all_members): Use armap to find members if it's
15162 (Archive::include_member): Skip reading symbols if already read.
15163 Factored code into Archive::get_file_and_offset and
15164 Archive::get_elf_object_for_member. Changed call to
15165 Mapfile::report_include_archive_member.
15166 (Archive::print_stats): New function.
15167 * archive.h: Declare Object and Read_symbols_data classes.
15168 (Archive::Archive): Add initializers for new members.
15169 (Archive::setup): Add parameter.
15170 (Archive::print_stats): New function.
15171 (Archive::total_archives, Archive::total_members)
15172 (Archive::total_members_loaded): New variables.
15173 (Archive::get_file_and_offset): New function.
15174 (Archive::get_elf_object_for_member): New function.
15175 (Archive::read_all_symbols): New function.
15176 (Archive::read_symbols): New function.
15177 (Archive::Archive_member): New class.
15178 (Archive::members_): New member.
15179 (Archive::num_members_): New member.
15180 * main.cc: Include archive.h.
15181 (main): Call Archive::print_stats.
15182 * mapfile.cc (Mapfile::report_include_archive_member): Delete
15183 archive parameter; member_name is now the fully-decorated name.
15184 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15185 * options.h: (General_options): Add --preread-archive-symbols option.
15186 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15189 2008-08-04 Ian Lance Taylor <iant@google.com>
15191 * symtab.h (Symbol::use_plt_offset): New function.
15192 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15193 * powerpc.cc (Relocate::relocate): Likewise.
15194 * sparc.cc (Relocate::relocate): Likewise.
15195 * x86_64.cc (Relocate::relocate): Likewise.
15196 * testsuite/weak_plt.sh: New test.
15197 * testsuite/weak_plt_main.cc: New test.
15198 * testsuite/weak_plt_shared.cc: New test.
15199 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15200 (check_PROGRAMS): Add weak_plt.
15201 (check_DATA): Add weak_plt_shared.so.
15202 (weak_plt_main_pic.o, weak_plt): New targets.
15203 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15204 * testsuite/Makefile.in: Rebuild.
15206 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15208 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15209 * testsuite/Makefile.in: Rebuild.
15211 2008-08-04 Alan Modra <amodra@bigpond.net.au>
15213 * Makefile.am (POTFILES.in): Set LC_ALL=C.
15214 * Makefile.in: Regenerate.
15215 * po/POTFILES.in: Regenerate.
15217 2008-07-29 Ian Lance Taylor <iant@google.com>
15219 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15220 symbols before other symbols.
15221 * testsuite/script_test_2.cc (test_addr): Declare.
15222 (test_addr_alias): Declare.
15223 (main): Check that test_addr and test_addr_alias have the right
15225 * testsuite/script_test_2.t: Define test_addr_alias and
15228 2008-07-24 Ian Lance Taylor <iant@google.com>
15231 * descriptors.cc: New file.
15232 * descriptors.h: New file.
15233 * gold-threads.h (class Hold_optional_lock): New class.
15234 * fileread.cc: Include "descriptors.h".
15235 (File_read::~File_read): Release descriptor rather than closing
15237 (File_read::open) [file]: Call open_descriptor rather than open.
15238 Set is_descriptor_opened_.
15239 (File_read::open) [memory]: Assert that descriptor is not open.
15240 (File_read::reopen_descriptor): New function.
15241 (File_read::release): Release descriptor.
15242 (File_read::do_read): Make non-const. Reopen descriptor.
15243 (File_read::read): Make non-const.
15244 (File_read::make_view): Reopen descriptor.
15245 (File_read::do_readv): Likewise.
15246 * fileread.h (class File_read): Add is_descriptor_opened_ field.
15247 Update declarations.
15248 * layout.cc: Include "descriptors.h".
15249 (Layout::create_build_id): Use open_descriptor rather than open.
15250 * output.cc: Include "descriptors.h".
15251 (Output_file::open): Use open_descriptor rather than open.
15252 * archive.cc (Archive::const_iterator): Change Archive to be
15254 (Archive::begin, Archive::end): Make non-const.
15255 (Archive::count_members): Likewise.
15256 * archive.h (class Archive): Update declarations.
15257 * object.h (Object::read): Make non-const.
15258 * Makefile.am (CCFILES): Add descriptors.cc.
15259 (HFILES): Add descriptors.h.
15260 * Makefile.in: Rebuild.
15263 * gold.h: Always include <clocale>. Add Solaris workarounds
15264 following code in binutils/sysdep.h.
15267 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15268 this->eh_frame_hdr_ is NULL before using it.
15270 * dynobj.cc (Versions::Versions): Update comment.
15272 * dynobj.cc (Versions::Versions): If there is an soname, use it as
15273 the base version name.
15275 * stringpool.cc (Stringpool_template::add_with_length): Set key to
15276 array size plus one.
15277 (Stringpool_template::set_string_offsets): Subtract one from key
15278 before using it as an array index.
15279 (Stringpool_template::get_offset_with_length): Likewise.
15280 (Stringpool_template::write_to_buffer): Likewise.
15281 * stringpool.h (Stringpool_template::get_offset_from_key):
15284 2008-07-23 Ian Lance Taylor <iant@google.com>
15287 * object.h (Merged_symbol_value::value): Do our best to handle a
15291 * script.cc (Version_script_info::get_versions): Don't add empty
15292 version tag to return value.
15293 (Version_script_info::get_symbol_version_helper): Change return
15294 type to bool. Add pversion parameter. Change all callers.
15295 (script_register_vers_node): Don't require a non-NULL tag.
15296 * script.h (class Version_script_info): Update declarations.
15297 (Version_script_info::get_symbol_version): Change return type to
15298 bool. Add version parameter. Change all callers.
15299 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15300 handling. Handle an empty version from a version script.
15301 (Symbol_table::define_special_symbol): Likewise.
15302 * testsuite/ver_test_10.script: New file.
15303 * testsuite/ver_test_10.sh: New file.
15304 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15305 (check_DATA): Add ver_test_10.syms.
15306 (ver_test_10.syms, ver_test_10.so): New target.
15307 * testsuite/Makefile.in: Rebuild.
15309 2008-07-23 Simon Baldwin <simonb@google.com>
15311 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15312 to zero for undefined symbols from dynamic libraries.
15314 2008-07-23 Ian Lance Taylor <iant@google.com>
15316 * symtab.cc (Symbol_table::resolve): Remove version parameter.
15317 Change all callers.
15318 * symtab.h (class Symbol_table): Update declaration.
15319 * testsuite/ver_test_9.cc: New file.
15320 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15321 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15322 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15323 (ver_test_9.so, ver_test_9.o): New targets.
15324 * testsuite/Makefile.in: Rebuild.
15326 2008-07-22 Ian Lance Taylor <iant@google.com>
15328 * options.h (class General_options): Define --check-sections.
15329 * layout.cc (Layout::set_segment_offsets): Handle
15332 * options.h (class General_options): Define -n/--nmagic and
15334 * options.cc (General_options::finalize): For -n/--nmagic or
15335 -N/--omagic, set -static.
15336 * layout.cc (Layout::attach_allocated_section_to_segment): If
15337 -N/--omagic, don't put read-only and read-write sections in
15338 different segments.
15339 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15340 finding a read-only segment.
15341 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15342 don't set the minimum segment alignment to the common page size,
15343 and don't set the file offset to the address modulo the page size.
15344 * script-sections.cc (Script_sections::create_segments): If
15345 -n/--omagic, don't put read-only and read-write sections in
15346 different segments.
15348 * cref.cc: New file.
15349 * cref.h: New file.
15350 * options.h (class General_options): Add --print-symbol-counts.
15351 * main.cc (main): Issue defined symbol report if requested.
15352 * archive.cc (Archive::interpret_header): Make into a const member
15354 (Archive::add_symbols): Call Input_objects::archive_start and
15356 (Archive::const_iterator): Define new class.
15357 (Archive::begin, Archive::end): New functions.
15358 (Archive::include_all_members): Rewrite to use iterator.
15359 (Archive::count_members): New function.
15360 * archive.h (class Archive): Update declarations.
15361 (Archive::filename): New function.
15362 * object.cc: Include "cref.h".
15363 (Sized_relobj::Sized_relobj): Initialize defined_count_.
15364 (Sized_relobj::do_get_global_symbol_counts): New function.
15365 (Input_objects::add_object): Add object to cross-referencer.
15366 (Input_objects::archive_start): New function.
15367 (Input_objects::archive_stop): New function.
15368 (Input_objects::print_symbol_counts): New function.
15369 * object.h: Declare Cref and Archive.
15370 (Object::get_global_symbol_counts): New function.
15371 (Object::do_get_global_symbol_counts): New pure virtual function.
15372 (class Sized_relobj): Add defined_count_ field. Update
15374 (class Input_objects): Add cref_ field. Update constructor.
15375 Update declarations.
15376 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15378 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15380 (Sized_dynobj::do_get_global_symbol_counts): New function.
15381 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15382 defined_count_. Update declarations. Define Symbols typedef.
15383 * symtab.cc (Symbol_table::add_from_relobj): Add defined
15384 parameter. Change all callers.
15385 (Symbol_table::add_from_dynobj): Add sympointers and defined
15386 parameters. Change all callers.
15387 * symtab.h (class Symbol_table): Update declarations.
15388 * Makefile.am (CCFILES): Add cref.cc.
15389 (HFILES): Add cref.h.
15390 * Makefile.in: Rebuild.
15392 2008-07-22 Simon Baldwin <simonb@google.com>
15394 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15395 to zero when writing undefined symbols.
15397 2008-07-22 Ian Lance Taylor <iant@google.com>
15399 * output.cc (Output_section::add_input_section): Don't try to
15400 merge empty merge sections.
15402 2008-07-21 Craig Silverstein <csilvers@google.com>
15404 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15405 Include symbol version in error message.
15407 2008-07-20 Chris Demetriou <cgd@google.com>
15409 * configure.ac (gold_cv_c_random_seed): New configured variable.
15410 (RANDOM_SEED_CFLAGS): New substituted variable.
15411 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15412 * configure: Rebuild.
15413 * Makefile.in: Likewise.
15414 * testsuite/Makefile.in: Likewise.
15416 2008-07-18 Ian Lance Taylor <iant@google.com>
15418 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15419 where we see NAME/NULL and NAME/VERSION as separate symbols.
15420 * testsuite/ver_test_main.cc (main): Call t4.
15421 (t4, t4_2a): Define.
15422 * testsuite/ver_test_2.cc (t4_2): Define.
15423 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15424 * testsuite/ver_test_4.cc (t4_2a): Define.
15425 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15426 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15428 2008-07-17 Ian Lance Taylor <iant@google.com>
15430 * dynobj.cc (Versions::add_def): If we give an error about a
15431 missing version, go ahead and create the version anyhow.
15433 2008-07-10 Ian Lance Taylor <iant@google.com>
15435 Handle output sections with more than 0x7fffffff bytes.
15436 * object.h (class Relobj): Change map_to_output_ to
15437 output_sections_, and just keep a section pointer. Change all
15438 uses. Move comdat group support to Sized_relobj.
15439 (Relobj::is_section_specially_mapped): Remove.
15440 (Relobj::output_section): Remove poff parameter. Change all
15442 (Relobj::output_section_offset): New function.
15443 (Relobj::set_section_offset): Rewrite.
15444 (Relobj::map_to_output): Remove.
15445 (Relobj::output_sections): New function.
15446 (Relobj::do_output_section_offset): New pure virtual function.
15447 (Relobj::do_set_section_offset): Likewise.
15448 (class Sized_relobj): Add section_offsets_ field. Add comdat
15449 group support from Relobj. Update declarations.
15450 (Sized_relobj::get_output_section_offset): New function.
15451 (Sized_relobj::do_output_section_offset): New function.
15452 (Sized_relobj::do_set_section_offset): New function.
15453 * object.cc (Relobj::output_section_address): Remove.
15454 (Sized_relobj::Sized_relobj): Initialize new fields.
15455 (Sized_relobj::include_section_group): Cast find_kept_object to
15457 (Sized_relobj::include_linkonce_section): Likewise.
15458 (Sized_relobj::do_layout): Use separate arrays for output section
15460 (Sized_relobj::do_count_local_symbols): Change map_to_output to
15462 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15463 output_sections and section_offsets.
15464 (Sized_relobj::write_local_symbols): Likewise.
15465 (map_to_kept_section): Compute output address directly.
15466 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15467 output_sections and section_offsets.
15468 (Sized_relobj::write_sections): Likewise.
15469 (Sized_relobj::relocate_sections): Likewise.
15470 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15471 * output.h (class Output_reloc): Update declarations. Change
15472 u2_.relobj to Sized_relobj*.
15473 (class Output_data_reloc): Change add functions to use
15475 * output.cc (Output_reloc::Output_reloc): Change relobj to
15477 (Output_reloc::local_section_offset): Change return type to
15478 Elf_Addr. Use get_output_section_offset.
15479 (Output_reloc::get_address): Likewise.
15480 (Output_section::is_input_address_mapped): Don't call
15481 is_section_specially_mapped.
15482 (Output_section::output_offset): Likewise.
15483 (Output_section::output_address): Likewise.
15484 (Output_section::starting_output_address): Likewise.
15485 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15486 parameter to Sized_relobj*.
15487 (Copy_relocs::need_copy_reloc): Likewise.
15488 (Copy_relocs::save): Likewise.
15489 * copy-relocs.h (class Copy_relocs): Update declarations.
15490 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15491 Sized_relobj*. Change relobj_ field to Sized_relobj*.
15492 * target-reloc.h (relocate_for_relocatable): Change
15493 offset_in_output_section type to Elf_Addr. Change code that uses
15495 * layout.cc (Layout::layout): Always set *off.
15496 * mapfile.cc (Mapfile::print_input_section): Use
15497 output_section_offset.
15498 * i386.cc (Target_i386::copy_reloc): Change object parameter to
15500 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15501 * sparc.cc (Target_sparc::copy_reloc): Likewise.
15502 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15504 2008-07-03 Ian Lance Taylor <iant@google.com>
15506 * layout.cc (Layout::include_section): Do not discard unrecognized
15507 SHT_STRTAB sections.
15509 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
15511 * script.cc (Lex::can_continue_name): Make '?' allowable in
15512 version-script names.
15513 * testsuite/version_script.map: Change glob pattern to use '?'
15515 2008-06-30 Manish Singh <yosh@gimp.org>
15518 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15521 2008-06-30 Ian Lance Taylor <iant@google.com>
15525 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15526 versions]: Don't try to read the value in the contents, since we
15527 don't use it. Use the template endianness when writing.
15529 2008-06-25 Cary Coutant <ccoutant@google.com>
15531 * fileread.cc (File_read::make_view): Assert on zero-length view.
15532 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15533 symbol table when there are no symbols to read.
15535 2008-06-23 Craig Silverstein <csilvers@google.com>
15537 * version.cc (version_string): Bump to 1.7
15539 2008-06-18 Craig Silverstein <csilvers@google.com>
15541 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15542 constant 0xFFFF to type Valtype.
15543 (Powerpc_relocate_functions::rel16_ha): Likewise.
15545 2008-06-17 Ian Lance Taylor <iant@google.com>
15547 * output.h (Output_section::Input_section): Initialize p2align_ to
15548 zero for Output_section_data constructors.
15549 (Output_section::Input_section::addralign): If not an input
15550 section, return the alignment of the Output_section_data.
15551 * testsuite/copy_test.cc: New file.
15552 * testsuite/copy_test_1.cc: New file.
15553 * testsuite/copy_test_2.cc: New file.
15554 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15555 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15556 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15557 (copy_test_1_pic.o, copy_test_1.so): New targets.
15558 (copy_test_2_pic.o, copy_test_2.so): New targets.
15559 * testsuite/Makefile.in: Rebuild.
15561 * script-sections.cc (Script_sections::place_orphan): Initialize
15562 local variable exact.
15564 2008-06-13 David Edelsohn <edelsohn@gnu.org>
15566 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15568 2008-06-12 David Edelsohn <edelsohn@gnu.org>
15569 David S. Miller <davem@davemloft.net>
15571 * powerpc.cc: New file.
15572 * Makefile.am (TARGETSOURCES): Add powerpc.cc
15573 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15574 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15575 * Makefile.in: Rebuild.
15577 2008-06-09 Ian Lance Taylor <iant@google.com>
15579 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15581 (throwing, orig_terminate): New static variables.
15582 (terminate_handler): New static function.
15583 (t2): Set terminate handler.
15585 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
15588 * binary.cc (Binary_to_elf::sized_convert): Fix .data
15591 2008-05-30 Cary Coutant <ccoutant@google.com>
15593 * archive.cc (Archive::include_all_members) Correct to step
15594 over symbol table and extended name table in thin archives.
15596 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
15599 * target-reloc.h (relocate_for_relocatable): Fix new_offset
15602 2008-05-28 Caleb Howe <cshowe@google.com>
15604 * reduced_debug_output.cc: New file.
15605 * reduced_debug_output.h: New file.
15606 * options.h (class General_options): Add --strip-debug-non-line.
15607 * options.cc (General_options::finalize): Add strip_debug_non_line
15608 to the strip heirarchy.
15609 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15611 * layout.cc: Include "reduced_debug_output.h".
15612 (Layout::Layout): Initialize new fields.
15613 (line_only_debug_sections): New static array.
15614 (is_lines_only_debug_sections): New static inline function.
15615 (Layout::include_section): Handle --strip-debug-non-line.
15616 (Layout::make_output_section): If --strip-debug-non-line, build
15617 new output sections for .debug_abbrev and .debug_info.
15618 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15619 gold. Warn about possible overflow.
15620 (read_signed_LEB_128): Likewise.
15621 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15622 (read_signed_LEB_128): Declare.
15623 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15624 (HFILES): Add reduced_debug_output.h.
15625 * Makefile.in: Rebuild.
15627 2008-05-21 Ian Lance Taylor <iant@google.com>
15629 * mapfile.cc: New file.
15630 * mapfile.h: New file.
15631 * options.h (class General_options): Add -M/--print-map and -Map.
15632 * options.cc (General_options::finalize): Make -M equivalent to
15634 * main.cc: Include <cstdio> and "mapfile.h".
15635 (main): Open mapfile if requested.
15636 * gold.cc (class Middle_runner): Add mapfile_ field. Update
15637 constructor. Change caller.
15638 (queue_initial_tasks): Add mapfile parameter. Change caller.
15639 (queue_middle_tasks): Likewise.
15640 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15642 * archive.cc: Include "mapfile.h".
15643 (Archive::add_symbols): Add mapfile parameter. Change all
15644 callers. Pass mapfile, symbol, and reason to include_member.
15645 (Archive::include_all_members): Add mapfile parameter. Change all
15647 (Archive::include_member): Add mapfile, sym, and why parameters.
15648 Change all callers. Report inclusion to map file.
15649 * archive.h: Include "fileread.h".
15650 (class Archive): Update declarations.
15651 (Archive::file): New const method.
15652 (class Add_archive_symbols): Add mapfile_ field. Update
15653 constructor. Change all callers.
15654 * readsyms.h (class Read_symbols): Likewise.
15655 (class Finish_group): Likewise.
15656 (class Read_script): Likewise.
15657 * common.cc: Include "mapfile.h".
15658 (Symbol_table::allocate_commons): Add mapfile parameter. Change
15660 (Symbol_table::do_allocate_commons): Likewise.
15661 (Symbol_table::do_allocate_commons_list): Likewise. Report common
15662 symbol allocation to mapfile.
15663 * common.h (class Allocate_commons_task): Add mapfile_ field.
15664 Update constructor. Change all callers.
15665 * symtab.h (class Symbol_table): Update declarations.
15666 * layout.cc: Include "mapfile.h".
15667 (Layout_task_runner::run): Print information to mapfile.
15668 (Layout::create_gold_note): Change Output_data_fixed_space to
15669 Output_data_zero_fill.
15670 (Layout::create_build_id): Likewise.
15671 (Layout::print_to_mapfile): New function.
15672 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
15673 constructor. Change caller.
15674 (class Layout): Declare print_to_mapfile.
15675 * output.cc (Output_section::Input_section::print_to_mapfile): New
15677 (Output_section::add_input_section): If producing a map, always
15678 add to input_sections_ list.
15679 (Output_section::do_print_to_mapfile): New function.
15680 (Output_segment::print_sections_to_mapfile): New function.
15681 (Output_segment::print_section_list_to_mapfile): New function.
15682 * output.h: Include "mapfile.h".
15683 (Output_data::print_to_mapfile): New function.
15684 (Output_data::do_print_to_mapfile): New virtual function.
15685 (Output_segment_headers::do_print_to_mapfile): New function.
15686 (Output_file_header::do_print_to_mapfile): New function.
15687 (Output_data_const::do_print_to_mapfile): New function.
15688 (class Output_data_const_buffer): Add map_name_ field. Update
15689 constructor. Change all callers. Add do_print_to_mapfile
15691 (class Output_data_fixed_space): Likewise.
15692 (class Output_data_space): Likewise.
15693 (class Output_data_zero_fill): New class.
15694 (Output_data_strtab::do_print_to_mapfile): New function.
15695 (Output_data_reloc_base::do_print_to_mapfile): New function.
15696 (Output_relocatable_relocs::do_print_to_mapfile): New function.
15697 (Output_data_group::do_print_to_mapfile): New function.
15698 (Output_data_got::do_print_to_mapfile): New function.
15699 (Output_data_dynamic::do_print_to_mapfile): New function.
15700 (Output_symtab_xindex::do_print_to_mapfile): New function.
15701 (class Output_section): Declare do_print_to_mapflie. Declare
15702 print_to_mapfile in Input_section.
15703 (class Output_segment): Declare new functions.
15704 * object.h (Sized_relobj::symbol_count): New function.
15705 * script-sections.cc
15706 (Output_section_element_dot_assignment::set_section_addresses):
15707 Change Output_data_fixed_space to Output_data_zero_fill.
15708 (Output_data_expression::do_print_to_mapfile): New function.
15709 * script.cc (read_input_script): Add mapfile parameter. Change
15711 * script.h (read_input_script): Update declaration.
15712 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15713 (Eh_frame::do_print_to_mapfile): New function.
15714 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15715 (Output_merge_string::do_print_to_mapfile): New function.
15716 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15718 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15720 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15722 * Makefile.am (CCFILES): Add mapfile.cc.
15723 (HFILES): Add mapfile.h.
15724 * Makefile.in: Rebuild.
15726 2008-05-19 Ian Lance Taylor <iant@google.com>
15728 * options.h (class General_options): Add -z relro.
15729 * layout.cc (Layout::Layout): Initialize relro_segment_.
15730 (Layout::add_output_section_data): Return the output section.
15731 (Layout::make_output_section): Rcognize relro sections and mark
15732 them appropriately.
15733 (Layout::attach_allocated_section_to_segment): Put relro sections
15734 in a PT_GNU_RELRO segment.
15735 (Layout::create_initial_dynamic_sections): Mark the .dynamic
15737 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15739 (Layout::linkonce_mapping): Map d.rel.ro.local to
15740 .data.rel.ro.local.
15741 (Layout::output_section_name): Us .data.rel.ro.local for any
15742 section which begins with that.
15743 * layout.h (class Layout): Update add_output_section_data
15744 declaration. Add relro_segment_ field.
15745 * output.cc (Output_section::Output_section): Initialize is_relro_
15746 and is_relro_local_ fields.
15747 (Output_segment::add_output_section): Group relro sections.
15748 (Output_segment::is_first_section_relro): New function.
15749 (Output_segment::maximum_alignment): If there is a relro section,
15750 align the segment to the common page size.
15751 (Output_segment::set_section_addresses): Track whether we are
15752 looking at relro sections. If the last section is a relro
15753 section, align to the common page size.
15754 (Output_segment::set_section_list_addresses): Add in_relro
15755 parameter. Change all callers. Align to the page size when
15756 moving from relro to non-relro section.
15757 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15759 * output.h (class Output_section): Add is_relro_ and
15760 is_relro_local_ fields.
15761 (Output_section::is_relro): New function.
15762 (Output_section::set_is_relro): New function.
15763 (Output_section::is_relro_local): New function.
15764 (Output_section::set_is_relro_local): New function.
15765 (class Output_segment): Update declarations.
15766 * i386.cc (Target_i386::got_section): Mark .got section as relro.
15767 * sparc.cc (Target_sparc::got_section): Likewise.
15768 * x86_64.cc (Target_x86_64::got_section): Likewise.
15769 * testsuite/relro_test_main.cc: New file.
15770 * testsuite/relro_test.cc: New file.
15771 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15772 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15773 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15774 (relro_test.so, relro_test_pic.o): New targets.
15775 * testsuite/Makefile.in: Rebuild.
15777 2008-05-16 Ian Lance Taylor <iant@google.com>
15779 * output.cc (Output_segment::add_output_section): Remove front
15781 * output.h (class Output_segment): Remove
15782 add_initial_output_section and overloaded add_output_section.
15783 Update declaration of remaining add_output_section.
15784 * layout.cc (Layout::create_interp): Call add_output_section
15785 rather than add_initial_output_section.
15786 (Layout::finish_dynamic_section): Likewise.
15788 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15789 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
15790 know the dynamic type.
15791 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15792 field. Initialize it in constructor.
15793 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15794 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15795 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15798 * output.cc (Output_reloc::get_address): Change return type to
15800 * output.h (class Output_reloc): Update get_address declaration.
15801 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15802 for section addresses.
15804 2008-05-09 Ian Lance Taylor <iant@google.com>
15807 * gold.cc (gold_nomem): Use return value of write.
15809 2008-05-08 Ian Lance Taylor <iant@google.com>
15811 * symtab.c (Symbol::init_base_output_data): Add version
15812 parameter. Change all callers.
15813 (Symbol::init_base_output_segment): Likewise.
15814 (Symbol::init_base_constant): Likewise.
15815 (Symbol::init_base_undefined): Likewise.
15816 (Sized_symbol::init_output_data): Likewise.
15817 (Sized_symbol::init_output_segment): Likewise.
15818 (Sized_symbol::init_constant): Likewise.
15819 (Sized_symbol::init_undefined): Likewise.
15820 (Symbol_table::do_define_in_output_data): If the new symbol has a
15821 version, mark it as the default.
15822 (Symbol_table::do_define_in_output_segment): Likewise.
15823 (Symbol_table::do_define_as_constant): Likewise.
15824 * symtab.h (class Symbol): Update declarations.
15825 (class Sized_symbol): Likewise.
15826 * resolve.cc (Symbol::override_version): New function.
15827 (Symbol::override_base): Call override_version.
15828 (Symbol::override_base_with_special): Likewise.
15829 * testsuite/ver_script_8.script: New file.
15830 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15831 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15832 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15833 (ver_test_8_1.so, ver_test_8_2.so): New targets.
15835 2008-05-06 Ian Lance Taylor <iant@google.com>
15838 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15840 (class General_options): Remove existing --undefined, and add
15841 --no-undefined instead. Add new --undefined as synonym for -u.
15842 * archive.cc (Archive::add_symbols): Check whether symbol was
15844 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15845 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15846 all uses. Add IS_UNDEFINED. Update declarations to split
15847 different versions of init_base. Declare init_base_undefined.
15848 (Symbol::is_defined): Handle IS_UNDEFINED.
15849 (Symbol::is_undefined): Likewise.
15850 (Symbol::is_weak_undefined): Call is_undefined.
15851 (Symbol::is_absolute): Handle IS_CONSTANT.
15852 (class Sized_symbol): Update declarations to split different
15853 versions of init. Declare init_undefined.
15854 (class Symbol_table): Declare new functions.
15855 * symtab.cc (Symbol::init_base_object): Rename from init_base.
15856 Change all callers.
15857 (Symbol::init_base_output_data): Likewise.
15858 (Symbol::init_base_output_segment): Likewise.
15859 (Symbol::init_base_constant): Likewise.
15860 (Symbol::init_base_undefined): New function.
15861 (Sized_symbol::init_object): Rename from init. Change all
15863 (Sized_symbol::init_output_data): Likewise.
15864 (Sized_symbol::init_output_segment): Likewise.
15865 (Sized_symbol::init_constant): Likewise.
15866 (Sized_symbol::init_undefined): New function.
15867 (Symbol_table::add_undefined_symbols_from_command_line): New
15869 (Symbol_table::do_add_undefined_symbols_from_command_line): New
15871 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15872 (Symbol::output_section): Likewise.
15873 (Symbol::set_output_section): Likewise.
15874 (Symbol_table::sized_finalize_symbol): Likewise.
15875 (Symbol_table::sized_write_globals): Likewise.
15876 * resolve.cc (Symbol_table::should_override): Likewise.
15877 (Symbol::override_base_with_special): Likewise.
15879 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15880 symbol, change it to have default visibility.
15881 * testsuite/protected_1.cc: New file.
15882 * testsuite/protected_2.cc: New file.
15883 * testsuite/protected_3.cc: New file.
15884 * testsuite/protected_main_1.cc: New file.
15885 * testsuite/protected_main_2.cc: New file.
15886 * testsuite/protected_main_3.cc: New file.
15887 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15888 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15889 (protected_1_LDFLAGS, protected_1_LDADD): Define.
15890 (protected_1.so): New target.
15891 (protected_1_pic.o, protected_2_pic.o): New targets.
15892 (protected_3_pic.o): New target.
15893 (check_PROGRAMS): Add protected_2.
15894 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15895 (protected_2_LDFLAGS, protected_2_LDADD): Define.
15896 * testsuite/Makefile.in: Rebuild.
15898 * options.h (DEFINE_var): Add set_user_set_##varname__.
15899 (DEFINE_bool_alias): New macro.
15900 (class General_options): Define -Bstatic using DEFINE_bool_alias
15901 rather than DEFINE_special. Add --undefined as an alias for -z
15903 * options.cc (General_options::parse_Bstatic): Remove.
15905 * options.h (class General_options): Add --fatal-warnings.
15906 * main.cc (main): Implement --fatal-warnings.
15907 * errors.h (Errors::warning_count): New function.
15909 * options.h (class General_options): Add -Bsymbolic-functions.
15910 * symtab.h (Symbol::is_preemptible): Check for
15911 -Bsymbolic-functions.
15913 2008-05-05 Ian Lance Taylor <iant@google.com>
15915 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15916 as noVARNAME rather than no-VARNAME.
15917 (class General_options): Add option -z combreloc.
15918 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15920 (Output_reloc::sort_before) [SHT_REL]: New function.
15921 (Output_reloc::sort_before) [SHT_RELA]: New function.
15922 (class Output_data_reloc_base): Add sort_relocs_ field. Define
15923 Sort_relocs_comparison.
15924 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15925 parameter. Change all callers.
15926 (Output_data_reloc::Output_data_reloc) [both versions]: Add
15927 sort_relocs parameter. Change all callers.
15928 * output.cc (Output_reloc::get_address): New function, broken out
15930 (Output_reloc::write_rel): Call it.
15931 (Output_reloc::compare): New function.
15932 (Output_data_reloc_base::do_write): Optionally sort relocs.
15934 * configure.ac: If targ_extra_obj is set, link it in.
15935 * configure.tgt: Initialize all variables.
15936 (x86_64*): Set targ_extra_obj and targ_extra_size.
15937 * configure: Rebuild.
15939 * object.cc (Sized_relobj::include_section_group): Adjust section
15940 indexes read from group data. Build vector to pass to
15942 * layout.cc (Layout::layout_group): Add flags and shndxes
15943 parameters. Remove contents parameter. Change caller. Update
15944 explicit instantiations.
15945 * layout.h (class Layout): Update layout_group declaration.
15946 * output.cc (Output_data_group::Output_data_group): Add flags and
15947 input_shndxes parameters. Remove contents parameter. Change
15949 (Output_data_group::do_write): Change input_sections_ to
15951 * output.h (class Output_data_group): Update constructor
15952 declaration. Rename input_sections_ to input_shndxes_.
15953 * testsuite/many_sections_test.cc: Add template.
15955 2008-04-30 Cary Coutant <ccoutant@google.com>
15957 * target-reloc.h (relocate_section): Fix dead-pointer bug.
15959 * layout.cc (Layout::include_section): Refactored check for debug
15961 (Layout::add_comdat): Add new parameters. Change type
15962 of signature parameter. Add object and shndx to signatures table.
15963 (Layout::find_kept_object): New function.
15964 * layout.h: Include <cstring>.
15965 (Layout::is_debug_info_section): New function.
15966 (Layout::add_comdat): Add new parameters.
15967 (Layout::find_kept_object): New function.
15968 (Layout::Kept_section): New struct.
15969 (Layout::Signatures): Change type of map range.
15970 * object.cc (Relobj::output_section_address): New function.
15971 (Sized_relobj::include_section_group): Add new parameters. Change
15972 calls to Layout::add_comdat. Change to build table of kept comdat
15973 groups and table mapping discarded sections to kept sections.
15974 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15975 (Sized_relobj::do_layout): Change calls to include_section_group and
15976 include_linkonce_section.
15977 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15978 value to zero when section is discarded.
15979 (Sized_relobj::map_to_kept_section): New function.
15980 * object.h (Relobj::output_section_address): New function.
15981 (Relobj::Comdat_group): New type.
15982 (Relobj::find_comdat_group): New function.
15983 (Relobj::Comdat_group_table): New type.
15984 (Relobj::Kept_comdat_section): New type.
15985 (Relobj::Kept_comdat_section_table): New type.
15986 (Relobj::add_comdat_group): New function.
15987 (Relobj::set_kept_comdat_section): New function.
15988 (Relobj::get_kept_comdat_section): New function.
15989 (Relobj::comdat_groups_): New field.
15990 (Relobj::kept_comdat_sections_): New field.
15991 (Symbol_value::input_value): Update comment.
15992 (Sized_relobj::map_to_kept_section) New function.
15993 (Sized_relobj::include_linkonce_section): Add new parameter.
15994 * target-reloc.h (Comdat_behavior): New type.
15995 (get_comdat_behavior): New function.
15996 (relocate_section): Add code to map a discarded section to the
15997 corresponding kept section when applying a relocation.
15999 2008-04-30 Craig Silverstein <csilvers@google.com>
16001 * dwarf_reader.cc (next_generation_count): New static var.
16002 (Addr2line_cache_entry): New struct.
16003 (addr2line_cache): New static var.
16004 (Dwarf_line_info::one_addr2line): Added caching.
16005 (Dwarf_line_info::clear_addr2line_cache): New function.
16006 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16007 cache-size parameter.
16008 (Dwarf_line_info::one_addr2line_cache): New function.
16009 * symtab.cc (Symbol_table::detect_odr_violations): Pass
16010 new cache-size argument to one_addr2line(), and clear cache.
16012 2008-04-28 Cary Coutant <ccoutant@google.com>
16014 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16015 R_386_PC8 relocations.
16017 2008-04-23 Ian Lance Taylor <iant@google.com>
16019 * object.cc (Sized_relobj::include_section_group): Check for
16020 invalid section group.
16022 * object.cc (make_elf_object): Correct test for 64-bit ELF file
16025 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16026 than read for file header.
16027 * archive.cc (Archive::include_member): Likewise.
16029 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
16031 * aclocal.m4: Regenerate.
16032 * configure: Regenerate.
16034 2008-04-19 Ian Lance Taylor <iant@google.com>
16036 * version.cc (version_string): Bump to 1.6.
16038 * testsuite/Makefile.am (many_sections_r_test): New target.
16039 (many_sections_r_test_SOURCES): Remove.
16040 (many_sections_r_test_DEPENDENCIES): Remove.
16041 (many_sections_r_test_LDFLAGS): Remove.
16042 (many_sections_r_test_LDADD): Remove.
16044 * object.cc (Sized_relobj::do_add_symbols): Always pass
16045 local_symbol_count_ to add_from_relobj.
16047 * testsuite/Makefile.am (many_sections_check.h): Only check one in
16048 every thousand variables.
16049 * testsuite/Makefile.in: Rebuild.
16051 * object.cc (Xindex::initialize_symtab_xindex): New function.
16052 (Xindex::read_symtab_xindex): New function.
16053 (Xindex::sym_xindex_to_shndx): New function.
16054 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16056 (Sized_relobj::do_initialize_xindex): New function.
16057 (Sized_relobj::do_read_symbols): Adjust section links.
16058 (Sized_relobj::symbol_section_and_value): Add is_ordinary
16059 parameter. Change all callers.
16060 (Sized_relobj::include_section_group): Adjust section links and
16061 symbol section indexes.
16062 (Sized_relobj::do_layout): Adjust section links.
16063 (Sized_relobj::do_count_local_symbols): Adjust section links and
16064 symbol section indexes.
16065 (Sized_relobj::do_finalize_local_symbols): Distinguish between
16066 ordinary and special symbols.
16067 (Sized_relobj::write_local_symbols): Add symtab_xindex and
16068 dynsym_xindex parameters. Change all callers. Adjust section
16069 links. Use SHN_XINDEX when needed.
16070 (Sized_relobj::get_symbol_location_info): Adjust section links.
16071 Don't get fooled by special symbols.
16072 * object.h (class Xindex): Define.
16073 (class Object): Add xindex_ parameter. Declare virtual functoin
16074 do_initialize_xindex.
16075 (Object::adjust_sym_shndx): New function.
16076 (Object::set_xindex): New protected function.
16077 (class Symbol_value): Add is_ordinary_shndx_ field.
16078 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16079 (Symbol_value::value): Assert ordinary section.
16080 (Symbol_value::initialize_input_to_output_map): Likewise.
16081 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16082 Change all callers.
16083 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
16085 (class Sized_relobj): Update declarations.
16086 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16087 parameter. Change all callers.
16088 (Sized_relobj::adjust_shndx): New function.
16089 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16091 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16092 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
16093 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
16094 (Sized_dynobj::read_dynsym_section): Adjust section links.
16095 (Sized_dynobj::read_dynamic): Likewise.
16096 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
16098 (Sized_dynobj::do_initialize_xindex): New function.
16099 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
16100 do_initialize_xindex.
16101 (Sized_dynobj::adjust_shndx): New function.
16102 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16103 dynsym_xindex_ fields.
16104 (Layout::finalize): Add a call to set_section_indexes before
16105 creating the symtab sections.
16106 (Layout::set_section_indexes): Don't do anything if the section
16107 already has a section index.
16108 (Layout::create_symtab_sections): Add shnum parameter. Change
16109 caller. Create .symtab_shndx section if needed.
16110 (Layout::create_shdrs): Add shstrtab_section parameter. Change
16112 (Layout::allocated_output_section_count): New function.
16113 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16115 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16116 fields. Update declarations.
16117 (Layout::symtab_xindex): New function.
16118 (Layout::dynsym_xindex): New function.
16119 (class Write_symbols_task): Add layout_ field.
16120 (Write_symbols_task::Write_symbols_task): Add layout parameter.
16122 * output.cc (Output_section_headers::Output_section_headers): Add
16123 shstrtab_section parameter. Change all callers.
16124 (Output_section_headers::do_sized_write): Store overflow values
16125 for section count and section string table section index in
16126 section header zero.
16127 (Output_file_header::do_sized_write): Check for overflow of
16128 section count and section string table section index.
16129 (Output_symtab_xindex::do_write): New function.
16130 (Output_symtab_xindex::endian_do_write): New function.
16131 * output.h (class Output_section_headers): Add shstrtab_section_.
16132 Update declarations.
16133 (class Output_symtab_xindex): Define.
16134 (Output_section::has_out_shndx): New function.
16135 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16137 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16138 Change all callers.
16139 (Sized_symbol::init): Likewise.
16140 (Symbol::output_section): Check for ordinary symbol.
16141 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
16142 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
16144 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16145 Change all callers. Simplify handling of symbols from sections
16146 not included in the link.
16147 (Symbol_table::add_from_dynobj): Handle ordinary symbol
16149 (Weak_alias_sorter::operator()): Assert that symbols are
16151 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16153 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16154 parameters. Change all callers.
16155 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
16156 symbol distinction. Use SHN_XINDEX when needed.
16157 (Symbol_table::write_section_symbol): Add symtab_xindex
16158 parameter. Change all callers.
16159 (Symbol_table::sized_write_section_symbol): Likewise. Use
16160 SHN_XINDEX when needed.
16161 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
16163 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
16164 (Symbol::is_defined): Check is_ordinary.
16165 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16166 (Symbol::is_absolute, Symbol::is_common): Likewise.
16167 (class Sized_symbol): Update declarations.
16168 (class Symbol_table): Update declarations.
16169 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16170 parameters. Change all callers.
16171 (Sized_symbol::override): Likewise.
16172 (Symbol_table::override): Likewise.
16173 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
16174 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
16175 is_ordinary, and orig_st_shndx parameters. Change all callers.
16176 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16177 to be in an ordinary section.
16178 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16179 object and is_ordinary parameters. Change all callers.
16180 (Sized_dwarf_line_info::read_relocs): Add object parameter.
16181 Change all callers. Don't add undefined or non-ordinary symbols
16183 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16184 Change all callers.
16185 * dwarf_reader.h (class Sized_dwarf_line_info): Update
16187 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16188 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16189 (Sized_relobj::relocate_sections): Likewise.
16190 * target-reloc.h (scan_relocs): Adjust section symbol index.
16191 (scan_relocatable_relocs): Likewise.
16192 * i386.cc (Scan::local): Check for ordinary symbols.
16193 * sparc.cc (Scan::local): Likewise.
16194 * x86_64.cc (Scan::local): Likewise.
16195 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16196 to symbol_section_and_value.
16197 * testsuite/many_sections_test.cc: New file.
16198 * testsuite/Makefile.am (BUILT_SOURCES): Define.
16199 (check_PROGRAMS): Add many_sections_test.
16200 (many_sections_test_SOURCES): Define.
16201 (many_sections_test_DEPENDENCIES): Define.
16202 (many_sections_test_LDFLAGS): Define.
16203 (BUILT_SOURCES): Add many_sections_define.h.
16204 (many_sections_define.h): New target.
16205 (BUILT_SOURCES): Add many_sections_check.h.
16206 (many_sections_check.h): New target.
16207 (check_PROGRAMS): Add many_sections_r_test.
16208 (many_sections_r_test_SOURCES): Define.
16209 (many_sections_r_test_DEPENDENCIES): Define.
16210 (many_sections_r_test_LDFLAGS): Define.
16211 (many_sections_r_test_LDADD): Define.
16212 (many_sections_r_test.o): New target.
16213 * testsuite/Makefile.in: Rebuild.
16215 2008-04-17 Cary Coutant <ccoutant@google.com>
16217 * errors.cc (Errors::info): New function.
16218 (gold_info): New function.
16219 * errors.h (Errors::info): New function.
16220 * gold.h (gold_info): New function.
16221 * object.cc (Input_objects::add_object): Print trace output.
16222 * options.cc (options::parse_set): New function.
16223 (General_options::parse_wrap): Deleted.
16224 (General_options::General_options): Deleted initializer.
16225 * options.h (options::String_set): New typedef.
16226 (options::parse_set): New function.
16227 (DEFINE_set): New macro.
16228 (General_options::wrap): Changed to use DEFINE_set. Changed
16229 callers of any_wrap_symbols and is_wrap_symbol.
16230 (General_options::trace, General_options::trace_symbol):
16232 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16233 (General_options::wrap_symbols_): Deleted.
16234 * symtab.cc (Symbol_table::add_from_object): Print trace output.
16236 2008-04-17 David S. Miller <davem@davemloft.net>
16238 * options.cc (General_options::parse_V): New function.
16239 * options.h: Add entries for -V and -Qy.
16241 2008-04-17 Ian Lance Taylor <iant@google.com>
16243 * common.cc (Symbol_table::allocate_commons): Remove options
16244 parameter. Change caller.
16245 (Symbol_table::do_allocate_commons): Remove options parameter.
16246 Change caller. Just call do_allocate_commons_list twice.
16247 (Symbol_table::do_allocate_commons_list): New function, broken out
16248 of do_allocate_commons.
16249 * common.h (class Allocate_commons_task): Remove options_ field.
16250 Update constructor.
16251 * symtab.cc (Symbol_table::Symbol_table): Initialize
16253 (Symbol_table::add_from_object): Put TLS common symbols on
16255 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16256 which are IN_OUTPUT_DATA.
16257 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
16258 allocate_commons and do_allocate_commons declarations. Declare
16259 do_allocate_commons_list.
16260 * gold.cc (queue_middle_tasks): Update creation of
16261 Allocate_commons_task to not pass options.
16262 * testsuite/Makefile.am (INCLUDES): Add -I.. .
16263 (TLS_TEST_C_FLAGS): New variable.
16264 (tls_test_c_pic.o): New target.
16265 (tls_test_shared.so): Link in tls_test_c_pic.o.
16266 (tls_test_c_pic_ie.o): New target.
16267 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16268 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16269 (tls_test_c.o): New target.
16270 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16271 (tls_pic_test_LDADD): Likewise.
16272 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16273 (tls_shared_gd_to_ie_test_LDADD): Likewise.
16274 (tls_test_c_gnu2.o): New target.
16275 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16277 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16278 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16279 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16280 * testsuite/tls_test.cc: Include "config.h".
16281 (t_last): Call t11_last.
16282 * testsuite/tls_test.h (t11, t11_last): Declare.
16283 * testsuite/tls_test_c.c: New file.
16284 * testsuite/tls_test_main.cc (thread_routine): Call t11.
16285 * configure.ac: Check for OpenMP support.
16286 * configure, config.in, Makefile.in: Rebuild.
16287 * testsuite/Makefile.in: Rebuild.
16289 2008-04-16 Cary Coutant <ccoutant@google.com>
16291 * i386.cc (Target_i386::define_tls_base_symbol): New function.
16292 (Target_i386::tls_base_symbol_defined_): New field.
16293 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16294 (Target_i386::Scan::global): Likewise.
16295 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16296 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16297 (Target_x86_64::tls_base_symbol_defined_): New field.
16298 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16299 (Target_x86_64::Scan::global): Likewise.
16301 2008-04-16 Cary Coutant <ccoutant@google.com>
16303 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16304 (Symbol::needs_plt_entry): Allow weak undefined symbols.
16305 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16306 building shared libraries.
16307 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16308 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16309 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16310 * testsuite/Makefile.in: Rebuild.
16311 * testsuite/weak_undef.h: New file.
16312 * testsuite/weak_undef_file1.cc: Add extra test cases.
16313 * testsuite/weak_undef_file2.cc: Likewise.
16314 * testsuite/weak_undef_test.cc: Likewise.
16316 2008-04-16 David S. Miller <davem@davemloft.net>
16318 * sparc.cc (Target_sparc::Scan): Change from struct to class.
16319 Add issued_non_pic_error_ field. Declare check_non_pic.
16320 (Target_sparc::Scan::check_non_pic): New function.
16321 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16322 (Target_sparc::Scan::global): Likewise.
16324 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16325 * configure: Rebuild.
16327 * options.h (DEFINE_enable): New macro.
16328 (new_dtags): New enable option.
16329 (initfirst, interpose, loadfltr, nodefaultlib,
16330 nodelete, nodlopen, nodump): New -z options.
16331 * layout.cc (Layout:finish_dynamic_section): If new
16332 dtags enabled, emit DT_RUNPATH. Also, emit a
16333 DT_FLAGS_1 containing any specified -z flags.
16335 2008-04-16 Ian Lance Taylor <iant@google.com>
16337 * copy-relocs.cc: New file.
16338 * copy-relocs.h: New file.
16339 * reloc.cc: Remove Copy_relocs code.
16340 * reloc.h: Likewise.
16341 * reloc-types.h (struct Reloc_types) [both versions]: Add
16342 get_reloc_addend_noerror.
16343 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16344 variants of add_global which take an addend which must be zero.
16345 * i386.cc: Include "copy-relocs.h".
16346 (class Target_i386): Change type of copy_relocs_ to variable,
16347 update initializer.
16348 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16349 Change all callers.
16350 (Target_i386::do_finalize_sections): Change handling of
16352 * sparc.cc: Include "copy-relocs.h".
16353 (class Target_sparc): Change type of copy_relocs_ to variable,
16354 update initializer.
16355 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16356 Change all callers.
16357 (Target_sparc::do_finalize_sections): Change handling of
16359 * x86_64.cc: Include "copy-relocs.h".
16360 (class Target_x86_64): Change type of copy_relocs_ to variable,
16361 update initializer.
16362 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16363 class. Change all callers.
16364 (Target_x86_64::do_finalize_sections): Change handling of
16366 * Makefile.am (CCFILES): Add copy-relocs.cc.
16367 (HFILES): Add copy-relocs.h.
16369 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16371 * testsuite/script_test_4.sh: Permit leading zeroes.
16373 2008-04-15 Ian Lance Taylor <iant@google.com>
16375 * script-sections.cc (Script_sections::create_segments): Use
16376 header_size_adjustment even when there is enough room for the
16378 * testsuite/script_test_4.sh: New file.
16379 * testsuite/script_test_4.t: New file.
16380 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16381 (check_DATA): Add script_test_4.stdout.
16382 (MOSTLYCLEANFILES): Likewise.
16383 (script_test_4): New target.
16384 (script_test_4.stdout): New target.
16385 * testsuite/Makefile.in: Rebuild.
16387 * sparc.cc: Add definitions for Output_data_plt_sparc class
16390 2008-04-14 David S. Miller <davem@davemloft.net>
16392 * sparc.cc: New file.
16393 * Makefile.am (TARGETSOURCES): Add sparc.cc
16394 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16395 * configure.tgt: Document targ_extra_size and
16396 targ_extra_big_endian. Add entries for sparc-* and
16398 * configure.ac: Handle targ_extra_size and
16399 targ_extra_big_endian.
16400 * Makefile.in: Rebuild.
16401 * configure: Likewise.
16402 * po/POTFILES.in: Likewise.
16403 * po/gold.pot: Likewise.
16405 2008-04-14 Ian Lance Taylor <iant@google.com>
16407 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16408 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16409 in the name/type/flags to section mapping. Don't call
16410 allocate_output_section.
16411 (Layout::choose_output_section): Change parameter from adjust_name
16412 to is_input_section. Don't permit input sections after sections
16413 are attached to segments. Don't call allocate_output_section.
16414 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16415 not write_enable_output_section.
16416 (Layout::make_output_section): Don't push to
16417 unattached_section_list_ nor call attach_to_segment. Call
16418 attach_section_to_segment if sections are attached.
16419 (Layout::attach_sections_to_segments): New function.
16420 (Layout::attach_section_to_segment): New function.
16421 (Layout::attach_allocated_section_to_segment): Rename from
16422 attach_to_segment. Remove flags parameter.
16423 (Layout::allocate_output_section): Remove function.
16424 (Layout::write_enable_output_section): Remove function.
16425 * layout.h (class Layout): Update for above changes. Add new
16426 field sections_are_attached_.
16427 * output.h (Output_section::update_flags_for_input_section): New
16429 * output.cc (Output_section::add_input_section): Call
16430 update_flags_for_input_section.
16431 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16433 2008-04-11 Cary Coutant <ccoutant@google.com>
16435 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16436 thought unnecessary.
16437 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16439 2008-04-11 Ian Lance Taylor <iant@google.com>
16441 * output.h (class Output_section_data): Remove inline definition
16443 * output.cc (Output_section_data::set_addralign): New function.
16445 2008-04-11 Cary Coutant <ccoutant@google.com>
16447 Add support for TLS descriptors for i386 and x86_64.
16448 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16449 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16450 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16452 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16453 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16454 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16456 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16457 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16458 Fix problem with initial-exec relocations.
16459 (Target_i386::Relocate::relocate_tls): Likewise.
16460 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16462 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16463 support for section-plus-offset dynamic table entries.
16464 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16465 (Output_data_dynamic::Dynamic_entry): Add support for
16466 section-plus-offset dynamic table entries.
16467 (Output_data_dynamic::Classification): Likewise.
16468 (Output_data_dynamic::classification_): Renamed offset_.
16469 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16470 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16471 (Target_x86_64::make_plt_section): New function.
16472 (Target_x86_64::reserve_tlsdesc_entries): New function.
16473 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16474 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16475 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16476 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16477 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16478 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16479 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16480 add extra PLT entry for TLS descriptors.
16481 (Output_data_plt_x86_64::got_): New field.
16482 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16483 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16485 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16487 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16488 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16489 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16490 R_386_TLS_DESC_CALL relocations.
16491 (Target_x86_64::Scan::global): Likewise.
16492 (Target_x86_64::do_finalize_sections): Add dynamic table entries
16493 for TLS descriptors.
16494 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16495 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16496 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16497 GD-to-IE relaxation.
16498 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16499 and TLS_DESCRIPTORS.
16500 * Makefile.in: Rebuild.
16501 * configure: Rebuild.
16502 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16503 (tls_test_shared2.so): New target.
16504 (tls_shared_gd_to_ie_test_SOURCES): New variable.
16505 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16506 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16507 (tls_shared_gd_to_ie_test_LDADD): New variable.
16508 (tls_shared_gnu2_gd_to_ie_test): New target.
16509 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16511 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16512 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16513 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16514 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16515 (tls_shared_gnu2_test): New target.
16516 (tls_test_gnu2_shared.so): New target.
16517 (tls_shared_gnu2_test_SOURCES): New variable.
16518 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16519 (tls_shared_gnu2_test_LDFLAGS): New variable.
16520 (tls_shared_gnu2_test_LDADD): New variable.
16521 * testsuite/Makefile.in: Rebuild.
16522 * testsuite/Makefile.
16524 2008-04-11 Ian Lance Taylor <iant@google.com>
16526 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16528 * testsuite/Makefile.in: Rebuild.
16530 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16532 * testsuite/script_test_2.cc (main): Adjust test.
16534 2008-04-11 David S. Miller <davem@davemloft.net>
16535 Ian Lance Taylor <iant@google.com>
16537 * options.h (General_options): Add entries for '-Y' and
16539 * options.cc (General_options:finalize): If -Y was used, add those
16540 entries to the library path instead of the default "/lib" and
16543 2008-04-11 David S. Miller <davem@davemloft.net>
16545 * testsuite/justsyms.t: Start at 0x100.
16546 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16547 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16549 * testsuite/script_test_2.cc: Adjust string and section length
16552 2008-04-09 Ian Lance Taylor <iant@google.com>
16555 * script-sections.cc (Sections_element::allocate_to_segment): Add
16557 (Output_section_definition::allocate_to_segment): Likewise.
16558 (Orphan_output_section::allocate_to_segment): Likewise.
16559 (Script_sections::attach_sections_using_phdrs_clause): Don't
16560 propagate non-PT_LOAD segments to orphan sections.
16561 * testsuite/Makefile.am (script_test_3.stdout): Generate using
16562 readelf rather than objdump.
16563 * testsuite/script_test_3.sh: Adjust accordingly. Test that
16564 .interp section and PT_INTERP segment are the same size.
16565 * testsuite/Makefile.in: Rebuild.
16567 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16568 aliases for symbols defined in the same object.
16569 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16570 (weak_alias_test_SOURCES): New variable.
16571 (weak_alias_test_DEPENDENCIES): New variable.
16572 (weak_alias_test_LDFLAGS): New variable.
16573 (weak_alias_test_LDADD): New variable.
16574 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16575 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16576 (weak_alias_test_3.o): New target.
16577 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16578 * testsuite/weak_alias_test_main.cc: New file.
16579 * testsuite/weak_alias_test_1.cc: New file.
16580 * testsuite/weak_alias_test_2.cc: New file.
16581 * testsuite/weak_alias_test_3.cc: New file.
16583 2008-04-08 Ian Lance Taylor <iant@google.com>
16585 * options.h (class General_options): Add --noinhibit-exec option.
16586 * main.cc (main): Check --noinhibit-exec.
16588 * options.h (class General_options): Define --wrap as a special
16589 option. Add wrap_symbols_ field.
16590 (General_options::any_wrap_symbols): New function.
16591 (General_options::is_wrap_symbol): New function.
16592 * options.cc (General_options::parse_wrap): New function.
16593 (General_options::General_options): Initialize wrap_symbols_.
16594 * symtab.cc (Symbol_table::wrap_symbol): New function.
16595 (Symbol_table::add_from_object): Handle --wrap.
16596 * symtab.h (class Symbol_table): Declare wrap_symbol.
16597 * target.h (Target::wrap_char): New function.
16598 (Target::Target_info): Add wrap_char field.
16599 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16600 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16601 * testsuite/testfile.cc (Target_test::test_target_info):
16604 * errors.cc (Errors::undefined_symbol): Mention symbol version if
16607 * layout.h (class Layout): Add added_eh_frame_data_ field.
16608 * layout.cc (Layout::Layout): Initialize new field.
16609 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16610 output section until we find a section we merged successfully.
16611 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16612 that the size be non-zero.
16614 * merge.cc (Object_merge_map::get_output_offset): Remove inline
16617 2008-04-08 Craig Silverstein <csilvers@google.com>
16619 * configure.ac: Export new conditional variable HAVE_ZLIB.
16620 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16622 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16623 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16625 2008-04-07 Ian Lance Taylor <iant@google.com>
16627 * version.cc (version_string): Set to "1.5".
16629 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16630 Add issued_non_pic_error_ field. Declare check_non_pic.
16631 (Target_x86_64::Scan::check_non_pic): New function.
16632 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16633 (Target_x86_64::Scan::global): Likewise.
16635 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16636 addend parameter. Change caller. Handle merge sections.
16637 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16638 Address to Addend. Don't add in the result of
16639 local_section_offset, pass down the addend and use the returned
16641 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16642 Update declarations of local_section_offset and symbol_value.
16643 * testsuite/two_file_test_1.cc (t18): New function.
16644 * testsuite/two_file_test_2.cc (f18): New function.
16645 * testsuite/two_file_test_main.cc (main): Call t18.
16646 * testsuite/two_file_test.h (t18, f18): Declare.
16648 * configure.ac: Don't test for objdump, c++filt, or readelf.
16649 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16651 (TEST_READELF): New variable.
16652 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16653 (check_PROGRAMS): Add two_file_strip_test.
16654 (two_file_strip_test): New target.
16655 (check_PROGRAMS): Add two_file_same_shared_strip_test.
16656 (two_file_same_shared_strip_test_SOURCES): New variable.
16657 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16658 (two_file_same_shared_strip_test_LDFLAGS): New variable.
16659 (two_file_same_shared_strip_test_LDADD): New variable.
16660 (two_file_shared_strip.so): New target.
16661 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16662 (ver_test_5.syms, ver_test_7.syms): Likewise.
16663 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16664 (strip_test_3.stdout): Use TEST_OBJDUMP.
16665 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16667 2008-04-04 Cary Coutant <ccoutant@google.com>
16669 * symtab.h (Symbol::is_weak_undefined): New function.
16670 (Symbol::is_strong_undefined): New function.
16671 (Symbol::is_absolute): New function.
16672 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16673 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16675 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16676 (weak_undef_test): New target.
16677 * testsuite/Makefile.in: Rebuild.
16678 * testsuite/weak_undef_file1.cc: New file.
16679 * testsuite/weak_undef_file2.cc: New file.
16680 * testsuite/weak_undef_test.cc: New file.
16682 2008-04-03 Craig Silverstein <csilvers@google.com>
16684 * compressed_output.h (class Output_compressed_section): Use
16686 * compressed_output.cc (zlib_compress): Use unsigned buffers,
16688 (zlib_compressed_suffix): Removed.
16689 (Output_compressed_section::set_final_data_size): Use unsigned
16691 * testsuite/Makefile.am (flagstest_compress_debug_sections):
16692 Fix linker invocation.
16693 (flagstest_o_specialfile_and_compress_debug_sections):
16695 * testsuite/Makefile.in: Regenerated.
16697 2008-04-02 David S. Miller <davem@davemloft.net>
16699 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16700 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16702 2008-04-02 Craig Silverstein <csilvers@google.com>
16706 2008-04-02 Ian Lance Taylor <iant@google.com>
16708 * fileread.cc (File_read::find_view): Add byteshift and vshifted
16709 parameters. Update for new key type to views_. Change all
16711 (File_read::read): Adjust for byteshift in returned view.
16712 (File_read::add_view): New function, broken out of
16713 find_and_make_view.
16714 (File_read::make_view): New function, broken out of
16715 find_and_make_view.
16716 (File_read::find_or_make_view): Add offset and aligned
16717 parameters. Rewrite accordingly. Change all callers.
16718 (File_read::get_view): Add offset and aligned parameters. Adjust
16719 for byteshift in return value.
16720 (File_read::get_lasting_view): Likewise.
16721 * fileread.h (class File_read): Update declarations.
16722 (class File_read::View): Add byteshift_ field. Add byteshift to
16723 constructor. Add byteshift method.
16724 * archive.h (Archive::clear_uncached_views): New function.
16725 (Archive::get_view): Add aligned parameter. Change all callers.
16726 * object.h (Object::get_view): Add aligned parameter. Change all
16728 (Object::get_lasting_view): Likewise.
16730 * fileread.cc (File_read::release): Don't call clear_views if
16731 there are multiple objects.
16732 * fileread.h (File_read::clear_uncached_views): New function.
16733 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16736 2008-03-31 Cary Coutant <ccoutant@google.com>
16738 Add thin archive support.
16739 * archive.cc (Archive::armagt): New const.
16740 (Archive::setup): Remove task parameter and calls to unlock.
16741 (Archive::unlock_nested_archives): New function.
16742 (Archive::read_header): Add nested_off parameter. Change
16744 (Archive::interpret_header): Likewise.
16745 (Archive::include_all_members): Change to handle thin
16747 (Archive::include_member): Likewise.
16748 * archive.h (Archive::Archive): Add new parameters and
16750 (Archive::armagt): New const.
16751 (Archive::setup): Remove task parameter.
16752 (Archive::unlock_nested_archives): New function.
16753 (Archive::read_header): Add nested_off parameter.
16754 (Archive::interpret_header): Likewise.
16755 (Archive::Nested_archive_table): New typedef.
16756 (Archive::is_thin_archive_): New field.
16757 (Archive::nested_archives_): New field.
16758 (Archive::options_): New field.
16759 (Archive::dirpath_): New field.
16760 (Archive::task_): New field.
16761 * readsyms.cc (Read_symbols::do_read_symbols): Add check
16762 for thin archives. Pass additional parameters to
16763 Archive::Archive. Unlock the archive file after calling
16766 2008-03-29 Ian Lance Taylor <iant@google.com>
16768 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16769 version symbol to be local.
16770 * testsuite/ver_test_4.sh: New file.
16771 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16772 (check_DATA): Add ver_test_4.syms.
16773 (ver_test_4.syms): New target.
16774 * testsuite/Makefile.in: Rebuild.
16777 (Output_section::Input_section_sort_entry::has_priority): New
16779 (Output_section::Input_section_sort_entry::match_file_name): New
16781 (Output_section::Input_section_sort_entry::match_section_name):
16783 (Output_section::Input_section_sort_entry::match_section_name_prefix):
16785 (Output_section::Input_section_sort_entry::match_section_file):
16787 (Output_section::Input_section_sort_compare::operator()): Rewrite
16788 using new Input_section_sort_entry functions. Sort crtbegin and
16789 crtend first. Sort sections with no priority before sections with
16791 * testsuite/initpri1.c (d3): Check j != 4.
16792 (cd5): New constructor/destructor function.
16793 (main): Check j != 2.
16795 * symtab.cc (Symbol_table::add_from_object): If we don't use the
16796 new symbol when resolving, don't call set_is_default.
16797 * testsuite/ver_test_7.cc: New file.
16798 * testsuite/ver_test_7.sh: New file.
16799 * testsuite/Makefile.am (ver_test_7.so): New target.
16800 (ver_test_7.o): New target.
16801 (check_SCRIPTS): Add ver_test_7.sh.
16802 (check_DATA): Add ver_test_7.syms.
16803 (ver_test_7.syms): New target.
16805 2008-03-28 Ian Lance Taylor <iant@google.com>
16807 * layout.cc (Layout::layout): If we see an input section with a
16808 name that needs sorting, set the must_sort flag for the output
16810 (Layout::make_output_section): If the name of the output section
16811 indicates that it might require sorting, set the may_sort flag.
16812 * output.h (Output_section::may_sort_attached_input_sections): New
16814 (Output_section::set_may_sort_attached_input_sections): New
16816 (Output_section::must_sort_attached_input_sections): New
16818 (Output_section::set_must_sort_attached_input_sections): New
16820 (class Output_section): Declare Input_section_sort_entry. Define
16821 Input_section_sort_compare. Declare
16822 sort_attached_input_sections. Add new fields:
16823 may_sort_attached_input_sections_,
16824 must_sort_attached_input_sections_,
16825 attached_input_sections_are_sorted_.
16826 * output.cc (Output_section::Output_section): Initialize new
16828 (Output_section::add_input_section): Add an entry to
16829 input_sections_ if may_sort or must_sort are true.
16830 (Output_section::set_final_data_size): Call
16831 sort_attached_input_sections if necessary.
16832 (Output_section::Input_section_sort_entry): Define new class.
16833 (Output_section::Input_section_sort_compare::operator()): New
16835 (Output_section::sort_attached_input_sections): New function.
16836 * configure.ac: Check whether the compiler supports constructor
16837 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
16838 * testsuite/initpri1.c: New file.
16839 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16840 CONSTRUCTOR_PRIORITY.
16841 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16842 (initpri1_LDFLAGS): New variable.
16843 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16845 2008-03-27 Ian Lance Taylor <iant@google.com>
16847 * common.cc (Sort_commons::operator): Correct sorting algorithm.
16848 * testsuite/common_test_1.c: New file.
16849 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16850 (common_test_1_SOURCES): New variable.
16851 (common_test_1_DEPENDENCIES): New variable.
16852 (common_test_1_LDFLAGS): New variable.
16854 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16855 and commons_ correctly when NAME/VERSION does not override
16857 * testsuite/ver_test_6.c: New file.
16858 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16859 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16860 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16862 2008-03-26 Ian Lance Taylor <iant@google.com>
16864 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16865 of an undefined symbol from a version script.
16866 * testsuite/Makefile.am (ver_test_5.so): New target.
16867 (ver_test_5.o): New target.
16868 (check_SCRIPTS): Add ver_test_5.sh.
16869 (check_DATA): Add ver_test_5.syms.
16870 (ver_test_5.syms): New target.
16871 * testsuite/ver_test_5.cc: New file.
16872 * testsuite/ver_test_5.script: New file.
16873 * testsuite/ver_test_5.sh: New file.
16874 * Makefile.in, testsuite/Makefile.in: Rebuild.
16877 Fix problems building gold with gcc 4.3.0.
16878 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16879 (gold_error_at_location, gold_warning_at_location): Use it.
16880 * configure.ac: Check whether we can compile and use a template
16881 function with a printf attribute.
16882 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16883 when jumping over bytes.
16884 * object.cc: Instantiate Object::read_section_data.
16885 * debug.h: Include <cstring>
16886 * dwarf_reader.cc: Include <algorithm>
16887 * main.cc: Include <cstring>.
16888 * options.cc: Include <cstring>.
16889 * output.cc: Include <cstring>.
16890 * script.cc: Include <cstring>.
16891 * script.h: Include <string>.
16892 * symtab.cc: Include <cstring> and <algorithm>.
16893 * target-select.cc: Include <cstring>.
16894 * version.cc: Include <string>.
16895 * testsuite/testmain.cc: Include <cstdlib>.
16896 * configure, config.in: Rebuild.
16898 2008-03-25 Ian Lance Taylor <iant@google.com>
16900 * options.cc: Include "../bfd/bfdver.h".
16901 (options::help): Print bug reporting address.
16903 * version.cc (print_version): Adjust output for current value of
16904 BFD_VERSION_STRING.
16908 * options.cc (options::help): Print list of supported targets.
16909 * target-select.h: Include <vector>.
16910 (class Target_selector): Make machine_, size_, and is_big_endian_
16911 fields const. Add bfd_name_ and instantiated_target_ fields.
16912 (Target_selector::Target_selector): Add bfd_name parameter.
16913 (Target_selector::recognize): Make non-virtual, call
16915 (Target_selector::recognize_by_name): Make non-virtual, call
16916 do_recognize_by_name.
16917 (Target_selector::supported_names): New function.
16918 (Target_selector::bfd_name): New function.
16919 (Target_selector::do_instantiate_target): New pure virtual
16921 (Target_selector::do_recognize): New virtual function.
16922 (Target_selector::do_recognize_by_name): New virtual function.
16923 (Target_selector::instantiate_target): New private function.
16924 (supported_target_names): Declare.
16925 * target-select.cc (Target_selector::Target_selector): Update for
16926 new parameter and fields.
16927 (select_target_by_name): Check that the name matches before
16928 calling recognize_by_name.
16929 (supported_target_names): New function.
16930 * i386.cc (class Target_selector_i386): Update Target_selector
16931 constructor call. Remove recognize and recognize_by_name. Add
16932 do_instantiate_target.
16933 * x86_64.cc (class Target_selector_x86_64): Likewise.
16934 * testsuite/testfile.cc (class Target_selector_test): Update for
16935 changes to Target_selector.
16937 * README: Rewrite, with some notes on unsupported features.
16939 2008-03-24 Cary Coutant <ccoutant@google.com>
16941 * i386.cc (Target_i386::Got_type): New enum declaration.
16942 (Target_i386::Scan::local): Updated callers of Output_data_got
16944 (Target_i386::Scan::global): Likewise.
16945 (Target_i386::Relocate::relocate): Likewise.
16946 (Target_i386::Relocate::relocate_tls): Likewise.
16947 * object.h (Got_offset_list): New class.
16948 (Sized_relobj::local_has_got_offset): Added got_type parameter.
16949 (Sized_relobj::local_got_offset): Likewise.
16950 (Sized_relobj::set_local_got_offset): Likewise.
16951 (Sized_relobj::local_has_tls_got_offset): Removed.
16952 (Sized_relobj::local_tls_got_offset): Removed.
16953 (Sized_relobj::set_local_tls_got_offset): Removed.
16954 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16955 * output.cc (Output_data_got::add_global): Added got_type parameter.
16956 (Output_data_got::add_global_with_rel): Likewise.
16957 (Output_data_got::add_global_with_rela): Likewise.
16958 (Output_data_got::add_global_pair_with_rel): New function.
16959 (Output_data_got::add_global_pair_with_rela): New function.
16960 (Output_data_got::add_local): Added got_type parameter.
16961 (Output_data_got::add_local_with_rel): Likewise.
16962 (Output_data_got::add_local_with_rela): Likewise.
16963 (Output_data_got::add_local_pair_with_rel): New function.
16964 (Output_data_got::add_local_pair_with_rela): New function.
16965 (Output_data_got::add_global_tls): Removed.
16966 (Output_data_got::add_global_tls_with_rel): Removed.
16967 (Output_data_got::add_global_tls_with_rela): Removed.
16968 (Output_data_got::add_local_tls): Removed.
16969 (Output_data_got::add_local_tls_with_rel): Removed.
16970 (Output_data_got::add_local_tls_with_rela): Removed.
16971 * output.h (Output_data_got::add_global): Added got_type parameter.
16972 (Output_data_got::add_global_with_rel): Likewise.
16973 (Output_data_got::add_global_with_rela): Likewise.
16974 (Output_data_got::add_global_pair_with_rel): New function.
16975 (Output_data_got::add_global_pair_with_rela): New function.
16976 (Output_data_got::add_local): Added got_type parameter.
16977 (Output_data_got::add_local_with_rel): Likewise.
16978 (Output_data_got::add_local_with_rela): Likewise.
16979 (Output_data_got::add_local_pair_with_rel): New function.
16980 (Output_data_got::add_local_pair_with_rela): New function.
16981 (Output_data_got::add_global_tls): Removed.
16982 (Output_data_got::add_global_tls_with_rel): Removed.
16983 (Output_data_got::add_global_tls_with_rela): Removed.
16984 (Output_data_got::add_local_tls): Removed.
16985 (Output_data_got::add_local_tls_with_rel): Removed.
16986 (Output_data_got::add_local_tls_with_rela): Removed.
16987 * resolve.cc (Symbol::override_base_with_special): Removed
16988 reference to has_got_offset_ field.
16989 * symtab.cc (Symbol::init_fields): Replaced initialization
16990 of got_offset_ with got_offsets_. Removed initialization
16992 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16993 (Symbol::got_offset): Likewise.
16994 (Symbol::set_got_offset): Likewise.
16995 (Symbol::has_tls_got_offset): Removed.
16996 (Symbol::tls_got_offset): Removed.
16997 (Symbol::set_tls_got_offset): Removed.
16998 (Symbol::got_offset_): Removed.
16999 (Symbol::tls_mod_got_offset_): Removed.
17000 (Symbol::tls_pair_got_offset_): Removed.
17001 (Symbol::got_offsets_): New field.
17002 (Symbol::has_got_offset): Removed.
17003 (Symbol::has_tls_mod_got_offset): Removed.
17004 (Symbol::has_tls_pair_got_offset): Removed.
17005 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17006 (Target_x86_64::Scan::local): Updated callers of Output_data_got
17008 (Target_x86_64::Scan::global): Likewise.
17009 (Target_x86_64::Relocate::relocate): Likewise.
17010 (Target_x86_64::Relocate::relocate_tls): Likewise.
17012 2008-03-25 Ben Elliston <bje@au.ibm.com>
17014 * yyscript.y: Fix spelling error in comment.
17016 2008-03-24 Ian Lance Taylor <iant@google.com>
17018 * options.h (class General_options): Define build_id option.
17019 * layout.h (class Layout): Declare write_build_id, create_note,
17020 create_build_id. Add build_id_note_ member.
17021 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17022 "libiberty.h", "md5.h", "sha1.h".
17023 (Layout::Layout): Initialize eh_frame_data_,
17024 eh_frame_hdr_section_, and build_id_note_.
17025 (Layout::finalize): Call create_build_id.
17026 (Layout::create_note): New function, broken out of
17027 Layout::create_gold_note.
17028 (Layout::create_gold_note): Call create_note.
17029 (Layout::create_build_id): New function.
17030 (Layout::write_build_id): New function.
17031 (Close_task_runner::run): Call write_build_id.
17033 * x86_64.cc: Correct license to GPLv3.
17035 2008-03-23 Ian Lance Taylor <iant@google.com>
17037 * options.cc: Include "demangle.h".
17038 (parse_optional_string): New function.
17039 (parse_long_option): Handle takes_optional_argument.
17040 (parse_short_option): Update dash_z initializer. Handle
17041 takes_optional_argument.
17042 (General_options::General_options): Initialize do_demangle_.
17043 (General_options::finalize): Set do_demangle_. Handle demangling
17045 * options.h (parse_optional_string): Declare.
17046 (struct One_option): Add optional_arg field. Update constructor.
17047 Update call constructor calls. Add takes_optional_argument
17049 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
17050 (DEFINE_optional_string): Define.
17051 (General_options::demangle): Change from DEFINE_bool to
17052 DEFINE_optional_string.
17053 (General_options::no_demangle): New function.
17054 (General_options::do_demangle): New function.
17055 (General_options::set_do_demangle): New function.
17056 (General_options::execstack_status_): Move definition to end of
17058 (General_options::static_): Likewise.
17059 (General_options::do_demangle_): New field.
17060 * object.cc (big_endian>::get_symbol_location_info): Call
17061 Options::do_demangle, not Options::demangle.
17062 * symtab.cc (demangle): Likewise.
17064 2008-03-22 Ian Lance Taylor <iant@google.com>
17066 * gold.h: Include <cstddef> and <sys/types.h>
17067 * options.h: Include <cstring>.
17069 2008-03-21 Ian Lance Taylor <iant@google.com>
17071 * Added source code to GNU binutils.
17073 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17075 Copying and distribution of this file, with or without modification,
17076 are permitted in any medium without royalty provided the copyright
17077 notice and this notice are preserved.
17083 version-control: never