1 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
3 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6 2009-10-30 Doug Kwan <dougkwan@google.com>
8 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10 2009-10-30 Doug Kwan <dougkwan@google.com>
12 * arm.cc (Stub_addend_reader): New struct template definition
13 and partial specializations.
14 (Stub_addend_reader::operator()): New method definition for a
15 partially specialized template.
17 2009-10-30 Doug Kwan <dougkwan@google.com>
19 * arm.cc (Arm_relobj::processor_specific_flags): New method
21 (Arm_relobj::do_read_symbols): New method declaration.
22 (Arm_relobj::processor_specific_flags_): New data member declaration.
23 (Arm_dynobj): New class definition.
24 (Target_arm::do_finalize_sections): Add input_objects parameter.
25 (Target_arm::do_adjust_elf_header): New method declaration.
26 (Target_arm::are_eabi_versions_compatible,
27 (Target_arm::merge_processor_specific_flags): New method declaration.
28 (Target_arm::do_make_elf_object): New overloaded method definitions
30 (Arm_relobj::do_read_symbols): New method definition.
31 (Arm_dynobj::do_read_symbols): Ditto.
32 (Target_arm::do_finalize_sections): Add input_objects parameters.
33 Merge processor-specific flags from all input objects.
34 (Target_arm::are_eabi_versions_compatible,
35 Target_arm::merge_processor_specific_flags,
36 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
37 New method definitions.
38 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
39 Input_objects pointer type parameter.
40 * layout.cc (Layout::finalize): Pass input objects to target's.
41 finalize_sections function.
42 * output.cc (Output_file_header::do_sized_write): Set ELF file
43 header's processor-specific flags.
44 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
45 Input_objects pointer type parameter.
46 * sparc.cc (Target_sparc::do_finalize_sections): Same.
47 * target.h (Input_objects): New forward class declaration.
48 (Target::processor_specific_flags,
49 Target::are_processor_specific_flags_sect): New method definitions.
50 (Target::finalize_sections): Add input_objects parameter.
51 (Target::Target): Initialize processor_specific_flags_ and
52 are_processor_specific_flags_set_.
53 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
55 (Target::set_processor_specific_flags): New method definition.
56 (Target::processor_specific_flags_,
57 Target::are_processor_specific_flags_set_): New data member
59 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
60 Input_objects pointer type parameter.
62 2009-10-30 Doug Kwan <dougkwan@google.com>
64 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
66 2009-10-28 Ian Lance Taylor <iant@google.com>
68 * object.h (class Relobj): Drop options parameter from
69 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
70 do_scan_relocs, do_relocate. Change all callers.
71 (class Sized_relobj): Drop options parameters from
72 do_gc_process_relocs, do_scan_relocs, do_relocate,
73 do_relocate_sections, relocate_sections, emit_relocs_scan,
74 emit_relocs_scan_reltype. Change all callers.
75 (struct Relocate_info): Remove options field and all references to
77 * reloc.h (class Read_relocs): Remove options constructor
78 parameter and options_ field. Change all callers.
79 (class Gc_process_relocs, class Scan_relocs): Likewise.
80 (class Relocate_task): Likewise.
81 * target-reloc.h (scan_relocs): Remove options parameter. Change
83 (scan_relocatable_relocs): Likewise.
84 * target.h (class Sized_target): Remove options parameter from
85 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
87 * gc.h (gc_process_relocs): Remove options parameter. Change all
89 * arm.cc: Update functions to remove options parameters.
91 * powerpc.cc: Likewise.
93 * x86_64.cc: Likewise.
94 * testsuite/testfile.cc: Likewise.
96 2009-10-28 Doug Kwan <dougkwan@google.com>
98 * arm.cc (Arm_relobj): New class definition.
99 (Arm_relobj::scan_sections_for_stubs,
100 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
101 New method definitions.
103 2009-10-28 Cary Coutant <ccoutant@google.com>
105 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
106 (Plugin::cleanup_done_): New member.
107 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
108 (Plugin_manager::cleanup_done_): Remove.
109 (Plugin_manager::add_input_file): Edit error message.
110 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
111 (Plugin_manager::cleanup): Remove use of cleanup_done_.
113 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
115 * fileread.cc: (File_read::View::~View): Use the new
116 data_ownership_ filed.
117 (File_read::~File_read): Dispose the new whole_file_view_.
118 (File_read::open): Mmap the whole file if needed.
119 (File_read::open): Use whole_file_view_ instead of contents_.
120 (File_read::find_view): Use whole_file_view_ if applicable.
121 (File_read::do_read): Use whole_file_view_ instead of contents_.
122 (File_read::make_view): Use whole_file_view_ instead of contents_,
123 update File_read::View::View call.
124 (File_read::find_or_make_view): Update File_read::View::View
126 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
128 (File_read::View::Data_ownership): New enum.
129 (File_read::View::View): Replace bool mapped_ with Data_ownership
131 (File_read::View::mapped_): Remove (replaced by data_ownership_).
132 (File_read::View::data_ownership_): New field.
133 (File_read::contents_): Remove (replaced by whole_file_view_).
134 (File_read::whole_file_view_): New field.
135 * options.h (class General_options): Add --keep-files-mapped.
137 2009-10-27 Cary Coutant <ccoutant@google.com>
139 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
140 * testsuite/Makefile.am (plugin_test_5): New test case.
141 * testsuite/Makefile.in: Regenerate.
143 2009-10-25 Doug Kwan <dougkwan@google.com>
145 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
146 from private to protected to allow access by child class.
147 (Sized_relobj::do_relocate_sections): New method declaration.
148 (Sized_relobj::relocate_sections): Virtualize.
149 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
150 Sized_relobj::relocate_sections. Instantiate template explicitly
151 for different target sizes and endianity.
153 2009-10-24 Doug Kwan <dougkwan@google.com>
155 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
156 (Arm_input_section::as_arm_input_section): New method.
157 (Arm_output_section): New class definition.
158 (Arm_output_section::create_stub_group,
159 Arm_output_section::group_sections): New method definitions.
161 2009-10-22 Doug Kwan <dougkwan@google.com>
163 * arm.cc (Arm_input_section): New class definition.
164 (Arm_input_section::init, Arm_input_section:do_write,
165 Arm_input_section::set_final_data_size,
166 Arm_input_section::do_reset_address_and_file_offset): New method
169 2009-10-21 Doug Kwan <dougkwan@google.com>
171 * arm.cc (Stub_table, Arm_input_section): New forward class
173 (Stub_table): New class defintion.
174 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
175 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
176 New method definition.
178 2009-10-21 Doug Kwan <dougkwan@google.com>
180 * arm.cc: Update copyright comments.
181 (Target_arm): New forward class template declaration.
182 (Arm_address): New type.
183 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
184 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
185 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
187 (Insn_template): Same.
188 (DEF_STUBS): New macro.
189 (Stub_type): New enum type.
190 (Stub_template): New class definition.
193 (Stub_factory): Same.
194 (Target_arm::Target_arm): Initialize may_use_blx_ and
195 should_force_pic_veneer_.
196 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
197 Target_arm::should_force_pic_veneer,
198 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
199 Target_arm::using_thumb_only, Target_arm:;default_target): New
201 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
202 New data member declarations.
203 (Insn_template::size, Insn_template::alignment): New method defintions.
204 (Stub_template::Stub_template): New method definition.
205 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
206 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
207 (Stub_factory::Stub_factory): New method definition.
208 * gold.h (string_hash): New template.
209 * output.h (Input_section_specifier::hash_value): Use
211 (Input_section_specifier::string_hash): Remove.
212 * stringpool.cc (Stringpool_template::string_hash): Use
215 2009-10-20 Doug Kwan <dougkwan@google.com>
217 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
218 symbols of relaxed input sections.
219 * output.h (Output_section::find_relaxed_input_section): Make
222 2009-10-16 Doug Kwan <dougkwan@google.com>
224 * dynobj.cc (Versions::Versions): Initialize version_script_.
225 Only insert base version symbol definition for a shared object
226 if version script defines any version versions.
227 (Versions::define_base_version): New method definition.
228 (Versions::add_def): Check that base version is not needed.
229 (Versions::add_need): Define base version lazily.
230 * dynobj.h (Versions::define_base_version): New method declaration.
231 (Versions::needs_base_version_): New data member declaration.
232 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
233 (check_DATA): Add no_version_test.stdout.
234 (libno_version_test.so, no_version_test.o no_version_test.stdout):
236 * testsuite/Makefile.in: Regenerate.
237 * testsuite/no_version_test.c: New file.
238 * testsuite/no_version_test.sh: Ditto.
240 2009-10-16 Doug Kwan <dougkwan@google.com>
242 * expression.cc (class Segment_start_expression): New class definition.
243 (Segment_start_expression::value): New method definition.
244 (script_exp_function_segment_start): Return a new
245 Segment_start_expression.
246 * gold/script-c.h (script_saw_segment_start_expression): New function
248 * script-sections.cc (Script_sections::Script_sections): Initialize
249 SAW_SEGMENT_START_EXPRESSION_ to false.
250 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
251 and -Tbbs options to specify section addresses if given in
252 command line and no SEGMENT_START expression is seen in a script.
253 * script-sections.h (Script_sections::saw_segment_start_expression,
254 Script_sections::set_saw_segment_start_expression): New method
256 (Script_sections::saw_segment_start_expression_): New data member
258 * script.cc (script_saw_segment_start_expression): New function.
259 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
260 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
261 script_test_7.sh and script_test_8.sh.
262 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
263 script_test_8.stdout.
264 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
265 (script_test_6, script_test_6.stdout, script_test_7,
266 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
267 * Makefile.in: Regenerate.
268 * testsuite/script_test_6.sh: New file.
269 * testsuite/script_test_6.t: Same.
270 * testsuite/script_test_7.sh: Same.
271 * testsuite/script_test_7.t: Same.
272 * testsuite/script_test_8.sh: Same.
274 2009-10-16 Doug Kwan <dougkwan@google.com>
276 * output.cc (Output_segment::set_section_list_address): Cast
277 expressions to unsigned long long type to avoid format warnings.
279 2009-10-15 Ian Lance Taylor <iant@google.com>
281 * script.cc (Script_options::add_symbol_assignment): Always add a
282 dot assginment to script_sections_.
283 * script-sections.cc (Script_sections::add_dot_assignment):
284 Initialize if necessary.
286 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
287 program headers with no load segment if there is a linker script.
289 * layout.cc (Layout::set_segment_offsets): Align the file offset
290 to the segment aligment for -N or -n with no load segment.
291 * output.cc (Output_segment::add_output_section): Don't crash if
292 the first section is a TLS section.
293 (Output_segment::set_section_list_addresses): Print an error
294 message if the address moves backward in a linker script.
296 (Output_section_element_input::set_section_addresses): Don't
297 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
298 (Orphan_output_section::set_section_addresses): Likewise.
300 2009-10-15 Doug Kwan <dougkwan@google.com>
302 * layout.cc (Layout::finish_dynamic_section): Generate tags
303 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
304 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
305 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
307 2009-10-14 Ian Lance Taylor <iant@google.com>
309 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
311 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
312 data_shdr fields of relinfo.
313 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
314 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
315 R_386_TLS_LDO_32, adjust based on section flags.
316 (Target_i386::Relocate::fix_up_ldo): Remove.
318 2009-10-13 Ian Lance Taylor <iant@google.com>
320 Add support for -pie.
321 * options.h (class General_options): Add -pie and
323 (General_options::output_is_position_independent): Test -pie.
324 (General_options::output_is_executable): Return true if not shared
326 (General_options::output_is_pie): Remove.
327 * options.cc (General_options::finalize): Reject incompatible uses
329 * gold.cc (queue_middle_tasks): A -pie link is not static.
330 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
331 * symtab.cc (Symbol::final_value_is_known): Return false if
332 output_is_position_independent.
333 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
334 output_is_position_independent.
335 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
336 output_is_position_independent.
337 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
338 output_is_position_independent.
339 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
341 (basic_pie_test.o, basic_pie_test): New targets.
342 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
343 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
344 (two_file_pie_test): New target.
345 * testsuite/Makefile.in: Rebuild.
346 * README: Remove note saying that -pie is not supported.
348 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
350 * options.h (class General_options): Add -init and -fini.
351 * layout.cc (Layout::finish_dynamic_section): Emit
352 given init and fini functions.
354 2009-10-13 Sriraman Tallam <tmsriram@google.com>
356 * gc.h (gc_process_relocs): Check if icf is enabled using new
358 * gold.cc (queue_initial_tasks): Likewise.
359 (queue_middle_tasks): Likewise.
360 * object.cc (do_layout): Likewise.
361 * symtab.cc (is_section_folded): Likewise.
362 * main.cc (main): Likewise.
363 * reloc.cc (Read_relocs::run): Likewise.
364 (Sized_relobj::do_scan_relocs): Likewise.
365 * icf.cc (is_function_ctor_or_dtor): New function.
366 (Icf::find_identical_sections): Check if function is ctor or dtor when
368 * options.h (General_options::icf): Change option to be an enum.
369 (Icf_status): New enum.
370 (icf_enabled): New method.
371 (icf_safe_folding): New method.
372 (set_icf_status): New method.
373 (icf_status_): New variable.
374 * (options.cc) (General_options::finalize): Set icf_status_.
375 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
376 icf_test and icf_keep_unique_test to use the --icf enum flag.
377 * testsuite/icf_safe_test.sh: New file.
378 * testsuite/icf_safe_test.cc: New file.
380 2009-10-12 Sriraman Tallam <tmsriram@google.com>
382 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
383 includes to gc.h and icf.h.
384 * arm.cc: Include gc.h.
387 * powerpc.cc: Likewise.
388 * sparc.cc: Likewise.
389 * x86_64.cc: Likewise.
390 * gc.h: Include icf.h.
392 2009-10-11 Ian Lance Taylor <iant@google.com>
394 * plugin.cc: Include "gold.h" before other header files.
396 2009-10-10 Chris Demetriou <cgd@google.com>
398 * options.h (Input_file_argument::Input_file_type): New enum.
399 (Input_file_argument::is_lib_): Replace with...
400 (Input_file_argument::type_): New member.
401 (Input_file_argument::Input_file_argument): Take Input_file_type
402 'type' rather than boolean 'is_lib' as second argument.
403 (Input_file_argument::is_lib): Use type_.
404 (Input_file_argument::is_searched_file): New function.
405 (Input_file_argument::may_need_search): Handle is_searched_file.
406 * options.cc (General_options::parse_library): Support -l:filename.
407 (General_options::parse_just_symbols): Update for Input_file_argument
409 (Command_line::process): Likewise.
410 * archive.cc (Archive::get_file_and_offset): Likewise.
411 * plugin.cc (Plugin_manager::release_input_file): Likewise.
412 * script.cc (read_script_file, script_add_file): Likewise.
413 * fileread.cc (Input_file::Input_file): Likewise.
414 (Input_file::will_search_for): Handle is_searched_file.
415 (Input_file::open): Likewise.
416 * readsyms.cc (Read_symbols::get_name): Likewise.
417 * testsuite/Makefile.am (searched_file_test): New test.
418 * testsuite/Makefile.in: Regenerate.
419 * testsuite/searched_file_test.cc: New file.
420 * testsuite/searched_file_test_lib.cc: New file.
422 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
423 Ian Lance Taylor <iant@google.com>
425 * descriptor.cc: Include <cstdio> and "binary-io.h".
426 (Descriptors::open): Open the files in binary mode always.
427 * script.cc (Lex::get_token): Treat \r as whitespace.
429 2009-10-09 Ian Lance Taylor <iant@google.com>
431 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
433 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
434 Ian Lance Taylor <iant@google.com>
436 * configure.ac: Check for readv function also.
437 * fileread.cc (readv): Define if not HAVE_READV.
438 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
440 * config.in: Regenerate.
441 * configure: Regenerate.
443 2009-10-09 Doug Kwan <dougkwan@google.com>
445 * layout.cc (Layout::make_output_section): Call target hook to make
446 ordinary output section.
447 (Layout::finalize): Adjust parameter list of call the
449 * layout.h (class Layout::section_list): New method.
450 * merge.h (Output_merge_base::entsize): Change visibility to public.
451 (Output_merge_base::is_string, Output_merge_base::do_is_string):
453 (Output_merge_string::do_is_string): New method.
454 * object.cc (Sized_relobj::do_setup): renamed from
455 Sized_relobj::set_up.
456 * object.h (Sized_relobj::adjust_shndx,
457 Sized_relobj::initializ_input_to_output_maps,
458 Sized_relobj::free_input_to_output_maps): Change visibilities to
460 (Sized_relobj::setup): Virtualize.
461 (Sized_relobj::do_setup): New method declaration.
462 (Sized_relobj::invalidate_section_offset,
463 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
464 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
465 * options.cc (parse_int): New function.
466 * options.h (parse_int): New declaration.
467 (DEFINE_int): New macro.
468 (stub_group_size): New option.
469 * output.cc (Output_section::Output_section): Initialize memebers
470 merge_section_map_, merge_section_by_properties_map_,
471 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
472 (Output_section::add_input_section): Handled deferred code-fill
473 generation and remove an old comment.
474 (Output_section::add_relaxed_input_section): New method definition.
475 (Output_section::add_merge_input_section): Use merge section by
476 properties map to speed to search. Update merge section maps
478 (Output_section::build_relaxation_map): New method definition.
479 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
481 (Output_section::relax_input_section): Renamed to
482 Output_section::convert_input_sections_to_relaxed_sections and change
483 interface to take a vector of pointers to relaxed sections.
484 (Output_section::find_merge_section,
485 Output_section::find_relaxed_input_section): New method definitions.
486 (Output_section::is_input_address_mapped,
487 Output_section::output_offset, Output_section::output_address):
488 Use output section data maps to speed up searching.
489 (Output_section::find_starting_output_address): Add comments.
490 (Output_section::do_write,
491 Output_section::write_to_postprocessing_buffer): Do code-fill
492 generation as appropriate.
493 (Output_section::get_input_sections): Invalidate relaxed input section
495 (Output_section::restore_states): Adjust type of checkpoint .
496 Invalidate relaxed input section map.
497 * output.h (Output_merge_base): New class declaration.
498 (Input_section_specifier): New class defintion.
499 (class Output_relaxed_input_section) Change base class to
500 Output_section_data_build.
501 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
502 base class initializer.
503 (Output_section::add_relaxed_input_section): New method declaration.
504 (Output_section::Input_section): Change visibility to protected.
505 (Output_section::Input_section::relobj,
506 Output_section::Input_section::shndx): Handle relaxed input sections.
507 Output_section::input_sections) Change visibility to protected. Also
508 define overload to return a non-const pointer.
509 (Output_section::Merge_section_properties): New class defintion.
510 (Output_section::Merge_section_by_properties_map,
511 Output_section::Output_section_data_by_input_section_map,
512 Output_section::Relaxation_map): New types.
513 (Output_section::relax_input_section): Rename method to
514 Output_section::convert_input_sections_to_relaxed_sections and change
515 interface to take a vector of relaxed section pointers.
516 (Output_section::find_merge_section,
517 Output_section::find_relaxed_input_section,
518 Output_section::build_relaxation_map,
519 Output_section::convert_input_sections_in_list_to_relaxed_sections):
520 New method declarations.
521 (Output_section::merge_section_map_
522 Output_section::merge_section_by_properties_map_,
523 Output_section::relaxed_input_section_map_,
524 Output_section::is_relaxed_input_section_map_valid_,
525 Output_section::generate_code_fills_at_write_): New data members.
527 (Output_section_element_input::set_section_addresses): Call
528 current_data_size and addralign methods of relaxed input sections.
529 (Orphan_output_section::set_section_addresses): Call current_data_size
530 and addralign methods of relaxed input sections.
531 * symtab.cc (Symbol_table::compute_final_value): Extract template
532 from the body of Symbol_table::sized_finalize_symbol.
533 (Symbol_table::sized_finalized_symbol): Call
534 Symbol_table::compute_final_value.
535 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
536 (Symbol_table::compute_final_value): New templated method declaration.
537 * target.cc (Target::do_make_output_section): New method defintion.
538 * target.h (Target::make_output_section): New method declaration.
539 (Target::relax): Add more parameters for input objects, symbol table
540 and layout. Adjust call to do_relax.
541 (Target::do_make_output_section): New method declaration.
542 (Target::do_relax): Add parameters for input objects, symbol table
545 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
547 * pread.c: Include stdio.h.
549 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
551 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
554 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
556 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
557 Change read_shndx type to unsigned int.
558 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
560 (Sized_dwarf_line_info::read_line_mappings): Likewise.
561 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
562 Change read_shndx type to unsigned int.
563 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
565 (Sized_dwarf_line_info::read_line_mappings): Likewise.
566 * layout.cc (Layout::create_symtab_sections): Cast the result of
567 local_symcount * symsize to off_t in the gold_assert.
569 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
571 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
572 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
574 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
575 (Arm_relocate_functions::thm_abs5): New function.
576 (Arm_relocate_functions::abs12): New function.
577 (Arm_relocate_functions::abs16): New function.
578 (Arm_relocate_functions::base_abs): New function.
579 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
580 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
581 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
583 (Scan::global): Likewise.
584 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
585 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
586 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
587 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
590 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
592 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
593 (Arm_relocate_functions::movt_prel): New function.
594 (Arm_relocate_functions::thm_movw_prel_nc): New function.
595 (Arm_relocate_functions::thm_movt_prel): New function.
596 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
597 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
598 (Scan::global, Relocate::relocate): Likewise.
599 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
601 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
603 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
605 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
607 (class Incremental_inputs_header): New class.
608 (Incremental_inputs_header_writer): Edit comment.
609 (Incremental_inputs_entry): New class.
610 (Incremental_inputs_entry_writer): Edit comment.
611 (Sized_incremental_binary::do_find_incremental_inputs_section):
612 Add *strtab_shndx parameter, fill it.
613 (Sized_incremental_binary::do_check_inputs): New method.
614 (Incremental_checker::can_incrementally_link_output_file): Use
615 Sized_incremental_binary::check_inputs.
616 (Incremental_inputs::report_command_line): Save command line in
619 (Incremental_binary::find_incremental_inputs_section): New
621 (Incremental_binary::do_find_incremental_inputs_section): Add
622 strtab_shndx parameter.
623 (Incremental_binary::do_check_inputs): New pure virtual method.
624 (Sized_incremental_binary::do_check_inputs): Declare.
625 (Incremental_checker::Incremental_checker): Add incremental_inputs
626 parameter, use it to initialize incremental_inputs_.
627 (Incremental_checker::incremental_inputs_): New field.
628 (Incremental_checker::command_line): New method.
629 (Incremental_checker::inputs): New method.
630 (Incremental_checker::command_line_): New field.
632 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
634 * incremental.cc: Include <cstdarg> and "target-select.h".
635 (vexplain_no_incremental): New function.
636 (explain_no_incremental): New function.
637 (Incremental_binary::error): New method.
638 (Sized_incremental_binary::do_find_incremental_inputs_section): New
640 (make_sized_incremental_binary): New function.
641 (open_incremental_binary): New function.
642 (can_incrementally_link_file): Add checks if output is ELF and has
644 * incremental.h: Include "elfcpp_file.h" and "output.h".
645 (Incremental_binary): New class.
646 (Sized_incremental_binary): New class.
647 (open_incremental_binary): Declare.
648 * object.cc (is_elf_object): Use
649 elfcpp::Elf_recognizer::is_elf_file.
650 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
651 * output.h (Output_file::filesize): New method.
653 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
655 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
657 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
658 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
660 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
662 (Arm_relocate_functions::movw_abs_nc): New function.
663 (Arm_relocate_functions::movt_abs): New function.
664 (Arm_relocate_functions::thm_movw_abs_nc): New function.
665 (Arm_relocate_functions::thm_movt_abs): New function.
666 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
667 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
668 (Scan::global): Likewise.
669 (Relocate::relocate): Likewise.
670 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
672 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
674 * arm.cc (Arm_relocate_functions::got_prel) New function.
675 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
676 (Relocate::relocate): Likewise.
677 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
679 2009-10-06 Ian Lance Taylor <iant@google.com>
681 * options.h (class General_options): Define
682 split_stack_adjust_size parameter.
683 * object.h (class Object): Add uses_split_stack_ and
684 has_no_split_stack_ fields. Add uses_split_stack and
685 has_no_split_stack accessor functions. Declare
686 handle_split_stack_section.
687 (class Reloc_symbol_changes): Define.
688 (class Sized_relobj): Define Function_offsets. Declare
689 split_stack_adjust, split_stack_adjust_reltype, and
691 * object.cc (Object::handle_split_stack_section): New function.
692 (Sized_relobj::do_layout): Call handle_split_stack_section.
693 * dynobj.cc (Sized_dynobj::do_layout): Call
694 handle_split_stack_section.
695 * reloc.cc (Sized_relobj::relocate_sections): Call
696 split_stack_adjust for executable sections in split_stack
697 objects. Pass reloc_map to relocate_section.
698 (Sized_relobj::split_stack_adjust): New function.
699 (Sized_relobj::split_stack_adjust_reltype): New function.
700 (Sized_relobj::find_functions): New function.
701 * target-reloc.h: Include "object.h".
702 (relocate_section): Add reloc_symbol_changes parameter. Change
704 * target.h (class Target): Add calls_non_split method. Declare
705 do_calls_non_split virtual method. Declare match_view and
707 * target.cc: Include "elfcpp.h".
708 (Target::do_calls_non_split): New function.
709 (Target::match_view): New function.
710 (Target::set_view_to_nop): New function.
711 * gold.cc (queue_middle_tasks): Give an error if mixing
712 split-stack and non-split-stack objects with -r.
713 * i386.cc (Target_i386::relocate_section): Add
714 reloc_symbol_changes parameter.
715 (Target_i386::do_calls_non_split): New function.
716 * x86_64.cc (Target_x86_64::relocate_section): Add
717 reloc_symbol_changes parameter.
718 (Target_x86_64::do_calls_non_split): New function.
719 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
721 * powerpc.cc (Target_powerpc::relocate_section): Add
722 reloc_symbol_changes parameter.
723 * sparc.cc (Target_sparc::relocate_section): Add
724 reloc_symbol_changes parameter.
725 * configure.ac: Call AM_CONDITIONAL for the default target.
726 * configure: Rebuild.
727 * testsuite/Makefile.am (TEST_AS): New variable.
728 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
729 (check_DATA): Add split_i386 and split_x86_64 files.
730 (SPLIT_DEFSYMS): Define.
731 (split_i386_[1234n].o): New targets.
732 (split_i386_[124]): New targets.
733 (split_i386_[1234r].stdout): New targets.
734 (split_x86_64_[1234n].o): New targets.
735 (split_x86_64_[124]): New targets.
736 (split_x86_64_[1234r].stdout): New targets.
737 (MOSTLYCLEANFILES): Add new executables.
738 * testsuite/split_i386.sh: New file.
739 * testsuite/split_x86_64.sh: New file.
740 * testsuite/split_i386_1.s: New file.
741 * testsuite/split_i386_2.s: New file.
742 * testsuite/split_i386_3.s: New file.
743 * testsuite/split_i386_4.s: New file.
744 * testsuite/split_i386_n.s: New file.
745 * testsuite/split_x86_64_1.s: New file.
746 * testsuite/split_x86_64_2.s: New file.
747 * testsuite/split_x86_64_3.s: New file.
748 * testsuite/split_x86_64_4.s: New file.
749 * testsuite/split_x86_64_n.s: New file.
750 * testsuite/testfile.cc (Target_test): Update relocation_section
752 * testsuite/Makefile.in: Rebuild.
754 2009-10-06 Ian Lance Taylor <iant@google.com>
756 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
757 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
758 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
759 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
760 the address on ldo_addrs_.
761 (Target_i386::Relocate::fix_up_ldo): New function.
763 2009-10-06 Rafael Espindola <espindola@google.com>
765 * plugin.cc (add_input_library): New.
766 (Plugin::load): Add add_input_library to tv.
767 (Plugin_manager::add_input_file): Add the is_lib argument.
768 (add_input_file): Update call to Plugin_manager::add_input_file.
769 (add_input_library): New.
770 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
772 2009-09-30 Doug Kwan <dougkwan@google.com>
774 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
775 symbol and call Symbol::may_need_copy_reloc to determine if
776 a copy reloc is needed.
777 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
778 nocopyreloc is given in command line.
779 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
780 given in command line.
781 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
782 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
783 of the removed Target_i386::may_need_copy_reloc.
784 * options.h (copyreloc): New option with default value false.
785 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
786 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
787 instead of the removed Target_powerpc::may_need_copy_reloc.
788 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
789 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
790 instead of the removed Target_sparc::may_need_copy_reloc.
791 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
792 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
793 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
794 instead of the removed Target_x86_64::may_need_copy_reloc.
796 2009-09-30 Ian Lance Taylor <iant@google.com>
798 * object.h (class Object): Remove target_ field, and target,
799 sized_target, and set_target methods.
800 (Object::sized_target): Remove.
801 (class Sized_relobj): Update declarations. Remove sized_target.
802 * object.cc (Sized_relobj::setup): Remove target parameter.
804 (Input_objects::add_object): Don't do anything with the target.
805 (make_elf_sized_object): Add punconfigured parameter. Change all
806 callers. Set or test parameter target.
807 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
809 * parameters.cc (Parameters::set_target): Change parameter type to
811 (Parameters::default_target): Remove.
812 (set_parameters_target): Change parameter type to be non-const.
813 (parameters_force_valid_target): New function.
814 (parameters_clear_target): New function.
815 * parameters.h (class Parameters): Update declarations. Remove
816 default_target method. Add sized_target and clear_target
817 methods. Change target_ to be non-const.
818 (set_parameters_target): Update declaration.
819 (parameters_force_valid_target): Declare.
820 (parameters_clear_target): Declare.
821 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
822 as NULL if we aren't searching.
823 (Add_symbols::run): Don't check for compatible target.
824 * fileread.cc (Input_file::open_binary): Call
825 parameters_force_valid_target.
826 * gold.cc (queue_middle_tasks): Likewise.
827 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
828 set_target on object.
829 * dynobj.h (class Sized_dynobj): Update declarations.
830 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
831 make_elf_object returns NULL.
832 (Archive::include_member): Don't check whether object target is
834 * output.cc (Output_section::add_input_section): Get target from
836 (Output_section::relax_input_section): Likewise.
837 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
839 (Sized_relobj::do_scan_relocs): Likewise.
840 (Sized_relobj::relocate_sections): Likewise.
841 * resolve.cc (Symbol_table::resolve): Likewise.
842 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
843 parameter. Change all callers.
844 (Symbol_table::add_from_object): Get target from parameters.
845 (Symbol_table::add_from_relobj): Don't check object target.
846 (Symbol_table::add_from_dynobj): Likewise.
847 (Symbol_table::define_special_symbol): Get target from
849 * symtab.h (class Symbol_table): Update declaration.
850 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
851 parameter. Change all callers. Clear parameter target.
852 (Binary_test): Test target here.
853 * testsuite/object_unittest.cc (gold_testsuite): Remove
854 target_test_pointer parameter. Change all callers.
855 (Object_test): Test target here.
857 2009-09-26 Ian Lance Taylor <iant@google.com>
859 * testsuite/initpri1.c: Don't try to use constructor priorities if
860 compiling with gcc before 4.3.
862 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
864 * testsuite/retain_symbols_file_test.sh (check_present): Change
865 output file name to retain_symbols_file_test.stdout.
866 (check_absent): Likewise.
868 2009-09-18 Craig Silverstein <csilvers@google.com>
870 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
871 * options.cc: Include <cerrno> and <fstream>.
872 (General_options::finalize): Parse -retain-symbols-file tag.
873 * options.h: New flag.
874 (General_options): New method should_retain_symbol, new
875 variable symbols_to_retain.
876 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
877 should_retain_symbol map.
878 * testsuite/Makefile.am (retain_symbols_file_test): New test.
879 * testsuite/Makefile.in: Regenerate.
880 * testsuite/retain_symbols_file_test.sh: New file.
882 2009-09-18 Nick Clifton <nickc@redhat.com>
884 * po/es.po: Updated Spanish translation.
886 2009-09-17 Doug Kwan <dougkwan@google.com>
888 * debug.h (DEBUG_RELAXATION): New constant.
889 (DEBUG_ALL): Add DEBUG_RELAXATION.
890 (debug_string_to_enum): Add relaxation debug option.
892 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
893 Layout::Relaxation_debug_check::read_sections,
894 Layout::Relaxation_debug_check::read_sections): New method definitions.
895 (Layout::Layout): Initialize data members
896 record_output_section_data_from_scrips_,
897 script_output_section_data_list_ and relaxation_debug_check_.
898 (Layout::save_segments, Layout::restore_segments,
899 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
900 Layout::relaxation_loop_body): New method definitions.
901 (Layout::finalize): Support relaxation. Move section layout code to
902 Layout::relaxation_loop_body.
903 (Layout::set_asection_address_from_script): Move code for orphan
904 section placement out.
905 (Layout::place_orphan_sections_in_script): New method definition.
906 * layout.h (Output_segment_headers, Output_file_header):
907 New forward class declarations.
908 (Layout::~Layout): Define.
909 (Layout::new_output_section_data_from_script): New method definition.
910 (Layout::place_orphan_sections_in_script): New method declaration.
911 (Layout::Segment_states): New type declaration.
912 (Layout::save_segments, Layout::restore_segments,
913 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
914 Layout::relaxation_loop_body): New method declarations.
915 (Layout::Output_section_data_list): New type declaration.
916 (Layout::Relaxation_debug_check): New class definition.
917 (Layout::record_output_section_data_from_script_,
918 Layout::script_output_section_data_list_, Layout::segment_states_,
919 Layout::relaxation_debug_check_): New data members.
920 * output.cc: (Output_section_headers::do_size): New method definition.
921 (Output_section_headers::Output_section_headers): Move size
922 computation to Output_section_headers::do_size.
923 (Output_segment_headers::do_size): New method definition.
924 (Output_file_header::Output_file_header): Move size computation to
925 Output_file_header::do_size and call it.
926 (Output_file_header::do_size): New method definition.
927 (Output_data_group::Output_data_group): Adjust call to
929 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
930 (Output_symtab_xindex::do_write): Add array bound check.
931 (Output_section::Input_section::print_to_mapfile): Handle
932 RELAXED_INPUT_SECTION_CODE.
933 (Output_section::Output_section): Initialize data member checkpoint_.
934 (Output_section::~Output_section): Delete checkpoint object pointed
936 (Output_section::add_input_section): Always add an Input_section if
938 (Output_section::add_merge_input_section): Add assert.
939 (Output_section::relax_input_section): New method definition.
940 (Output_section::set_final_data_size): Set load address to zero for
941 an unallocated section.
942 (Output_section::do_address_and_file_offset_have_reset_values):
943 New method definition.
944 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
945 Handle relaxed input section.
946 (Output_section::sort_attached_input_sections): Checkpoint input
948 (Output_section::get_input_sections): Change type of input_sections to
949 list of Simple_input_section pointers. Checkpoint input section list
950 lazily. Also handle relaxed input sections.
951 (Output_section::add_input_section_for_script): Take a reference to
952 a Simple_input_section object instead of Relobj pointer and section
953 index as parameter. Handle relaxed input sections.
954 (Output_section::save_states, Output_section::restore_states): New
956 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
957 (Output_data::is_data_size_fixed): New method definition.
958 (Output_data::reset_addresss_and_file_offset): Do not reset data size
960 (Output_data::address_and_file_offset_have_reset_values): New method
962 (Output_data::do_address_and_file_offset_have_reset_values): New method
964 (Output_data::set_data_size): Check that data size is not fixed.
965 (Output_data::fix_data_size): New method definition.
966 (Output_data::is_data_size_fixed_): New data member.
967 (Output_section_headers::set_final_data_size): New method definition.
968 (Output_section_headers::do_size): New method declaration.
969 (Output_segment_headers::set_final_data_size): New method definition.
970 (Output_segment_headers::do_size): New method declaration.
971 (Output_file_header::set_final_data_size)::New method definition.
972 (Output_file_header::do_size)::New method declaration.
973 (Output_section_data::Output_section_data): Add new parameter
974 is_data_size_fixed and use it to fix data size.
975 (Output_data_const::Output_data_const): Adjust call to base class
976 constructor and fix data size.
977 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
978 base class constructor and fix data size.
979 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
980 base class constructor and fix data size.
981 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
982 class constructor and fix data size.
983 (Output_data_group::set_final_data_size): New method definition.
984 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
985 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
986 class constructor and fix data size.
987 (Output_relaxed_input_section): New class definition.
988 (Output_section::Simple_input_section): New class definition.
989 (Output_section::get_input_sections): Adjust parameter list.
990 (Output_section::add_input_section_for_script): Same.
991 (Output_section::save_states, Output_section::restore_states,
992 Output_section::do_address_and_file_offset_have_reset_values,
993 (Output_section::Input_section::Input_section): Handle
994 RELAXED_INPUT_SECTION_CODE. Add new overload for
995 Output_relaxed_input_section.
996 (Output_section::Input_section::is_input_section,
997 Output_section::Input_section::set_output_section): Handle relaxed
999 (Output_section::Input_section::is_relaxed_input_section,
1000 Output_section::Input_section::output_section_data,
1001 Output_section::Input_section::relaxed_input_section): New method
1003 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1005 (Output_section::Input_section::u1_): Update comments.
1006 (Output_section::Input_section::u2_): Add new union member poris.
1007 (Output_section::Checkpoint_output_section): New classs definition.
1008 (Output_section::relax_input_section): New method declaration.
1009 (Output_section::checkpoint_): New data member.
1010 (Output_segment): Update comments.
1011 (Output_segment::Output_segment): Un-privatize copy constructor.
1012 (Output_segment::operator=): Un-privatize.
1013 * script-sections.cc (Output_section_element::Input_section_list):
1014 Change element type to Output_section::Simple_input_section.
1015 (Output_section_element_dot_assignment::set_section_addresses):
1016 Register output section data for relaxation clean up.
1017 (Output_data_exression::Output_data_expression): Adjust call to base
1018 constructor to fix data size.
1019 (Output_section_element_data::set_section_addresses): Register
1020 Output_data_expression object for relaxation clean up.
1021 (struct Input_section_info): Replace Relobj pointer and section index
1022 pair with Output_section::Simple_input_section and Convert struct to a
1024 (Input_section_sorter::operator()): Adjust access to
1025 Input_section_info data member to use accessors.
1026 (Output_section_element_input::set_section_addresses): Use layout
1027 parameter. Adjust code to use Output_section::Simple_input_section
1028 and Input_secction_info classes. Register filler for relaxation
1030 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1031 and section index pair with Output_section::Simple_input_section
1032 class. Adjust code accordingly.
1033 (Phdrs_element::release_segment): New method definition.
1034 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1036 (Script_sections::release_segments): New method definition.
1037 * gold/script-sections.h (Script_sections::release_segments): New
1039 * gold/target.h (Target::may_relax, Target::relax,
1040 Target::do_may_relax, Target::do_relax): New method definitions.
1042 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1044 * arm.cc (has_signed_unsigned_overflow): New function.
1045 (Arm_relocate_functions::abs8): New function.
1046 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1047 (Target_arm::Scan::global): Likewise.
1048 (Target_arm::relocate::relocate): Likewise.
1049 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1052 2009-09-16 Cary Coutant <ccoutant@google.com>
1054 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1055 * testsuite/Makefile.in: Regenerate.
1057 2009-09-11 Nick Clifton <nickc@redhat.com>
1059 * po/gold.pot: Updated by the Translation project.
1061 2009-09-08 Cary Coutant <ccoutant@google.com>
1063 * output.cc (Output_file::open): Add execute permission to empty file.
1064 * testsuite/Makefile.am (permission_test): New test.
1065 * testsuite/Makefile.in: Regenerate.
1067 2009-09-02 Ian Lance Taylor <iant@google.com>
1069 * output.cc (Output_file::resize): Call map_no_anonymous rather
1072 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1074 * gold.cc: Include "incremental.h".
1075 (queue_initial_tasks): Call Incremental_checker methods.
1076 * incremental.cc: Include "output.h".
1077 (Incremental_checker::can_incrementally_link_output_file): New
1079 * incremental.h (Incremental_checker): New class.
1081 * output.cc (Output_file::open_for_modification): New method.
1082 (Output_file::map_anonymous): Changed return type to bool. Record
1084 (Output_file::map_no_anonymous): New method, broken out of map.
1085 (Output_file::map): Use map_no_anonymous and map_anonymous.
1086 * output.h (class Output_file): Update declarations.
1088 2009-08-24 Cary Coutant <ccoutant@google.com>
1090 * options.h (Command_line::Pre_options): New class.
1091 (Command_line::pre_options): New member.
1092 * options.cc (gold::options::ready_to_register): New variable.
1093 (One_option::register_option): Do nothing if not registering options.
1094 Assert if same short option registered twice.
1095 (General_options::General_options): Turn off option registration when
1097 (Command_line::Pre_options::Pre_options): New constructor.
1099 2009-08-24 Cary Coutant <ccoutant@google.com>
1101 * options.h (General_options::no_keep_memory): Remove incorrect
1104 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1106 * Makefile.am (am__skiplex, am__skipyacc): New.
1107 * Makefile.in: Regenerate.
1109 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1111 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1112 (INCLUDES): ... this.
1113 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1114 (AM_CPPFLAGS): Renamed from ...
1115 (INCLUDE): ... this.
1116 * Makefile.in, testsuite/Makefile.in: Regenerate.
1118 * Makefile.in: Regenerate.
1119 * aclocal.m4: Likewise.
1120 * config.in: Likewise.
1121 * configure: Likewise.
1122 * testsuite/Makefile.in: Likewise.
1124 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1125 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1126 * Makefile.in: Regenerate.
1127 * testsuite/Makefile.in: Regenerate.
1129 2009-08-19 Cary Coutant <ccoutant@google.com>
1131 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1132 symbols in shared libraries overridden by hidden or internal symbols
1133 in the main program.
1135 2009-08-19 Chris Demetriou <cgd@google.com>
1137 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1138 checking source file names in error messages.
1140 2009-08-18 Doug Kwan <dougkwan@google.com>
1142 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1143 an elcpp::Ehdr as parameter. Adjust call to set_target.
1144 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1145 an elfcpp::Ehdr as parameter.
1146 * object.cc (Object::set_target): Remove the version that looks up
1147 a target and sets it.
1148 (Sized_relobj::setup): Take a Target object instead of
1149 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1150 (make_elf_sized_object): Find target and ask target to
1152 * object.h: (Object::set_target): Remove the version that looks up
1153 a target and sets it.
1154 (Sized_relobj::setup): Take a Target object instead of
1155 an elfcpp:Ehdr as parameter.
1156 * target.cc: Include dynobj.h.
1157 (Target::do_make_elf_object_implementation): New.
1158 (Target::do_make_elf_object): New.
1159 * target.h (Target::make_elf_object): New template declaration.
1160 (Target::do_make_elf_object): New method declarations.
1161 (Target::do_make_elf_object_implementation): New template declaration.
1163 2009-08-14 Ian Lance Taylor <iant@google.com>
1165 * gold.h (FUNCTION_NAME): Define.
1166 (gold_unreachable): Use FUNCTION_NAME.
1168 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1170 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1171 symbol in the --keep-unique list is not found.
1173 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1175 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1176 been maked as --keep-unique.
1177 (Icf::unfold_section): New function.
1178 * icf.h (Icf::unfold_section): New function.
1179 * options.h (General_options::keep_unique): New option.
1180 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1181 * testsuite/Makefile.in: Regenerate.
1182 * testsuite/icf_keep_unique_test.sh: New file.
1183 * testsuite/icf_keep_unique_test.cc: New file.
1185 2009-08-12 Cary Coutant <ccoutant@google.com>
1188 * resolve.cc (Symbol_table::resolve): Check for references from
1189 dynamic objects to hidden and internal symbols.
1190 * testsuite/Makefile.am (hidden_test.sh): New test.
1191 * testsuite/Makefile.in: Regenerate.
1192 * testsuite/hidden_test.sh: New script.
1193 * testsuite/hidden_test_1.c: New test source.
1194 * testsuite/hidden_test_main.c: New test source.
1196 2009-08-11 Doug Kwan <dougkwan@google.com>
1198 * arm.cc: Update comments.
1199 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1200 segment to locate the .ARM.exidx section if present.
1202 2009-08-09 Doug Kwan <dougkwan@google.com>
1204 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1207 2009-08-07 Sriraman Tallam <tmsriram@google.com>
1208 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1211 2009-08-06 Sriraman Tallam <tmsriram@google.com>
1213 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1214 valid tls_segment only for non-debug-section relocations.
1215 * testsuite/Makefile.am: Add gc_tls_test.
1216 * testsuite/Makefile.in: Regenerate.
1217 * testsuite/gc_tls_test.cc: New file.
1218 * testsuite/gc_tls_test.sh: New file.
1220 2009-08-05 Sriraman Tallam <tmsriram@google.com>
1224 * Makefile.am (CCFILES): Add icf.cc.
1226 * Makefile.in: Regenerate.
1227 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1228 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1229 section, symbol and addend information for the relocs.
1230 * gold.cc (queue_middle_tasks): Call identical code folding.
1231 * gold.h: Add defines for multimap.
1232 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1233 to the call of finalize_local_symbols.
1234 * main.cc (main): Create object of class Icf.
1235 * object.cc (Sized_relobj::do_layout): Allow this function to be
1236 called twice during icf.
1237 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1238 to sections marked as identical by icf.
1239 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1241 (Sized_relobj::do_section_entsize): New function.
1242 * object.h (Object::section_entsize): New function.
1243 (Object::do_section_entsize): New pure virtual function.
1244 (Relobj::finalize_local_symbols): Add new parameter.
1245 (Relobj::do_section_entsize): New function.
1246 * options.h (General_options::icf): New option.
1247 (General_options::icf_iterations): New option.
1248 (General_options::print_icf_sections): New option.
1249 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1250 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1251 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1253 * symtab.cc (Symbol_table::is_section_folded): New function.
1254 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1255 to sections marked as identical by icf.
1256 * symtab.h (Symbol_table::set_icf): New function.
1257 (Symbol_table::icf): New function.
1258 (Symbol_table::is_section_folded): New function.
1259 (Symbol_table::icf_): New data member.
1260 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1261 * testsuite/Makefile.am: Add commands to build icf_test.
1262 * testsuite/Makefile.in: Regenerate.
1263 * testsuite/icf_test.sh: New file.
1264 * testsuite/icf_test.cc: New file.
1266 2009-07-24 Chris Demetriou <cgd@google.com>
1268 * layout.cc (is_compressible_debug_section): Fix incorrect
1269 comment about compressed section names.
1271 2009-07-20 Ian Lance Taylor <ian@airs.com>
1274 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1276 2009-07-16 Ian Lance Taylor <iant@google.com>
1279 * layout.h: #include <map>.
1280 (class Kept_section): Change from struct to class. Add accessors
1281 and setters. Add section size to Comdat_group mapping. Change
1282 Comdat_group to std::map. Add is_comdat_ field. Add
1283 linkonce_size field in union.
1284 (class Layout): Update declaration of find_or_add_kept_section.
1285 Don't declare find_kept_object.
1286 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1287 parameter. Add object, shndx, is_comdat, and is_group_name
1288 parameters. Change all callers. Adjust for new Kept_section.
1289 (Layout::find_kept_object): Remove.
1290 * object.cc (Sized_relobj::include_section_group): Update use of
1291 Kept_section. Rename secnum to shndx. Only record
1292 Kept_comdat_section if sections are the same size.
1293 (Sized_relobj::include_linkonce_section): Update use of
1294 Kept_section. Only record Kept_comdat_section if sections are the
1295 same size. Set size of linkonce section.
1296 (Sized_relobj::map_to_kept_section): Update call to
1297 get_kept_comdat_section.
1298 * object.h (class Sized_relobj): Rename fields in
1299 Kept_comdat_section to drop trailing underscores; change object
1300 field to Relobj*. Change Kept_comdat_section_table to store
1301 struct rather than pointer.
1302 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1303 Add kept_object and kept_shndx parameters. Change all callers.
1304 (Sized_relobj::get_kept_comdat_section): Change return type to
1305 bool. Add kept_object and kept_shndx parameters. Change all
1307 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1308 Layout::find_or_add_kept_section.
1310 2009-07-09 Ian Lance Taylor <iant@google.com>
1312 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1313 Reserve space in the hash table.
1315 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1317 * fileread.cc (File_read::get_mtime): New method.
1318 * fileread.h (Timespec): New structure.
1319 (File_read::get_mtime): New method.
1320 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1321 Renamed from timestamp_nsec.
1322 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1324 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1326 (Incremental_inputs::report_archive): Save mtime; style fix.
1327 (Incremental_inputs::report_obejct): Save mtime; style fix.
1328 (Incremental_inputs::report_script): Save mtime; style fix.
1329 (Incremental_inputs::finalize_inputs): Style fix.
1330 (Incremental_inputs::finalize): Style fix.
1331 (Incremental_inputs::create_input_section_data): Store inputs
1333 * incremental.h (Incremental_inputs::report_script): Add mtime
1335 (Incremental_inputs::Input_info::Input_info): Intialize only one
1337 (Incremental_inputs::Input_info::archive): Move to nameless
1339 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1340 (Incremental_inputs::Input_info::script): Move to nameless union.
1341 (Incremental_inputs::mtime): New field.
1342 * script.cc (read_input_script): Pass file mtime to
1344 * script.h (Script_info::inputs): Style fix.
1346 2009-07-01 Ian Lance Taylor <ian@airs.com>
1348 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1351 2009-06-24 Ian Lance Taylor <iant@google.com>
1354 * layout.cc (Layout::choose_output_section): If we find an
1355 existing section, update the flags.
1356 (Layout::create_notes): New function, broken out of
1358 (Layout::finalize): Don't create note sections.
1359 (Layout::create_note): Don't crash if linker script discards
1361 (Layout::create_gold_note): Likewise.
1362 (Layout::create_build_id): Likewise. Don't set
1363 after_input_sections on the section.
1364 (Layout::create_executable_stack_info): Remove target parameter.
1366 * layout.h (class Layout): Declare create_notes. Update
1367 declaration of create_executable_stack_info.
1368 * gold.cc (queue_middle_tasks): Call create_notes.
1369 * output.cc (Output_section::update_flags_for_input_section): Move
1370 here from output.h. If SHF_ALLOC flag is newly set, mark address
1372 * output.h (Output_data::mark_address_invalid): New function.
1373 (class Output_section): Only declare, not define,
1374 update_flags_for_input_section. Remove set_flags.
1376 2009-06-24 Ian Lance Taylor <iant@google.com>
1378 * script-sections.cc (Output_section_definition::
1379 set_section_addresses): Rename shadowing local load_address to
1382 2009-06-24 Ian Lance Taylor <iant@google.com>
1385 * reloc.cc (relocate_sections): Skip empty relocation sections.
1387 2009-06-23 Ian Lance Taylor <iant@google.com>
1390 * layout.cc (Layout::create_note): Use choose_output_section
1391 rather than make_output_section.
1393 2009-06-23 Ian Lance Taylor <iant@google.com>
1396 * options.cc (General_options::parse_V): Set printed_version_.
1397 (General_options::General_options): Initialize printed_version_.
1398 * options.h (class General_options): Add printed_version_ field.
1399 * gold.cc (queue_initial_tasks): If there are no input files,
1400 don't give a fatal error if we printed the version information.
1401 (queue_middle_tasks): If using -r with a shared object, give a
1402 fatal error rather than an ordinary error.
1404 2009-06-23 Ian Lance Taylor <iant@google.com>
1407 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1408 (Layout::make_output_section): Set have_stabstr_section_ if we see
1409 a .stab*str section.
1410 (Layout::finalize): Call link_stabs_sections.
1411 (Layout::link_stabs_sections): New file.
1412 * layout.h (class Layout): Add have_stabstr_section_ field.
1413 Declare link_stabs_sections.
1415 2009-06-23 Doug Kwan <dougkwan@google.com>
1417 * Makefile.am (libgold_a_LIBADD): New.
1418 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1419 * Makefile.in: Regenerate.
1420 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1421 * configure: Regenerate.
1422 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1423 * fileread.cc: Include sys/state.h
1424 * gold.h: Declare memmem and strndup if found missing.
1425 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1427 2009-06-23 Ian Lance Taylor <iant@google.com>
1429 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1430 * configure: Rebuild.
1432 2009-06-23 Ian Lance Taylor <iant@google.com>
1435 * object.cc (Object::section_contents): Don't try to get a view if
1436 the section has length zero.
1437 (Object::handle_gnu_warning_section): If the section is empty, use
1438 the name of the section as the warning.
1440 2009-06-23 Ian Lance Taylor <iant@google.com>
1443 * stringpool.h (class Stringpool_template): Add optimize_ field.
1444 (Stringpool_template::set_optimize): New function.
1445 * stringpool.cc (Stringpool_template::Stringpool_template):
1446 Initialize optimize_ field.
1447 (Stringpool_template::set_string_offsets): Test local optimize
1448 fild rather than parameter.
1449 * layout.cc (Layout::Layout): Call set_optimize on the section
1452 2009-06-22 Ian Lance Taylor <iant@google.com>
1455 * yyscript.y: Parse TARGET.
1456 * script.cc (script_set_target): New function.
1457 * script-c.h (script_set_target): Declare.
1458 * options.cc (General_options::string_to_object_format): Rename
1459 from string_to_object_format in anonymous namespace. Change
1461 * options.h (class General_options): Declare
1462 string_to_object_format.
1464 2009-06-22 Ian Lance Taylor <iant@google.com>
1466 * script-sections.cc (Script_sections::create_segments): Don't put
1467 program headers in a PT_LOAD segment if -n or -N.
1469 2009-06-22 Ian Lance Taylor <iant@google.com>
1472 * options.h (class General_options): Add -z lazy and -z now. Sort
1473 -z options into alphabetical order.
1474 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1476 2009-06-21 Ian Lance Taylor <iant@google.com>
1478 * layout.cc (Layout::make_output_section): Call
1479 Target::new_output_section.
1480 (Layout::attach_allocated_section_to_segment): Put large section
1481 sections in a separate load segment with the large segment flag
1483 (Layout::segment_precedes): Sort large data segments after other
1485 (align_file_offset): New static function.
1486 (Layout::set_segment_offsets): Use align_file_offset.
1487 * output.h (class Output_section): Add is_small_section_ and
1488 is_large_section_ fields.
1489 (Output_section::is_small_section): New function.
1490 (Output_section::set_is_small_section): New function.
1491 (Output_section::is_large_section): New function.
1492 (Output_section::set_is_large_section): New function.
1493 (Output_section::is_large_data_section): New function.
1494 (class Output_segment): Add is_large_data_segment_ field.
1495 (Output_segment::is_large_data_segment): New function.
1496 (Output_segment::set_is_large_data_segment): New function.
1497 * output.cc (Output_section::Output_section): Initialize new
1499 (Output_segment::Output_segment): Likewise.
1500 (Output_segment::add_output_section): Add assertion that large
1501 data sections always go in large data segments. Force small data
1502 sections to the end of the list of data sections. Force small BSS
1503 sections to the start of the list of BSS sections. For large BSS
1504 sections to the end of the list of BSS sections.
1505 * symtab.h (class Symbol): Declare is_common_shndx.
1506 (Symbol::is_defined): Check Symbol::is_common_shndx.
1507 (Symbol::is_common): Likewise.
1508 (class Symbol_table): Define enum Commons_section_type. Update
1509 declarations. Add small_commons_ and large_commons_ fields.
1510 * symtab.cc (Symbol::is_common_shndx): New function.
1511 (Symbol_table::Symbol_table): Initialize new fields.
1512 (Symbol_table::add_from_object): Put small and large common
1513 symbols in the right list.
1514 (Symbol_table::sized_finalized_symbol): Check
1515 Symbol::is_common_shndx.
1516 (Symbol_table::sized_write_globals): Likewise.
1517 * common.cc (Symbol_table::do_allocate_commons): Allocate new
1518 common symbol lists. Don't call do_allocate_commons_list if the
1520 (Symbol_table::do_allocate_commons_list): Remove is_tls
1521 parameter. Add comons_section_type parameter. Change all
1522 callers. Handle small and large common symbols.
1523 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
1524 Symbol::is_common_shndx.
1525 * resolve.cc (symbol_to_bits): Likewise.
1526 * target.h (Target::small_common_shndx): New function.
1527 (Target::small_common_section_flags): New function.
1528 (Target::large_common_shndx): New function.
1529 (Target::large_common_section_flags): New function.
1530 (Target::new_output_section): New function.
1531 (Target::Target_info): Add small_common_shndx, large_common_shndx,
1532 small_common_section_flags, and large_common_section_flags
1534 (Target::do_new_output_section): New virtual function.
1535 * arm.cc (Target_arm::arm_info): Initialize new fields.
1536 * i386.cc (Target_i386::i386_info): Likewise.
1537 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1539 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
1540 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1541 (Target_x86_64::do_new_output_section): New function.
1542 * configure.ac: Define conditional MCMODEL_MEDIUM.
1543 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1544 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1545 (large_LDFLAGS): Define.
1546 * testsuite/large.c: New file.
1547 * testsuite/testfile.cc (Target_test::test_target_info):
1548 Initialize new fields.
1549 * configure, testsuite/Makefile.in: Rebuild.
1551 2009-06-05 Doug Kwan <dougkwan@google.com>
1553 * Makefile.am (CCFILES): Add target.cc.
1554 * Makefile.in: Regenerate.
1555 * i386.cc (class Target_i386): Define new virtual method to
1556 override do_is_local_label_name in parent.
1557 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1558 local symbols if --discard-locals or -X is given.
1559 * options.h (class General_options): Declare new options
1560 '--discard-locals' and '-X' for discarding locals.
1561 * target.h (class Target): Define new methods is_local_label_name.
1562 Declare new virtual method do_is_local_label_name.
1563 * target.cc: New file.
1564 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1565 (check_SCRIPTS): Add discard_locals_test.sh.
1566 (check_DATA): Add discard_local_tests.syms.
1567 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1568 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1569 * testsuite/Makefile.in: Regenerate.
1570 * testsuite/discard_locals_test.c: New file.
1571 * testsuite/discard_locals_test.sh: Same.
1573 2009-06-05 Doug Kwan <dougkwan@google.com>
1575 * object.cc (Sized_relobj::Sized_relobj): Initialize
1576 discarded_eh_frame_shndx_ to -1U.
1577 (Sized_relobj::do_layout): Record index of a discard .eh_frame
1579 (Sized_relobj::do_count_local_symbols): Skip local symbols in
1580 a discarded .eh_frame section.
1581 (Sized_relobj::do_finalize_local_symbols): Ditto.
1582 * object.h (class Sized_relobj): Declare new member
1583 discarded_eh_frame_shndx_.
1584 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
1585 (local_labels_test.o, local_labels_test): New rules.
1586 * testsuite/Makefile.in: Regenerate.
1588 2009-06-04 Doug Kwan <dougkwan@google.com>
1590 * layout.cc (Layout::section_name_mapping): Add mapping for
1591 special ARM sections.
1593 2009-06-03 Doug Kwan <dougkwan@google.com>
1595 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
1596 (utils::has_overflow): Same.
1598 2009-06-03 Ian Lance Taylor <iant@google.com>
1600 * layout.cc (Layout::section_name_mapping): New array, replacing
1601 Layout::linkonce_mapping.
1602 (Layout::section_name_mapping_count): New variable, replacing
1603 Layout::linkonce_mapping_count.
1604 (Layout::linkonce_output_name): Remove.
1605 (Layout::output_section_name): Rewrite.
1606 * layout.h (class Layout): Rename Linkonce_mapping to
1607 Section_name_mapping, linkonce_mapping to section_name_mapping,
1608 linkonce_mapping_count to section_name_mapping_count. Don't
1609 declare linkonce_output_name.
1611 2009-06-03 Doug Kwan <dougkwan@google.com>
1613 * gold/arm.cc (namespace utils): New.
1614 (Target_arm::reloc_is_non_pic): Define new method.
1615 (class Arm_relocate_functions): New.
1616 (Target_arm::Relocate::relocate): Handle relocation types used by
1619 2009-06-03 Ian Lance Taylor <iant@google.com>
1621 * arm.cc (Target_arm::scan::global): Use || instead of |.
1623 2009-06-02 Doug Kwan <dougkwan@google.com>
1625 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
1626 issued_non_pic_error_.
1627 (class Target_arm::Scan): Declare new method check_non_pic.
1628 Define new method symbol_needs_plt_entry.
1629 Declare new data member issued_non_pic_error_.
1630 (class Target_arm::Relocate): Declare new method
1631 should_apply_static_reloc.
1632 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
1633 (Target_arm::Scan::check_non_pic): Define new method.
1634 (Target_arm::Scan::local): Handle a small subset of reloc types used
1636 (Target_arm::Scan::local): Same.
1637 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
1639 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
1641 * incremental.cc (Incremental_inputs::report_command_line): Filter
1642 out --incremental-* options.
1644 2009-05-29 Doug Kwan <dougkwan@google.com>
1646 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
1648 (class Target_arm): Update comment.
1649 (Target_arm::Target_arm): Initialize new data members GOT_,
1650 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
1651 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
1652 and Target_arm::rel_dyn_section.
1653 Declare new_enum Target_arm::Got_type.
1654 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
1656 Update commments for member do_dynsym_value.
1657 (Target_arm::got_size, Target_arm::plt_section,
1658 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
1659 new methods inside class defintion.
1660 (Target_arm::got_section): Define new method.
1661 (Target_arm::rel_dyn_section): Same.
1662 (Output_data_plt_arm): New template class.
1663 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
1664 (Output_data_plt_arm:do_adjust_output_section): Define new method.
1665 (Output_data_plt_arm::add_entry): Same.
1666 (Output_data_plt_arm::first_plt_entry): Define new
1667 static data member for PLT instruction template.
1668 (Output_data_plt_arm::plt_entry): Same.
1669 (Output_data_plt_arm::do_write): Define new method.
1670 (Target_arm::make_plt_entry): Same.
1671 (Target_arm::do_finalize_sections): Same.
1672 (Target_arm::do_dynsym_value): Same.
1674 2009-05-28 Doug Kwan <dougkwan@google.com>
1676 * Makefile.am (TARGETSOURCES): Add arm.cc.
1677 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
1678 * Makefile.in: Regenerate.
1680 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
1682 2009-05-26 Doug Kwan <dougkwan@google.com>
1684 * options.cc (General_options::parse_exclude_libs). Fix a comment.
1685 (General_options::check_excluded_libs): Strip off directories in
1686 archive name before matching like GNU ld does.
1687 * testsuite/Makefile.am (MOSTLYCLEANFILES,
1688 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
1689 (exclude_libs_test_LDFLAGS): Add linker option
1690 -Wl,--exclude-libs,libexclude_libs_test_3
1691 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
1692 an explicit archive without using -l.
1693 (alt/libexclude_libs_test_3.a): New make rule.
1694 * testsuite/Makefile.in: Regenerate.
1695 * testsuite/exclude_libs_test.c : Declare lib3_default().
1697 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
1698 * exclude_libs_test_3.c: New file.
1700 2009-05-26 Nick Clifton <nickc@redhat.com>
1702 * po/id.po: New Indonesian translation.
1703 * po/gold.pot: Updated template file.
1705 2009-05-22 Sriraman Tallam <tmsriram@google.com>
1707 * testsuite/Makefile.am: Add -ffunction-sections to compile
1708 gc_comdat_test files. Add -Wl,--gc-sections to build
1710 * testsuite/Makefile.in: Regenerate.
1711 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
1713 2009-05-21 Sriraman Tallam <tmsriram@google.com>
1715 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
1716 kept comdat section was garbage collected.
1717 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
1718 * testsuite/Makefile.in: Regenerate.
1719 * testsuite/gc_comdat_test.sh: New file.
1720 * testsuite/gc_comdat_test_1.cc: New file.
1721 * testsuite/gc_comdat_test_2.cc: New file.
1723 2009-05-19 Doug Kwan <dougkwan@google.com>
1725 * archive.cc (Archive::Archive): Move constructor from archive.h
1726 to here. Initialize no_export_.
1727 (Archive::get_elf_object_for_member): Set no_export flag of object.
1728 * archive.h (Archive::Archive): Move constructor body to
1730 (Archive::no_export): New method.
1731 (Archive::no_export_): New field.
1732 * object.h (Object::Object): Initialize no_export_ to false.
1733 (Object::no_export, Object::set_no_export): New methods.
1734 (Object::no_export_): New field.
1735 * options.cc (General_options::parse_exclude_libs): New method.
1736 (General_options::check_excluded_libs) Same.
1737 * options.h (exclude_libs): New option.
1738 (General_options::check_excluded_libs): New method declaration.
1739 (General_options::excluded_libs_): New field.
1740 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
1741 default or protected visibility if an object has no-export flag set.
1742 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
1743 (check_SCRIPTS): Add exclude_libs_test.sh.
1744 (check_DATA): Add exclude_libs_test.syms.
1745 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
1746 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
1747 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
1748 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
1749 (exclude_libs_test.syms, libexclude_libs_test_1.a,
1750 libexclude_libs_test_2.a): New rules.
1751 * testsuite/Makefile.in: Regenerate.
1752 * testsuite/exclude_libs_test.c: New file.
1753 * testsuite/exclude_libs_test.sh: Ditto.
1754 * testsuite/exclude_libs_test_1.c: Ditto.
1755 * testsuite/exclude_libs_test_2.c: Ditto.
1757 2009-05-15 Ian Lance Taylor <iant@google.com>
1759 * configure.ac: Check for declarations for cases where libiberty.h
1760 checks HAVE_DECL_xxx.
1761 * configure, config.in: Rebuild.
1763 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
1765 * gold.h (Incremental_argument_list): Remove (invalid) forward
1767 * incremental.cc (Incremental_inputs::report_achive): New method.
1768 (Incremental_inputs::report_object): New method.
1769 (Incremental_inputs::report_script): New method.
1770 (Incremental_inputs::finalize_inputs): New method.
1771 (Incremental_inputs::finalize): Call finalize_inputs().
1772 (Incremental_inputs::sized_create_incremental_inputs_section_data):
1773 Create inputs entries.
1774 * incremental.h (Incremental_input_type): New enum.
1775 (Incremental_inputs::Incremental_input): Initialize new fields.
1776 (Incremental_inputs::report_inputs): New method.
1777 (Incremental_inputs::report_achive): New method.
1778 (Incremental_inputs::report_object): New method.
1779 (Incremental_inputs::report_script): New method.
1780 (Incremental_inputs::finalize_inputs): New method.
1781 (Incremental_inputs::Input_info): New struct.
1782 (Incremental_inputs::Input_info_map): New typedef.
1783 (Incremental_inputs::lock_): New field.
1784 (Incremental_inputs::Inputs_): New field.
1785 (Incremental_inputs::Inputs_map): New field.
1786 * main.cc (main): Call Incremental_input::report_inputs.
1787 * options.h (Input_argument_list): Typedef moved from
1789 (Input_file_group::Files): Remove, use ::Input_argument_list.
1790 (Input_file_group::Input_argument_list): Remove, use
1791 ::Input_argument_list.
1792 * plugin.cc (Plugin_manager::add_input_file): Add error in
1794 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
1796 * script.cc (read_input_script): Call
1797 Incremental_input::report_script.
1798 * script.h (Script_info): New class.
1800 2009-04-27 Ian Lance Taylor <iant@google.com>
1802 * x86_64.cc (do_adjust_output_section): Set entsize to
1805 2009-04-23 Elliott Hughes <enh@google.com>
1807 * output.cc (Output_file::close): After short writes, continue
1808 writing from the correct offset in the buffer being written.
1810 2009-04-23 Chris Demetriou <cgd@google.com>
1812 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
1813 * configure: Regenerate.
1814 * config.in: Regenerate.
1815 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
1816 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
1818 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
1820 * incremental.cc (Incremental_inputs_header_data): Renamed from
1821 Incremental_input_header_data.
1822 (Incremental_inputs_header_data::data_size): New field.
1823 (Incremental_inputs_header_data::put_input_file_count): Renamed
1824 from input_file_count.
1825 (Incremental_inputs_header_data::put_command_line_offset): Renamed
1826 from command_line_offset.
1827 (Incremental_inputs_header_data::put_reserved): Renamed from
1829 (Incremental_inputs_entry_data): Renamed from
1830 Incremental_input_entry_data.
1831 (Incremental_inputs_entry_data::data_size): New field.
1832 (Incremental_inputs::report_command_line): New method.
1833 (Incremental_inputs::finalize): New method.
1834 (Incremental_inputs::create_incremental_inputs_data): New method.
1835 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
1836 * incremental.h: New file.
1837 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
1838 (Layout::finalize): Create incremental inputs section in
1840 (Layout::create_incremental_info_sections): New method.
1841 * layout.h (Layout::incremental_inputs): New method.
1842 (Layout::create_incremental_info_sections): New method.
1843 (Layout::incremental_inputs_): New field.
1844 * main.cc (main): Notify Incremental_input of the command line.
1846 2009-04-01 Ian Lance Taylor <iant@google.com>
1847 Mikolaj Zalewski <mikolajz@google.com>
1849 * gold.h (reserve_unordered_map): Define, three versions, one for
1850 each version of Unordered_map.
1851 * layout.cc (Layout::Layout): Remove options parameter. Add
1852 number_of_input_files parameter. Don't initialize options_.
1853 Initialize number_of_input_files_ and resized_signatures_. Move
1854 sections_are_attached_.
1855 (Layout::layout_group): Reserve space for group_signatures_.
1856 (Layout::find_or_add_kept_section): Change name parameter to be a
1857 reference. Resize signatures_ map when it gets large enough.
1858 (Layout::layout_eh_frame): Use parameters->options() instead of
1860 (Layout::make_output_section): Likewise.
1861 (Layout::attach_allocated_section_to_segment): Likewise.
1862 (Layout::finalize, Layout::create_executable_stack): Likewise.
1863 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
1864 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
1865 * layout.h (class Layout): Update declarations. Remove options_
1866 field. Add number_of_input_files_ and resized_signatures_
1867 fields. Move sections_are_attached_ field.
1868 * main.cc (main): Pass number of input files to Layout
1869 constructor. Don't pass options.
1871 2009-03-30 Ian Lance Taylor <iant@google.com>
1873 * ffsll.c (ffsll): Correct implementation.
1875 2009-03-27 Ian Lance Taylor <iant@google.com>
1877 * ffsll.c: New file.
1878 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
1879 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
1880 * ftruncate.c (ftruncate): Declare before definition.
1881 * mremap.c (mremap): Likewise.
1882 * pread.c (pread): Likewise.
1883 * configure, Makefile.in, config.in: Rebuild.
1885 * mremap.c: New file.
1886 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
1887 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
1888 (mremap): Declare if HAVE_MREMAP is not defined.
1889 * configure, Makefile.in, config.in: Rebuild.
1891 2009-03-27 Cary Coutant <ccoutant@google.com>
1893 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
1894 position independent.
1895 * sparc.cc (Target_sparc::check_non_pic): Likewise.
1896 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
1898 2009-03-24 Cary Coutant <ccoutant@google.com>
1900 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
1902 (needs_dynamic_reloc): Likewise.
1904 2009-03-24 Ian Lance Taylor <iant@google.com>
1906 * yyscript.y (file_cmd): Recognize EXTERN.
1907 (extern_name_list, extern_name_list_body): New nonterminals.
1908 * script.cc (script_add_extern): Define.
1909 * script-c.h (script_add_extern): Declare.
1911 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
1913 * object.cc (is_elf_object): Define.
1914 * object.h (is_elf_object): Declare.
1915 * archive.cc (Archive::get_elf_object_for_member): Call
1917 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
1919 2009-03-24 Elliott Hughes <enh@google.com>
1921 * output.cc (Output_file::map_anonymous): Define.
1922 (Output_file::map): Use map_anonymous. If the regular mmap fails,
1923 try an anonymous one. Report the size if the mmap fails.
1924 * output.h (class Output_file): Declare map_anonymous.
1926 2009-03-24 Ian Lance Taylor <iant@google.com>
1928 * target-select.cc (instantiate_target): Don't acquire the lock if
1929 the instantiated_target_ field has already been set.
1931 2009-03-23 Ian Lance Taylor <iant@google.com>
1933 * gold-threads.h (class Initialize_lock): Define.
1934 * gold-threads.cc (class Initialize_lock_once): Define.
1935 (initialize_lock_control): New static variable.
1936 (initialize_lock_pointer): New static variable.
1937 (initialize_lock_once): New static function.
1938 (Initialize_lock::Initialize_lock): Define.
1939 (Initialize_lock::initialize): Define.
1940 * target-select.h: Include "gold-threads.h".
1941 (class Target_selector): Add lock_ and initialize_lock_ fields.
1942 Don't define instantiate_target, just declare it.
1943 * target-select.cc (Target_selector::Target_selector): Initialize
1945 (Target_selector::instantiate_target): Define.
1946 * descriptors.h: Include "gold-threads.h".
1947 (class Descriptors): Add initialize_lock_ field.
1948 * descriptors.cc (Descriptors::Descriptors): Initialize new
1950 (Descriptors::open): Use initialize_lock_ field
1951 * errors.h (class Errors): Add initialize_lock_ field.
1952 * errors.cc (Errors::Errors): Initialize new field.
1953 (Errors::initialize_lock): Use initialize_lock_ field.
1954 * powerpc.cc (class Target_selector_powerpc): Remove
1955 instantiated_target_ field. In do_recognize call
1956 instantiate_target rather than do_instantiate_target. In
1957 do_instantiate_target just allocate a new target.
1958 * sparc.cc (class Target_selector_sparc): Likewise.
1960 * freebsd.h: New file.
1961 * i386.cc: Include "freebsd.h".
1962 (Target_i386): Derive from Target_freebsd rather than
1964 (Target_selector_i386): Derive from Target_selector_freebsd rather
1965 than Target_selector.
1966 * x86_64.cc: Include "freebsd.h".
1967 (Target_x86_64): Derive from Target_freebsd rather than
1969 (Target_selector_x86_64): Derive from Target_selector_freebsd
1970 rather than Target_selector.
1971 * target.h (class Target): Add adjust_elf_header and
1972 do_adjust_elf_header.
1973 * output.cc (Output_file_header:: do_sized_write): Call target
1974 adjust_elf_header routine.
1975 * configure.tgt: Set targ_osabi.
1976 * configure.ac: Define GOLD_DEFAULT_OSABI.
1977 * parameters.cc (Parameters::default_target): Pass
1978 GOLD_DEFAULT_OSABI to select_target.
1979 * target-select.h (class Target_selector): Make instantiate_target
1980 protected rather than private.
1981 * Makefile.am (HFILES): Add freebsd.h.
1982 * configure, Makefile.in, config.in: Rebuild.
1984 * merge.cc (do_add_input_section): Correct pend value. Change
1985 message about last entry not being null terminated from error to
1988 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
1990 * incremental.cc: New file.
1991 * Makefile.am (CCFILES): Add incremental.cc.
1992 * Makefile.in: Rebuild.
1994 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
1996 * layout.cc (Layout::output_section_name): Preserve names
1997 of '.note.' sections.
1999 2009-03-19 Ian Lance Taylor <iant@google.com>
2001 * descriptors.cc (Descriptors::open): Check that the options are
2002 valid before using them.
2004 2009-03-18 Ian Lance Taylor <iant@google.com>
2006 * script-sections.h: Include <list>.
2007 (class Script_sections): Change Sections_elements from std::vector
2008 to std::list. Typedef public Elements_iterator. Add
2009 orphan_section_placement_, data_segment_align_start_, and
2010 saw_data_segment_align_ fields. Remove data_segment_align_index_
2012 * script-sections.cc (class Orphan_section_placement): New class.
2013 (class Sections_element): Add virtual functions is_relro and
2014 orphan_section_init. Remove virtual function place_orphan_here.
2015 (class Output_section_definition): Add is_relro and
2016 orphan_section_init. Remove place_orphan_here.
2017 (class Orphan_output_section): Likewise.
2018 (Script_sections::Script_sections): Update for field changes.
2019 (Script_sections::data_segment_align): Set saw_data_segment_align_
2020 and data_segment_align_start_, not data_segment_align_index.
2021 (Script_sections::data_segment_relro_end): Check
2022 saw_data_segment_align_. Use data_segment_align_start_ rather
2023 than data_segment_align_index_.
2024 (Script_sections::place_orphan): Rewrite to use
2025 Orphan_section_placement.
2027 2009-03-17 Ian Lance Taylor <iant@google.com>
2029 * archive.cc (Archive::add_symbols): Check for a version attached
2030 to the symbol name in the archive map.
2031 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2032 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2033 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2034 (ver_test_11.a): New target.
2035 * testsuite/Makefile.in: Rebuild.
2037 * configure.ac: Check for chsize and posix_fallocate. Replace
2039 * ftruncate.c: New file, from gnulib.
2040 * output.cc (posix_fallocate): Define dummy version if not
2041 HAVE_POSIX_FALLOCATE.
2042 (Output_file::map): Call posix_fallocate rather than lseek and
2044 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2045 * configure, Makefile.in, config.in: Rebuild.
2047 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2049 * layout.h (Layout::create_note): Add section_name parameter.
2050 * layout.cc (Layout::create_note): Likewise.
2051 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2053 2009-03-17 Ian Lance Taylor <iant@google.com>
2055 * descriptors.cc: Include "options.h".
2056 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2057 (Descriptors::open): Always use O_CLOEXEC when opening a new
2058 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2059 then set FD_CLOEXEC.
2061 * sparc.cc (class Target_sparc): Add has_got_section.
2062 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2063 make sure we have a GOT section.
2065 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2066 (Target_sparc::Scan::local): Likewise.
2067 (Target_sparc::Scan::global): Likewise.
2068 (Target_sparc::Relocate::relocate): Likewise.
2069 (Target_sparc::Relocate::relocate_tls): Likewise.
2071 * symtab.cc (Symbol_table::define_default_version): New function,
2072 broken out of add_from_object.
2073 (Symbol_table::add_from_object): Call define_default_version.
2074 (Symbol_table::define_special_symbol): Add resolve_oldsym
2075 parameter. Change all callers. If the version for a symbol comes
2076 from a version script, resolve it with the symbol with the same
2077 name with no version. Also add the symbol without a version if
2079 (do_define_in_output_data): If resolving with oldsym, don't delete
2081 (do_define_in_output_segment): Likewise.
2082 (do_define_as_constant): Likewise.
2083 * symtab.h (class Symbol_table): Update declarations.
2085 2009-03-13 Ian Lance Taylor <iant@google.com>
2087 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2088 (Read_symbols::requeue): New function.
2089 (Read_symbols::do_read_symbols): If make_elf_object fails because
2090 the target type is not configured, and the file was searched for,
2091 issue a warning and retry with the next directory.
2092 (Add_symbols::run): If the file has an incompatible format, and
2093 it was searched for, requeue the Read_symbols task. On error,
2095 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2096 dirindex parameter to constructor. Change all callers. Declare
2097 incompatible_warning and requeue.
2098 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2099 input_argument_ and input_group_ fields. Add them to
2100 constructor. Change all callers.
2101 (class Read_script): Add dirindex_ field. Add it to constructor.
2103 * archive.cc (Archive::setup): Remove input_objects parameter.
2105 (Archive::get_file_and_offset): Likewise.
2106 (Archive::read_all_symbols): Likewise.
2107 (Archive::read_symbols): Likewise.
2108 (Archive::get_elf_object_for_member): Remove input_objects
2109 parameter. Add punconfigured parameter. Change all callers.
2110 (Archive::add_symbols): Change return type to bool. Check return
2111 value of include_member.
2112 (Archive::include_all_members): Likewise.
2113 (Archive::include_member): Change return type to bool. Return
2114 false if first included object has incompatible target. Set
2115 included_member_ field.
2116 (Add_archive_symbols::run): If add_symbols returns false, requeue
2118 * archive.h (class Archive): Add included_member_ field.
2119 Initialize it in constructor. Add input_file and searched_for
2120 methods. Update declarations.
2121 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2122 input_argument_ fields. Add them to constructor. Change all
2124 * script.cc: Include "target-select.h".
2125 (class Parser_closure): Add skip_on_incompatible_target_ and
2126 found_incompatible_target_ fields. Add
2127 skip_on_incompatible_target parameter to constructor. Change all
2128 callers. Add methods skip_on_incompatible_target,
2129 clear_skip_on_incompatible_target, found_incompatible_target, and
2130 set_found_incompatible_target.
2131 (read_input_script): Add dirindex parameter. Change all callers.
2132 If parser finds an incompatible target, requeue Read_symbols
2134 (script_set_symbol): Clear skip_on_incompatible_target in
2136 (script_add_assertion, script_parse_option): Likewise.
2137 (script_start_sections, script_add_phdr): Likewise.
2138 (script_check_output_format): New function.
2139 * script.h (read_input_script): Update declaration.
2140 * script-c.h (script_check_output_format): Declare.
2141 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2142 (ignore_cmd): Remove OUTPUT_FORMAT.
2143 * fileread.cc (Input_file::Input_file): Add explicit this.
2144 (Input_file::will_search_for): New function.
2145 (Input_file::open): Add pindex parameter. Change all callers.
2146 * fileread.h (class Input_file): Add input_file_argument method.
2147 Declare will_search_for. Update declarations.
2148 * object.cc (make_elf_object): Add punconfigured parameter.
2150 * object.h (class Object): Make input_file public. Add
2151 searched_for method.
2152 (make_elf_object): Update declaration.
2153 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2155 * dirsearch.h (class Dirsearch): Update declaration.
2156 * options.h (class General_options): Add --warn-search-mismatch.
2157 * parameters.cc (Parameters::is_compatible_target): New function.
2158 * parameters.h (class Parameters): Declare is_compatible_target.
2159 * workqueue.cc (Workqueue::add_blocker): New function.
2160 * workqueue.h (class Workqueue): Declare add_blocker.
2162 * fileread.cc (Input_file::open): Remove options parameter.
2164 (Input_file::open_binary): Likewise.
2165 * script.cc (read_input_script): Likewise.
2166 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2167 options parameter from constructor. Change all callers.
2168 (class Read_script): Likewise.
2169 * fileread.h (class Input_file): Update declarations.
2170 * script.h (read_input_script): Update declaration.
2172 2009-03-10 Nick Clifton <nickc@redhat.com>
2174 * po/es.po: New Spanish translation.
2176 2009-03-06 Cary Coutant <ccoutant@google.com>
2178 * options.cc (parse_short_option): Keep dash_z from registering itself.
2180 2009-03-03 Ian Lance Taylor <iant@google.com>
2183 * target-reloc.h (relocate_section): Pass output_section to
2185 * i386.cc (Target_i386::should_apply_static_reloc): Add
2186 output_section parameter. Change all callers.
2187 (Target_i386::Relocate::relocate): Add output_section parameter.
2188 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2189 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2190 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2191 * testsuite/two_file_shared.sh: New script.
2192 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2193 (check_DATA): Add two_file_shared.dbg.
2194 (two_file_shared.dbg): New target.
2195 * testsuite/Makefile.in: Rebuild.
2197 2009-03-01 Ian Lance Taylor <iant@google.com>
2199 * configure.ac: Check for byteswap.h.
2200 * configure: Rebuild.
2201 * config.in: Rebuild.
2203 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2205 * layout.cc (Layout::find_or_add_kept_section): New function.
2206 (Layout::add_comdat): Removed.
2207 * layout.h (struct Kept_section): Move out of class Layout.
2208 Remove trailing underscores from field names. Add group_sections
2209 field. Rename group_ field to is_group. Change all uses.
2210 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2211 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2212 comdat_groups_ field.
2213 (Sized_relobj::include_section_group): Use
2214 find_or_add_kept_section and Kept_section::group_sections.
2215 (Sized_relobj::include_linkonce_section): Likewise.
2216 * object.cc (class Sized_relobj): Don't define Comdat_group or
2217 Comdat_group_table. Remove find_comdat_group and
2218 add_comdat_group. Remove comdat_groups_ field.
2219 * plugin.cc (include_comdat_group): Use
2220 Layout::find_or_add_kept_section.
2222 2009-02-28 Ian Lance Taylor <iant@google.com>
2224 * README: --gc-sections and map files are now supported. Document
2225 some build requirements.
2228 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2229 relocatable link set the value of the section symbol to zero.
2230 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2231 relocatable link don't include the section address in the local
2234 2009-02-27 Ian Lance Taylor <iant@google.com>
2237 * options.h (class Search_directory): Add is_system_directory.
2238 (class General_options): Declare is_in_system_directory.
2239 * options.cc (get_relative_sysroot): Make static.
2240 (get_default_sysroot): Make static.
2241 (General_optoins::is_in_system_directory): New function.
2242 * fileread.cc (Input_file::is_in_system_directory): New function.
2243 * fileread.h (class Input_file): Declare is_in_system_directory.
2244 * object.h (class Object): Add is_in_system_directory.
2245 (class Input_objects): Remove system_library_directory_ field.
2246 * object.cc (Input_objects::add_object): Don't set
2247 system_library_directory_.
2248 (input_objects::found_in_system_library_directory): Remove.
2249 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2250 parameter. Change all callers.
2251 (Symbol_table::sized_write_globals): Likewise.
2252 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2253 Call Object::is_in_system_directory.
2254 * symtab.h (class Symbol_table): Update declarations.
2257 * descriptors.h (Open_descriptor): Add is_on_stack field.
2258 * descriptors.cc (Descriptors::open): If the descriptor is on the
2259 top of the stack, remove it. Initialize is_on_stack field.
2260 (Descriptors::release): Only add pod to stack if it is not on the
2262 (Descriptors::close_some_descriptor): Clear stack_next and
2266 * output.cc (Output_section::find_starting_output_address): Rename
2267 from starting_output_address; add PADDR parameter; change return
2269 * output.h (class Output_section): Declare
2270 find_starting_output_address instead of starting_output_address.
2271 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2272 section symbol for which we can't find a merge section.
2275 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2276 hidden or internal, force the symbol to be local.
2277 * resolve.cc (Symbol::override_visibility): Define.
2278 (Symbol::override_base): Use override_visibility.
2279 (Symbol_table::resolve): Likewise.
2280 (Symbol::override_base_with_special): Likewise.
2281 (Symbol_table::override_with_special): If the visibility is hidden
2282 or internal, force the symbol to be local.
2283 * symtab.h (class Symbol): Add set_visibility and
2284 override_visibility.
2285 * testsuite/ver_test_1.sh: New file.
2286 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2287 (check_DATA): Add ver_test_1.syms.
2288 (ver_test_1.syms): New target.
2289 * testsuite/Makefile.in: Rebuild.
2291 2009-02-25 Cary Coutant <ccoutant@google.com>
2293 * layout.cc (Layout::choose_output_section): Don't rename sections
2294 when using a linker script that has a SECTIONS clause.
2295 * Makefile.in: Regenerate.
2297 * testsuite/Makefile.am (script_test_5.sh): New test case.
2298 * testsuite/Makefile.in: Regenerate.
2299 * testsuite/script_test_5.cc: New file.
2300 * testsuite/script_test_5.sh: New file.
2301 * testsuite/script_test_5.t: New file.
2303 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
2305 * archive.cc (Archive::include_member): Update calls to add_symbols.
2306 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2307 the Layout argument.
2308 * dynobj.h (do_add_symbols): Add the Layout argument.
2309 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2311 * object.h (Object::add_symbols): Add the Layout argument.
2312 (Object::do_add_symbols): Add the Layout argument.
2313 (Sized_relobj::do_add_symbols): Add the Layout argument.
2314 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2315 Unify the two versions.
2316 (Add_plugin_symbols): Remove.
2317 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2318 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2319 (Add_plugin_symbols): Remove.
2320 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2321 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2322 (Add_symbols::run): Make it work with Pulginobj.
2324 2009-02-06 Ian Lance Taylor <iant@google.com>
2326 * object.cc (Sized_relobj::do_layout): Make info message start
2327 with lower case letter.
2329 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2331 * binary.cc: Fix file comment.
2333 * options.h (enum Incremental_disposition): Define.
2334 (class General_options): Add new options: --incremental,
2335 --incremental_changed, --incremental_unchanged,
2336 --incremental_unknown. Add incremental_disposition_ and
2337 implicit_incremental_ fields.
2338 (General_options::incremental_disposition): New function.
2339 (class Position_dependent_options): Add incremental_disposition
2341 (Position_dependent_options::copy_from_options): Set incremental
2343 * options.cc (General_options::parse_incremental_changed): New
2345 (General_options::parse_incremental_unchanged): New function.
2346 (General_options::parse_incremental_unknown): New function.
2347 (General_options::General_options): Initialize new fields
2348 incremental_disposition_ and implicit_incremental_.
2349 (General_options::finalize): Check for uasge of --incremental-*
2350 without --incremental.
2352 2009-02-06 Chris Demetriou <cgd@google.com>
2354 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2355 pointer and to report location as the file name associated with
2357 (gold_undefined_symbol_at_location): New function to replace the
2358 old gold_undefined_symbol functionality.
2359 * target-reloc.h (relocate_section): Update to use
2360 gold_undefined_symbol_at_location.
2361 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2362 Call gold_undefined_symbol function rather than gold_error.
2363 * errors.h (Errors::undefined_symbol): Take location as a
2364 string, rather than calculating it from a relocation.
2365 * errors.cc (Errors::fatal): Print "fatal error:" before the
2367 (Errors::error, Errors::error_at_location): Print "error: "
2368 before the formatted message.
2369 (Errors::undefined_symbol): Take location as a string, rather
2370 than calculating it from a relocation.
2371 (gold_undefined_symbol_at_location): New function akin to
2372 old gold_undefined_symbol, calculates location from relocation.
2373 (gold_undefined_symbol): Change to take only a Symbol pointer
2374 and to report location as the file name associated with the symbol.
2375 * testsuite/debug_msg.sh: Update for changed error messages.
2376 * testsuite/undef_symbol.sh: Likewise.
2378 2009-02-04 Duncan Sands <baldrick@free.fr>
2381 * reduced_debug_output.h
2382 (Output_reduced_debug_abbrev_section::failed): Use format for
2384 (Output_reduced_debug_info_section::faild): Likewise.
2386 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2388 * script.cc (Lazy_demangler): New class.
2389 (Version_script_info::get_symbol_version_helper): Demangle a
2392 2009-01-29 Cary Coutant <ccoutant@google.com>
2394 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2396 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2398 2009-01-28 Ian Lance Taylor <iant@google.com>
2400 * version.cc (version_string): Bump to 1.9.
2402 * gold.h: Include <cstring> and <stdint.h>.
2403 * version.cc: Include <cstdio>.
2404 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2406 * reduced_debug_output.cc (insert_into_vector): Rename from
2407 Insert_into_vector; change all callers. Use Swap_unaligned to
2408 avoid aliasing issue; remove union since it is unnecessary.
2410 2009-01-27 Sriraman Tallam <tmsriram@google.com>
2412 * Makefile.am (CCFILES): Add gc.cc.
2414 * Makefile.in: Regenerate.
2415 * gold.cc (Gc_runner): New class.
2416 (queue_initial_tasks): Call garbage collection related tasks
2417 when corresponding options are invoked.
2418 (queue_middle_gc_tasks): New function.
2419 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2420 processed early before laying out sections during garbage collection.
2421 * gold.h (queue_middle_gc_tasks): New function.
2422 (is_prefix_of): Move from "layout.cc".
2423 * i386.cc (Target_i386::gc_process_relocs): New function.
2424 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2425 * main.cc (main): Create object of class "Garbage_collection".
2426 * object.cc (Relobj::copy_symbols_data): New function.
2427 (Relobj::is_section_name_included): New function.
2428 (Sized_relobj::do_layout): Allow this function to be called twice
2429 during garbage collection and defer layout of section during the
2431 * object.h (Relobj::get_symbols_data): New function.
2432 (Relobj::is_section_name_included): New function.
2433 (Relobj::copy_symbols_data): New function.
2434 (Relobj::set_symbols_data): New function.
2435 (Relobj::get_relocs_data): New function.
2436 (Relobj::set_relocs_data): New function.
2437 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2438 (Relobj::gc_process_relocs): New function.
2439 (Relobj::do_gc_process_relocs): New pure virtual function.
2440 (Relobj::sd_): New data member.
2441 (Sized_relobj::is_output_section_offset_invalid): New function.
2442 (Sized_relobj::do_gc_process_relocs): New function.
2443 * options.h (General_options::gc_sections): Modify to not be a no-op.
2444 (General_options::print_gc_sections): New option.
2445 * plugin.cc (Plugin_finish::run): Remove function call to
2446 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2447 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2448 * reloc.cc (Read_relocs::run): Add task to process relocs and
2449 determine unreferenced sections when doing garbage collection.
2450 (Gc_process_relocs): New class.
2451 (Sized_relobj::do_gc_process_relocs): New function.
2452 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2453 sections that are garbage collected.
2454 * reloc.h (Gc_process_relocs): New class.
2455 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2456 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2457 symbols whose corresponding sections are garbage collected.
2458 (Symbol_table::Symbol_table): Add new parameter for the garbage
2460 (Symbol_table::gc_mark_undef_symbols): New function.
2461 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2462 (Symbol_table::gc_mark_dyn_syms): New function.
2463 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2465 (Symbol_table::add_from_object): Likewise.
2466 (Symbol_table::add_from_relobj): When building shared objects, do not
2467 treat externally visible symbols as garbage.
2468 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2469 table information for static and relocatable links.
2470 * symtab.h (Symbol_table::set_gc): New function.
2471 (Symbol_table::gc): New function.
2472 (Symbol_table::gc_mark_undef_symbols): New function.
2473 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2474 (Symbol_table::gc_mark_dyn_syms): New function.
2475 (Symbol_table::gc_): New data member.
2476 * target.h (Sized_target::gc_process_relocs): New pure virtual
2478 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2479 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2481 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2483 * options.h (General_options::gc_sections): Define as a no-op for now.
2484 (General_options::no_keep_memory): Ditto.
2485 (General_options::Bshareable): Define.
2486 * options.cc (General_options::finalize): Honor -Bshareable.
2488 2009-01-20 Andreas Schwab <schwab@suse.de>
2490 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2491 read the value in the contents, since we don't use it. Use the
2492 template endianness when writing.
2493 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2495 2009-01-19 Andreas Schwab <schwab@suse.de>
2497 * configure.tgt (powerpc64-*): Fix targ_obj.
2499 2009-01-15 Ian Lance Taylor <iant@google.com>
2501 * object.cc (Sized_relobj::write_local_symbols): Don't write out
2502 local symbols when stripping all symbols.
2504 2009-01-14 Cary Coutant <ccoutant@google.com>
2506 * output.cc (Output_reloc): Add explicit instantiations.
2508 2009-01-14 Cary Coutant <ccoutant@google.com>
2510 * archive.cc (Archive::get_elf_object_for_member): Remove call
2511 to File_read::claim_for_plugin.
2512 * descriptors.cc (Descriptors::open): Remove reference to
2514 (Descriptors::claim_for_plugin): Remove.
2515 * descriptors.h (Descriptors::claim_for_plugin): Remove.
2516 (Descriptors::is_claimed): Remove.
2517 (claim_descriptor_for_plugin): Remove.
2518 * fileread.cc (File_read::claim_for_plugin): Remove.
2519 * fileread.h (File_read::claim_for_plugin): Remove.
2520 (File_read::descriptor): Reopen descriptor if necessary.
2521 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
2522 (Plugin_manager::all_symbols_read): Add task parameter. Change
2524 (Plugin_manager::get_input_file): New function.
2525 (Plugin_manager::release_input_file): New function.
2526 (Pluginobj::Pluginobj): Add filesize parameter and initialize
2527 corresponding data member.
2528 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
2529 and pass to base constructor. Change all callers.
2530 (get_input_file, release_input_file): New functions.
2531 (make_sized_plugin_object): Add filesize parameter. Change all callers.
2532 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
2533 (Plugin_manager::all_symbols_read): Add task parameter.
2534 (Plugin_manager::get_input_file): New function.
2535 (Plugin_manager::release_input_file): New function.
2536 (Plugin_manager::task_): New data member.
2537 (Pluginobj::Pluginobj): Add filesize parameter.
2538 (Pluginobj::filename): New function.
2539 (Pluginobj::descriptor): New function.
2540 (Pluginobj::filesize): New function.
2541 (Pluginobj::filesize_): New data member.
2542 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
2543 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2544 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2546 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2547 with archive libraries.
2548 * testsuite/Makefile.in: Regenerate.
2549 * testsuite/plugin_test.c (struct sym_info): New type.
2550 (get_input_file, release_input_file): New static variables.
2551 (onload): Capture new transfer vector entries.
2552 (claim_file_hook): Stop reading at end of file according to filesize.
2553 Factor out parsing of readelf output into separate function.
2554 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2555 APIs and get the source file name from the symbol table. Convert
2556 source file name to corresponding object file name. Print info
2557 message when adding new input files.
2558 (parse_readelf_line): New function.
2559 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2560 * testsuite/plugin_test_2.sh: Likewise.
2561 * testsuite/plugin_test_3.sh: Likewise.
2562 * testsuite/plugin_test_4.sh: New test case.
2564 2009-01-07 Ian Lance Taylor <iant@google.com>
2566 * version.cc (version_string): Bump to 1.8.
2568 2008-12-23 Cary Coutant <ccoutant@google.com>
2570 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2571 * plugin.cc (Plugin_manager::finish): Rename as
2572 layout_deferred_objects. Move cleanup to separate function.
2573 (Plugin_manager::cleanup): New function.
2574 (Plugin_finish::run): Call layout_deferred_objects and cleanup
2576 * plugin.h (Plugin_manager::finish): Rename as
2577 layout_deferred_objects.
2578 (Plugin_manager::cleanup): New function.
2579 (Plugin_manager::cleanup_done): New field.
2581 2008-12-23 Cary Coutant <ccoutant@google.com>
2583 * plugin.cc (is_visible_from_outside): New function.
2584 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
2585 so we don't return "IR only" status for exported symbols or -r links.
2587 * testsuite/Makefile.am (plugin_test_3): New test case.
2588 * testsuite/Makefile.in: Regenerate.
2589 * testsuite/plugin_test_3.sh: New file.
2591 2008-12-22 Cary Coutant <ccoutant@google.com>
2593 * object.cc (Sized_relobj::layout_section): New function.
2594 (Sized_relobj::do_layout): Defer layout of input sections until after
2595 plugin has provided replacement files.
2596 (Sized_relobj::do_layout_deferred_sections): New function.
2597 * object.h (Relobj::set_section_offset): Remove virtual keyword.
2598 (Relobj::layout_deferred_sections): New function.
2599 (Relobj::do_layout_deferred_sections): New function.
2600 (Sized_relobj::do_layout_deferred_sections): New function.
2601 (Sized_relobj::layout_section): New function.
2602 (Sized_relobj::Deferred_layout): New structure.
2603 (Sized_relobj::deferred_layout_): New field.
2604 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
2605 Change all callers. Layout deferred sections.
2606 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
2608 (Plugin_hook::run): Move code from do_plugin_hook inline.
2609 (Plugin_hook::do_plugin_hook): Remove.
2610 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
2611 (Plugin_manager::finish): Renamed, was cleanup.
2612 (Plugin_manager::should_defer_layout): New function.
2613 (Plugin_manager::add_deferred_layout_object): New function.
2614 (Plugin_manager::Deferred_layout_list): New type.
2615 (Plugin_manager::deferred_layout_objects_): New field.
2616 (Plugin_hook::do_plugin_hook): Remove.
2618 2008-12-17 Ian Lance Taylor <iant@google.com>
2620 * options.h (class General_options): Add --no case for
2623 2008-12-16 Cary Coutant <ccoutant@google.com>
2625 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
2627 (Plugin_manager::claim_file): Create plugin object even if
2628 plugin did not call the add_symbols callback.
2629 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
2630 asking for more symbols than were added.
2631 * testsuite/Makefile.am (plugin_test_1): Add test case with
2633 (empty.syms): New target.
2634 * testsuite/Makefile.in: Regenerate.
2635 * testsuite/plugin_test.c (claim_file_hook): Add new debug
2636 message. Don't call add_symbols if no globals.
2637 (all_symbols_read_hook): Don't provide replacement for empty
2640 2008-12-12 Ian Lance Taylor <iant@google.com>
2642 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
2643 r_type == 0 for a local symbol with r_sym == 0.
2644 (scan_relocatable_relocs): Pass r_sym to
2645 local_non_section_strategy.
2646 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
2649 * configure.ac: Update test for TLS descriptors: they are
2650 supported as of glibc 2.9.
2651 * configure: Rebuild.
2653 2008-12-11 Ian Lance Taylor <iant@google.com>
2656 * target-reloc.h (Default_scan_relocatable_relocs): For each
2657 function, map r_type == 0 to RELOC_DISCARD.
2659 2008-12-10 Cary Coutant <ccoutant@google.com>
2661 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
2662 object to override a kept COMDAT group from a plugin object.
2664 2008-12-09 Ian Lance Taylor <iant@google.com>
2667 * yyscript.y (file_cmd): Handle INPUT.
2669 * testsuite/initpri1.c: Change all declarations to be full
2670 prototypes by adding void, to avoid compiler warnings.
2672 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
2674 * options.cc (General_options::parse_plugin_opt): New.
2675 (General_options::add_plugin): The argument now is just the filename.
2676 (General_options::add_plugin_option): New.
2677 * options.h (plugin_opt): New.
2678 (add_plugin): Change argument name.
2679 (add_plugin_option): New.
2680 * plugin.cc (Plugin::load): Don't parse the plugin option.
2681 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
2682 (Plugin::add_option): New.
2683 (Plugin::args_): Change type.
2684 (Plugin::filename_): New.
2685 (Plugin_manager::add_plugin_option): New.
2686 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
2687 * testsuite/Makefile.in: Regenerate.
2689 2008-12-05 Cary Coutant <ccoutant@google.com>
2691 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
2692 Handle --strip-lto-sections option.
2693 * options.h (strip_lto_sections): New option.
2695 2008-12-01 Cary Coutant <ccoutant@google.com>
2697 * plugin.cc (ld_plugin_message): Change format parameter to const.
2698 Fix mismatch between new[] and delete.
2700 2008-11-14 Cary Coutant <ccoutant@google.com>
2702 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
2705 2008-11-05 Craig Silverstein <csilvers@google.com>
2707 * options.cc (General_options::parse_dynamic_list): New function.
2708 * options.h (General_options): New flags dynamic_list,
2709 dynamic_list_data, dynamic_list_cpp_new, and
2710 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
2711 (General_options::in_dynamic_list): New function.
2712 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
2713 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
2714 (Lex::can_continue_name): Likewise.
2716 (read_script_file): New parameter script_options.
2717 (read_dynamic_list): New function.
2718 (Script_options::define_dynamic_list): New function.
2719 (dynamic_list_keyword_parsecodes): New variable.
2720 (dynamic_list_keywords): New variable.
2721 * script.h (Script_options::define_dynamic_list): New function
2723 (read_dynamic_list): New function prototype.
2724 * symtab.cc (strprefix): New macro.
2725 (Symbol::should_add_dynsym_entry): Support dynamic_list,
2726 dynamic_list_data, dynamic_list_cpp_new, and
2727 dynamic_list_cpp_typeinfo.
2728 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
2729 (dynamic_list_expr): New rule.
2730 (dynamic_list_nodes): Likewise.
2731 (dynamic_list_node): Likewise.
2732 * testsuite/Makefile.am (dynamic_list): New test.
2733 * testsuite/Makefile.in: Regenerated.
2734 * testsuite/dynamic_list.t: New file.
2735 * testsuite/dynamic_list.sh: New file.
2737 2008-11-05 Craig Silverstein <csilvers@google.com>
2739 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
2740 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
2741 (t11_last): Likewise.
2742 * testsuite/ver_test_6.c (main): Likewise.
2744 2008-10-07 Cary Coutant <ccoutant@google.com>
2746 * options.c (General_options::finalize): Add check for -static and
2748 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
2751 2008-10-02 Cary Coutant <ccoutant@google.com>
2753 * plugin.cc (make_sized_plugin_object): Fix conditional
2754 compilation to work when not all targets are enabled.
2756 2008-09-29 Cary Coutant <ccoutant@google.com>
2758 * archive.cc (Archive::get_file_and_offset): Use filename instead
2759 of name to get library path.
2760 (Archive::include_member): Unlock external member of a thin archive.
2762 * testsuite/Makefile.am (TEST_AR): New variable.
2763 (thin_archive_test_1): New test.
2764 (thin_archive_test_2): New test.
2765 * testsuite/Makefile.in: Regenerate.
2766 * testsuite/thin_archive_main.cc: New file.
2767 * testsuite/thin_archive_test_1.cc: New file.
2768 * testsuite/thin_archive_test_2.cc: New file.
2769 * testsuite/thin_archive_test_3.cc: New file.
2770 * testsuite/thin_archive_test_4.cc: New file.
2772 2008-09-29 Cary Coutant <ccoutant@google.com>
2774 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
2775 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
2777 (Sized_relobj::do_finalize_local_symbols): Likewise.
2778 (Sized_relobj::map_to_kept_section): Likewise.
2779 * object.h (Sized_relobj::invalid_address): New constant.
2780 (Sized_relobj::do_output_section_offset): Check for invalid_address
2782 * output.cc (Output_reloc::local_section_offset): Use constant
2783 invalid_address instead of -1U.
2784 (Output_reloc::get_address): Likewise.
2785 (Output_section::output_address): Change -1U to -1ULL.
2786 * output.h (Output_reloc::invalid_address): New constant.
2787 * reloc.cc (Sized_relobj::write_sections): Use constant
2788 invalid_address instead of -1U.
2789 (Sized_relobj::relocate_sections): Likewise.
2790 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
2791 values for merge sections.
2792 * target-reloc.h (relocate_for_relocatable): Use constant
2793 invalid_address instead of -1U.
2795 2008-09-19 Cary Coutant <ccoutant@google.com>
2797 Add plugin functionality for link-time optimization (LTO).
2798 * configure.ac (plugins): Add --enable-plugins option.
2799 * configure: Regenerate.
2800 * config.in: Regenerate.
2801 * Makefile.am (LIBDL): New variable.
2802 (CCFILES): Add plugin.cc.
2803 (HFILES): Add plugin.h.
2804 (ldadd_var): Add LIBDL.
2805 * Makefile.in: Regenerate.
2807 * archive.cc: Include "plugin.h".
2808 (Archive::setup): Don't preread archive symbols when using a plugin.
2809 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
2810 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
2812 (Archive::include_member): Add symbols from plugin objects.
2813 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
2814 * descriptors.cc (Descriptors::open): Check for file descriptors
2815 abandoned by plugins.
2816 (Descriptors::claim_for_plugin): New function.
2817 * descriptors.h (Descriptors::claim_for_plugin): New function.
2818 (Open_descriptor::is_claimed): New field.
2819 (claim_descriptor_for_plugin): New function.
2820 * fileread.cc (File_read::claim_for_plugin): New function.
2821 * fileread.h (File_read::claim_for_plugin): New function.
2822 (File_read::descriptor): New function.
2823 * gold.cc: Include "plugin.h".
2824 (queue_initial_tasks): Add task to call plugin hooks for generating
2826 * main.cc: Include "plugin.h".
2827 (main): Load plugin libraries.
2828 * object.h (Pluginobj): Declare.
2829 (Object::pluginobj): New function.
2830 (Object::do_pluginobj): New function.
2831 (Object::set_target): New function.
2832 * options.cc: Include "plugin.h".
2833 (General_options::parse_plugin): New function.
2834 (General_options::General_options): Initialize plugins_ field.
2835 (General_options::add_plugin): New function.
2836 * options.h (Plugin_manager): Declare.
2837 (General_options): Add --plugin option.
2838 (General_options::has_plugins): New function.
2839 (General_options::plugins): New function.
2840 (General_options::add_plugin): New function.
2841 (General_options::plugins_): New field.
2842 * plugin.cc: New file.
2843 * plugin.h: New file.
2844 * readsyms.cc: Include "plugin.h".
2845 (Read_symbols::do_read_symbols): Check for archive before checking
2846 for ELF file. Call plugin hooks to claim files.
2847 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
2848 from a real object file; force override when processing replacement
2850 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
2851 (Symbol::init_base_object): Likewise.
2852 (Symbol::init_base_output_data): Likewise.
2853 (Symbol::init_base_output_segment): Likewise.
2854 (Symbol::init_base_constant): Likewise.
2855 (Symbol::init_base_undefined): Likewise.
2856 (Symbol::output_section): Assert that object is not a plugin.
2857 (Symbol_table::add_from_pluginobj): New function.
2858 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
2860 (Symbol_table::sized_write_globals): Likewise.
2861 (Symbol_table::add_from_pluginobj): Instantiate template.
2862 * symtab.h (Sized_pluginobj): Declare.
2863 (Symbol::in_real_elf): New function.
2864 (Symbol::set_in_real_elf): New function.
2865 (Symbol::in_real_elf_): New field.
2866 (Symbol_table::add_from_pluginobj): New function.
2868 * testsuite/Makefile.am (AM_CFLAGS): New variable.
2869 (LIBDL): New variable.
2871 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
2872 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
2873 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
2874 (MOSTLYCLEANFILES): Likewise.
2875 * testsuite/Makefile.in: Regenerate.
2876 * testsuite/plugin_test.c: New file.
2877 * testsuite/plugin_test_1.sh: New file.
2878 * testsuite/plugin_test_2.sh: New file.
2880 2008-09-16 Ian Lance Taylor <iant@google.com>
2882 * target-reloc.h (relocate_section): Check whether a symbol is
2883 defined by the ABI before reporting an undefined symbol error.
2884 * target.h (Target::is_defined_by_abi): Make parameter const.
2885 (Target::do_is_defined_by_abi): Likewise.
2886 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
2887 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
2888 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
2889 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
2890 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
2891 * testsuite/Makefile.in: Rebuild.
2893 * fileread.cc (make_view): Add casts to avoid warning.
2895 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2897 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
2898 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2900 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2902 * options.h (General_options::output_is_executable): New.
2903 (General_options::output_is_pie): New.
2904 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
2905 for shared libraries.
2906 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2908 2008-09-11 Chris Demetriou <cgd@google.com>
2910 * options.h (origin): New -z option.
2911 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
2912 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
2915 2008-09-05 Cary Coutant <ccoutant@google.com>
2917 * fileread.cc (File_read::make_view): Add check for attempt to map
2920 2008-09-05 Cary Coutant <ccoutant@google.com>
2922 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
2923 explicit instantiations.
2925 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
2928 * options.cc (General_options::finalize): Allow undefined symbols
2929 in shlibs if linking -shared.
2932 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
2933 symbols as not needing a dynsym entry.
2935 2008-08-20 Craig Silverstein <csilvers@google.com>
2937 * fileread.cc (File_read::open): Do not lock the file unless it
2938 was successfully opened.
2940 2008-08-14 Cary Coutant <ccoutant@google.com>
2942 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
2943 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
2944 * testsuite/tls_test.cc (struct int128): 128-bit struct
2945 for testing TLS relocs with non-zero addend.
2946 (v12): New TLS variable.
2948 (t_last): Add check for v12.
2949 * testsuite/tls_test.h (t12): New function.
2950 * testsuite/tls_test_main.cc (thread_routine): Call new test.
2952 2008-08-13 Ian Lance Taylor <iant@google.com>
2954 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
2955 set tls_segment_ or relro_segment_.
2956 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
2958 * output.h (Output_section::clear_is_relro): New function.
2959 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
2960 sections specially even when output_data_ is empty.
2961 (Output_segment::maximum_alignment): When first section is relro,
2962 only force alignment for PT_LOAD segments.
2963 * script.cc (script_data_segment_align): New function.
2964 (script_data_segment_relro_end): New function.
2965 * script-c.h (script_data_segment_align): Declare.
2966 (script_data_segment_relro_end): Declare.
2967 * script-sections.h (class Script_sections): Declare
2968 data_segment_align and data_segment_relro_end. Add fields
2969 segment_align_index_ and saw_relro_end_.
2970 * script-sections.cc (class Sections_element): Add set_is_relro
2971 virtual function. Add new bool* parameter to place_orphan_here.
2972 Add get_output_section virtual function.
2973 (class Output_section_definition): Add set_is_relro. Add new
2974 bool* parameter to place_orphan_here. Add get_output_section.
2975 Add is_relro_ field.
2976 (Output_section_definition::Output_section_definition): Initialize
2977 evaluated_address_, evaluated_load_address, evaluated_addralign_,
2978 and is_relro_ fields.
2979 (Output_section_definition::place_orphan_here): Add is_relro
2981 (Output_section_definition::set_section_addresses): Set relro for
2983 (Output_section_definition::alternate_constraint): Likewise.
2984 (class Orphan_output_section): Add new bool* parameter to
2985 place_orphan_here. Add get_output_section.
2986 (Orphan_output_section::place_orphan_here): Add is_relro
2988 (Script_sections::Script_sections): Initialize
2989 data_segment_align_index_ and saw_relro_end_.
2990 (Script_sections::data_segment_align): New function.
2991 (Script_sections::data_segment_relro_end): New function.
2992 (Script_sections::place_orphan): Set or clear is_relro.
2993 (Script_sections::set_section_addresses): Force alignment of first
2995 * yyscript.y (exp): Call script_data_segment_align and
2996 script_data_segment_relro_end.
2997 * testsuite/relro_script_test.t: New file.
2998 * testsuite/relro_test.cc (using_script): Declare.
2999 (t1, t2): Test using_script.
3000 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3001 (relro_script_test_SOURCES): Define.
3002 (relro_script_test_DEPENDENCIES): Define.
3003 (relro_script_test_LDFLAGS): Define.
3004 (relro_script_test_LDADD): Define.
3005 (relro_script_test.so): New target.
3006 * testsuite/Makefile.in: Rebuild.
3008 2008-08-06 Cary Coutant <ccoutant@google.com>
3010 * archive.cc (Archive::total_archives, Archive::total_members)
3011 (Archive::total_members_loaded): New variables.
3012 (Archive::setup): Add parameter. Add option to preread
3014 (Archive::read_armap): Add counter.
3015 (Archive::get_file_and_offset): New function.
3016 (Archive::get_elf_object_for_member): New function.
3017 (Archive::read_all_symbols): New function.
3018 (Archive::read_symbols): New function.
3019 (Archive::add_symbols): Add counters.
3020 (Archive::include_all_members): Use armap to find members if it's
3022 (Archive::include_member): Skip reading symbols if already read.
3023 Factored code into Archive::get_file_and_offset and
3024 Archive::get_elf_object_for_member. Changed call to
3025 Mapfile::report_include_archive_member.
3026 (Archive::print_stats): New function.
3027 * archive.h: Declare Object and Read_symbols_data classes.
3028 (Archive::Archive): Add initializers for new members.
3029 (Archive::setup): Add parameter.
3030 (Archive::print_stats): New function.
3031 (Archive::total_archives, Archive::total_members)
3032 (Archive::total_members_loaded): New variables.
3033 (Archive::get_file_and_offset): New function.
3034 (Archive::get_elf_object_for_member): New function.
3035 (Archive::read_all_symbols): New function.
3036 (Archive::read_symbols): New function.
3037 (Archive::Archive_member): New class.
3038 (Archive::members_): New member.
3039 (Archive::num_members_): New member.
3040 * main.cc: Include archive.h.
3041 (main): Call Archive::print_stats.
3042 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3043 archive parameter; member_name is now the fully-decorated name.
3044 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3045 * options.h: (General_options): Add --preread-archive-symbols option.
3046 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3049 2008-08-04 Ian Lance Taylor <iant@google.com>
3051 * symtab.h (Symbol::use_plt_offset): New function.
3052 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3053 * powerpc.cc (Relocate::relocate): Likewise.
3054 * sparc.cc (Relocate::relocate): Likewise.
3055 * x86_64.cc (Relocate::relocate): Likewise.
3056 * testsuite/weak_plt.sh: New test.
3057 * testsuite/weak_plt_main.cc: New test.
3058 * testsuite/weak_plt_shared.cc: New test.
3059 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3060 (check_PROGRAMS): Add weak_plt.
3061 (check_DATA): Add weak_plt_shared.so.
3062 (weak_plt_main_pic.o, weak_plt): New targets.
3063 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3064 * testsuite/Makefile.in: Rebuild.
3066 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3068 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3069 * testsuite/Makefile.in: Rebuild.
3071 2008-08-04 Alan Modra <amodra@bigpond.net.au>
3073 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3074 * Makefile.in: Regenerate.
3075 * po/POTFILES.in: Regenerate.
3077 2008-07-29 Ian Lance Taylor <iant@google.com>
3079 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3080 symbols before other symbols.
3081 * testsuite/script_test_2.cc (test_addr): Declare.
3082 (test_addr_alias): Declare.
3083 (main): Check that test_addr and test_addr_alias have the right
3085 * testsuite/script_test_2.t: Define test_addr_alias and
3088 2008-07-24 Ian Lance Taylor <iant@google.com>
3091 * descriptors.cc: New file.
3092 * descriptors.h: New file.
3093 * gold-threads.h (class Hold_optional_lock): New class.
3094 * fileread.cc: Include "descriptors.h".
3095 (File_read::~File_read): Release descriptor rather than closing
3097 (File_read::open) [file]: Call open_descriptor rather than open.
3098 Set is_descriptor_opened_.
3099 (File_read::open) [memory]: Assert that descriptor is not open.
3100 (File_read::reopen_descriptor): New function.
3101 (File_read::release): Release descriptor.
3102 (File_read::do_read): Make non-const. Reopen descriptor.
3103 (File_read::read): Make non-const.
3104 (File_read::make_view): Reopen descriptor.
3105 (File_read::do_readv): Likewise.
3106 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3107 Update declarations.
3108 * layout.cc: Include "descriptors.h".
3109 (Layout::create_build_id): Use open_descriptor rather than open.
3110 * output.cc: Include "descriptors.h".
3111 (Output_file::open): Use open_descriptor rather than open.
3112 * archive.cc (Archive::const_iterator): Change Archive to be
3114 (Archive::begin, Archive::end): Make non-const.
3115 (Archive::count_members): Likewise.
3116 * archive.h (class Archive): Update declarations.
3117 * object.h (Object::read): Make non-const.
3118 * Makefile.am (CCFILES): Add descriptors.cc.
3119 (HFILES): Add descriptors.h.
3120 * Makefile.in: Rebuild.
3123 * gold.h: Always include <clocale>. Add Solaris workarounds
3124 following code in binutils/sysdep.h.
3127 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3128 this->eh_frame_hdr_ is NULL before using it.
3130 * dynobj.cc (Versions::Versions): Update comment.
3132 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3133 the base version name.
3135 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3136 array size plus one.
3137 (Stringpool_template::set_string_offsets): Subtract one from key
3138 before using it as an array index.
3139 (Stringpool_template::get_offset_with_length): Likewise.
3140 (Stringpool_template::write_to_buffer): Likewise.
3141 * stringpool.h (Stringpool_template::get_offset_from_key):
3144 2008-07-23 Ian Lance Taylor <iant@google.com>
3147 * object.h (Merged_symbol_value::value): Do our best to handle a
3151 * script.cc (Version_script_info::get_versions): Don't add empty
3152 version tag to return value.
3153 (Version_script_info::get_symbol_version_helper): Change return
3154 type to bool. Add pversion parameter. Change all callers.
3155 (script_register_vers_node): Don't require a non-NULL tag.
3156 * script.h (class Version_script_info): Update declarations.
3157 (Version_script_info::get_symbol_version): Change return type to
3158 bool. Add version parameter. Change all callers.
3159 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3160 handling. Handle an empty version from a version script.
3161 (Symbol_table::define_special_symbol): Likewise.
3162 * testsuite/ver_test_10.script: New file.
3163 * testsuite/ver_test_10.sh: New file.
3164 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3165 (check_DATA): Add ver_test_10.syms.
3166 (ver_test_10.syms, ver_test_10.so): New target.
3167 * testsuite/Makefile.in: Rebuild.
3169 2008-07-23 Simon Baldwin <simonb@google.com>
3171 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3172 to zero for undefined symbols from dynamic libraries.
3174 2008-07-23 Ian Lance Taylor <iant@google.com>
3176 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3178 * symtab.h (class Symbol_table): Update declaration.
3179 * testsuite/ver_test_9.cc: New file.
3180 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3181 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3182 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3183 (ver_test_9.so, ver_test_9.o): New targets.
3184 * testsuite/Makefile.in: Rebuild.
3186 2008-07-22 Ian Lance Taylor <iant@google.com>
3188 * options.h (class General_options): Define --check-sections.
3189 * layout.cc (Layout::set_segment_offsets): Handle
3192 * options.h (class General_options): Define -n/--nmagic and
3194 * options.cc (General_options::finalize): For -n/--nmagic or
3195 -N/--omagic, set -static.
3196 * layout.cc (Layout::attach_allocated_section_to_segment): If
3197 -N/--omagic, don't put read-only and read-write sections in
3199 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3200 finding a read-only segment.
3201 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3202 don't set the minimum segment alignment to the common page size,
3203 and don't set the file offset to the address modulo the page size.
3204 * script-sections.cc (Script_sections::create_segments): If
3205 -n/--omagic, don't put read-only and read-write sections in
3208 * cref.cc: New file.
3210 * options.h (class General_options): Add --print-symbol-counts.
3211 * main.cc (main): Issue defined symbol report if requested.
3212 * archive.cc (Archive::interpret_header): Make into a const member
3214 (Archive::add_symbols): Call Input_objects::archive_start and
3216 (Archive::const_iterator): Define new class.
3217 (Archive::begin, Archive::end): New functions.
3218 (Archive::include_all_members): Rewrite to use iterator.
3219 (Archive::count_members): New function.
3220 * archive.h (class Archive): Update declarations.
3221 (Archive::filename): New function.
3222 * object.cc: Include "cref.h".
3223 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3224 (Sized_relobj::do_get_global_symbol_counts): New function.
3225 (Input_objects::add_object): Add object to cross-referencer.
3226 (Input_objects::archive_start): New function.
3227 (Input_objects::archive_stop): New function.
3228 (Input_objects::print_symbol_counts): New function.
3229 * object.h: Declare Cref and Archive.
3230 (Object::get_global_symbol_counts): New function.
3231 (Object::do_get_global_symbol_counts): New pure virtual function.
3232 (class Sized_relobj): Add defined_count_ field. Update
3234 (class Input_objects): Add cref_ field. Update constructor.
3235 Update declarations.
3236 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3238 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3240 (Sized_dynobj::do_get_global_symbol_counts): New function.
3241 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3242 defined_count_. Update declarations. Define Symbols typedef.
3243 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3244 parameter. Change all callers.
3245 (Symbol_table::add_from_dynobj): Add sympointers and defined
3246 parameters. Change all callers.
3247 * symtab.h (class Symbol_table): Update declarations.
3248 * Makefile.am (CCFILES): Add cref.cc.
3249 (HFILES): Add cref.h.
3250 * Makefile.in: Rebuild.
3252 2008-07-22 Simon Baldwin <simonb@google.com>
3254 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3255 to zero when writing undefined symbols.
3257 2008-07-22 Ian Lance Taylor <iant@google.com>
3259 * output.cc (Output_section::add_input_section): Don't try to
3260 merge empty merge sections.
3262 2008-07-21 Craig Silverstein <csilvers@google.com>
3264 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3265 Include symbol version in error message.
3267 2008-07-20 Chris Demetriou <cgd@google.com>
3269 * configure.ac (gold_cv_c_random_seed): New configured variable.
3270 (RANDOM_SEED_CFLAGS): New substituted variable.
3271 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3272 * configure: Rebuild.
3273 * Makefile.in: Likewise.
3274 * testsuite/Makefile.in: Likewise.
3276 2008-07-18 Ian Lance Taylor <iant@google.com>
3278 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3279 where we see NAME/NULL and NAME/VERSION as separate symbols.
3280 * testsuite/ver_test_main.cc (main): Call t4.
3281 (t4, t4_2a): Define.
3282 * testsuite/ver_test_2.cc (t4_2): Define.
3283 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3284 * testsuite/ver_test_4.cc (t4_2a): Define.
3285 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3286 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3288 2008-07-17 Ian Lance Taylor <iant@google.com>
3290 * dynobj.cc (Versions::add_def): If we give an error about a
3291 missing version, go ahead and create the version anyhow.
3293 2008-07-10 Ian Lance Taylor <iant@google.com>
3295 Handle output sections with more than 0x7fffffff bytes.
3296 * object.h (class Relobj): Change map_to_output_ to
3297 output_sections_, and just keep a section pointer. Change all
3298 uses. Move comdat group support to Sized_relobj.
3299 (Relobj::is_section_specially_mapped): Remove.
3300 (Relobj::output_section): Remove poff parameter. Change all
3302 (Relobj::output_section_offset): New function.
3303 (Relobj::set_section_offset): Rewrite.
3304 (Relobj::map_to_output): Remove.
3305 (Relobj::output_sections): New function.
3306 (Relobj::do_output_section_offset): New pure virtual function.
3307 (Relobj::do_set_section_offset): Likewise.
3308 (class Sized_relobj): Add section_offsets_ field. Add comdat
3309 group support from Relobj. Update declarations.
3310 (Sized_relobj::get_output_section_offset): New function.
3311 (Sized_relobj::do_output_section_offset): New function.
3312 (Sized_relobj::do_set_section_offset): New function.
3313 * object.cc (Relobj::output_section_address): Remove.
3314 (Sized_relobj::Sized_relobj): Initialize new fields.
3315 (Sized_relobj::include_section_group): Cast find_kept_object to
3317 (Sized_relobj::include_linkonce_section): Likewise.
3318 (Sized_relobj::do_layout): Use separate arrays for output section
3320 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3322 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3323 output_sections and section_offsets.
3324 (Sized_relobj::write_local_symbols): Likewise.
3325 (map_to_kept_section): Compute output address directly.
3326 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3327 output_sections and section_offsets.
3328 (Sized_relobj::write_sections): Likewise.
3329 (Sized_relobj::relocate_sections): Likewise.
3330 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3331 * output.h (class Output_reloc): Update declarations. Change
3332 u2_.relobj to Sized_relobj*.
3333 (class Output_data_reloc): Change add functions to use
3335 * output.cc (Output_reloc::Output_reloc): Change relobj to
3337 (Output_reloc::local_section_offset): Change return type to
3338 Elf_Addr. Use get_output_section_offset.
3339 (Output_reloc::get_address): Likewise.
3340 (Output_section::is_input_address_mapped): Don't call
3341 is_section_specially_mapped.
3342 (Output_section::output_offset): Likewise.
3343 (Output_section::output_address): Likewise.
3344 (Output_section::starting_output_address): Likewise.
3345 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3346 parameter to Sized_relobj*.
3347 (Copy_relocs::need_copy_reloc): Likewise.
3348 (Copy_relocs::save): Likewise.
3349 * copy-relocs.h (class Copy_relocs): Update declarations.
3350 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3351 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3352 * target-reloc.h (relocate_for_relocatable): Change
3353 offset_in_output_section type to Elf_Addr. Change code that uses
3355 * layout.cc (Layout::layout): Always set *off.
3356 * mapfile.cc (Mapfile::print_input_section): Use
3357 output_section_offset.
3358 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3360 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3361 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3362 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3364 2008-07-03 Ian Lance Taylor <iant@google.com>
3366 * layout.cc (Layout::include_section): Do not discard unrecognized
3367 SHT_STRTAB sections.
3369 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3371 * script.cc (Lex::can_continue_name): Make '?' allowable in
3372 version-script names.
3373 * testsuite/version_script.map: Change glob pattern to use '?'
3375 2008-06-30 Manish Singh <yosh@gimp.org>
3378 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3381 2008-06-30 Ian Lance Taylor <iant@google.com>
3385 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3386 versions]: Don't try to read the value in the contents, since we
3387 don't use it. Use the template endianness when writing.
3389 2008-06-25 Cary Coutant <ccoutant@google.com>
3391 * fileread.cc (File_read::make_view): Assert on zero-length view.
3392 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3393 symbol table when there are no symbols to read.
3395 2008-06-23 Craig Silverstein <csilvers@google.com>
3397 * version.cc (version_string): Bump to 1.7
3399 2008-06-18 Craig Silverstein <csilvers@google.com>
3401 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3402 constant 0xFFFF to type Valtype.
3403 (Powerpc_relocate_functions::rel16_ha): Likewise.
3405 2008-06-17 Ian Lance Taylor <iant@google.com>
3407 * output.h (Output_section::Input_section): Initialize p2align_ to
3408 zero for Output_section_data constructors.
3409 (Output_section::Input_section::addralign): If not an input
3410 section, return the alignment of the Output_section_data.
3411 * testsuite/copy_test.cc: New file.
3412 * testsuite/copy_test_1.cc: New file.
3413 * testsuite/copy_test_2.cc: New file.
3414 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3415 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3416 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3417 (copy_test_1_pic.o, copy_test_1.so): New targets.
3418 (copy_test_2_pic.o, copy_test_2.so): New targets.
3419 * testsuite/Makefile.in: Rebuild.
3421 * script-sections.cc (Script_sections::place_orphan): Initialize
3422 local variable exact.
3424 2008-06-13 David Edelsohn <edelsohn@gnu.org>
3426 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3428 2008-06-12 David Edelsohn <edelsohn@gnu.org>
3429 David S. Miller <davem@davemloft.net>
3431 * powerpc.cc: New file.
3432 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3433 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3434 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3435 * Makefile.in: Rebuild.
3437 2008-06-09 Ian Lance Taylor <iant@google.com>
3439 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3441 (throwing, orig_terminate): New static variables.
3442 (terminate_handler): New static function.
3443 (t2): Set terminate handler.
3445 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3448 * binary.cc (Binary_to_elf::sized_convert): Fix .data
3451 2008-05-30 Cary Coutant <ccoutant@google.com>
3453 * archive.cc (Archive::include_all_members) Correct to step
3454 over symbol table and extended name table in thin archives.
3456 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3459 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3462 2008-05-28 Caleb Howe <cshowe@google.com>
3464 * reduced_debug_output.cc: New file.
3465 * reduced_debug_output.h: New file.
3466 * options.h (class General_options): Add --strip-debug-non-line.
3467 * options.cc (General_options::finalize): Add strip_debug_non_line
3468 to the strip heirarchy.
3469 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3471 * layout.cc: Include "reduced_debug_output.h".
3472 (Layout::Layout): Initialize new fields.
3473 (line_only_debug_sections): New static array.
3474 (is_lines_only_debug_sections): New static inline function.
3475 (Layout::include_section): Handle --strip-debug-non-line.
3476 (Layout::make_output_section): If --strip-debug-non-line, build
3477 new output sections for .debug_abbrev and .debug_info.
3478 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3479 gold. Warn about possible overflow.
3480 (read_signed_LEB_128): Likewise.
3481 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3482 (read_signed_LEB_128): Declare.
3483 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3484 (HFILES): Add reduced_debug_output.h.
3485 * Makefile.in: Rebuild.
3487 2008-05-21 Ian Lance Taylor <iant@google.com>
3489 * mapfile.cc: New file.
3490 * mapfile.h: New file.
3491 * options.h (class General_options): Add -M/--print-map and -Map.
3492 * options.cc (General_options::finalize): Make -M equivalent to
3494 * main.cc: Include <cstdio> and "mapfile.h".
3495 (main): Open mapfile if requested.
3496 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3497 constructor. Change caller.
3498 (queue_initial_tasks): Add mapfile parameter. Change caller.
3499 (queue_middle_tasks): Likewise.
3500 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
3502 * archive.cc: Include "mapfile.h".
3503 (Archive::add_symbols): Add mapfile parameter. Change all
3504 callers. Pass mapfile, symbol, and reason to include_member.
3505 (Archive::include_all_members): Add mapfile parameter. Change all
3507 (Archive::include_member): Add mapfile, sym, and why parameters.
3508 Change all callers. Report inclusion to map file.
3509 * archive.h: Include "fileread.h".
3510 (class Archive): Update declarations.
3511 (Archive::file): New const method.
3512 (class Add_archive_symbols): Add mapfile_ field. Update
3513 constructor. Change all callers.
3514 * readsyms.h (class Read_symbols): Likewise.
3515 (class Finish_group): Likewise.
3516 (class Read_script): Likewise.
3517 * common.cc: Include "mapfile.h".
3518 (Symbol_table::allocate_commons): Add mapfile parameter. Change
3520 (Symbol_table::do_allocate_commons): Likewise.
3521 (Symbol_table::do_allocate_commons_list): Likewise. Report common
3522 symbol allocation to mapfile.
3523 * common.h (class Allocate_commons_task): Add mapfile_ field.
3524 Update constructor. Change all callers.
3525 * symtab.h (class Symbol_table): Update declarations.
3526 * layout.cc: Include "mapfile.h".
3527 (Layout_task_runner::run): Print information to mapfile.
3528 (Layout::create_gold_note): Change Output_data_fixed_space to
3529 Output_data_zero_fill.
3530 (Layout::create_build_id): Likewise.
3531 (Layout::print_to_mapfile): New function.
3532 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
3533 constructor. Change caller.
3534 (class Layout): Declare print_to_mapfile.
3535 * output.cc (Output_section::Input_section::print_to_mapfile): New
3537 (Output_section::add_input_section): If producing a map, always
3538 add to input_sections_ list.
3539 (Output_section::do_print_to_mapfile): New function.
3540 (Output_segment::print_sections_to_mapfile): New function.
3541 (Output_segment::print_section_list_to_mapfile): New function.
3542 * output.h: Include "mapfile.h".
3543 (Output_data::print_to_mapfile): New function.
3544 (Output_data::do_print_to_mapfile): New virtual function.
3545 (Output_segment_headers::do_print_to_mapfile): New function.
3546 (Output_file_header::do_print_to_mapfile): New function.
3547 (Output_data_const::do_print_to_mapfile): New function.
3548 (class Output_data_const_buffer): Add map_name_ field. Update
3549 constructor. Change all callers. Add do_print_to_mapfile
3551 (class Output_data_fixed_space): Likewise.
3552 (class Output_data_space): Likewise.
3553 (class Output_data_zero_fill): New class.
3554 (Output_data_strtab::do_print_to_mapfile): New function.
3555 (Output_data_reloc_base::do_print_to_mapfile): New function.
3556 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3557 (Output_data_group::do_print_to_mapfile): New function.
3558 (Output_data_got::do_print_to_mapfile): New function.
3559 (Output_data_dynamic::do_print_to_mapfile): New function.
3560 (Output_symtab_xindex::do_print_to_mapfile): New function.
3561 (class Output_section): Declare do_print_to_mapflie. Declare
3562 print_to_mapfile in Input_section.
3563 (class Output_segment): Declare new functions.
3564 * object.h (Sized_relobj::symbol_count): New function.
3565 * script-sections.cc
3566 (Output_section_element_dot_assignment::set_section_addresses):
3567 Change Output_data_fixed_space to Output_data_zero_fill.
3568 (Output_data_expression::do_print_to_mapfile): New function.
3569 * script.cc (read_input_script): Add mapfile parameter. Change
3571 * script.h (read_input_script): Update declaration.
3572 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
3573 (Eh_frame::do_print_to_mapfile): New function.
3574 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
3575 (Output_merge_string::do_print_to_mapfile): New function.
3576 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
3578 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
3580 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
3582 * Makefile.am (CCFILES): Add mapfile.cc.
3583 (HFILES): Add mapfile.h.
3584 * Makefile.in: Rebuild.
3586 2008-05-19 Ian Lance Taylor <iant@google.com>
3588 * options.h (class General_options): Add -z relro.
3589 * layout.cc (Layout::Layout): Initialize relro_segment_.
3590 (Layout::add_output_section_data): Return the output section.
3591 (Layout::make_output_section): Rcognize relro sections and mark
3593 (Layout::attach_allocated_section_to_segment): Put relro sections
3594 in a PT_GNU_RELRO segment.
3595 (Layout::create_initial_dynamic_sections): Mark the .dynamic
3597 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
3599 (Layout::linkonce_mapping): Map d.rel.ro.local to
3601 (Layout::output_section_name): Us .data.rel.ro.local for any
3602 section which begins with that.
3603 * layout.h (class Layout): Update add_output_section_data
3604 declaration. Add relro_segment_ field.
3605 * output.cc (Output_section::Output_section): Initialize is_relro_
3606 and is_relro_local_ fields.
3607 (Output_segment::add_output_section): Group relro sections.
3608 (Output_segment::is_first_section_relro): New function.
3609 (Output_segment::maximum_alignment): If there is a relro section,
3610 align the segment to the common page size.
3611 (Output_segment::set_section_addresses): Track whether we are
3612 looking at relro sections. If the last section is a relro
3613 section, align to the common page size.
3614 (Output_segment::set_section_list_addresses): Add in_relro
3615 parameter. Change all callers. Align to the page size when
3616 moving from relro to non-relro section.
3617 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
3619 * output.h (class Output_section): Add is_relro_ and
3620 is_relro_local_ fields.
3621 (Output_section::is_relro): New function.
3622 (Output_section::set_is_relro): New function.
3623 (Output_section::is_relro_local): New function.
3624 (Output_section::set_is_relro_local): New function.
3625 (class Output_segment): Update declarations.
3626 * i386.cc (Target_i386::got_section): Mark .got section as relro.
3627 * sparc.cc (Target_sparc::got_section): Likewise.
3628 * x86_64.cc (Target_x86_64::got_section): Likewise.
3629 * testsuite/relro_test_main.cc: New file.
3630 * testsuite/relro_test.cc: New file.
3631 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
3632 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
3633 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
3634 (relro_test.so, relro_test_pic.o): New targets.
3635 * testsuite/Makefile.in: Rebuild.
3637 2008-05-16 Ian Lance Taylor <iant@google.com>
3639 * output.cc (Output_segment::add_output_section): Remove front
3641 * output.h (class Output_segment): Remove
3642 add_initial_output_section and overloaded add_output_section.
3643 Update declaration of remaining add_output_section.
3644 * layout.cc (Layout::create_interp): Call add_output_section
3645 rather than add_initial_output_section.
3646 (Layout::finish_dynamic_section): Likewise.
3648 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
3649 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
3650 know the dynamic type.
3651 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
3652 field. Initialize it in constructor.
3653 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
3654 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
3655 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
3658 * output.cc (Output_reloc::get_address): Change return type to
3660 * output.h (class Output_reloc): Update get_address declaration.
3661 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
3662 for section addresses.
3664 2008-05-09 Ian Lance Taylor <iant@google.com>
3667 * gold.cc (gold_nomem): Use return value of write.
3669 2008-05-08 Ian Lance Taylor <iant@google.com>
3671 * symtab.c (Symbol::init_base_output_data): Add version
3672 parameter. Change all callers.
3673 (Symbol::init_base_output_segment): Likewise.
3674 (Symbol::init_base_constant): Likewise.
3675 (Symbol::init_base_undefined): Likewise.
3676 (Sized_symbol::init_output_data): Likewise.
3677 (Sized_symbol::init_output_segment): Likewise.
3678 (Sized_symbol::init_constant): Likewise.
3679 (Sized_symbol::init_undefined): Likewise.
3680 (Symbol_table::do_define_in_output_data): If the new symbol has a
3681 version, mark it as the default.
3682 (Symbol_table::do_define_in_output_segment): Likewise.
3683 (Symbol_table::do_define_as_constant): Likewise.
3684 * symtab.h (class Symbol): Update declarations.
3685 (class Sized_symbol): Likewise.
3686 * resolve.cc (Symbol::override_version): New function.
3687 (Symbol::override_base): Call override_version.
3688 (Symbol::override_base_with_special): Likewise.
3689 * testsuite/ver_script_8.script: New file.
3690 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
3691 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
3692 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
3693 (ver_test_8_1.so, ver_test_8_2.so): New targets.
3695 2008-05-06 Ian Lance Taylor <iant@google.com>
3698 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
3700 (class General_options): Remove existing --undefined, and add
3701 --no-undefined instead. Add new --undefined as synonym for -u.
3702 * archive.cc (Archive::add_symbols): Check whether symbol was
3704 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
3705 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
3706 all uses. Add IS_UNDEFINED. Update declarations to split
3707 different versions of init_base. Declare init_base_undefined.
3708 (Symbol::is_defined): Handle IS_UNDEFINED.
3709 (Symbol::is_undefined): Likewise.
3710 (Symbol::is_weak_undefined): Call is_undefined.
3711 (Symbol::is_absolute): Handle IS_CONSTANT.
3712 (class Sized_symbol): Update declarations to split different
3713 versions of init. Declare init_undefined.
3714 (class Symbol_table): Declare new functions.
3715 * symtab.cc (Symbol::init_base_object): Rename from init_base.
3717 (Symbol::init_base_output_data): Likewise.
3718 (Symbol::init_base_output_segment): Likewise.
3719 (Symbol::init_base_constant): Likewise.
3720 (Symbol::init_base_undefined): New function.
3721 (Sized_symbol::init_object): Rename from init. Change all
3723 (Sized_symbol::init_output_data): Likewise.
3724 (Sized_symbol::init_output_segment): Likewise.
3725 (Sized_symbol::init_constant): Likewise.
3726 (Sized_symbol::init_undefined): New function.
3727 (Symbol_table::add_undefined_symbols_from_command_line): New
3729 (Symbol_table::do_add_undefined_symbols_from_command_line): New
3731 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
3732 (Symbol::output_section): Likewise.
3733 (Symbol::set_output_section): Likewise.
3734 (Symbol_table::sized_finalize_symbol): Likewise.
3735 (Symbol_table::sized_write_globals): Likewise.
3736 * resolve.cc (Symbol_table::should_override): Likewise.
3737 (Symbol::override_base_with_special): Likewise.
3739 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
3740 symbol, change it to have default visibility.
3741 * testsuite/protected_1.cc: New file.
3742 * testsuite/protected_2.cc: New file.
3743 * testsuite/protected_3.cc: New file.
3744 * testsuite/protected_main_1.cc: New file.
3745 * testsuite/protected_main_2.cc: New file.
3746 * testsuite/protected_main_3.cc: New file.
3747 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
3748 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
3749 (protected_1_LDFLAGS, protected_1_LDADD): Define.
3750 (protected_1.so): New target.
3751 (protected_1_pic.o, protected_2_pic.o): New targets.
3752 (protected_3_pic.o): New target.
3753 (check_PROGRAMS): Add protected_2.
3754 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
3755 (protected_2_LDFLAGS, protected_2_LDADD): Define.
3756 * testsuite/Makefile.in: Rebuild.
3758 * options.h (DEFINE_var): Add set_user_set_##varname__.
3759 (DEFINE_bool_alias): New macro.
3760 (class General_options): Define -Bstatic using DEFINE_bool_alias
3761 rather than DEFINE_special. Add --undefined as an alias for -z
3763 * options.cc (General_options::parse_Bstatic): Remove.
3765 * options.h (class General_options): Add --fatal-warnings.
3766 * main.cc (main): Implement --fatal-warnings.
3767 * errors.h (Errors::warning_count): New function.
3769 * options.h (class General_options): Add -Bsymbolic-functions.
3770 * symtab.h (Symbol::is_preemptible): Check for
3771 -Bsymbolic-functions.
3773 2008-05-05 Ian Lance Taylor <iant@google.com>
3775 * options.h (DEFINE_bool): For DASH_Z, create the negative option
3776 as noVARNAME rather than no-VARNAME.
3777 (class General_options): Add option -z combreloc.
3778 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
3780 (Output_reloc::sort_before) [SHT_REL]: New function.
3781 (Output_reloc::sort_before) [SHT_RELA]: New function.
3782 (class Output_data_reloc_base): Add sort_relocs_ field. Define
3783 Sort_relocs_comparison.
3784 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
3785 parameter. Change all callers.
3786 (Output_data_reloc::Output_data_reloc) [both versions]: Add
3787 sort_relocs parameter. Change all callers.
3788 * output.cc (Output_reloc::get_address): New function, broken out
3790 (Output_reloc::write_rel): Call it.
3791 (Output_reloc::compare): New function.
3792 (Output_data_reloc_base::do_write): Optionally sort relocs.
3794 * configure.ac: If targ_extra_obj is set, link it in.
3795 * configure.tgt: Initialize all variables.
3796 (x86_64*): Set targ_extra_obj and targ_extra_size.
3797 * configure: Rebuild.
3799 * object.cc (Sized_relobj::include_section_group): Adjust section
3800 indexes read from group data. Build vector to pass to
3802 * layout.cc (Layout::layout_group): Add flags and shndxes
3803 parameters. Remove contents parameter. Change caller. Update
3804 explicit instantiations.
3805 * layout.h (class Layout): Update layout_group declaration.
3806 * output.cc (Output_data_group::Output_data_group): Add flags and
3807 input_shndxes parameters. Remove contents parameter. Change
3809 (Output_data_group::do_write): Change input_sections_ to
3811 * output.h (class Output_data_group): Update constructor
3812 declaration. Rename input_sections_ to input_shndxes_.
3813 * testsuite/many_sections_test.cc: Add template.
3815 2008-04-30 Cary Coutant <ccoutant@google.com>
3817 * target-reloc.h (relocate_section): Fix dead-pointer bug.
3819 * layout.cc (Layout::include_section): Refactored check for debug
3821 (Layout::add_comdat): Add new parameters. Change type
3822 of signature parameter. Add object and shndx to signatures table.
3823 (Layout::find_kept_object): New function.
3824 * layout.h: Include <cstring>.
3825 (Layout::is_debug_info_section): New function.
3826 (Layout::add_comdat): Add new parameters.
3827 (Layout::find_kept_object): New function.
3828 (Layout::Kept_section): New struct.
3829 (Layout::Signatures): Change type of map range.
3830 * object.cc (Relobj::output_section_address): New function.
3831 (Sized_relobj::include_section_group): Add new parameters. Change
3832 calls to Layout::add_comdat. Change to build table of kept comdat
3833 groups and table mapping discarded sections to kept sections.
3834 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
3835 (Sized_relobj::do_layout): Change calls to include_section_group and
3836 include_linkonce_section.
3837 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
3838 value to zero when section is discarded.
3839 (Sized_relobj::map_to_kept_section): New function.
3840 * object.h (Relobj::output_section_address): New function.
3841 (Relobj::Comdat_group): New type.
3842 (Relobj::find_comdat_group): New function.
3843 (Relobj::Comdat_group_table): New type.
3844 (Relobj::Kept_comdat_section): New type.
3845 (Relobj::Kept_comdat_section_table): New type.
3846 (Relobj::add_comdat_group): New function.
3847 (Relobj::set_kept_comdat_section): New function.
3848 (Relobj::get_kept_comdat_section): New function.
3849 (Relobj::comdat_groups_): New field.
3850 (Relobj::kept_comdat_sections_): New field.
3851 (Symbol_value::input_value): Update comment.
3852 (Sized_relobj::map_to_kept_section) New function.
3853 (Sized_relobj::include_linkonce_section): Add new parameter.
3854 * target-reloc.h (Comdat_behavior): New type.
3855 (get_comdat_behavior): New function.
3856 (relocate_section): Add code to map a discarded section to the
3857 corresponding kept section when applying a relocation.
3859 2008-04-30 Craig Silverstein <csilvers@google.com>
3861 * dwarf_reader.cc (next_generation_count): New static var.
3862 (Addr2line_cache_entry): New struct.
3863 (addr2line_cache): New static var.
3864 (Dwarf_line_info::one_addr2line): Added caching.
3865 (Dwarf_line_info::clear_addr2line_cache): New function.
3866 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
3867 cache-size parameter.
3868 (Dwarf_line_info::one_addr2line_cache): New function.
3869 * symtab.cc (Symbol_table::detect_odr_violations): Pass
3870 new cache-size argument to one_addr2line(), and clear cache.
3872 2008-04-28 Cary Coutant <ccoutant@google.com>
3874 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
3875 R_386_PC8 relocations.
3877 2008-04-23 Ian Lance Taylor <iant@google.com>
3879 * object.cc (Sized_relobj::include_section_group): Check for
3880 invalid section group.
3882 * object.cc (make_elf_object): Correct test for 64-bit ELF file
3885 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
3886 than read for file header.
3887 * archive.cc (Archive::include_member): Likewise.
3889 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
3891 * aclocal.m4: Regenerate.
3892 * configure: Regenerate.
3894 2008-04-19 Ian Lance Taylor <iant@google.com>
3896 * version.cc (version_string): Bump to 1.6.
3898 * testsuite/Makefile.am (many_sections_r_test): New target.
3899 (many_sections_r_test_SOURCES): Remove.
3900 (many_sections_r_test_DEPENDENCIES): Remove.
3901 (many_sections_r_test_LDFLAGS): Remove.
3902 (many_sections_r_test_LDADD): Remove.
3904 * object.cc (Sized_relobj::do_add_symbols): Always pass
3905 local_symbol_count_ to add_from_relobj.
3907 * testsuite/Makefile.am (many_sections_check.h): Only check one in
3908 every thousand variables.
3909 * testsuite/Makefile.in: Rebuild.
3911 * object.cc (Xindex::initialize_symtab_xindex): New function.
3912 (Xindex::read_symtab_xindex): New function.
3913 (Xindex::sym_xindex_to_shndx): New function.
3914 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
3916 (Sized_relobj::do_initialize_xindex): New function.
3917 (Sized_relobj::do_read_symbols): Adjust section links.
3918 (Sized_relobj::symbol_section_and_value): Add is_ordinary
3919 parameter. Change all callers.
3920 (Sized_relobj::include_section_group): Adjust section links and
3921 symbol section indexes.
3922 (Sized_relobj::do_layout): Adjust section links.
3923 (Sized_relobj::do_count_local_symbols): Adjust section links and
3924 symbol section indexes.
3925 (Sized_relobj::do_finalize_local_symbols): Distinguish between
3926 ordinary and special symbols.
3927 (Sized_relobj::write_local_symbols): Add symtab_xindex and
3928 dynsym_xindex parameters. Change all callers. Adjust section
3929 links. Use SHN_XINDEX when needed.
3930 (Sized_relobj::get_symbol_location_info): Adjust section links.
3931 Don't get fooled by special symbols.
3932 * object.h (class Xindex): Define.
3933 (class Object): Add xindex_ parameter. Declare virtual functoin
3934 do_initialize_xindex.
3935 (Object::adjust_sym_shndx): New function.
3936 (Object::set_xindex): New protected function.
3937 (class Symbol_value): Add is_ordinary_shndx_ field.
3938 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
3939 (Symbol_value::value): Assert ordinary section.
3940 (Symbol_value::initialize_input_to_output_map): Likewise.
3941 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
3943 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
3945 (class Sized_relobj): Update declarations.
3946 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
3947 parameter. Change all callers.
3948 (Sized_relobj::adjust_shndx): New function.
3949 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
3951 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
3952 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
3953 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
3954 (Sized_dynobj::read_dynsym_section): Adjust section links.
3955 (Sized_dynobj::read_dynamic): Likewise.
3956 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
3958 (Sized_dynobj::do_initialize_xindex): New function.
3959 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
3960 do_initialize_xindex.
3961 (Sized_dynobj::adjust_shndx): New function.
3962 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
3963 dynsym_xindex_ fields.
3964 (Layout::finalize): Add a call to set_section_indexes before
3965 creating the symtab sections.
3966 (Layout::set_section_indexes): Don't do anything if the section
3967 already has a section index.
3968 (Layout::create_symtab_sections): Add shnum parameter. Change
3969 caller. Create .symtab_shndx section if needed.
3970 (Layout::create_shdrs): Add shstrtab_section parameter. Change
3972 (Layout::allocated_output_section_count): New function.
3973 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
3975 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
3976 fields. Update declarations.
3977 (Layout::symtab_xindex): New function.
3978 (Layout::dynsym_xindex): New function.
3979 (class Write_symbols_task): Add layout_ field.
3980 (Write_symbols_task::Write_symbols_task): Add layout parameter.
3982 * output.cc (Output_section_headers::Output_section_headers): Add
3983 shstrtab_section parameter. Change all callers.
3984 (Output_section_headers::do_sized_write): Store overflow values
3985 for section count and section string table section index in
3986 section header zero.
3987 (Output_file_header::do_sized_write): Check for overflow of
3988 section count and section string table section index.
3989 (Output_symtab_xindex::do_write): New function.
3990 (Output_symtab_xindex::endian_do_write): New function.
3991 * output.h (class Output_section_headers): Add shstrtab_section_.
3992 Update declarations.
3993 (class Output_symtab_xindex): Define.
3994 (Output_section::has_out_shndx): New function.
3995 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
3997 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
3999 (Sized_symbol::init): Likewise.
4000 (Symbol::output_section): Check for ordinary symbol.
4001 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4002 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4004 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4005 Change all callers. Simplify handling of symbols from sections
4006 not included in the link.
4007 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4009 (Weak_alias_sorter::operator()): Assert that symbols are
4011 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4013 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4014 parameters. Change all callers.
4015 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4016 symbol distinction. Use SHN_XINDEX when needed.
4017 (Symbol_table::write_section_symbol): Add symtab_xindex
4018 parameter. Change all callers.
4019 (Symbol_table::sized_write_section_symbol): Likewise. Use
4020 SHN_XINDEX when needed.
4021 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4023 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4024 (Symbol::is_defined): Check is_ordinary.
4025 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4026 (Symbol::is_absolute, Symbol::is_common): Likewise.
4027 (class Sized_symbol): Update declarations.
4028 (class Symbol_table): Update declarations.
4029 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4030 parameters. Change all callers.
4031 (Sized_symbol::override): Likewise.
4032 (Symbol_table::override): Likewise.
4033 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4034 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4035 is_ordinary, and orig_st_shndx parameters. Change all callers.
4036 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4037 to be in an ordinary section.
4038 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4039 object and is_ordinary parameters. Change all callers.
4040 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4041 Change all callers. Don't add undefined or non-ordinary symbols
4043 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4045 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4047 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4048 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4049 (Sized_relobj::relocate_sections): Likewise.
4050 * target-reloc.h (scan_relocs): Adjust section symbol index.
4051 (scan_relocatable_relocs): Likewise.
4052 * i386.cc (Scan::local): Check for ordinary symbols.
4053 * sparc.cc (Scan::local): Likewise.
4054 * x86_64.cc (Scan::local): Likewise.
4055 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4056 to symbol_section_and_value.
4057 * testsuite/many_sections_test.cc: New file.
4058 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4059 (check_PROGRAMS): Add many_sections_test.
4060 (many_sections_test_SOURCES): Define.
4061 (many_sections_test_DEPENDENCIES): Define.
4062 (many_sections_test_LDFLAGS): Define.
4063 (BUILT_SOURCES): Add many_sections_define.h.
4064 (many_sections_define.h): New target.
4065 (BUILT_SOURCES): Add many_sections_check.h.
4066 (many_sections_check.h): New target.
4067 (check_PROGRAMS): Add many_sections_r_test.
4068 (many_sections_r_test_SOURCES): Define.
4069 (many_sections_r_test_DEPENDENCIES): Define.
4070 (many_sections_r_test_LDFLAGS): Define.
4071 (many_sections_r_test_LDADD): Define.
4072 (many_sections_r_test.o): New target.
4073 * testsuite/Makefile.in: Rebuild.
4075 2008-04-17 Cary Coutant <ccoutant@google.com>
4077 * errors.cc (Errors::info): New function.
4078 (gold_info): New function.
4079 * errors.h (Errors::info): New function.
4080 * gold.h (gold_info): New function.
4081 * object.cc (Input_objects::add_object): Print trace output.
4082 * options.cc (options::parse_set): New function.
4083 (General_options::parse_wrap): Deleted.
4084 (General_options::General_options): Deleted initializer.
4085 * options.h (options::String_set): New typedef.
4086 (options::parse_set): New function.
4087 (DEFINE_set): New macro.
4088 (General_options::wrap): Changed to use DEFINE_set. Changed
4089 callers of any_wrap_symbols and is_wrap_symbol.
4090 (General_options::trace, General_options::trace_symbol):
4092 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4093 (General_options::wrap_symbols_): Deleted.
4094 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4096 2008-04-17 David S. Miller <davem@davemloft.net>
4098 * options.cc (General_options::parse_V): New function.
4099 * options.h: Add entries for -V and -Qy.
4101 2008-04-17 Ian Lance Taylor <iant@google.com>
4103 * common.cc (Symbol_table::allocate_commons): Remove options
4104 parameter. Change caller.
4105 (Symbol_table::do_allocate_commons): Remove options parameter.
4106 Change caller. Just call do_allocate_commons_list twice.
4107 (Symbol_table::do_allocate_commons_list): New function, broken out
4108 of do_allocate_commons.
4109 * common.h (class Allocate_commons_task): Remove options_ field.
4111 * symtab.cc (Symbol_table::Symbol_table): Initialize
4113 (Symbol_table::add_from_object): Put TLS common symbols on
4115 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4116 which are IN_OUTPUT_DATA.
4117 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4118 allocate_commons and do_allocate_commons declarations. Declare
4119 do_allocate_commons_list.
4120 * gold.cc (queue_middle_tasks): Update creation of
4121 Allocate_commons_task to not pass options.
4122 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4123 (TLS_TEST_C_FLAGS): New variable.
4124 (tls_test_c_pic.o): New target.
4125 (tls_test_shared.so): Link in tls_test_c_pic.o.
4126 (tls_test_c_pic_ie.o): New target.
4127 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4128 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4129 (tls_test_c.o): New target.
4130 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4131 (tls_pic_test_LDADD): Likewise.
4132 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4133 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4134 (tls_test_c_gnu2.o): New target.
4135 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4137 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4138 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4139 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4140 * testsuite/tls_test.cc: Include "config.h".
4141 (t_last): Call t11_last.
4142 * testsuite/tls_test.h (t11, t11_last): Declare.
4143 * testsuite/tls_test_c.c: New file.
4144 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4145 * configure.ac: Check for OpenMP support.
4146 * configure, config.in, Makefile.in: Rebuild.
4147 * testsuite/Makefile.in: Rebuild.
4149 2008-04-16 Cary Coutant <ccoutant@google.com>
4151 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4152 (Target_i386::tls_base_symbol_defined_): New field.
4153 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4154 (Target_i386::Scan::global): Likewise.
4155 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4156 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4157 (Target_x86_64::tls_base_symbol_defined_): New field.
4158 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4159 (Target_x86_64::Scan::global): Likewise.
4161 2008-04-16 Cary Coutant <ccoutant@google.com>
4163 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4164 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4165 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4166 building shared libraries.
4167 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4168 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4169 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4170 * testsuite/Makefile.in: Rebuild.
4171 * testsuite/weak_undef.h: New file.
4172 * testsuite/weak_undef_file1.cc: Add extra test cases.
4173 * testsuite/weak_undef_file2.cc: Likewise.
4174 * testsuite/weak_undef_test.cc: Likewise.
4176 2008-04-16 David S. Miller <davem@davemloft.net>
4178 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4179 Add issued_non_pic_error_ field. Declare check_non_pic.
4180 (Target_sparc::Scan::check_non_pic): New function.
4181 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4182 (Target_sparc::Scan::global): Likewise.
4184 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4185 * configure: Rebuild.
4187 * options.h (DEFINE_enable): New macro.
4188 (new_dtags): New enable option.
4189 (initfirst, interpose, loadfltr, nodefaultlib,
4190 nodelete, nodlopen, nodump): New -z options.
4191 * layout.cc (Layout:finish_dynamic_section): If new
4192 dtags enabled, emit DT_RUNPATH. Also, emit a
4193 DT_FLAGS_1 containing any specified -z flags.
4195 2008-04-16 Ian Lance Taylor <iant@google.com>
4197 * copy-relocs.cc: New file.
4198 * copy-relocs.h: New file.
4199 * reloc.cc: Remove Copy_relocs code.
4200 * reloc.h: Likewise.
4201 * reloc-types.h (struct Reloc_types) [both versions]: Add
4202 get_reloc_addend_noerror.
4203 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4204 variants of add_global which take an addend which must be zero.
4205 * i386.cc: Include "copy-relocs.h".
4206 (class Target_i386): Change type of copy_relocs_ to variable,
4208 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4210 (Target_i386::do_finalize_sections): Change handling of
4212 * sparc.cc: Include "copy-relocs.h".
4213 (class Target_sparc): Change type of copy_relocs_ to variable,
4215 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4217 (Target_sparc::do_finalize_sections): Change handling of
4219 * x86_64.cc: Include "copy-relocs.h".
4220 (class Target_x86_64): Change type of copy_relocs_ to variable,
4222 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4223 class. Change all callers.
4224 (Target_x86_64::do_finalize_sections): Change handling of
4226 * Makefile.am (CCFILES): Add copy-relocs.cc.
4227 (HFILES): Add copy-relocs.h.
4229 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4231 * testsuite/script_test_4.sh: Permit leading zeroes.
4233 2008-04-15 Ian Lance Taylor <iant@google.com>
4235 * script-sections.cc (Script_sections::create_segments): Use
4236 header_size_adjustment even when there is enough room for the
4238 * testsuite/script_test_4.sh: New file.
4239 * testsuite/script_test_4.t: New file.
4240 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4241 (check_DATA): Add script_test_4.stdout.
4242 (MOSTLYCLEANFILES): Likewise.
4243 (script_test_4): New target.
4244 (script_test_4.stdout): New target.
4245 * testsuite/Makefile.in: Rebuild.
4247 * sparc.cc: Add definitions for Output_data_plt_sparc class
4250 2008-04-14 David S. Miller <davem@davemloft.net>
4252 * sparc.cc: New file.
4253 * Makefile.am (TARGETSOURCES): Add sparc.cc
4254 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4255 * configure.tgt: Document targ_extra_size and
4256 targ_extra_big_endian. Add entries for sparc-* and
4258 * configure.ac: Handle targ_extra_size and
4259 targ_extra_big_endian.
4260 * Makefile.in: Rebuild.
4261 * configure: Likewise.
4262 * po/POTFILES.in: Likewise.
4263 * po/gold.pot: Likewise.
4265 2008-04-14 Ian Lance Taylor <iant@google.com>
4267 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4268 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4269 in the name/type/flags to section mapping. Don't call
4270 allocate_output_section.
4271 (Layout::choose_output_section): Change parameter from adjust_name
4272 to is_input_section. Don't permit input sections after sections
4273 are attached to segments. Don't call allocate_output_section.
4274 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4275 not write_enable_output_section.
4276 (Layout::make_output_section): Don't push to
4277 unattached_section_list_ nor call attach_to_segment. Call
4278 attach_section_to_segment if sections are attached.
4279 (Layout::attach_sections_to_segments): New function.
4280 (Layout::attach_section_to_segment): New function.
4281 (Layout::attach_allocated_section_to_segment): Rename from
4282 attach_to_segment. Remove flags parameter.
4283 (Layout::allocate_output_section): Remove function.
4284 (Layout::write_enable_output_section): Remove function.
4285 * layout.h (class Layout): Update for above changes. Add new
4286 field sections_are_attached_.
4287 * output.h (Output_section::update_flags_for_input_section): New
4289 * output.cc (Output_section::add_input_section): Call
4290 update_flags_for_input_section.
4291 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4293 2008-04-11 Cary Coutant <ccoutant@google.com>
4295 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4296 thought unnecessary.
4297 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4299 2008-04-11 Ian Lance Taylor <iant@google.com>
4301 * output.h (class Output_section_data): Remove inline definition
4303 * output.cc (Output_section_data::set_addralign): New function.
4305 2008-04-11 Cary Coutant <ccoutant@google.com>
4307 Add support for TLS descriptors for i386 and x86_64.
4308 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4309 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4310 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4312 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4313 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4314 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4316 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4317 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4318 Fix problem with initial-exec relocations.
4319 (Target_i386::Relocate::relocate_tls): Likewise.
4320 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4322 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4323 support for section-plus-offset dynamic table entries.
4324 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4325 (Output_data_dynamic::Dynamic_entry): Add support for
4326 section-plus-offset dynamic table entries.
4327 (Output_data_dynamic::Classification): Likewise.
4328 (Output_data_dynamic::classification_): Renamed offset_.
4329 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4330 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4331 (Target_x86_64::make_plt_section): New function.
4332 (Target_x86_64::reserve_tlsdesc_entries): New function.
4333 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4334 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4335 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4336 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4337 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4338 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4339 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4340 add extra PLT entry for TLS descriptors.
4341 (Output_data_plt_x86_64::got_): New field.
4342 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4343 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4345 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4347 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4348 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4349 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4350 R_386_TLS_DESC_CALL relocations.
4351 (Target_x86_64::Scan::global): Likewise.
4352 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4353 for TLS descriptors.
4354 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4355 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4356 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4357 GD-to-IE relaxation.
4358 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4359 and TLS_DESCRIPTORS.
4360 * Makefile.in: Rebuild.
4361 * configure: Rebuild.
4362 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4363 (tls_test_shared2.so): New target.
4364 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4365 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4366 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4367 (tls_shared_gd_to_ie_test_LDADD): New variable.
4368 (tls_shared_gnu2_gd_to_ie_test): New target.
4369 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4371 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4372 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4373 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4374 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4375 (tls_shared_gnu2_test): New target.
4376 (tls_test_gnu2_shared.so): New target.
4377 (tls_shared_gnu2_test_SOURCES): New variable.
4378 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4379 (tls_shared_gnu2_test_LDFLAGS): New variable.
4380 (tls_shared_gnu2_test_LDADD): New variable.
4381 * testsuite/Makefile.in: Rebuild.
4382 * testsuite/Makefile.
4384 2008-04-11 Ian Lance Taylor <iant@google.com>
4386 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4388 * testsuite/Makefile.in: Rebuild.
4390 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4392 * testsuite/script_test_2.cc (main): Adjust test.
4394 2008-04-11 David S. Miller <davem@davemloft.net>
4395 Ian Lance Taylor <iant@google.com>
4397 * options.h (General_options): Add entries for '-Y' and
4399 * options.cc (General_options:finalize): If -Y was used, add those
4400 entries to the library path instead of the default "/lib" and
4403 2008-04-11 David S. Miller <davem@davemloft.net>
4405 * testsuite/justsyms.t: Start at 0x100.
4406 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
4407 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4409 * testsuite/script_test_2.cc: Adjust string and section length
4412 2008-04-09 Ian Lance Taylor <iant@google.com>
4415 * script-sections.cc (Sections_element::allocate_to_segment): Add
4417 (Output_section_definition::allocate_to_segment): Likewise.
4418 (Orphan_output_section::allocate_to_segment): Likewise.
4419 (Script_sections::attach_sections_using_phdrs_clause): Don't
4420 propagate non-PT_LOAD segments to orphan sections.
4421 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4422 readelf rather than objdump.
4423 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4424 .interp section and PT_INTERP segment are the same size.
4425 * testsuite/Makefile.in: Rebuild.
4427 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4428 aliases for symbols defined in the same object.
4429 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4430 (weak_alias_test_SOURCES): New variable.
4431 (weak_alias_test_DEPENDENCIES): New variable.
4432 (weak_alias_test_LDFLAGS): New variable.
4433 (weak_alias_test_LDADD): New variable.
4434 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4435 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4436 (weak_alias_test_3.o): New target.
4437 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4438 * testsuite/weak_alias_test_main.cc: New file.
4439 * testsuite/weak_alias_test_1.cc: New file.
4440 * testsuite/weak_alias_test_2.cc: New file.
4441 * testsuite/weak_alias_test_3.cc: New file.
4443 2008-04-08 Ian Lance Taylor <iant@google.com>
4445 * options.h (class General_options): Add --noinhibit-exec option.
4446 * main.cc (main): Check --noinhibit-exec.
4448 * options.h (class General_options): Define --wrap as a special
4449 option. Add wrap_symbols_ field.
4450 (General_options::any_wrap_symbols): New function.
4451 (General_options::is_wrap_symbol): New function.
4452 * options.cc (General_options::parse_wrap): New function.
4453 (General_options::General_options): Initialize wrap_symbols_.
4454 * symtab.cc (Symbol_table::wrap_symbol): New function.
4455 (Symbol_table::add_from_object): Handle --wrap.
4456 * symtab.h (class Symbol_table): Declare wrap_symbol.
4457 * target.h (Target::wrap_char): New function.
4458 (Target::Target_info): Add wrap_char field.
4459 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4460 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4461 * testsuite/testfile.cc (Target_test::test_target_info):
4464 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4467 * layout.h (class Layout): Add added_eh_frame_data_ field.
4468 * layout.cc (Layout::Layout): Initialize new field.
4469 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4470 output section until we find a section we merged successfully.
4471 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4472 that the size be non-zero.
4474 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4477 2008-04-08 Craig Silverstein <csilvers@google.com>
4479 * configure.ac: Export new conditional variable HAVE_ZLIB.
4480 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4482 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4483 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4485 2008-04-07 Ian Lance Taylor <iant@google.com>
4487 * version.cc (version_string): Set to "1.5".
4489 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4490 Add issued_non_pic_error_ field. Declare check_non_pic.
4491 (Target_x86_64::Scan::check_non_pic): New function.
4492 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4493 (Target_x86_64::Scan::global): Likewise.
4495 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4496 addend parameter. Change caller. Handle merge sections.
4497 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
4498 Address to Addend. Don't add in the result of
4499 local_section_offset, pass down the addend and use the returned
4501 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
4502 Update declarations of local_section_offset and symbol_value.
4503 * testsuite/two_file_test_1.cc (t18): New function.
4504 * testsuite/two_file_test_2.cc (f18): New function.
4505 * testsuite/two_file_test_main.cc (main): Call t18.
4506 * testsuite/two_file_test.h (t18, f18): Declare.
4508 * configure.ac: Don't test for objdump, c++filt, or readelf.
4509 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
4511 (TEST_READELF): New variable.
4512 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
4513 (check_PROGRAMS): Add two_file_strip_test.
4514 (two_file_strip_test): New target.
4515 (check_PROGRAMS): Add two_file_same_shared_strip_test.
4516 (two_file_same_shared_strip_test_SOURCES): New variable.
4517 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
4518 (two_file_same_shared_strip_test_LDFLAGS): New variable.
4519 (two_file_same_shared_strip_test_LDADD): New variable.
4520 (two_file_shared_strip.so): New target.
4521 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
4522 (ver_test_5.syms, ver_test_7.syms): Likewise.
4523 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
4524 (strip_test_3.stdout): Use TEST_OBJDUMP.
4525 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4527 2008-04-04 Cary Coutant <ccoutant@google.com>
4529 * symtab.h (Symbol::is_weak_undefined): New function.
4530 (Symbol::is_strong_undefined): New function.
4531 (Symbol::is_absolute): New function.
4532 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
4533 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
4535 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
4536 (weak_undef_test): New target.
4537 * testsuite/Makefile.in: Rebuild.
4538 * testsuite/weak_undef_file1.cc: New file.
4539 * testsuite/weak_undef_file2.cc: New file.
4540 * testsuite/weak_undef_test.cc: New file.
4542 2008-04-03 Craig Silverstein <csilvers@google.com>
4544 * compressed_output.h (class Output_compressed_section): Use
4546 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4548 (zlib_compressed_suffix): Removed.
4549 (Output_compressed_section::set_final_data_size): Use unsigned
4551 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4552 Fix linker invocation.
4553 (flagstest_o_specialfile_and_compress_debug_sections):
4555 * testsuite/Makefile.in: Regenerated.
4557 2008-04-02 David S. Miller <davem@davemloft.net>
4559 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4560 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4562 2008-04-02 Craig Silverstein <csilvers@google.com>
4566 2008-04-02 Ian Lance Taylor <iant@google.com>
4568 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4569 parameters. Update for new key type to views_. Change all
4571 (File_read::read): Adjust for byteshift in returned view.
4572 (File_read::add_view): New function, broken out of
4574 (File_read::make_view): New function, broken out of
4576 (File_read::find_or_make_view): Add offset and aligned
4577 parameters. Rewrite accordingly. Change all callers.
4578 (File_read::get_view): Add offset and aligned parameters. Adjust
4579 for byteshift in return value.
4580 (File_read::get_lasting_view): Likewise.
4581 * fileread.h (class File_read): Update declarations.
4582 (class File_read::View): Add byteshift_ field. Add byteshift to
4583 constructor. Add byteshift method.
4584 * archive.h (Archive::clear_uncached_views): New function.
4585 (Archive::get_view): Add aligned parameter. Change all callers.
4586 * object.h (Object::get_view): Add aligned parameter. Change all
4588 (Object::get_lasting_view): Likewise.
4590 * fileread.cc (File_read::release): Don't call clear_views if
4591 there are multiple objects.
4592 * fileread.h (File_read::clear_uncached_views): New function.
4593 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
4596 2008-03-31 Cary Coutant <ccoutant@google.com>
4598 Add thin archive support.
4599 * archive.cc (Archive::armagt): New const.
4600 (Archive::setup): Remove task parameter and calls to unlock.
4601 (Archive::unlock_nested_archives): New function.
4602 (Archive::read_header): Add nested_off parameter. Change
4604 (Archive::interpret_header): Likewise.
4605 (Archive::include_all_members): Change to handle thin
4607 (Archive::include_member): Likewise.
4608 * archive.h (Archive::Archive): Add new parameters and
4610 (Archive::armagt): New const.
4611 (Archive::setup): Remove task parameter.
4612 (Archive::unlock_nested_archives): New function.
4613 (Archive::read_header): Add nested_off parameter.
4614 (Archive::interpret_header): Likewise.
4615 (Archive::Nested_archive_table): New typedef.
4616 (Archive::is_thin_archive_): New field.
4617 (Archive::nested_archives_): New field.
4618 (Archive::options_): New field.
4619 (Archive::dirpath_): New field.
4620 (Archive::task_): New field.
4621 * readsyms.cc (Read_symbols::do_read_symbols): Add check
4622 for thin archives. Pass additional parameters to
4623 Archive::Archive. Unlock the archive file after calling
4626 2008-03-29 Ian Lance Taylor <iant@google.com>
4628 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
4629 version symbol to be local.
4630 * testsuite/ver_test_4.sh: New file.
4631 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
4632 (check_DATA): Add ver_test_4.syms.
4633 (ver_test_4.syms): New target.
4634 * testsuite/Makefile.in: Rebuild.
4637 (Output_section::Input_section_sort_entry::has_priority): New
4639 (Output_section::Input_section_sort_entry::match_file_name): New
4641 (Output_section::Input_section_sort_entry::match_section_name):
4643 (Output_section::Input_section_sort_entry::match_section_name_prefix):
4645 (Output_section::Input_section_sort_entry::match_section_file):
4647 (Output_section::Input_section_sort_compare::operator()): Rewrite
4648 using new Input_section_sort_entry functions. Sort crtbegin and
4649 crtend first. Sort sections with no priority before sections with
4651 * testsuite/initpri1.c (d3): Check j != 4.
4652 (cd5): New constructor/destructor function.
4653 (main): Check j != 2.
4655 * symtab.cc (Symbol_table::add_from_object): If we don't use the
4656 new symbol when resolving, don't call set_is_default.
4657 * testsuite/ver_test_7.cc: New file.
4658 * testsuite/ver_test_7.sh: New file.
4659 * testsuite/Makefile.am (ver_test_7.so): New target.
4660 (ver_test_7.o): New target.
4661 (check_SCRIPTS): Add ver_test_7.sh.
4662 (check_DATA): Add ver_test_7.syms.
4663 (ver_test_7.syms): New target.
4665 2008-03-28 Ian Lance Taylor <iant@google.com>
4667 * layout.cc (Layout::layout): If we see an input section with a
4668 name that needs sorting, set the must_sort flag for the output
4670 (Layout::make_output_section): If the name of the output section
4671 indicates that it might require sorting, set the may_sort flag.
4672 * output.h (Output_section::may_sort_attached_input_sections): New
4674 (Output_section::set_may_sort_attached_input_sections): New
4676 (Output_section::must_sort_attached_input_sections): New
4678 (Output_section::set_must_sort_attached_input_sections): New
4680 (class Output_section): Declare Input_section_sort_entry. Define
4681 Input_section_sort_compare. Declare
4682 sort_attached_input_sections. Add new fields:
4683 may_sort_attached_input_sections_,
4684 must_sort_attached_input_sections_,
4685 attached_input_sections_are_sorted_.
4686 * output.cc (Output_section::Output_section): Initialize new
4688 (Output_section::add_input_section): Add an entry to
4689 input_sections_ if may_sort or must_sort are true.
4690 (Output_section::set_final_data_size): Call
4691 sort_attached_input_sections if necessary.
4692 (Output_section::Input_section_sort_entry): Define new class.
4693 (Output_section::Input_section_sort_compare::operator()): New
4695 (Output_section::sort_attached_input_sections): New function.
4696 * configure.ac: Check whether the compiler supports constructor
4697 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
4698 * testsuite/initpri1.c: New file.
4699 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
4700 CONSTRUCTOR_PRIORITY.
4701 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
4702 (initpri1_LDFLAGS): New variable.
4703 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4705 2008-03-27 Ian Lance Taylor <iant@google.com>
4707 * common.cc (Sort_commons::operator): Correct sorting algorithm.
4708 * testsuite/common_test_1.c: New file.
4709 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
4710 (common_test_1_SOURCES): New variable.
4711 (common_test_1_DEPENDENCIES): New variable.
4712 (common_test_1_LDFLAGS): New variable.
4714 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
4715 and commons_ correctly when NAME/VERSION does not override
4717 * testsuite/ver_test_6.c: New file.
4718 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
4719 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
4720 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
4722 2008-03-26 Ian Lance Taylor <iant@google.com>
4724 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
4725 of an undefined symbol from a version script.
4726 * testsuite/Makefile.am (ver_test_5.so): New target.
4727 (ver_test_5.o): New target.
4728 (check_SCRIPTS): Add ver_test_5.sh.
4729 (check_DATA): Add ver_test_5.syms.
4730 (ver_test_5.syms): New target.
4731 * testsuite/ver_test_5.cc: New file.
4732 * testsuite/ver_test_5.script: New file.
4733 * testsuite/ver_test_5.sh: New file.
4734 * Makefile.in, testsuite/Makefile.in: Rebuild.
4737 Fix problems building gold with gcc 4.3.0.
4738 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
4739 (gold_error_at_location, gold_warning_at_location): Use it.
4740 * configure.ac: Check whether we can compile and use a template
4741 function with a printf attribute.
4742 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
4743 when jumping over bytes.
4744 * object.cc: Instantiate Object::read_section_data.
4745 * debug.h: Include <cstring>
4746 * dwarf_reader.cc: Include <algorithm>
4747 * main.cc: Include <cstring>.
4748 * options.cc: Include <cstring>.
4749 * output.cc: Include <cstring>.
4750 * script.cc: Include <cstring>.
4751 * script.h: Include <string>.
4752 * symtab.cc: Include <cstring> and <algorithm>.
4753 * target-select.cc: Include <cstring>.
4754 * version.cc: Include <string>.
4755 * testsuite/testmain.cc: Include <cstdlib>.
4756 * configure, config.in: Rebuild.
4758 2008-03-25 Ian Lance Taylor <iant@google.com>
4760 * options.cc: Include "../bfd/bfdver.h".
4761 (options::help): Print bug reporting address.
4763 * version.cc (print_version): Adjust output for current value of
4768 * options.cc (options::help): Print list of supported targets.
4769 * target-select.h: Include <vector>.
4770 (class Target_selector): Make machine_, size_, and is_big_endian_
4771 fields const. Add bfd_name_ and instantiated_target_ fields.
4772 (Target_selector::Target_selector): Add bfd_name parameter.
4773 (Target_selector::recognize): Make non-virtual, call
4775 (Target_selector::recognize_by_name): Make non-virtual, call
4776 do_recognize_by_name.
4777 (Target_selector::supported_names): New function.
4778 (Target_selector::bfd_name): New function.
4779 (Target_selector::do_instantiate_target): New pure virtual
4781 (Target_selector::do_recognize): New virtual function.
4782 (Target_selector::do_recognize_by_name): New virtual function.
4783 (Target_selector::instantiate_target): New private function.
4784 (supported_target_names): Declare.
4785 * target-select.cc (Target_selector::Target_selector): Update for
4786 new parameter and fields.
4787 (select_target_by_name): Check that the name matches before
4788 calling recognize_by_name.
4789 (supported_target_names): New function.
4790 * i386.cc (class Target_selector_i386): Update Target_selector
4791 constructor call. Remove recognize and recognize_by_name. Add
4792 do_instantiate_target.
4793 * x86_64.cc (class Target_selector_x86_64): Likewise.
4794 * testsuite/testfile.cc (class Target_selector_test): Update for
4795 changes to Target_selector.
4797 * README: Rewrite, with some notes on unsupported features.
4799 2008-03-24 Cary Coutant <ccoutant@google.com>
4801 * i386.cc (Target_i386::Got_type): New enum declaration.
4802 (Target_i386::Scan::local): Updated callers of Output_data_got
4804 (Target_i386::Scan::global): Likewise.
4805 (Target_i386::Relocate::relocate): Likewise.
4806 (Target_i386::Relocate::relocate_tls): Likewise.
4807 * object.h (Got_offset_list): New class.
4808 (Sized_relobj::local_has_got_offset): Added got_type parameter.
4809 (Sized_relobj::local_got_offset): Likewise.
4810 (Sized_relobj::set_local_got_offset): Likewise.
4811 (Sized_relobj::local_has_tls_got_offset): Removed.
4812 (Sized_relobj::local_tls_got_offset): Removed.
4813 (Sized_relobj::set_local_tls_got_offset): Removed.
4814 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
4815 * output.cc (Output_data_got::add_global): Added got_type parameter.
4816 (Output_data_got::add_global_with_rel): Likewise.
4817 (Output_data_got::add_global_with_rela): Likewise.
4818 (Output_data_got::add_global_pair_with_rel): New function.
4819 (Output_data_got::add_global_pair_with_rela): New function.
4820 (Output_data_got::add_local): Added got_type parameter.
4821 (Output_data_got::add_local_with_rel): Likewise.
4822 (Output_data_got::add_local_with_rela): Likewise.
4823 (Output_data_got::add_local_pair_with_rel): New function.
4824 (Output_data_got::add_local_pair_with_rela): New function.
4825 (Output_data_got::add_global_tls): Removed.
4826 (Output_data_got::add_global_tls_with_rel): Removed.
4827 (Output_data_got::add_global_tls_with_rela): Removed.
4828 (Output_data_got::add_local_tls): Removed.
4829 (Output_data_got::add_local_tls_with_rel): Removed.
4830 (Output_data_got::add_local_tls_with_rela): Removed.
4831 * output.h (Output_data_got::add_global): Added got_type parameter.
4832 (Output_data_got::add_global_with_rel): Likewise.
4833 (Output_data_got::add_global_with_rela): Likewise.
4834 (Output_data_got::add_global_pair_with_rel): New function.
4835 (Output_data_got::add_global_pair_with_rela): New function.
4836 (Output_data_got::add_local): Added got_type parameter.
4837 (Output_data_got::add_local_with_rel): Likewise.
4838 (Output_data_got::add_local_with_rela): Likewise.
4839 (Output_data_got::add_local_pair_with_rel): New function.
4840 (Output_data_got::add_local_pair_with_rela): New function.
4841 (Output_data_got::add_global_tls): Removed.
4842 (Output_data_got::add_global_tls_with_rel): Removed.
4843 (Output_data_got::add_global_tls_with_rela): Removed.
4844 (Output_data_got::add_local_tls): Removed.
4845 (Output_data_got::add_local_tls_with_rel): Removed.
4846 (Output_data_got::add_local_tls_with_rela): Removed.
4847 * resolve.cc (Symbol::override_base_with_special): Removed
4848 reference to has_got_offset_ field.
4849 * symtab.cc (Symbol::init_fields): Replaced initialization
4850 of got_offset_ with got_offsets_. Removed initialization
4852 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
4853 (Symbol::got_offset): Likewise.
4854 (Symbol::set_got_offset): Likewise.
4855 (Symbol::has_tls_got_offset): Removed.
4856 (Symbol::tls_got_offset): Removed.
4857 (Symbol::set_tls_got_offset): Removed.
4858 (Symbol::got_offset_): Removed.
4859 (Symbol::tls_mod_got_offset_): Removed.
4860 (Symbol::tls_pair_got_offset_): Removed.
4861 (Symbol::got_offsets_): New field.
4862 (Symbol::has_got_offset): Removed.
4863 (Symbol::has_tls_mod_got_offset): Removed.
4864 (Symbol::has_tls_pair_got_offset): Removed.
4865 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
4866 (Target_x86_64::Scan::local): Updated callers of Output_data_got
4868 (Target_x86_64::Scan::global): Likewise.
4869 (Target_x86_64::Relocate::relocate): Likewise.
4870 (Target_x86_64::Relocate::relocate_tls): Likewise.
4872 2008-03-25 Ben Elliston <bje@au.ibm.com>
4874 * yyscript.y: Fix spelling error in comment.
4876 2008-03-24 Ian Lance Taylor <iant@google.com>
4878 * options.h (class General_options): Define build_id option.
4879 * layout.h (class Layout): Declare write_build_id, create_note,
4880 create_build_id. Add build_id_note_ member.
4881 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
4882 "libiberty.h", "md5.h", "sha1.h".
4883 (Layout::Layout): Initialize eh_frame_data_,
4884 eh_frame_hdr_section_, and build_id_note_.
4885 (Layout::finalize): Call create_build_id.
4886 (Layout::create_note): New function, broken out of
4887 Layout::create_gold_note.
4888 (Layout::create_gold_note): Call create_note.
4889 (Layout::create_build_id): New function.
4890 (Layout::write_build_id): New function.
4891 (Close_task_runner::run): Call write_build_id.
4893 * x86_64.cc: Correct license to GPLv3.
4895 2008-03-23 Ian Lance Taylor <iant@google.com>
4897 * options.cc: Include "demangle.h".
4898 (parse_optional_string): New function.
4899 (parse_long_option): Handle takes_optional_argument.
4900 (parse_short_option): Update dash_z initializer. Handle
4901 takes_optional_argument.
4902 (General_options::General_options): Initialize do_demangle_.
4903 (General_options::finalize): Set do_demangle_. Handle demangling
4905 * options.h (parse_optional_string): Declare.
4906 (struct One_option): Add optional_arg field. Update constructor.
4907 Update call constructor calls. Add takes_optional_argument
4909 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
4910 (DEFINE_optional_string): Define.
4911 (General_options::demangle): Change from DEFINE_bool to
4912 DEFINE_optional_string.
4913 (General_options::no_demangle): New function.
4914 (General_options::do_demangle): New function.
4915 (General_options::set_do_demangle): New function.
4916 (General_options::execstack_status_): Move definition to end of
4918 (General_options::static_): Likewise.
4919 (General_options::do_demangle_): New field.
4920 * object.cc (big_endian>::get_symbol_location_info): Call
4921 Options::do_demangle, not Options::demangle.
4922 * symtab.cc (demangle): Likewise.
4924 2008-03-22 Ian Lance Taylor <iant@google.com>
4926 * gold.h: Include <cstddef> and <sys/types.h>
4927 * options.h: Include <cstring>.
4929 2008-03-21 Ian Lance Taylor <iant@google.com>
4931 * Added source code to GNU binutils.